pax_global_header00006660000000000000000000000064121400307270014506gustar00rootroot0000000000000052 comment=f0c8f5e70bfeb8e11f8b2b72790a212fad2e6780 icicles-2013.04.23.23400/000077500000000000000000000000001214003072700141645ustar00rootroot00000000000000icicles-2013.04.23.23400/icicles-chg.el000066400000000000000000022317061214003072700166730ustar00rootroot00000000000000;;; icicles-chg.el --- Change logs for Icicles libraries. ;; ;; Filename: icicles-chg.el ;; Description: Change logs for Icicles libraries. ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 2007-2013, Drew Adams, all rights reserved. ;; Created: Tue Nov 27 07:47:53 2007 ;; Version: 22.0 ;; Last-Updated: Tue Apr 23 19:21:05 2013 (-0700) ;; By: dradams ;; Update #: 9977 ;; URL: http://www.emacswiki.org/icicles-chg.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; None ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; Change logs for Icicles libraries. ;; ;; This file consolidates the change logs for all Icicles libraries. ;; It contains no code. ;; ;; Libraries `icicles-doc1.el' and `icicles-doc2.el' contain only ;; documentation, and they do not have change logs. Initially, ;; everything was in one library, `icicles.el', so its change log is ;; the oldest. ;; ;; This is a long file. To fontify it, you will likely need to ;; increase `font-lock-maximum-size'. (I use the value 1024000.) ;; ;; **************************************************************************************************** ;; NOTE: If you byte-compile Icicles (recommended), then WHENEVER `icicles-mac.el' is updated, you ;; MUST LOAD `icicles-mac.el' (not just `icicles-mac.elc'), then compile it, then RECOMPILE *ALL* ;; of the other Icicles source files as well. This is normal for Lisp. Code that depends on ;; macros needs to be byte-compiled anew after loading the updated macros. ;; **************************************************************************************************** ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "CHANGE LOG FOR `icicles-cmd1.el'") ;; (@> "CHANGE LOG FOR `icicles-cmd2.el'") ;; (@> "CHANGE LOG FOR `icicles-face.el'") ;; (@> "CHANGE LOG FOR `icicles-fn.el'") ;; (@> "CHANGE LOG FOR `icicles-mac.el'") ;; (@> "CHANGE LOG FOR `icicles-mcmd.el'") ;; (@> "CHANGE LOG FOR `icicles-mode.el'") ;; (@> "CHANGE LOG FOR `icicles-opt.el'") ;; (@> "CHANGE LOG FOR `icicles-var.el'") ;; (@> "CHANGE LOG FOR `icicles.el'") ;; (@> "CHANGE LOG FOR `icicles-cmd.el'" - Deprecated file) ;;;(@* "CHANGE LOG FOR `icicles-cmd1.el'") ;; ;; 2013/04/17 dadams ;; icicle-buffer-name-prompt, icicle-default-buffer-names: C-u C-u C-u means invisible buffers. ;; icicle-kill-buffer: Add current buff to icicle-default-buffer-names. ;; icicle-visit-marked-file-of-content*: Pass no arg to icicle-default-buffer-names. ;; icicle-add-buffer-candidate: Single default if < Emacs 23. ;; 2013/04/06 dadams ;; icicle-default-buffer-names: If ARG is nil, put other-buffer first. Return up to six, not four. ;; 2013/04/02 dadams ;; Removed: icicle-ess-* (four Icicles completion functions for ESS). ;; 2013/03/31 dadams ;; icicle-buffer-name-prompt: (new) C-u C-u means visible buffer. ;; icicle-buffer: Update doc string for visible buffers as candidates. ;; 2013/03/27 dadams ;; Do not require dabbrev for Emacs 24+ (until I get around to fixing icicle-dabbrev-completion). ;; Temporarily removed icicle-dabbrev-completion for Emacs 24+. ;; 2013/03/16 dadams ;; custom-variable-p: Return nil if arg is not a symbol. ;; icicle-buffer-multi-complete, icicle-(buffer|file-of-content)-apropos-complete-match: ;; Test this-command, not last-command, and test it also for icicle-cycling-command. ;; icicle-binary-option-p, icicle-buffer-multi-complete: Use icicle-get-safe, not get. ;; 2013/03/12 dadams ;; Added: icicle-buffer-cand-help (factored out). ;; icicle-buffer(other-window), icicle-visit-marked-file-of-content(-other-window): ;; Use icicle-buffer-cand-help. ;; icicle-visit-marked-file-of-content: ;; Bind icicle-last-apropos-complete-match-fn to icicle-buffer-apropos-complete-match. ;; Bind icicle-apropos-complete-match-fn in second part of icicle-buffer-bindings, not first. ;; icicle-send-bug-report: Ask for Update # from icicles-chg.el. ;; 2013/03/11 dadams ;; icicle(-customize)-apropos-options-of-type: ;; Bound *-last-apropos-complete-match-fn to *-multi-comp-apropos-complete-match for progressive. ;; 2013/03/08 dadams ;; (icicle-(visit-marked-file-of-content|buffer(-no-search)))-other-window: ;; Forgot OTHER-WIN arg to icicle-buffer-name-prompt. ;; 2013/03/07 dadams ;; Updated to use icicle-user-error where appropriate. ;; 2013/03/05 dadams ;; icicle-search-read-context-regexp: Provide default(s) using icicle-defaults-at-point (new). ;; 2013/02/25 dadams ;; icicle-buffer-multi-complete, icicle-buffer-apropos-complete-match, icicle-find-file-of-content: ;; isearch-update-ring if find content-pat match. ;; 2013/02/24 dadams ;; icicle-find-file-of-content(-other-window): ;; Use normal-mode, not revert-buffer. No need to restore r-o status. Thx to Michael Heerdegen. ;; 2013/02/16 dadams ;; Renamed: icicle-find-file(-other-window) to icicle-find-file-no-search(-other-window). ;; Added defaliases for (new) icicle-find-file(-other-window), depending on Emacs version. ;; icicle-file(-other-window): Corrected current-prefix-arg binding. ;; icicle-find-file-absolute(-other-window): Prefix arg on candidate means open it read-only. ;; *-find-file-(absolute|no-search)(-other-window): Include *-mouse-candidate-action in memq test. ;; icicle-find-file-read-only*: Use icicle-find-file-no-search*, not icicle-find-file*. ;; icicle-find-file-of-content(-other-window): Restore correct read-only status after reverting. ;; *-dired-(saved-file-candidates|project)-other-window, *-find-file-no-search(-other-window) ;; *-find-file-read-only-other-window, *-((recent|locate)-file(-no-symlinks)|locate)-other-window: ;; Put property icicle-Completions-window-max-height (forgot). ;; 2013/02/15 dadams ;; icicle-pp-eval-expression: Bind deactivate-mark to nil, like fix for Emacs bug #13724. ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/01/06 dadams ;; icicle-execute-extended-command-1: ;; Extra safeguards: Ensure CMD is fboundp before calling symbol-function. ;; Ensure it is commandp before calling it interactively. Error if not. ;; 2013/01/05 dadams ;; icicle-bookmark-*-narrow: No-op unless (featurep 'bookmark+). ;; icicle-(delete-file|dired|find-file(-absolute|-of-content|-in-tags-table)|recent-file| ;; locate(-file)|(file|directory)-list): ;; Updated doc string for new C-x C-t bindings. ;; 2013/01/04 dadams ;; icicle-bookmark-(autofile|autonamed)-narrow: ;; Use icicle-transform-multi-completion, not icicle-mctized-display-candidate, like others. ;; 2013/01/02 dadams ;; icicle-other-window-or-frame: Use 1on1-other-frame. ;; 2012/12/21 dadams ;; icicle-buffer-multi-complete, icicle-file-of-content-apropos-complete-match: ;; Added filtering by icicle-(buffer|find-file-of-content)-skip-hook. Thx to C. Schmidt. ;; 2012/12/20 dadams ;; Removed: icicle-find-file-of-content-multi-complete. Use only *-apropos-complete-match. ;; icicle-file-of-content-apropos-complete-match: ;; Do not use find-file-noselect, except for a dir. ;; Use find-buffer-visiting or create-file-buffer, and with-current-buffer, insert-file-contents. ;; Add buffer to new-bufs--to-kill. ;; icicle-find-file-of-content(-other-window): ;; Do not bind icicle-read-file-name-internal-fn to icicle-find-file-of-content-multi-complete. ;; revert-buffer, so use correct mode. ;; 2012/12/15 dadams ;; icicle-find-file-of-content*: ;; Bind icicle-apropos-complete-match-fn to icicle-file-of-content-apropos-complete-match, to fix ;; apropos completion ;; Bind icicle-compute-narrowing-regexp-p to t, for narrowing optimization. ;; Set buffer-modified-p to nil before calling kill-buffer. ;; icicle-file-of-content-apropos-complete-match: ;; Require that each file name is matched by icicle-narrow-regexp (optimization for narrowing). ;; 2012/12/14 dadams ;; icicle-describe-option-of-type: ;; Bind icicle-last-apropos-complete-match-fn to icicle-multi-comp-apropos-complete-match, ;; for progressive completion. Bind icicle-dot-string to icicle-anychar-regexp. ;; Updated doc to reflect improved behavior. ;; 2012/12/12 dadams ;; Added: icicle-buffer-apropos-complete-match, icicle-file-of-content-apropos-complete-match. ;; icicle-buffer(-other-window): ;; Bind icicle-last-apropos-complete-match-fn to icicle-buffer-apropos-complete-match. ;; Move binding of icicle-apropos-complete-match-fn to post-bindings. ;; icicle-find-file-of-content(-other-window): ;; Bind icicle-last-apropos-complete-match-fn to icicle-file-of-content-apropos-complete-match. ;; Reverted the 12/07 change. Binding *-apropos-complete-match-fn to nil broke apropos compl. ;; icicle-find-file-of-content-multi-complete: ;; Rewrote. Do not use all-completions. Use completion-table-in-turn for everything, passing ;; content-matching predicate. ;; icicle-execute-extended-command-1, icicle-command-abbrev-action: ;; Bind completion-annotate-function to nil, to cancel top-level binding. ;; 2012/12/07 dadams ;; icicle-find-file-of-content(-other-window): ;; Restored binding of icicle-apropos-complete-match-fn to nil. ;; 2012/12/02 dadams ;; Removed: icicle-find-file-of-content-read-file-name (use icicle-read-file-name-default instead). ;; icicle-find-file-of-content(-other-window): ;; Bind icicle-read-file-name-internal-fn, not read-file-name-function. ;; No longer bind icicle-apropos-complete-match-fn to nil. ;; 2012/12/01 dadams ;; icicle-find-file-of-content-multi-complete: ;; Use icicle-completion--embedded-envvar-table & completion-file-name-table, not internal Emacs. ;; 2012/11/29 dadams ;; icicle-find-file-of-content: Typo: removed -other-window. ;; 2012/11/28 dadams ;; icicle-apropos-value: Minor corrections. And treat C-u case like C-0 for C-$. ;; icicle-completing-yank: ;; Do not icicle-delete-dups when constructing cands. Let icicle-transform-function do it. ;; 2012/11/26 dadams ;; Added: icicle-apropos-value. Thx to Michael Heerdegen. ;; icicle-execute-extended-command(-1): Save and restore icicle-toggle-transforming-message. ;; 2012/11/19 dadams ;; icicle-execute-extended-command-1: Show key-reminder after invoking CMD. Thx to M. Heerdegen. ;; icicle-customize-apropos: lexical-let -> let. Put PATTERN in progress msg. Add comma for TYPE. ;; icicle-find-tag-define-candidates-1: Put regexp in progress msg. ;; 2012/11/17 dadams ;; icicle-execute-extended-command-1: Show key-reminder msg before sit-for. Thx to M. Heerdegen. ;; 2012/11/10 dadams ;; custom-variable-p, icicle-binary-option-p: icicle-get-safe -> get. ;; icicle-increment-(option|variable): intern -> intern-soft. Thx to Michael Heerdegen. ;; 2012/11/08 dadams ;; custom-variable-p, icicle-execute-extended-command-1, icicle-binary-option-p: ;; Use icicle-get-safe. ;; Doc strings: Use \\[...] more. ;; 2012/11/07 dadams ;; icicle-zap-to-char: char-to-string -> string. ;; 2012/11/03 dadams ;; Typo in eval-when-compile around icicle-bbdb-complete-name. ;; 2012/11/02 dadams ;; icicle-buffer-multi-complete: Use prog1 around content search in *-remove-if-not. ;; Wrap icicle-bbdb-complete-name in eval-when-compile to avoid byte-compile error for BBDB 3.02. ;; icicle-(buffer|file-of-content)-multi-complete: Put back prepending ^ for prefix mode. ;; 2012/11/01 dadams ;; icicle-(buffer|file-of-content)-multi-complete: Handle metadata COMPLETION-MODE arg. ;; Comment out prepending ^ for prefix mode. ;; 2012/10/28 dadams ;; icicle-execute-extended-command, icicle-command-abbrev: With icicle-pre-minibuffer-buffer. ;; 2012/10/27 dadams ;; Added: icicle-bbdb-complete-mail (version for BBDB 3.02). ;; icicle-execute-extended-command, icicle-command-abbrev: ;; Bind icicle-last-transform-function: show only bound cmds. Thx to Michael Heerdegen. ;; Bind completion-annotate-function: annotate with key bindings. ;; 2012/10/21 dadams ;; Added: icicle-cached-files-without-buffers, icicle-recent-files-without-buffers. ;; icicle-buffer-multi-complete, icicle-buffer(-other-window): ;; Add file names from recentf-list and file-cache-alist as candidates. ;; 2012/10/20 dadams ;; icicle-cd-for-(abs|loc)-files: ;; Same change as 2012/08/27 fix to *-make-directory: Use dir in minibuffer as default. ;; 2012/10/18 dadams ;; icicle-directory-list: New feature: proxy candidates = vars with dir-list (i.e., path) values. ;; icicle-locate-file-1: ;; New feature: Treat plain C-u and C-u C-u, prompting for dir list. ;; Ensure correct prefix arg treatment for icicle-locate (vs *-locate-file*). ;; icicle-string-list: Last code: reset icicle-proxy-candidates to (). ;; 2012/10/09 dadams ;; icicle-customize-face*, icicle(-customize)-apropos-options-of-type, ;; icicle-describe-option-of-type, icicle-dired-saved-file-candidates*, icicle-bookmark*, ;; icicle-buffer*, icicle-visit-marked-file-of-content*, icicle-send-signal-to-process, ;; icicle-find-file-absolute*, icicle-find-file-of-content*, icicle-recent-file*, ;; icicle-locate-file-1, icicle-find-file-in-tags-table*, icicle-face-list, icicle-bookmark-list: ;; Bind icicle-multi-completing-p. ;; icicle-cd-for-(abs|loc)-files: Test icicle-multi-completing-p, not icicle-list-use-nth-parts. ;; 2012/10/05 dadams ;; Added: icicle-find-file-of-content(-other-window|-multi-complete|-read-file-name). ;; icicle-buffer-multi-complete: Add new bufs to NEW-BUFS--TO-KILL, so can kill them when done. ;; icicle-visit-marked-file-of-content(-other-window): ;; Action arg: Transform multi-completion before passing to switch-to-buffer*. ;; Save visited buffer to NEW-BUFS--TO-KEEP. ;; When done, kill any unused buffers that were created, per new option ;; icicle-kill-visited-buffers-flag. But prefix arg flips that. ;; 2012/10/04 dadams ;; icicle-find-file(-other-window): If precede C-! with prefix arg, then open all read-only. ;; 2012/10/02 dadams ;; icicle-describe-opt-of-type-complete, icicle-buffer-multi-complete: ;; In try-completion: change PRED to a predicate that works on a singleton list, not a string. ;; 2012/09/24 dadams ;; icicle-recent-file(-other-window): Bind icicle-transform-before-sort-p to t, ;; icicle-sort-comparer to icicle-last-accessed-first-p. ;; 2012/09/22 dadams ;; icicle-bookmark-jump-1: ;; Use full bookmark, not name, after jump and before crosshairs, in case renamed autonamed bmk. ;; 2012/09/15 dadams ;; icicle-visit-marked-file-of-content*: *-remove-if -> use filter as dired-get-marked-files arg. ;; 2012/09/11 dadams ;; Renamed: ;; *-buffer(-other-window) to *-buffer-no-search(-other-window) ;; *-buffer-of-content(-other-window|complete) to *-buffer(-other-window|multi-complete) ;; icicle-buffer(-other-window): Simplified prompt (no multi-completion hint). ;; Updated doc strings for this icicle-buffer switch. ;; icicle-default-buffer-names: Respect icicle-buffer-ignore-space-prefix-flag. Optimize a bit. ;; 2012/09/09 dadams ;; Added: icicle-visit-marked-file-of-content(-other-window). ;; icicle-default-buffer-names: If BNAME is not in icicle-bufflist then do not use it. ;; 2012/09/08 dadams ;; Added: icicle-buffer-of-content(-other-window), icicle-buffer-of-content-complete. ;; icicle-buffer-list: Remove binding of icicle-ignore-space-prefix-flag. ;; 2012/09/07 dadams ;; icicle-buffer(-other-window): Exclude icicle-orig-buff from candidates. ;; 2012/08/13 dadams ;; icicle-customize-face: Doc string improvement. ;; 2012/08/10 dadams ;; icicle-bookmark-set: If bookmark-make-record provides a name, use that as default. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-file, icicle-ORIG-customize-face, icicle-ORIG-customize-face-other-window, ;; icicle-ORIG-dabbrev-completion, icicle-ORIG-lisp-complete-symbol, ;; icicle-ORIG-lisp-completion-at-point, icicle-ORIG-repeat-complex-command. ;; 2012/07/31 dadams ;; Added widgets icicle-file, old-file. Added command icicle-widget-file-complete. ;; icicle-comint-dynamic-complete(-as)-filename, icicle-comint-replace-by-expanded-filename: ;; Added optional (prefix) arg REPLACE-TO-EOL-P. ;; 2012/07/22 dadams ;; icicle-pp-display-expression: Do not try to select old-window if it is no longer live. ;; 2012/07/21 dadams ;; Replace defun of *-comint-completion-at-point by defalias to *-comint-dynamic-complete. ;; icicle-comint-replace-orig-completion-fns: Redefined for new format of ;; icicle-comint-dynamic-complete-replacements. Thx to Christopher Schmidt. ;; icicle-execute-extended-command-1: Pass non-nil NOINDIRECT arg to where-is-internal. ;; 2012/07/19 dadams ;; icicle-default-buffer-names: Added optional ARG. Use in all calls to it. ;; icicle-buffer-list: Allow also Dired buffers for positive prefix arg. ;; icicle-(kill|insert)-buffer, icicle-add-buffer-candidate: ;; Removed doc string content - just refer to icicle-buffer doc. ;; 2012/07/10 dadams ;; icicle-comint-dynamic-complete-as-filename: ;; (file-name-nondir* (directory-file-name...)) -> (directory-file-name (file-relative-name...)) ;; Thx to Christopher Schmidt. ;; 2012/07/08 dadams ;; Added icicle-comint-completion-at-point. Thx to Christopher Schmidt and Michael Heerdegen. ;; 2012/06/29 dadams ;; icicle-command-abbrev: ;; Bind icicle-sort-comparer to icicle-proxy-candidate-first-p, not ;; icicle-command-abbrev-used-more-p. icicle-command-abbrev-used-more-p is second sort order. ;; Bind icicle-allowed-sort-predicate (new), to allow icicle-command-abbrev-used-more-p. ;; Improved doc string, mentioning icicle-command-abbrev-alist. ;; icicle-command-abbrev-action: ;; Add abbrev-or-cmd to icicle-commands-for-abbrev if it is in icicle-command-abbrev-alist. ;; Do not bind icicle-sort-comparer here - not needed (?). ;; During completion, bind icicle-current-input to abbrev-or-cmd. ;; Removed #' from lambdas. ;; 2012/06/24 dadams ;; icicle-shell-dynamic-complete-as-command: ;; Use shell-command-to-string in *Help* explicitly, not just shell-command. ;; Thx to Christopher Schmidt & Michael Heerdegen. ;; 2012/06/09 dadams ;; icicle-pp-display-expression: Use backquote+comma, not lexical-let (bug fix). ;; 2012/06/04 dadams ;; Comment or otherwise handle free vars in lambdas: some lexical-let, some backquoting. ;; 2012/06/03 dadams ;; icicle-execute-extended-command-1: ;; Do not show "You can invoke..." message for multi-command use. Do it only for top-level M-x. ;; Use backquote+comma to eliminate free var CMD. ;; 2012/05/30 dadams ;; icicle-dired-insert-as-subdir: Include default-directory as candidate for ANCESTOR-DIR. ;; 2012/05/25 dadams ;; Added: icicle-dired-insert-as-subdir. ;; 2012/05/22 dadams ;; icicle-comint-dynamic-complete-as-filename, icicle-dired-(project|saved-file-candidates(*)), ;; icicle-grep-saved-file-candidates: ;; Test with icicle-file-remote-p before file-exists-p, to avoid Tramp. ;; 2012/05/13 dadams ;; Added: icicle-dired-save-marked(-more|to-cache-file|to-fileset|to-variable)-recursive, ;; 2012/04/22 dadams ;; Added: icicle-buffer-name-prompt. ;; Removed: icicle-filter-buffer-cands-for-mode (replaced by *-(remove|keep-only)* in *-mcmd.el). ;; icicle-(kill|insert)-buffer, icicle-buffer(-other-window), icicle-add-buffer-candidate: ;; Use icicle-buffer-name-prompt, icicle-(un)bind-buffer-candidate-keys. Updated doc string. ;; icicle-add-buffer-candidate: ;; Bind icicle-delete-candidate-object to icicle-remove-buffer-candidate-action (as previously). ;; 2012/04/09 dadams ;; Fixed typos: double single-quotes in autoload cookies. ;; 2012/04/08 dadams ;; Make autoload cookies for commands load icicles[.el] explicitly. ;; 2012/04/07 dadams ;; icicle-bookmark-set: ;; Updated for Bookmark+ changes, including new defaulting, removing region handling, and making ;; bmk temporary. ;; Updated doc string with info from icicle-bookmark-cmd. Refer to bookmark-set doc. ;; icicle-bookmark-cmd: ;; Updated doc string. Refer to icicle-bookmark-set doc. ;; 2012/04/04 dadams ;; Moved hint about (S-)TAB from icicle-read-args-w-val-satisfying to callers that need it. ;; 2012/04/03 dadams ;; Added: icicle-apropos-vars-w-val-satisfying, icicle-describe-var-w-val-satisfying, ;; icicle-customize-opts-w-val-satisfying, icicle-read-args-w-val-satisfying. ;; icicle-send-signal-to-process: ;; Moved it and icicle-describe-process here from *-cmd2.el. Added autoload cookie. ;; Changed definition guard condition to locate-library. Updated def, including to ;; require proced.el. ;; icicle-kmacro: ;; Changed autoload cookie to be conditional on locate-library. ;; Changed definition guard condition to locate-library. Updated def to require kmacro.el. ;; Moved here from *cmd2.el: ;; icicle-apropos, icicle-apropos-command, icicle-apropos-function, icicle-apropos-option, ;; icicle-apropos-options-of-type, icicle-apropos-variable, icicle-apropos-zippy, ;; icicle-apropos-opt-action, icicle-describe-option-of-type, icicle-describe-opt-action, ;; icicle-describe-opt-of-type-complete. ;; Plus compile-time requires of libraries yow, cookie1, apropos-fn+var. ;; 2012/04/01 dadams ;; Removed: old-customize-apropos* (no longer redefine automatically for Icicle mode). ;; 2012/03/31 dadams ;; icicle-customize-apropos: Do not call split-string if string is empty. ;; Allow word list for Emacs 22+, not 24+. ;; icicle-customize-apropos*: Added optional MSGP arg - display progress msg if non-nil. ;; 2012/03/30 dadams ;; Added: icicle-customize-apropos-opt-action. ;; icicle-customize-apropos-options-of-type: Rewrote as a multi-command using multi-completions. ;; icicle-customize-apropos*: ;; Updated wrt Emacs 24 (handle PATTERN). Fixed vanilla Emacs bugs #11124, #11126, #11132. ;; 2012/03/29 dadams ;; icicle-customize-apropos-options-of-type: ;; Pass inherit-or-value to icicle-var-is-of-type-p as the MODE. ;; Handle the case where the user just enters a regexp, without using completion: mapatoms. ;; icicle-customize-apropos: Use backquote and comma on regexp in lambda. ;; 2012/03/28 dadams ;; Changed FILE arg in autoloads by removing .el, so .elc will be loaded if available. ;; 2012/03/10 dadams ;; Added: icicle-make-bookmark-candidate (factored out). ;; icicle-bookmark(-set|-list|-other-window): ;; Use icicle-make-bookmark-candidate to define icicle-candidates-alist. ;; 2012/03/09 dadams ;; icicle-bookmarked-file-list: Call bookmark-maybe-load-default-file. ;; icicle-customize-apropos(-faces|-groups|-options(-of-type)), icicle-(re)set-option-to-(t|nil), ;; icicle-toggle-option, icicle-increment-(option|variable), icicle-doremi-increment-variable+, ;; icicle-command-abbrev, icicle-execute-named-keyboard-macro, icicle-buffer-list: ;; When Icomplete mode, use normal PRED, not *-must-pass-after-match-predicate. ;; icicle-execute-extended-command: Likewise - redid it. ;; icicle-customize-apropos-options: If prefix arg, still use user-variable-p also (or). ;; 2012/03/03 dadams ;; icicle-execute-extended-command: ;; If in Icomplete mode, use the normal PRED arg, instead of *-must-pass-after-match-predicate. ;; 2012/02/26 dadams ;; Update to reflect Bookmark+ changes (bindings etc.). ;; Added: icicle-bookmark-autofile-(all|some)-tags(-regexp)(-other-window). ;; icicle-bookmark: Update doc string for binding changes. ;; icicle-bookmark-bind-narrow-commands: Update bindings to reflect Bookmark+ changes. ;; icicle-bookmark-help-string: Initialize no-position-p from bookmark, so it works if no pos. ;; Typo: icicle-bookmark-this-dir-file-all-tags -> icicle-bookmark-file-this-dir-all-tags. ;; 2012/02/11 dadams ;; Applied renaming. ;; 2012/01/31 dadams ;; icicle-yank-pop-commands, icicle-completing-yank: Minor changes to doc strings. ;; 2012/01/20 dadams ;; icicle-bookmark-*-tags(-other-window): Pass prefix arg to bmkp-read-tags-completing, to refresh. ;; 2012/01/15 dadams ;; icicle-bookmark-set: Added missing quote mark for (icicle-)bookmark-history. ;; 2012/01/14 dadams ;; Added: icicle-zap-to-char. ;; 2012/01/08 dadams ;; Added: icicle-yank-pop-commands, icicle-bookmark-bind-narrow-commands, ;; icicle-bookmark-(autofile|autonamed(-this-buffer)|file-this-dir|temporary)-narrow. ;; Soft-require second-sel.el. ;; icicle-bookmark-set: Mention narrowing in doc string. ;; icicle-bookmark: Suggest in doc string to refresh cache if error. ;; Added C-x j bindings to doc string: a, C-f, x, # ., # #. ;; icicle-bookmark(-set|-other-window): Use icicle-bookmark-bind-narrow-commands. ;; icicle-bookmark-*-narrow: ;; Use icicle-transform-multi-completion, not funcall icicle-get-alist-candidate-function. ;; icicle-completing-yank: Add prefix arg behavior: use secondary-selection-ring. Update doc. ;; Add alt action of copying to other selection ring. ;; icicle-yank-maybe-completing: Bind current-prefix-arg to nil around icicle-completing-yank. ;; 2011/12/19 dadams ;; icicle-find-file-absolute(-other-window): Do not insert default directory as initial input. ;; icicle-ess-R-complete-object-name: Use line-end-position, not point-at-eol (not in Emacs 20). ;; icicle-bookmark-(cmd|set), icicle-bbdb-complete-name: Use line-(beginning|end)-position. ;; 2011/12/14 dadams ;; Added: icicle-bookmark-bookmark-file-narrow, icicle-bookmark-image-narrow, ;; icicle-bookmark-image(-other-window). ;; icicle-bookmark-set, icicle-bookmark(-other-window): ;; Changed bindings to be the same as top-level jump bindings. ;; Added bindings: icicle-bookmark-bookmark-file-narrow, icicle-bookmark-image-narrow. ;; icicle-bookmark-list: ;; Return bookmarks, not their names, unless prefix arg or icicle-bookmark-list-names-only-p. ;; Bind icicle-unpropertize-completion-result-flag. Use icicle-unpropertize-completion, not ;; icicle-substring-no-properties, so remove only Icicles internal properties. ;; Call bookmark-maybe-load-default-file whether Bookmark+ or not. ;; Use icicle-bookmark-types only for Bookmark+. Use all bookmarks otherwise. ;; 2011/11/23 dadams ;; icicle-locate-file-1: when -> unless icicle-locate-file-use-locate-p. ;; 2011/11/21 dadams ;; icicle-locate-file-1: ;; Do not bind current-prefix-arg, so pick up prefix arg for vanilla Emacs locate cmd. ;; Require locate.el in ignored binding, not first code. ;; No progress message (gathering...) if use external locate cmd. ;; Put prop icicle-fancy-candidates only if not using external locate cmd. ;; icicle-locate: Improved doc string. ;; icicle-find-file-absolute*, icicle-locate-file-1: ;; Bind C-c C-d to icicle-cd-for-(abs|loc)-files (it was mistakenly removed). ;; icicle-(delete|recent)-file, icicle-dired, icicle-find-file(-read-only|-in-tags-table), ;; icicle-(file|directory)-list: ;; Removed mention of C-c C-d in doc string - inappropriate here. ;; 2011/11/13 dadams ;; icicle-locate-file-1: Corrected placement of kill-buffer in unwind-protect. ;; 2011/11/07 dadams ;; icicle-locate-file-1: ;; Use with-current-buffer with locate-buffer-name, to hide switch-to-buffer in locate. ;; 2011/11/06 dadams ;; icicle-locate-file-1: Wrap use of external locate program in save-window-excursion. ;; 2011/11/01 dadams ;; Added: icicle-bookmark-autofile(-other-window), ;; icicle-bookmark-autonamed(-this-buffer)(-other-window), icicle-bookmark-bookmark-file, ;; icicle-bookmark-temporary(-other-window). ;; 2011/10/29 dadams ;; icicle-delete-file: Add icicle-remove-candidate-display-others to action fn. Remove S-delete. ;; 2011/10/21 dadams ;; icicle-remove-entry-from-saved-completion-set: Bind icicle-remove-icicles-props-p to nil. ;; icicle-execute-extended-command-1: Don't bind WAIT-TIME to 0 if CURR-MSG. ;; icicle-(add|remove)-entry-(to|from)-saved-completion-set, icicle-remove-saved-set-action, ;; icicle-execute-extended-command-1, icicle-kmacro-action, icicle-toggle-option, ;; icicle-increment-(option|variable), icicle-find-tag-help, icicle-add-buffer-candidate, ;; icicle-remove-buffer-(candidate|config)-action, icicle-remove-from-recentf-candidate-action, ;; icicle-locate-file-1, icicle-(string|sexp|keyword|face|buffer|bookmark|file|directory)-list: ;; Use icicle-propertize. ;; Applied renaming: icicle-unpropertize -> icicle-unpropertize-completion. ;; 2011/10/10 dadams ;; icicle-define-bookmark-command*: Moved to icicles-mac.el. ;; 2011/10/08 dadams ;; icicle-dired-project*, icicle-bookmark*, icicle*-buffer*: Use icicle-kbd. ;; 2011/10/03 dadams ;; icicle-customize-face: Updated for Emacs 24: Added optional arg OTHER-WINDOW. ;; 2011/09/21 dadams ;; Added: icicle-locate-other-window, icicle-locate-file-use-locate-p. Improved doc string. ;; icicle-locate: Use icicle-locate-file-1 (not icicle-define-command). ;; icicle-locate-file-1: Use locate external program, if non-nil icicle-locate-file-use-locate-p. ;; icicle-(find-file-(absolute|in-tags-table)|recent-file)(-other-window), icicle-locate-file-1, ;; icicle-cd-for-abs-files: ;; Use file-name-as-directory instead of concat with /. ;; 2011/09/18 dadams ;; Added: icicle-sexp-list, icicle-string-list. ;; Moved here from icicles-cmd2.el: icicle-keyword-list. ;; Added: icicle-locate. Thx to Michael Heerdegen. ;; icicle-bookmarked-(buffer|file)-list, icicle-define-add-to-alist-command, ;; icicle-(bookmark|buffer|face|file|directory|regexp|keyword)-list, icicle-add-buffer-config: ;; Bind icicle-prompt. ;; icicle-(bookmark|buffer|face|file|directory|regexp|keyword)-list: ;; Added msg saying Added... when interactive. ;; 2011/09/02 dadams ;; icicle-completing-yank: Put kills in order, respecting kill-ring-yank-pointer. ;; (put 'icicle-completing-yank 'delete-selection 'yank). ;; icicle-insert-for-yank: Set this-command to yank. ;; 2011/08/30 dadams ;; icicle-yank-maybe-completing: Put delete-selection prop, so region is deleted. ;; 2011/08/26 dadams ;; icicle-comint-dynamic-complete-as-filename, icicle-comint-dynamic-simple-complete, ;; icicle-bbdb-complete-name, icicle-explore, icicle-bookmark(-list|-other-window), ;; icicle-define-bookmark-command-1, icicle-find-tag-action, ;; icicle-kill-a-buffer-and-update-completions, icicle-color-theme, ;; icicle-delete-file-or-directory: ;; Use icicle-condition-case-no-debug instead of condition-case. Thx to Michael Heerdegen. ;; Make sure to pass format string as first arg to calls to functions error and message. ;; 2011/08/12 dadams ;; icicle-delete-file, icicle-(file|directory)-list, icicle-(dired|file)*, ;; icicle-find-file(-absolute|-read-only|in-tags-table)*, icicle-(recent|locate)-file*: ;; Use icicle-(un)bind-file-candidate-keys. Don't do/undo such bindings individually here. ;; icicle-find-file-(absolute|in-tags-table)*, icicle-(recent|locate)-file*: ;; Bind icicle-full-cand-fn. ;; icicle-dired-(project|buffer)*: Removed fboundp test of icicle-bookmark-* (just test Bookmark+). ;; 2011/08/11 dadams ;; icicle-find-file-absolute(-other-window): ;; Bind C-x a [+-] to adding/removing tags. ;; 2011/08/09 dadams ;; icicle-define(-file)-command calls: Removed undo code if same as last code, so do not repeat it. ;; 2011/08/07 dadams ;; icicle-(find-file-absolute|recent-file)(-other-window), icicle-locate-file-1, ;; icicle-cd-for-(abs|loc)-files: ;; Bind icicle-abs-file-candidates to the COLLECTION alist (no longer just list of strings). ;; 2011/07/30 dadams ;; Moved to icicles-cmd2.el and wrapped in eval-after-load bookmark+.el: ;; icicle-find-file-(all|some)-tags(-regexp)(-other-window), icicle-(un)tag-a-file. ;; 2011/07/26 dadams ;; Removed: icicle-list-end-string (no longer needed). Thx to Michael Heerdegen. ;; 2011/05/22 dadams ;; Added defvars for free vars to quiet byte compiler. ;; 2011/05/21 dadams ;; icicle-customize-apropos(-options): let -> let* for interactive form. ;; 2011/04/29 dadams ;; icicle-execute-extended-command(-1), icicle-command-abbrev(-action|-command), ;; icicle-execute-named-keyboard-macro, icicle-increment-(option|variable), ;; icicle-doremi-increment-variable+: ;; Renamed: orig-must-pass-after-match-predicate to icicle-orig-must-pass-after-match-pred, ;; new-last-cmd to icicle-new-last-cmd. ;; 2011/04/25 dadams ;; Commands defined with icicle-define-file-command and using icicle-file-bindings: ;; Remove binding for icicle-candidate-help-fn - done in icicles-mac.el now. ;; 2011/04/13 dadams ;; Fixed autoload cookies for icicle-define-file-command commands added yesterday. ;; 2011/04/12 dadams ;; Added: icicle-bookmark-save-marked-files(-as-project|-more|-persistently|-to-variable), ;; icicle-find-file-(all|some)-tags(-regexp)(-other-window), icicle-(un)tag-a-file. ;; icicle-bookmark(-list|-set|-other-window|-delete-action), icicle-define-bookmark-command-1: ;; Applied Bookmark+ renaming: bmkp-sort-and-remove-dups -> bmkp-sort-omit. ;; icicle-bookmark-set: Fixed typo: bmkp-light-bookmarks-this-buffer -> bmkp-light-this-buffer. ;; icicle-define-bookmark-command-1: Doc strings now mention corresponding Bookmark+ command. ;; icicle-execute-extended-command-1: ;; Apply icicle-transform-multi-completion to arg. Thx to Michael Heerdegen. ;; 2011/04/04 dadams ;; icicle-bookmark-jump-1, icicle-pop-tag-mark: Use icicle-recenter. ;; 2011/04/02 dadams ;; Added: icicle-bookmark-file-this-dir((-all|some)-tags(-regexp))(-other-window), ;; icicle-locate-file-(action-fn|no-symlinks-p). ;; icicle-kmacro(-action), icicle-clear(-current)-history(-1): ;; Use (new) icicle-pref-arg, not pref-arg. ;; icicle(-kill|-insert)-buffer(-other-window), icicle-default-buffer-names, ;; icicle-filter-buffer-cands-for-mode, icicle-add-buffer-candidate: ;; Use (new) icicle-bufflist, not bufflist. ;; icicle-locate-file(-1|-no-symlinks)(-other-window): ;; Use (new) icicle-locate-file-no-symlinks-p, not no-symlinks-p. ;; 2011/03/31 dadams ;; icicle-search-action-1: Applied renaming: i*-target-window-recenter-amount to icicle-recenter. ;; icicle-customize-apropos-options-of-type: Wrap icicle-var-is-of-type-p with condition-case. ;; 2011/03/29 dadams ;; Use new icicle-* vars for various free vars (orig-buff etc.). ;; 2011/03/26 dadams ;; Added: icicle-bookmark-file-(all|some)-tags(-regexp)(-other-window). ;; 2011/02/22 dadams ;; Added: icicle-lisp-completion-at-point. ;; 2011/01/06 dadams ;; Added: icicle-filter-buffer-cands-for-mode. ;; icicle-(kill|insert)-buffer, icicle-buffer(-other-window), icicle-add-buffer-candidate: ;; Bind C-x M to icicle-filter-buffer-cands-for-mode. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; Added more autoload cookies for cmds & macros; removed from non-cmd fns. Thx to Richard Kim. ;; Specify cmd and file for cmds defined by Icicles macros. ;; Require icicles-opt.el before icicles-var.el (but it makes no difference). ;; 2010/11/21 dadams ;; defalias both old-lisp-complete-symbol and (for Emacs 23+) old-lisp-completion-at-point. ;; 2010/11/10 dadams ;; icicle-lisp-complete-symbol: Remove return value. Let it do everything (chg is in ici*mode.el). ;; 2010/11/04 dadams ;; icicle-lisp-complete-symbol: Fixed return value for Emacs 23.2+. Thx to Michael Heerdegen. ;; 2010/11/03 dadams ;; defalias old-lisp-completion-at-point, not old-lisp-complete-symbol, for Emacs 23.2+. ;; icicle-lisp-complete-symbol: ;; Explicitly return nil, for use in completion-at-point-functions (Emacs 23.2+). ;; 2010/10/25 dadams ;; icicle-buffer-list: Use icicle-must-pass-after-match-predicate, not icicle-must-pass-predicate. ;; icicle-directory-list: ;; Bind icicle-file-predicate instead of using PREDICATE arg. No emacs-version limit now. ;; 2010/10/24 dadams ;; icicle-customize-apropos(-faces|-groups|-options(-of-type)), icicle-execute-extended-command, ;; icicle-command-abbrev, icicle-execute-named-keyboard-macro, icicle-(re)set-option-to-(t|nil), ;; icicle-toggle-option, icicle-increment-(option|variable), icicle-doremi-increment-variable+: ;; Use icicle-must-pass-after-match-predicate, not PREDICATE arg. ;; icicle-execute-extended-command-1, icicle-command-abbrev-action, ;; icicle-increment-(option|variable), icicle-doremi-increment-variable+: ;; Restore orginal icicle-must-pass-after-match-predicate. ;; 2010/10/09 dadams ;; icicle-customize-face, icicle-repeat-complex-command, icicle-delete-window: ;; Updated doc string for new prefix and modal cycling keys. ;; 2010/08/27 dadams ;; icicle-pp-display-expression: Set the hooks locally instead of let-binding them, to avoid msg ;; "Making change-major-mode-hook buffer-local while locally ;; let-bound!" - suggestion from Stefan M. ;; 2010/07/20 dadams ;; icicle-find-file-in-tags-table(-other-window): ;; Pick up default-directory of TAGS table. Thx to Chris Hecker. ;; icicle-bookmark-jump-1: Applied renaming of bmkp-use-region-flag to bmkp-use-region. ;; 2010/07/17 dadams ;; Added: icicle-bookmark-url-narrow, icicle-bookmark-url(-other-window). ;; icicle-bookmark(-list|-set|-other-window|-propertize-candidate|-help-string), ;; icicle-define-bookmark-command-1: w3m -> url. ;; Bound URL commands to C-M-u, C-x j u. ;; 2010/07/02 dadams ;; icicle-bookmark-set: Added INTERACTIVEP arg. Prompt for tags when bmkp-prompt-for-tags-flag. ;; Highlight bookmark if bmkp-auto-light-when-set. ;; icicle-bookmark-cmd: Call icicle-bookmark-set with new INTERACTIVEP arg. ;; 2010/06/25 dadams ;; icicle-find-file(-other-window): ;; Use default-directory, not nil, as third arg to read-file-name. Thx to Thomas Lim. ;; Note: This more or less reverts a change I made (why?) on 2008/12/27 (see that, below). ;; 2010/06/18 dadams ;; Renamed: bookmarkp-* to bmkp-*. ;; 2010/06/11 dadams ;; icicle-find-file-absolute*, icicle-recent-file*, icicle-locate-file-1: ;; Bind C-c + to icicle-make-directory. ;; icicle-find-file-in-tags-table*: Removed bindings: C-x m, C-backspace. ;; 2010/06/10 dadams ;; icicle-cd-for-abs-files: Bound enable-recursive-minibuffers to t. ;; 2010/06/08 dadams ;; Added: icicle-bookmark-delete-action: Make it refresh the cache. ;; icicle-bookmark(-list|-other-window), icicle-define-bookmark-command-1: ;; Use icicle-bookmark-delete-action. ;; Use condition-case to filter out bad bookmarks (so no error). Thx to M. Heerdegen. ;; 2010/06/04 dadams ;; Applied renamings of doremi commands (added +). ;; icicle-(buffer|*file|directory)*: Updated doc string to mention icicle-(buffers|files)-ido-like. ;; 2010/05/30 dadams ;; Added: icicle-locate-file-no-symlinks(-other-window), icicle-locate-file(-other-window)-action, ;; icicle-locate-file-1. ;; icicle-locate-file*: Moved body to icicle-locate-file-1. Use named action functions. ;; Respect icicle-ignored-directories (via *-files-within). ;; icicle-cd-for-loc-files: Added optional arg NO-SYMLINKS-P. ;; icicle-dired-saved-file-candidates(-other-window): Handle multi-completion candidates. ;; Thx to M. Heerdegen. ;; 2010/05/28 dadams ;; icicle-(recent|locate)-file(-other-window), ;; Use *-transform-multi-completion in *-all-candidates-list-alt-action-fn. Thx to M. Heerdegen. ;; 2010/05/27 dadams ;; icicle-cd-for-loc-files: Wrap interactive spec in save-selected-window. Thx to M. Heerdegen. ;; 2010/05/26 dadams ;; icicle-bookmark-set: Removed pseudo-default. Thx to Michael Heerdegen. ;; 2010/05/24 dadams ;; icicle-comint-replace-orig-completion-fns: Rewrote to not use case. Thx to Michael Heerdegen. ;; 2010/05/21 dadams ;; icicle-bookmark-help-string: ;; Use BOOKMARK-NAME, not BMK, as arg to vanilla fns, for Emacs < 23. Thx to Alexander Haeckel. ;; 2010-05-18 dadams ;; Added: icicle-cd-for-abs-files, icicle-cd-for-loc-files. ;; icicle-find-file-absolute*, icicle-locate-file*: Bind C-c C-d to icicle-cd-for-(abs|loc)-files. ;; icicle-locate-file*: Make icicle-list-use-nth-parts be nil if no non-positive prefix arg. ;; 2010/05/16 dadams ;; icicle-define-bookmark-command-1: Defined command requires bookmark+.el. ;; Added: icicle-bookmark-specific-(buffers|files)-narrow, icicle-bookmark-this-buffer-narrow. ;; icicle-bookmark(-other-window), icicle-bookmark-set: ;; Bound C-M-= (b|f), C-M-. for narrowing to specific-(buffers|files), this-buffer. ;; icicle-bookmark-cleanup: Updated for added narrowing keys. ;; 2010/05/15 dadams ;; Added: icicle-define-bookmark-command(-1). Added ARGS param for use as arg for *-alist-only. ;; Added same-window commands for bookmark jumping. ;; Added: *-specific-(buffers|files)*, *-this-buffer*, *-(all|some)-tags(-regexp)* jump commands, ;; *-bookmarked-(buffer|file)-list. ;; icicle-bookmark-set: *-selected-buffers-alist-only -> *-specific-buffers-alist-only. ;; 2010/05/06 dadams ;; icicle-bookmark-set: Removed spurious format call with its arg. ;; 2010/04/29 dadams ;; icicle-explore: Bind icicle-remove-icicles-props-p to nil around call to completing-read. ;; Call icicle-unpropertize at the end (without that binding). ;; 2010/04/20 dadams ;; icicle-dired(-other-window): Use icicle-dirs-first-p, not icicle-dirs-last-p, and don't reverse. ;; 2010/04/17 dadams ;; Added: icicle-bookmark-set. ;; icicle-bookmark-cmd: Use icicle-bookmark-set, not bookmark-set. Simpler PARG code in that case. ;; icicle-bookmark(-list|-other-window), icicle-define-bookmark-other-window-command: ;; Use icicle-transform-multi-completion in icicle-delete-candidate-object. ;; 2010/04/10 dadams ;; Corrected prefix arg use for icicle-find-file(-read-only)(-other-window). Thx to M. Heerdegen. ;; 2010/04/09 dadams ;; Added: icicle-find-file-read-only(-other-window). ;; icicle-find-file(-other-window): ;; Prefix arg on individual candidate means visit read-only. ;; Prefix arg for the command means reverse the prefix arg effect: read-only for all by default. ;; 2010/04/02 dadams ;; Added: icicle-bookmark-list. ;; icicle-bookmark-cleanup: Clean up both minibuffer maps. ;; 2010/03/27 dadams ;; icicle-define-bookmark-other-window-command: Use optional PROMPT arg. ;; 2010/03/19 dadams ;; icicle-define-bookmark-other-window-command: Rich multi-completions per icicle-bookmark. ;; 2010/03/16 dadams ;; icicle-bookmark(-other-window): ;; Use tags, not just file names, in the multi-completions. ;; Use the default join string, ^G^J, and end string, ^J^J. ;; Use just icicle-candidate-properties-alist to highlight the file name. ;; Remove extra quote marks from face names. ;; 2010/03/14 dadams ;; icicle-bookmark(-other-window): ;; Copy file/buffer name string for candidate-part face, so we don't touch bookmark-alist. ;; Handle icicle-bookmark-refresh-cache-flag and C-u. ;; Bind the narrow keys in minibuffer-local-completion also (lax for multi-completion). ;; Use face file-name-shadow, not icicle-candidate-part (too distracting). ;; icicle-bookmark-*-narrow: Use icicle-get-alist-candidate-function. ;; icicle-define-bookmark-other-window-command: Rewrote to handle multi-completion. ;; icicle-bookmark-non-file-narrow: Use bookmarkp-non-file-bookmark-p. ;; icicle-bookmark-propertize-candidate: Typo in a face name. ;; 2010/03/13 dadams ;; icicle-bookmark(-other-window): ;; If Bookmark+ available then, depending on icicle-show-multi-completion-flag, use a ;; multi-completion showing file or buffer. Use icicle-candidates-alist to do that. ;; Don't put icicle-fancy-candidates prop on prompt. ;; Don't use icicle-sorted-bookmark-alist (removed). Recompute each time. ;; 2010/03/10 dadams ;; icicle-bookmark-help-string: ;; Mention the type in the help: sequence, function, bookmark list, desktop, etc. ;; Don't show position for types that don't use one. Don't show file for buffer & Dired. ;; 2010/03/09 dadams ;; icicle-color-theme: Initialize variable icicle-color-themes here, not in icicles-opt.el. ;; 2010/03/04 dadams ;; icicle-bookmark(-other-window): Use bookmarkp-describe-bookmark(-internals) for C-M-RET. ;; 2010/03/03 dadams ;; icicle-bookmark(-other-window), icicle-define-bookmark-other-window-command: ;; Use bookmarkp-sort-and-remove-dups. ;; Bind icicle-sort-orders-alist, using bookmarkp predicates. ;; icicle-bookmark(-other-window): ;; Set icicle-sorted-bookmark-alist and bookmarkp-sorted-alist. ;; Use bookmarkp-sorted-alist. ;; Don't append original icicle-sort-orders-alist. Just include a couple of its entries. ;; Applied renamings: icicle-sort-function to icicle-sort-comparer, ;; icicle-sort-functions-alist to icicle-sort-orders-alist. ;; 2010/02/28 dadams ;; icicle-send-bug-report: Formatted body a bit. ;; 2010/02/14 dadams ;; Added: icicle-bookmark-bookmark-list-other-window, icicle-bookmark-bookmark-list-narrow. ;; icicle-bookmark(-other-window): ;; Bound to C-M- prefix: icicle-bookmark-bookmark-list-narrow. Updated doc string. ;; 2010/02/13 dadams ;; Added: icicle-bookmark-(desktop|man)-other-window, ;; icicle-bookmark-(dired|desktop|man)-narrow. ;; icicle-define-bookmark-other-window-command: Raise error if bookmark+.el not found. ;; icicle-bookmark(-other-window): ;; Bound to C-M- prefix: icicle-bookmark-(dired|desktop|man)-narrow. ;; icicle-bookmark-propertize-candidate: ;; Handle also: sequence, function, bookmark list, desktop, man, buffer, bad bookmarks. ;; 2010/02/02 dadams ;; icicle-bookmark-jump-1: Don't select minibuffer window and give it focus. ;; 2010/01/30 dadams ;; icicle-dired(-other-window), icicle-(find|recent|locate)-file(-absolute)(-other-window) ;; icicle-find-file-in-tags-table(-other-window): ;; Bind icicle-all-candidates-list-alt-action-fn to open Dired on matching files. ;; 2010/01/13 dadams ;; icicle-recent-file(-other-window): ;; Restore C-S-RET as icicle-remove-from-recentf-candidate-action (accidentally removed). ;; 2010/01/12 dadams ;; Added: icicle-pp-display-expression. ;; icicle-pp-eval-expression: Use icicle-pp-display-expression. ;; icicle-bbdb-complete-name: save-excursion + set-buffer -> with-current-buffer. ;; 2009/12/21 dadams ;; fset -> defalias. ;; 2009/12/13 dadams ;; Added: icicle-bookmark-dired-other-window, icicle-dired(-other-window). ;; *-buffer*, *-dired-project*, *-find-file(-absolute)*, *-(recent|locate)-file*, ;; *-find-file-in-tags-table*: ;; Bind C-x m to icicle-bookmark-(non-file|dired|file)-other-window. ;; 2009/11/27 dadams ;; Added: icicle(-doremi)-increment-(variable|option). ;; 2009/11/25 dadams ;; icicle-color-theme: Raise error for empty input. Thx to Ahei. ;; 2009/11/24 dadams ;; icicle-color-theme: Take a snapshot each time invoked, unless prefix arg. ;; 2009/11/22 dadams ;; icicle-color-theme: Use color-theme-initialize instead of load-library, to load themes. ;; 2009/11/21 dadams ;; icicle-color-theme: Use color-theme-snapshot to let C-g undo changes. ;; Try to load color-theme-library.el (available with version 6.6.0). ;; 2009/11/17 dadams ;; icicle-bbdb-complete-name: Bind completion-case-ignore. ;; 2009/11/14 dadams ;; icicle-bbdb-complete-name: Replace macro bbdb-hashtable by its expansion. ;; 2009/09/21 dadams ;; icicle-lisp-complete-symbol: ;; Complete symbol in buffer as far as possible first. Show completions initially. ;; 2009/09/17 dadams ;; icicle-delete-file, icicle-(file|directory)-list, ;; icicle-find-file(-absolute)(-other-window), ;; icicle-(recent|locate)-file(-other-window), ;; icicle-find-file-in-tags-table(-other-window): Use icicle-file-bindings (new macro). ;; 2009/09/16 dadams ;; Added: icicle-insert-buffer. ;; icicle-kill-buffer, icicle-buffer(-other-window), icicle-add-buffer-candidate: ;; Use icicle-buffer-bindings (new macro). ;; 2009/08/29 dadams ;; Added: icicle-define-bookmark-other-window-command, icicle-select-bookmarked-region, ;; icicle-bookmark(-region|-info|-gnus|-w3m|(-non|-local|-remote)-file)-other-window. ;; icicle-bookmark-propertize-candidate: Updated to reflect renamed bookmark+.el face names. ;; icicle-bookmark-file-narrow: Use bookmarkp-file-bookmark-p. ;; (lambda...) -> #'(lambda...). ;; 2009/08/25 dadams ;; Added: icicle-bookmark-cleanup-on-quit. ;; icicle-bookmark(-other-window): Use icicle-bookmark-cleanup-on-quit. ;; icicle-bookmark-cleanup: Removed code to return to original window a focus minibuffer. ;; 2009/08/24 dadams ;; Added: icicle-bookmark-propertize-candidate. ;; icicle-bookmark(-other-window): Put faces on bookmark candidates according to type. ;; 2009/08/23 dadams ;; Added: icicle-bookmark-(region|info|gnus|w3m|(non-|local-|remote-)file)-narrow. ;; icicle-bookmark(-other-window): Bind keys to bookmark candidate narrowing commands. ;; icicle-bookmark-cleanup: Unbind the same commands. ;; icicle-bookmark-cmd: ;; Let bookmark+.el (latest version) handle prompting for name, even for region bookmark. ;; Remove any newlines in bookmark name, when no prompting (thx to Thierry Volpiatto). ;; 2009/08/21 dadams ;; icicle-bookmark-jump-1: Typo. ;; 2009/08/20 dadams ;; icicle-bookmark-cmd: Use icicle-bookmark-other-window, not icicle-bookmark. ;; Fix trimmed-name: no longer than def-name. ;; icicle-bookmark(-other-window): Bind enable-recursive-minibuffers, in case need to read. ;; icicle-bookmark-jump-1: No crosshair highlighting for region bookmarks. ;; 2009/08/19 dadams ;; Added: icicle-bookmark-help-string. ;; icicle-bookmark-cmd: Handle creation of region bookmarks (new default values). ;; icicle-bookmark-name-length-max now applies to whole bookmark name. ;; icicle-bookmark(-other-window): ;; Apply icicle-candidate-short-help to candidates. Use also for the help function. ;; icicle-bookmark-jump-1: Use bookmark--jump-via if it is defined. ;; 2009/06/21 dadams ;; icicle-bookmark-jump-1: Removed temporary Emacs 23 workaround for (fixed) bug #1175. ;; 2009/06/07 dadams ;; icicle-get-alist-candidate -> funcall icicle-get-alist-candidate-function. ;; 2009/05/22 dadams ;; Require icicles-mac.el if load-library doesn't find it. ;; Created - Split off from icicles-cmd.el. ;;;(@* "CHANGE LOG FOR `icicles-cmd2.el'") ;; ;; 2013/03/26 dadams ;; icicle-Info-multi-read-node-name: setq STRG only if it is nil. ;; icicle-Info-goto-node-of-content: Do not bother to bind icicle-candidate-properties-alist. ;; 2013/03/23 dadams ;; Renamed icicle-Info-goto-node to icicle-Info-goto-node-no-search. ;; Added: icicle-Info-goto-node (new version) - use *-of-content or *-no-search. ;; icicle-Info-menu-cmd: Use icicle-Info-goto-node-no-search, not new icicle-Info-goto-node. ;; icicle-Info-content-match: Set Info-tag-table-marker to saved position. ;; icicle-Info-read-node-of-content: Save position of Info-tag-table-marker for *-content-match. ;; 2013/03/17 dadams ;; Added: icicle-Info-goto-node-of-content, icicle-Info-apropos-complete-match, ;; icicle-Info-content-match, icicle-Info-read-node-of-content, ;; icicle-Info-multi-read-node-name, ;; 2013/03/16 dadams ;; icicle-Info-goto-node-action: Give focus back to minibuffer frame at end. ;; icicle-Info-read-node-name: Retain INCLUDE-FILE-P arg in recursive call. ;; 2013/03/15 dadams ;; Removed: icicle-Info-book-order-p (just ensure book order as default order). ;; icicle-Info-goto-node: ;; Bind icicle-pref-arg, so it is available in icicle-Info-goto-node-action. ;; Use nil, not icicle-Info-book-order-p, in icicle-sort-orders-alist and icicle-sort-comparer. ;; icicle-Info-goto-node-1: Use natnump as ARG test. ;; icicle-Info-build-node-completions-1: Ensure result is in book order, whatever Emacs version. ;; icicle-Info-build-node-completions: Do not do any reversing, since *-1 now uses book order. ;; icicle-Info-goto-node-action: Pass icicle-pref-arg to icicle-Info-goto-node-1 (bug fix). ;; Do not reverse list. ;; 2013/03/07 dadams ;; Updated to use icicle-user-error where appropriate. ;; 2013/02/28 dadams ;; icicle-cmd2-after-load-hexrgb, icicle-cmd2-after-load-wid-edit+: ;; Use fset, not defalias, for redefinitions of read-color, widget-color-complete. ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/01/06 dadams ;; icicle-(bookmark|(un)tag)-a-file: Updated calls to bmkp-*, to add nil NO-UPDATE-P argument. ;; 2013/01/05 dadams ;; icicle-find-file-(all|some)-tags*: protect free vars in lambdas using backquote quote comma. ;; icicle-(bookmark-a-file|find-file-tagged|): Updated doc string for new C-x C-t bindings. ;; 2012/12/31 dadams ;; icicle-search-in-context-default-fn: ;; Set icicle-mode-line-help instead of using icicle-show-help-in-mode-line. ;; 2012/12/22 dadams ;; Added: icicle-search-file-found-p. ;; icicle-search-define-candidates: ;; Search only files that have at least one regexp match: use icicle-search-file-found-p to test. ;; 2012/11/28 dadams ;; icicle-(fundoc|vardoc|plist): Use C-$ to toggle command/fn, option/var, faces/all. ;; icicle-vardoc: Do not use non-neg prefix arg for options. ;; icicle-doc: Be able to use C-$ to limit to commands, options, and faces. ;; Correction: separate setq in and, in case icicle-fn-doc-minus-sig returns nil. ;; 2012/11/20 dadams ;; icicle-search-define-candidates: ;; Added progress message for context gathering. Thx to Michael Heerdegen. ;; 2012/11/10 dadams ;; icicle-defined-thing-p: icicle-get-safe -> get. ;; icicle-read-color-wysiwyg: ;; Fix case where user inputs name or RGB without completing (transformed to ""). ;; Mention sorting in doc string. ;; 2012/11/08 dadams ;; icicle-defined-thing-p: Use icicle-get-safe. ;; Doc strings: Use \\[...] more. ;; 2012/11/05 dadams ;; Use \\[...] in doc strings instead of hard-coding, for some more keys. ;; 2012/11/03 dadams ;; Added: icicle-cmd2-after-load-wid-edit+. eval-after-load it for wid-edit+.el. ;; Use it for all of the widget stuff (take that out of icicle-cmd2-after-load-highlight). ;; 2012/10/26 dadams ;; icicle-search: Use \\[...] in doc string instead of hard-coding some of the keys. ;; 2012/10/22 dadams ;; icicle-Info-index: Bind *-transform-function to *-remove-duplicates. Emacs bug #12705. ;; 2012/10/20 dadams ;; icicle-read-color: Fix case where user inputs without completing (WYSIWYG transforms to ""). ;; 2012/10/09 dadams ;; icicle-find-file-tagged*, icicle-read-color(-wysiwyg), icicle-frame-(bg|fg), ;; icicle-choose(-(in)visible)-faces, icicle-(var|fun)doc, icicle-plist, ;; icicle-goto-global-marker, icicle-occur, icicle-imenu-1, ;; icicle-search(-bookmark(s-together|list-marked)|-buffer|-file|-sentences|-paragraphs|-pages): ;; Bind icicle-multi-completing-p. ;; 2012/10/06 dadams ;; icicle-hide/show-comments: Call comment-normalize-vars first. Thx to Stefan Monnier. ;; 2012/09/08 dadams ;; icicle-apply: Override icicle-buffer-ignore-space-prefix-flag, not icicle-ignore-space-prefix*. ;; icicle-search: Remove mention of overriding icicle-ignore-space-prefix-flag. ;; icicle-choose-candidate-of-type: Remove binding of icicle-ignore-space-prefix-flag. ;; 2012/09/06 dadams ;; Use icicle-string-match-p. ;; 2012/09/05 dadams ;; Added: icicle-select-text-at-point. ;; 2012/08/21 dadams ;; tap-symbol-nearest-point -> symbol-nearest-point. (icicles-opt.el DTRT.) ;; 2012/08/18 dadams ;; symbol-nearest-point -> tap-symbol-nearest-point. ;; bounds-of-thing-at-point -> icicle-bounds-of-thing-at-point. ;; next-visible-thing-(1|2) -> thgcmd-next-visible-thing-(1|2). ;; next-visible-thing-1: Note: < seems better than <= for comparison. I changed it to < for ;; Icicles version on 2011-05-14. But just changed the thing-cmd.el version to < today. ;; 2012/08/14 dadams ;; icicle-cmd2-after-load-highlight: ;; For Emacs < 24, require wid-edit.el before defalias to widget-color-complete. ;; 2012/08/12 dadams ;; icicle-read-color-WYSIWYG: Convert raw prefix arg `-' to -1. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-color, icicle-ORIG-read-color, icicle-ORIG-widget-color-complete. ;; icicle-Info-index(-20|-action), icicle-Info-menu, icicle-Info-goto-node-1: ;; Applied renaming to new: icicle-ORIG-*. ;; 2012/08/05 dadams ;; Added: widgets icicle-color, old-color. Added function icicle-widget-color-complete. ;; icicle-read-color-wysiwyg: ;; Added optional arg INITIAL-INPUT. ;; Return only variable's value if user-option candidate is chosen. ;; 2012/07/17 dadams ;; Removed: icicle-maybe-byte-compile-after-load (macro). Removed all calls to it. ;; 2012/07/07 dadams ;; icicle-Info-index: ;; Bind icicle-Info-(index-nodes|manual|hist-list), for highlighting visited nodes. ;; Raise error if not in Info-mode. ;; 2012/07/02 dadams ;; Moved defcustom of icicle-byte-compile-eval-after-load-flag to icicles-mcmd.el (loaded first). ;; icicle-search-bookmark(-action): Use *-search-context-regexp, not regexp, so no free warning. ;; Changed #'(lambda...) to (lambda...). ;; 2012/05/22 dadams ;; icicle-search-define-candidates, icicle-char-properties-in-buffers: ;; Test with icicle-file-remote-p before file-exists-p, to avoid Tramp. ;; 2012/05/15 dadams ;; Removed: icicle-search-desktop-bookmark (useless). ;; 2012/05/07 dadams ;; Renamed: icicle-search-dired-marked to icicle-search-dired-marked-recursive. ;; 2012/05/06 dadams ;; icicle-search-dired-marked: Call diredp-get-confirmation-recursive to get confirmation. ;; 2012/04/23 dadams ;; icicle-search-dired-marked: Use diredp-get-files. Raise error if Dired+ not present. ;; Moved other icicle-search-dired-* functions to Dired+ as diredp-*. ;; icicle-search-dired-get-files: ;; If user answers no, then pick up only the marked files here 9and all files underneath). ;; icicle-search-dired-get-files-for-dir: A no answer does not change what happens for top dir. ;; 2012/04/20 dadams ;; Added: icicle-search-dired-get-files-for-dir, icicle-search-dired-marked-here. ;; icicle-search-dired-marked: ;; Added arg IGNORE-MARKS-P (prefix arg). Pass it to icicle-search-dired-get-files. ;; icicle-search-dired-get-files: Rewrote - uses icicle-search-dired-get-files-for-dir. ;; Ask user whether to use Dired buffers for subdirs, if there are any. ;; 2012/04/14 dadams ;; icicle-search-dired-get-files: Moved handling of IGNORE-MARKS-P outside the lambda. ;; 2012/04/13 dadams ;; Added: icicle-search-dired-get-files. ;; icicle-search-dired-marked: Use icicle-search-dired-get-files, not dired-get-marked-files. ;; 2012/04/09 dadams ;; Changed last-command-char to last-command-event. ;; Fixed typos: double single-quotes in autoload cookies. ;; 2012/04/08 dadams ;; Make autoload cookies for commands load icicles[.el] explicitly. ;; 2012/04/03 dadams ;; Moved to *-cmd1.el: ;; icicle-send-signal-to-process, icicle-apropos, icicle-apropos-command, icicle-apropos-function, ;; icicle-apropos-option, icicle-apropos-options-of-type, icicle-apropos-variable, ;; icicle-apropos-zippy, icicle-apropos-opt-action, icicle-describe-option-of-type, ;; icicle-describe-opt-action, icicle-describe-opt-of-type-complete. ;; Plus compile-time requires of libraries yow, cookie1, apropos-fn+var. ;; 2012/04/01 dadams ;; Added: icicle-apropos-options-of-type, icicle-apropos-opt-action. ;; icicle-where-is: In help fn, wrap individual key sequences in `', not just all of them together. ;; 2012/03/31 dadams ;; icicle-apropos*: Updated wrt Emacs 24 (handle PATTERN). Added optional MSGP arg. ;; 2012/03/28 dadams ;; Changed FILE arg in autoloads by removing .el, so .elc will be loaded if available. ;; 2012/03/10 dadams ;; icicle-bookmark-a-file, icicle-find-file-tagged(-other-window): Bind icicle-full-cand-fn. ;; icicle-find-file-(handle-bookmark|(all|some)-tags(-regexp))(-other-window): ;; First code, last code: Call icicle-(un)bind-file-candidate-keys. ;; icicle-search-bookmark: Use icicle-make-bookmark-candidate to define icicle-candidates-alist. ;; 2012/03/09 dadams ;; icicle-untag-a-file, icicle-find-file-(all|some)-tags(-regexp)(-other-window), icicle-where-is, ;; icicle-apropos-(variable|option|function|command), icicle-apply, ;; icicle-save-string-to-variable, icicle-choose-candidate-of-type, ;; icicle-read-var-value-satisfying, icicle-read-args-for-set-completion-methods: ;; When Icomplete mode, use normal PRED, not *-must-pass-after-match-predicate. ;; icicle-find-file-handle-bookmark(-other-window): Use bmkp-find-file(-other-window) as action fn. ;; 2012/02/26 dadams ;; Update to reflect Bookmark+ changes (bindings etc.). ;; Added icicle-find-file-handle-bookmark(-other-window), as nontagging C-f commands. ;; icicle-find-file-tagged*: Use bmkp-find-file*, not find-file*, as action fn. ;; Pass prefix arg to bmkp-read-tags-completing, to update cache. ;; 2012/02/20 dadams ;; Added: icicle-Info-menu-cmd. Actually, renamed icicle-Info-menu to icicle-Info-menu-cmd and ;; added non-interactive icicle-Info-menu with args for compatibility with vanilla Emacs. ;; icicle-Info-index: Added optional arg for non-interactive compatibility with vanilla Emacs. ;; 2012/02/12 ;; Added def of icicle-byte-compile-eval-after-load-flag here too, so can load before icicles.el. ;; 2012/02/11 dadams ;; icicle-search: Update doc string for new input expansion. ;; icicle-search-highlight-all-input-matches: ;; Expand when apropos and 4 or prefix and 3 or 4. ;; 2012/01/25 dadams ;; icicle-exchange-point-and-mark: Support also vanilla Emacs 22+ use of a prefix arg. ;; 2012/01/16 dadams ;; icicle-search-define-candidates: Add COMPLEMENT to error msg. Thx to Michael Heerdegen. ;; 2011/12/19 dadams ;; icicle-marker+text, icicle-compilation-search-in-context-fn: Use line-(beginning|end)-position. ;; 2011/12/14 dadams ;; icicle-search-where-arg: Do not bind icicle-bookmark-types here. ;; icicle-search-define-candidates: For bookmarks, WHERE is a cons of conses (not just a cons). ;; 2011/12/13 dadams ;; icicle-search-define-candidates: In bookmarks part, test BEG =? END only if both are non-nil. ;; 2011/12/06 dadams ;; icicle-send-signal-to-process: Add process name to prompt. Thx to Michael Heerdegen. ;; 2011/11/26 dadams ;; Renamed icicle-read-color to icicle-read-color-wysiwyg. ;; Added icicle-read-color (args compatible with vanilla read-color), for *-functions-to-redefine. ;; icicle-read-color-wysiwyg: Added MSGP arg. Updated hexrgb-read-color call (new arg list). ;; icicle-color-help: Corrected for different cases of icicle-list-use-nth-parts (not just (1 2)). ;; icicle-color-distance-(rgb|hsv)-lessp, icicle-choose-candidate-of-type: ;; Applied renaming: icicle-read-color-wysiwyg. ;; 2011/11/02 dadams ;; Added: icicle-search-autonamed-bookmark, icicle-search-temporary-bookmark. ;; *-full search commands: ;; Corrected doc strings to refer to the right option, icicle-hide-non-matching-lines-flag. ;; 2011/10/22 dadams ;; icicle-send-signal-to-process: ;; Bind icicle-last-transform-function to nil, so icicle-toggle-transforming still works well. ;; 2011/10/21 dadams ;; icicle-read-color, icicle-where-is, icicle-apply((-list)-action), icicle-search-thing-args, ;; icicle-set-completion-methods-for-command: ;; Use icicle-propertize. ;; 2011/10/19 dadams ;; Added: icicle-describe-process, icicle-send-signal-to-process. Thx to Michael Heerdegen. ;; 2011/10/10 dadams ;; icicle-define-search-bookmark-command: Moved to icicles-mac.el. ;; Moved here (and to icicles-face.el) from icicles-mac.el: icicle-maybe-byte-compile-after-load. ;; Replaced bodies of eval-after-load sexps with call to icicle-cmd2-after-load-*. ;; Added: icicle-cmd2-after-load-(bookmark+'|hexrgb|highlight|palette|synonyms). ;; Removed: icicle-read-single-key-description (unused). ;; 2011/10/08 dadams ;; Moved to icicles-mac.el: icicle-read-kbd-macro, icicle-edmacro-parse-keys. ;; Removed: icicle-orig-(buff|win)-key-complete - use regular icicle-orig*. ;; icicle-complete-keys: Bind regular icicle-orig*, not icicle-orig-(buff|win)-key-complete. ;; icicle-complete-keys-1: New icicle-key-description, with PREFIX arg and ANGLES, not NO-ANGLES. ;; icicle-complete-keys-action: Set buffer & window to icicle-orig*. ;; icicle-keys+cmds-w-prefix: Use icicle-delete-alist-dups. Thx to Michael Heerdegen. ;; icicle-add-key+cmd: ;; Do not follow indirection to ultimate symbol. Include NO-REMAP arg to key-binding. ;; Replace ESC by M-.. Follow remapped command to its target. Thx to Michael Heerdegen. ;; Do not remove VARIATION* names (Unicode). ;; icicle-read-single-key-description: Change NO-ANGLES arg to ANGLES. ;; icicle-where-is: Use icicle-key-description, not key-description. ;; icicle-Info-(index|read-node-name), icicle-search-bookmark, palette-mode-map: Use icicle-kbd. ;; 2011/10/02 dadams ;; icicle-add-key+cmd: ;; Use Unicode char name in place of self-insert-command. Remove empty and VARIATION* names. ;; 2011/09/27 dadams ;; Added: icicle-search-modes (macro). ;; icicle-search-where-arg: Use icicle-search-modes - handle zero prefix arg. ;; icicle-(occur|sentences|paragraphs|pages), Use *-search-where-arg, to search files & bookmarks. ;; icicle-search-define-candidates: Use nil for BEG and END if region is empty. ;; Thx to Michael Heerdegen. ;; 2011/09/18 dadams ;; Added: icicle-search-property-default-match-fn. Handles MuMaMo major mode zones. ;; icicle-search-char-prop-matches-p. Doesn't just flatten overlay & text props and use ;; set intersect. Uses icicle-some with MATCH-FN. ;; Moved to icicles-fn.el: icicle-flat-list (no longer used). ;; Moved to icicles-cmd1.el: icicle-(keyword|regexp)-list. ;; icicle-color-completion-setup: Ensure icicle-prompt is a string before adding property. ;; icicle-search-where-arg, icicle-search-choose-buffers, icicle-search-(buffer|file): ;; Bind icicle-prompt. ;; icicle-search-char-property: Added arg MATCH-FN. Add it to the return value. ;; icicle-search-(overlay|text)-property: ;; Added arg MATCH-FN (pass to icicle-search). Made all args mandatory. ;; icicle-search-text-property: When PROP is face, call font-lock-fontify-region. ;; icicle-search-property-args: ;; Bind match-fn to icicle-search-property-default-match-fn. Add it to return value. ;; Bind icicle-prompt and icicle-hist-var. ;; For values: for non-face prop, use icicle-sexp-list, not icicle-completing-read-history. ;; icicle-search-char-property-scan: ;; Added arg MATCH-FN. Use icicle-search-char-prop-matches-p. ;; Extend zone if matching prop values also in contiguous zone. ;; icicle-search-(regexp|thing)-scan, icicle-search-highlight-input-matches-here, ;; icicle-search-char-property-scan: ;; Handle t value for icicle-search-highlight-threshold. ;; 2011/09/09 dadams ;; icicle-search-w-isearch-string: Added prefix-arg treatment. ;; 2011/09/08 dadams ;; Added: icicle-search-w-isearch-string, from a lambda in icicles-mode.el. ;; 2011/09/05 dadams ;; icicle-imenu-*: Others -> Other, as submenu name. ;; icicle-search, icicle-imenu*-full: Mention C-x . in doc strings. ;; 2011/09/04 dadams ;; icicle-add-key+cmd: Handle Emacs 23+ consp char-range events, for self-insert. ;; Applied renaming of icicle-complete-keys-self-insert-flag to *-ranges. ;; Removed: icicle-insert-char. ;; 2011/09/02 dadams ;; Removed: icicle-Info-index-cmd, icicle-Info-menu-cmd, icicle-Info-goto-node-cmd. ;; icicle-Info-index(-20|-action): Use old-Info-index. ;; icicle-Info-goto-node-1: Use old-Info-goto-node. ;; 2011/08/27 dadams ;; icicle-search-char-property-scan: Added optional ACTION arg. Move hit-end after ACTION. ;; Added: icicle-imenu-1. Created from old icicle-imenu*, but: (1) added args FULLP for full, ;; SUBMENU-FN to pick submenu, (2) pass PREDICATE and pos after forward-sexp for FULLP. ;; icicle-imenu, icicle-imenu-command: Use icicle-imenu-1. ;; Added: icicle-imenu(-command|-non-interactive-function)-full, icicle-search-defs-full, ;; icicle-imenu-(macro|variable|user-option|face|key-(implicit|explicit)-map)(-full), ;; icicle-apply-action, icicle-apply-list-action, icicle-search-regexp-scan, ;; icicle-search-action-1, icicle-search-bookmark, icicle-define-search-bookmark-command, ;; icicle-search-thing-scan, icicle-search-char-property-scan: ;; Use icicle-condition-case-no-debug instead of condition-case. Thx to Michael Heerdegen. ;; 2011/08/26 dadams ;; icicle-imenu: ;; When multiple Others menus, name them uniquely. ;; When only one submenu, just use it (no choosing). ;; icicle-complete-keys-action: Removed useless condition-case. ;; Make sure to pass format string as first arg to calls to functions error and message. ;; 2011/08/17 dadams ;; icicle-search-thing-scan: Use correct code (not 1+) also if thingatpt+.el is loaded. ;; icicle-search-regexp-scan: Quit while loop if no more match, except if complementing. ;; icicle-search-read-context-regexp, icicle-search-(thing|property)-args, icicle-tags-search: ;; Change prompt when complementing (add: *NOT*). ;; 2011/08/16 dadams ;; icicle-maybe-byte-compile-after-load the eval-after-load definitions. ;; 2011/08/14 dadams ;; icicle-search-thing-scan: Handle icicle-search-complement-domain-p. ;; Updated doc strings of search commands to mention complementing. ;; icicle-imenu(-command|-non-interactive-function), icicle-complete-keys-1: ;; Replaced mapc with dolist so do not require cl.el at runtime (Emacs 20). ;; icicle-imenu: Ignore case when completing to the type (function etc.). ;; 2011/08/13 dadams ;; Added: icicle-bookmark-a-file. ;; icicle-search-regexp-scan, icicle-search-char-property-scan: ;; Handle icicle-search-complement-domain-p. ;; 2011/08/12 dadams ;; icicle-find-file-tagged(-other-window): ;; Bind icicle-full-cand-fn. Use icicle-file-bindings. ;; Use icicle-(un)bind-file-candidate-keys. Don't do/undo such bindings individually here. ;; 2011/08/09 dadams ;; icicle-find-file-tagged(-other-window): Bind C-x a [+-] to adding/removing tags. ;; icicle-define(-file)-command calls: Removed undo code if same as last code, so do not repeat it. ;; 2011/08/08 dadams ;; icicle-find-file-tagged(-other-window): Prefix arg means use all (not just tagged) autofiles. ;; 2011/08/07 dadams ;; Added: icicle-find-file-tagged(-other-window). ;; 2011/08/05 dadams ;; icicle-(un)tag-a-file: Bind icicle-use-candidates-only-once-flag to t. ;; 2011/07/31 dadams ;; Added: icicle-search-xml-element-text-node. ;; icicle-search-thing(-scan): Added TRANSFORM-FN arg. ;; icicle-search-define-candidates: Added message when only one candidate. ;; 2011/07/30 dadams ;; Moved here from icicles-cmd1.el and wrapped in eval-after-load bookmark+.el: ;; icicle-find-file-(all|some)-tags(-regexp)(-other-window), icicle-(un)tag-a-file. ;; Moved here from synonyms.el and wrapped in eval-after-load synonyms.el: (icicle)-synonyms. ;; Moved here from icicles-fn.el and wrapped in eval-after-load hexrgb.el: ;; icicle-color-*-lessp (except -rgb-), icicle-color-completion-setup, icicle-color-help, ;; icicle-make-color-candidate. ;; Soft-require hexrgb.el only when byte-compile. ;; icicle-frame-(bg|fg), icicle-read-color: Wrap in eval-after-load hexrgb.el. ;; icicle-(insert|complete)-thesaurus-entry(-cand-fn): Wrap in eval-after-load synonyms.el. ;; icicle-choose(-(in)visible)-faces, icicle-(hide|show)(-only)-faces: ;; Use eval-after-load highlight.el, not featurep. ;; icicle-pick-color-by-name(-action), palette keys: Use eval-after-load palette.el, not featurep. ;; 2011/07/27 dadams ;; icicle-search-read-word: Changed regexp to what vanilla Emacs uses for word search. ;; icicle-search(-word): Updated doc string wrt word search. ;; 2011/07/26 dadams ;; Removed: icicle-list-end-string (no longer needed). Thx to Michael Heerdegen. ;; 2011/07/24 dadams ;; Moved here from palette.el, and renamed with prefix icicle-: ;; icicle-pick-color-by-name, icicle-pick-color-by-name-action ;; Moved here from highlight.el, and renamed with prefix icicle- (from hlt-) and suffix -faces: ;; icicle-(hide|show)(-only)-faces, icicle-choose(-(in)visible)-faces. ;; Added: icicle-invisible-face-p. ;; icicle-choose(-(in)visible)-faces: Corrected: ;; Lax if icicle-WYSIWYG-Completions-flag. Put icicle-fancy-candidates on prompt. ;; Use icicle-list-*, for multi-completions. Use icicle-invisible-face-p to test invisibility. ;; Added eval-when-compile with soft requires for bookmark+.el and highlight.el. ;; 2011/07/18 dadams ;; icicle-search-thing, icicle-search-thing-scan: ;; Moved normalizing BEG, END to *-scan, for multiple buffers case. Thx to M. Heerdegen. ;; 2011/07/13 dadams ;; icicle-search-replace-cand-in-mct: Changed <= to < for len-rep. Thx to M. Heerdegen. ;; 2011/07/04 dadams ;; icicle-search-in-context-default-fn: ;; Bound icicle-last-completion-candidate, icicle-completion-candidates. Thx to M. Heerdegen. ;; 2011/07/02 dadams ;; Added: icicle-defined-thing-p. ;; icicle-things-alist: Use icicle-defined-thing-p. Thx to Michael Heerdegen. ;; 2011/06/03 dadams ;; Replace icicle-help-in-mode-line-flag by icicle-help-in-mode-line-delay everywhere. ;; 2011/05/25 dadams ;; icicle-fundoc, icicle-vardoc, icicle-plist: ;; Use icicle-doc-action only. Bind icicle-list-use-nth-parts to (1). Thx to Michael Heerdegen. ;; 2011/05/24 dadams ;; icicle-invisible-p: Use invisible-p if available (Emacs 22+). ;; 2011/05/22 dadams ;; Added defvars for free vars to quiet byte compiler. ;; 2011/05/16 dadams ;; icicle-search-thing-args: Message about C-M-; when ignoring comments and THING is comment. ;; 2011/05/15 dadams ;; Added: icicle-search-xml-element. ;; icicle-search-thing, icicle-search-thing-scan: Added PREDICATE optional arg. ;; 2011/05/14 dadams ;; Added: icicle-things-alist. ;; icicle-search-thing-args, icicle-(next|previous)-visible-thing: ;; Use icicle-things-alist, not (now removed) option icicle-thing-types. ;; icicle-next-visible-thing-1: Change comparison to < from <= ;; Removed: icicle-defined-thing-p (not used). ;; 2011/05/13 dadams ;; Renamed: icicle-last-visible-thing-type to icicle-last-thing-type. ;; icicle-last-thing-type: Use thgcmd-last-thing-type value as default, if available. ;; icicle-search-thing: Ensure BEG is before END (swap if needed). ;; icicle-search-thing-args, icicle-(next|previous)-visible-thing: ;; Use completing-read, not read-string, to read thing type. ;; icicle-(next|previous)-visible-thing: Do not set this-command (no need). ;; icicle-search-thing-scan: Removed code defining BEG, END if nil. Go to BEG, not min BEG, END. ;; icicle-next-visible-thing-2: Do not return an empty thing. ;; 2011/05/11 dadams ;; Added: icicle-invisible-p, icicle-previous-single-char-property-change. ;; icicle-search-thing-scan: ;; Handle also text invisible due to overlay, and invisible prop other than t. ;; icicle-next-visible-thing-2: Separate handling overlay and text prop. Use icicle-invisible-p. ;; 2011/05/10 dadams ;; Added: icicle-last-visible-thing-type, icicle-previous-visible-thing, ;; icicle-next-visible-thing-(and-bounds|1|2). ;; Alias icicle-next-visible-thing-(1|2) to the same commands from thing-cmds.el. ;; icicle-search-thing-scan: ;; Use when, not while, to skip over invisible (since use next-single-property-change). ;; Use new icicle-next-visible-and-bounds, so save-excursion and goto min. ;; Old icicle-next-visible is now ~ *-2, but that handles backward too. New one is a command. ;; 2011/05/07 dadams ;; Added: icicle-with-comments-hidden, icicle-hide/show-comments, icicle-search-thing, ;; icicle-defined-thing-p, icicle-next-visible-thing, icicle-search-thing-args, ;; icicle-search-thing-scan. ;; icicle-search: Doc string tweak. ;; 2011/05/04 dadams ;; icicle-search-read-context-regexp: Changed prompt to make clear that we search within contexts. ;; icicle-search-define-candidates: Remove any region highlighting, so we can see search hits. ;; 2011/04/29 dadams ;; icicle-choose-candidate-of-type: Rewrote buffer bindings based on icicle-buffer-bindings. ;; 2011/04/26 dadams ;; Added: icicle-search-autofile-bookmark. ;; 2011/04/12 dadams ;; Added: icicle-search-bookmark-list-marked, icicle-named-colors. ;; icicle-search-bookmark, icicle-define-search-bookmark-command: ;; Applied Bookmark+ renaming: bmkp-sort-and-remove-dups -> bmkp-sort-omit. ;; icicle-comint-search: Improved doc string (don't use C-next etc.). ;; icicle-frame-(bg|fg), icicle-read-color: Rename free var named-colors to icicle-named-colors. ;; Bind it in icicle-frame-(bg|fg), icicle-read-color, for use in icicle-color-completion-setup. ;; 2011/04/04 dadams ;; icicle-insert-thesaurus-entry-cand-fn, icicle-goto-marker-1-action, icicle-search-final-act, ;; icicle-comint-search: Use icicle-recenter. ;; 2011/04/02 dadams ;; Added: icicle-info-(buff|window), icicle-key-prefix(-2), icicle-active-map, ;; Moved here from icicles-var.el: ;; icicle-orig-buff-key-complete, icicle-orig-extra-cands, icicle-orig-font, icicle-orig-frame, ;; icicle-orig-menu-bar, icicle-orig-pixelsize, icicle-orig-pointsize, icicle-this-cmd-keys, ;; icicle-orig-show-initially-flag, icicle-orig-sort-orders-alist, icicle-orig-win-key-complete. ;; icicle-Info-index(-goto-node)(-action): ;; Use (new) icicle-info-(buff|window), not info-(buff|window). ;; icicle-describe-option-of-type, icicle-describe-opt-of-type-complete: ;; Use (new) icicle-pref-arg, not pref-arg. ;; icicle-search: Bind (new) icicle-scan-fn-or-regexp. ;; Moved any alias inside emacs-major-version test. ;; icicle-complete-keys-1: Bind (new) icicle-key-prefix. ;; icicle-complete-keys-action: Use (new) icicle-key-prefix, not prefix. ;; icicle-keys+cmds-w-prefix: Bind (new) icicle-key-prefix-2. Use icicle-active-map, not map. ;; icicle-add-key+cmd: Use icicle-key-prefix-2 and icicle-active-map, not prefix and map. ;; 2011/03/31 dadams ;; icicle-describe-opt-of-type-complete: Wrap icicle-var-is-of-type-p with condition-case. ;; 2011/03/29 dadams ;; icicle-search-action-1: Set icicle-other-window. Use icicle-target-window-recenter-amount. ;; Use new icicle-* vars for various free vars (orig-buff etc.). ;; icicle-frame-(bg|fg), icicle-read-color: prompt -> icicle-prompt. ;; 2011/03/03 dadams ;; icicle-insert-thesaurus-entry: Changed to strict completion from lax. ;; icicle-describe-option-of-type, icicle-(fun|var)doc, icicle-plist: ;; Removed mention of RET in prompt. ;; 2011/02/17 dadams ;; Added defalias old-read-color for read-color. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; Added more autoload cookies for commands. Thx to Richard Kim. ;; Specify command and file for commands defined by Icicles macros. ;; Require icicles-opt.el before icicles-var.el (but it makes no difference). ;; 2010/12/14 dadams ;; icicle-search-regexp-scan: Don't create marker if hit string is "". ;; icicle-search-highlight-all-input-matches: ;; Don't search within empty search contexts. Do nothing if input and expanded input are "". ;; If search doesn't advance point then forward-char. Stop searching if eobp. ;; Don't add (empty) overlay if search is empty. ;; icicle-search-highlight-context-levels: Don't add overlay for empty match. ;; icicle-search-highlight-input-matches-here: If search doesn't advance point then forward-char. ;; icicle-search-char-property-scan: Don't create empty overlays. ;; 2010/11/10 dadams ;; Added: icicle-read-args-for-set-completion-methods. ;; icicle-set-((S-)TAB|completion)-methods-for-command: Added METHODS arg. ;; 2010/11/09 dadams ;; Added: icicle-set-((S-)TAB|completion)-methods-for-command. ;; 2010/11/07 dadams ;; Applied renaming of icicle-all-candidates-action-p to icicle-all-candidates-action. ;; 2010/10/27 dadams ;; icicle-where-is: Use different prompt if prefix arg. Clarify the pref-arg diff in doc string. ;; 2010/10/25 dadams ;; icicle-search: Remove mention of icicle-search-context-match-predicate (no longer exists). ;; 2010/10/24 dadams ;; icicle-where-is, icicle-apropos-(variable|option|function|command), icicle-apply, ;; icicle-save-string-to-variable, icicle-choose-candidate-of-type, ;; icicle-read-var-value-satisfying: ;; Use icicle-must-pass-after-match-predicate, not PREDICATE arg. ;; 2010/10/09 dadams ;; icicle-Info-goto-node, icicle-apply, icicle-goto-marker, icicle-occur, icicle-complete-keys, ;; icicle-(comint|compilation)-search, icicle-search(-sentences|-paragraphs|-pages): ;; Updated doc string for new prefix and modal cycling keys. ;; 2010/07/17 dadams ;; Added: icicle-search-url-bookmark. ;; icicle-search-bookmark, icicle-define-search-bookmark-command: w3m -> url. Added C-M-u binding. ;; 2010/07/14 dadams ;; icicle-Info-index: Bind C-x m to icicle-bookmark-info-other-window. ;; icicle-Info-read-node-name: Restore original binding of C-x m, if any. ;; 2010/06/21 dadams ;; icicle-comint-search: Wrap search with unwind-protect to remove hook. Thx to M. Heerdegen. ;; 2010/06/18 dadams ;; icicle-search-replace-match: Specific error message for read-only buffer. Thx to M. Heerdegen. ;; Renamed: bookmarkp-* to bmkp-*. ;; 2010/06/12 dadams ;; icicle-goto-marker-or-set-mark-command: ;; Set this-command so C-SPC C-SPC activates when not t-m mode. Thx to Chris Hecker. ;; 2010/06/11 dadams ;; icicle-search-action-1: (unless (pos-visible-in-window-p) (recenter -2)). Thx to M. Heerdegen. ;; 2010/06/08 dadams ;; icicle-search-bookmark, icicle-define-search-bookmark-command: ;; Use icicle-bookmark-delete-action. ;; Use condition-case to filter out bad bookmarks (so no error). ;; 2010/06/04 dadams ;; Added: icicle-ido-like-mode. ;; 2010/05/16 dadams ;; Added: icicle-search-(all|some)-tags(-regexp)-bookmark, icicle-search-desktop-bookmark, ;; icicle-search-specific-(buffers|files)-bookmark, icicle-search-this-buffer-bookmark. ;; icicle-define-search-bookmark-command: Defined cmd requires bookmark+.el. Added &rest arg ARGS. ;; 2010/05/15 dadams ;; icicle-search-highlight-and-maybe-replace: If candidate number is nil, set to 0. ;; icicle-search: Updated doc string: Can sort. Don't say not to use C-|. ;; 2010/05/09 dadams ;; Icicles search: Change to allow sorting. Use mctized candidates, not alist + candidate nb. ;; icicle-search-highlight-and-maybe-replace: ;; Use *-replace-cand-in-mct, not *-replace-cand-in-alist. Do not *-input-matches-here. ;; icicle-search-replace-cand-in-mct: Rewrote. ;; Handle multi-completions also. Update CAND+MRKER to use replacement string, but keep props. ;; icicle-search-in-context-default-fn: Rewrote. ;; Update icicle-last-completion-candidate to current candidate. Insert that. ;; Recompute input-match highlighting in current context. Remove current if no candidates. ;; icicle-search-action-1: Do nothing if no candidates. ;; icicle-search-help: Bind icicle-whole-candidate-as-text-prop-p to t, not nil. ;; 2010/05/04 dadams ;; icicle-object-action: Pass TYP to icicle-apply-to-saved-candidate. (UNTESTED) ;; icicle-choose-anything-candidate: Pass TYPE to icicle-apply-to-saved-candidate. (UNTESTED) ;; icicle-apply, icicle-read-var-value-satisfying: Bug fix: Removed #'. ;; 2010/04/30 dadams ;; icicle-search: Delete icicle-search-current-overlay via icicle-no-match-hook (& restore hook). ;; 2010/04/29 dadams ;; icicle-apply: Added optional args predicate initial-input hist def inherit-input-method. ;; Pass them to icicle-explore. ;; icicle-goto-marker-1: Pass a PREDICATE arg that ensures the marker points somewhere. ;; 2010/04/25 dadams ;; icicle-complete-keys-action: ;; Bind icicle-*, esp. *-initially-flag, around call of this-command-keys. Thx to M Heerdegen. ;; icicle-complete-keys: Save some icicle-* vars to reuse in icicle-complete-keys-action. ;; 2010/04/17 dadams ;; icicle-search-bookmark, icicle-define-search-bookmark-command: ;; Use icicle-transform-multi-completion in icicle-delete-candidate-object. ;; 2010/04/08 dadams ;; icicle-get-anything-candidates: Removed #' - it was preventing the fn from being functionp. ;; 2010/04/03 dadams ;; Removed: icicle-search-desktop-bookmark (no need). ;; 2010/04/02 dadams ;; Removed: ;; icicle-add-region, icicle-delete-region-from-alist, icicle-purge-bad-file-regions, ;; icicle-region-add-buffers, icicle-region-add-short-help, icicle-region-help, ;; icicle-region-open-all-files, icicle-regions, icicle-region-sorted, ;; icicle-remove-all-regions-action, icicle-remove-all-regions-in-buffer, icicle-remove-region, ;; icicle-search-all-regions, icicle-search-region(-action), icicle-select-region(-action). ;; Added: ;; icicle-search-bookmark-list-bookmark, icicle-search-bookmarks-together, ;; icicle-search-desktop-bookmark, icicle-search-dired-bookmark, icicle-search-man-bookmark. ;; icicle-exchange-point-and-mark, icicle-search(-define-candidates), ;; icicle-char-properties-in-buffers: ;; Use only region bookmarks, not Icicles saved regions. ;; icicle-exchange-point-and-mark: Negative prefix arg prompts for bookmark name. ;; icicle-search-define-candidates(-1): Raise the no-candidates error in parent, not in (-1). ;; icicle-search-bookmark: Use full multi-completions. Use bookmark sort orders. ;; Define narrowing keys in both minibuffer maps. ;; icicle-search-bookmark-action: Transform multi-completion. Use bookmark posns only for region. ;; icicle-define-search-bookmark-command: Added PROMPT arg. Use multi-completions, bookmark sorts. ;; 2010/03/28 dadams ;; Renamed: icicle-search-all-regions to icicle-search-region. ;; Removed: old icicle-search-region (use icicle-search-region-bookmark instead), ;; icicle-region-add-buffers, icicle-region-add-short-help, icicle-region-help, ;; icicle-region-sorted, icicle-region-open-all-files, icicle-add-region, ;; icicle-remove-region, icicle-delete-region-from-alist, ;; icicle-purge-bad-file-regions, icicle-remove-all-regions-(in-buffer|action). ;; icicle-search-all-regions: Use region bookmarks, not icicle-region-alist. ;; 2010/03/27 dadams ;; Added: icicle-search-(bookmark-list|desktop|dired|man)-bookmark. ;; icicle-search-bookmark: Use multi-completions. ;; icicle-search-bookmark-action: ;; Use icicle-transform-multi-completion. Use both minibuffer completion maps. ;; Search region if region bookmark. ;; icicle-define-search-bookmark-command: Added optional PROMPT arg. Use multi-completions. ;; 2010/03/13 dadams ;; Applied renaming of icicle-add-buffer-name-flag to icicle-show-multi-completion-flag. ;; 2010/03/09 dadams ;; icicle-regions: Use icicle-reversible-sort (with KEY arg), not sort. ;; 2010/03/03 dadams ;; Applied renamings: icicle-sort-function to icicle-sort-comparer ;; icicle-sort-functions-alist to icicle-sort-orders-alist, ;; icicle-alternative-sort-function to icicle-alternative-sort-comparer, ;; icicle-last-sort-function to icicle-last-sort-comparer. ;; 2010/02/06 dadams ;; icicle-where-is: Make sure orig-buff is current when look up the bindings. ;; 2010/01/12 dadams ;; icicle-insert-thesaurus-entry-cand-fn, icicle-marker+text, ;; icicle-search-(bookmark|region)-action, icicle-char-properties-in-buffer, ;; icicle-search-char-property-scan: ;; save-excursion + set-buffer -> with-current-buffer (+ save-excursion). ;; icicle-search-regexp-scan: set-buffer -> with-current-buffer. ;; 2009/12/13 dadams ;; icicle-Info-read-node-name: Bind C-x m to icicle-bookmark-info-other-window. ;; 2009/11/24 dadams ;; icicle-read-color: Copy the prompt string, so *-color-completion-setup can put props. ;; 2009/11/22 dadams ;; icicle-frame-(bg|fg): Don't apply *-make-color-candidate to named-colors (done already). ;; 2009/11/03 dadams ;; icicle-frame-(bg|fg): Use named-colors, not x-defined-colors. ;; icicle-read-color: No need to bind icicle-transform-function, since we use hexrgb.el. ;; 2009/09/05 dadams ;; icicle-search-replace-all-search-hits: ;; Bind to nil: icicle-minibuffer-message-ok-p, icicle-help-in-mode-line-flag. ;; icicle-search-action-1: Add condition-case to ignore disappearance of *Completions* win. ;; icicle-search-highlight-and-maybe-replace: ;; Apply renaming of icicle-acting-on-next/prev (no -p). ;; Use length of *-completion-candidates, not mct. ;; Fix assignment of new candidate nb, and for both directions. ;; Bind icicle-minibuffer-message-ok-p to inhibit no-candidates msg. ;; Wrap around to first only if not icicle-acting-on-next/prev. ;; 2009/09/02 dadams ;; icicle-exchange-point-and-mark: Respect icicle-region-bookmarks-flag. ;; 2009/08/29 dadams ;; Added: icicle-define-search-bookmark-command, ;; icicle-search(-region|-info|-gnus|-w3m|(-non|-local|-remote)-file)-bookmark, ;; icicle-search-bookmark-action. ;; Moved (and redefined) to icicles-cmd1.el: icicle-select-bookmarked-region. ;; (lambda...) -> #'(lambda...). ;; 2009/08/25 dadams ;; Added icicle-select-bookmarked-region. ;; icicle-exchange-point-and-mark: ;; If bookmark+ is loaded, use region bookmarks. ;; Raise error if try to save inactive region or try to select with no saved regions. ;; 2009/08/11 dadams ;; Added: icicle-search-replace-all-search-hits. ;; Renamed: icicle-search-replace-candidate to icicle-search-replace-cand-in-alist. ;; Added: icicle-search-replace-cand-in-mct (not used, for now). ;; icicle-search: ;; Bind icicle-all-candidates-list-alt-action-fn to icicle-search-replace-all-search-hits. ;; Bind replace-count to 0. Bind icicle-current-input to empty string. ;; Updated doc string. ;; icicle-search-replace-search-hit: ;; Do not bind icicle-completion-candidates, icicle-candidate-nb, icicle-last-input. ;; No lack-of-current-candidate error if icicle-all-candidates-action-p. ;; Added: icicle-search-action-1 (factored out from icicle-search-action. ;; icicle-search-action, icicle-search-help: ;; Bind icicle-whole-candidate-as-text-prop-p to nil, to force use of alist. ;; icicle-search-action(-1): Do not bind icicle-candidate-nb, so don't save and restore it. ;; icicle-search-in-context-default-fn: If replacement tried, then update the dialog state. ;; icicle-search-highlight-and-maybe-replace: REWRITE. ;; Msg if string to be replaced is not found in candidate. ;; Swap order: Don't search unless first time (or replacing all). ;; icicle-search-replace-candidate -> icicle-search-replace-cand-in-alist. ;; If replacement done, then: Update alist, minibuffer-completion-table, and ;; minibuffer content. Change candidate nb if navigating next/prev. Complete again. ;; Return indication of whether we tried to replace something. ;; icicle-search-replace-cand-in-alist: Added catch, to skip whole list traversal. ;; Moved byte-compile quieting defvars to top level. Added one for tooltip-mode. ;; 2009/07/20 dadams ;; icicle-font: Ensure no nil elements in COLLECTION arg to completing-read, for Emacs 22+. ;; 2009/06/07 dadams ;; icicle-get-alist-candidate -> funcall icicle-get-alist-candidate-function. ;; Added: icicle-purge-bad-file-regions. ;; icicle-add-region, icicle-(select|search)-region-action: ;; Special-case Info buffers. Thx to Thierry Volpiatto. ;; 2009/05/28 dadams ;; Bind icicle-search-replacement to nil. (Somehow forgot when moved to icicle-explore.) ;; icicle-search-replace-search-hit: Raise an error if icicle-candidate-nb is nil. ;; 2009/05/26 dadams ;; icicle-compilation-search: Use value 'until-move for next-error-highlight. ;; 2009/05/22 dadams ;; Added: icicle-Info-virtual-book. ;; Require icicles-mac.el if load-library doesn't find it. ;; icicle-search: Set icicle-search-final-choice to result. ;; Created - Split off from icicles-cmd.el. ;;;(@* "CHANGE LOG FOR `icicles-face.el'") ;; ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/01/18 dadams ;; Removed: icicle-increment-color-(hue|saturation|value) - moved to hexrgb.el and modified. ;; icicle-search-context-level-*: Use hexrgb-increment-*, with past increment divided by 100. ;; 2012/11/04 dadams ;; icicle-annotation: Fix default value for older Emacs versions. ;; 2012/10/27 dadams ;; Added icicle-annotation. ;; 2012/07/07 dadams ;; Added: icicle-historical-candidate-other (used only for icicle-Info-index so far). ;; 2012/03/29 dadams ;; Removed autoload cookies: hexrgb require, defs of *-increment-*, and *-search-context-level-*. ;; 2012/03/28 dadams ;; Soft-require hexrgb.el at autoload generation-time and load-time. Removed eval-when-compile. ;; Moved *-increment-* function defs from *-face-after-load-hexrgb to (when (featurep 'hexrgb)...), ;; and add autoload cookie for that. ;; Removed: icicle-byte-compile-eval-after-load-flag, icicle-maybe-byte-compile-after-load, ;; icicle-face-after-load-hexrgb. ;; Use (when (featurep 'hexrgb)...) instead of (defun icicle-face-after-load-hexrgb...) as wrapper. ;; Removed calls to icicle-maybe-byte-compile-after-load. ;; Removed (eval-after-load "hexrgb" '(icicle-face-after-load-hexrgb)). ;; Removed autoload cookie with autoloads for icicle-increment-color-*. ;; Changed FILE arg in autoloads by removing .el, so .elc will be loaded if available. ;; 2012/03/25 dadams ;; Replace autoload cookies for *-increment-color-* by autoloads inside soft-require of hexrgb.el. ;; 2012/02/12 ;; Added def of icicle-byte-compile-eval-after-load-flag here too, so can load before icicles.el. ;; 2011/10/21 dadams ;; Added face: icicle-msg-emphasis. ;; 2011/10/10 dadams ;; Added: icicle-face-after-load-hexrgb. ;; Replaced bodies of eval-after-load sexps with call to icicle-face-after-load-hexrgb. ;; Added autoload cookies for icicle-increment-color-*. ;; Removed eval-when-compile to load icicles-mac. ;; Moved here (and to icicles-cmd2.el) from icicles-mac.el: icicle-maybe-byte-compile-after-load. ;; 2011/10/08 dadams ;; eval-when-compile icicles-mac.el. ;; 2011/08/16 dadams ;; Require icicles-mac.el. ;; icicle-maybe-byte-compile-after-load the eval-after-load definitions. ;; 2011/07/30 dadams ;; eval-after-load hexrgb.el, not runtime error if not feature, for all fns that use hexrgb.el. ;; Moved here from icicles-opt.el: icicle-increment-color-value. ;; icicle-search-context-level-*: Use fboundp icicle-increment-color-satur*, not featurep hexrgb. ;; Soft-require hexrgb.el when byte compile. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/05/05 dadams ;; icicle-mustmatch-completion: Changed line-width from 2 to -2. ;; 2010/04/08 dadams ;; Added autoload cookies. ;; 2010/03/13 dadams ;; Made icicle-candidate-part paler (light background): #EF84FFEAF427, not #DB17FFF4E581. ;; 2010/02/17 dadams ;; Moved functions here from icicles-opt.el: icicle-increment-color-(hue|saturation). ;; So no longer require icicles-opt.el. ;; 2009/04/18 dadams ;; Removed load-time warning about using Icicles in a text terminal. ;; 2009/04/12 dadams ;; Added: face icicle-mode-line-help. ;; 2009/01/13 dadams ;; Added: icicle-extra-candidate. ;; 2008/10/26 dadams ;; Added group: Icicles-Files. ;; 2008/03/29 dadams ;; Redefined and renamed faces for completion status indicators. ;; Renamed: icicle-completing-mustmatch-prompt-prefix to icicle-mustmatch-completion, ;; icicle-mode-lighter-highlight(-plus) to icicle(-multi-command)-completion. ;; Removed: icicle-completing-prompt-prefix, icicle-prompt-suffix. ;; 2008/03/09 dadams ;; Added: icicle-mode-lighter-highlight. ;; 2007/12/10 dadams ;; Added: icicle-input-completion-fail-lax. ;; 2007/11/18 dadams ;; Added: icicle-proxy-candidate. ;; icicle-special-candidate: No longer use a raised box. ;; 2007/10/22 dadams ;; icicle-special-candidate: Raised box. ;; 2007/08/19 dadams ;; Added: icicle-input-completion-fail. ;; 2007/06/21 dadams ;; Added: icicle-candidate-part. Changed definition of icicle-special-candidate. ;; 2007/06/17 dadams ;; Added: icicle-saved-candidate. ;; 2007/06/12 dadams ;; icicle-prompt-suffix: No box for dark background. ;; 2007/06/11 dadams ;; Better defaults for dark background frames. ;; 2007/06/07 dadams ;; Changed emacs-commentary-link to point to icicles-doc1.el and icicles-doc2.el. ;; 2007/05/22 dadams ;; Protected icicle-search-context-level-1 to *-8, in case hexrgb is not loaded. ;; 2007/04/20 dadams ;; Added: icicle-search-context-level-1 through *-8. ;; Require icicles-opt.el. ;; 2006/12/22 dadams ;; Renamed group icicles to Icicles. ;; Added Icicles subgroups, and assigned them instead of group Icicles: ;; -Buffers, -Completions-Display, -Key-Bindings, -Key-Completion, -Matching, ;; -Minibuffer-Display, -Miscellaneous, -Searching. ;; 2006/11/06 dadams ;; icicle-search-highlight-all-flag -> icicle-search-highlight-threshold (integer) ;; 2006/10/16 dadams ;; icicle-special-candidate: changed background from Pink to #DB17FFF4E581. ;; 2006/10/04 dadams ;; Added: icicle-special-candidate. ;; 2006/08/13 dadams ;; Added: icicle-completing-prompt-prefix. ;; 2006/07/16 dadams ;; Added dark-background face suggestions from Le Wang - thx. ;; 2006/06/30 dadams ;; Added: minibuffer-prompt for Emacs < 22 (e.g. Emacs 21.4 has propertize). ;; 2006/04/28 dadams ;; Added: icicle-whitespace-highlight. ;; 2006/04/14 dadams ;; Renamed icicle-search-refined-regexp to icicle-search-current-input. ;; 2006/04/07 dadams ;; Added: icicle-search-main-regexp-others. ;; Renamed: icicle-search-main-regexp to icicle-search-main-regexp-current. ;; 2006/03/27 dadams ;; Added: icicle-search-*-regexp. ;; 2006/03/22 dadams ;; Renamed: icicle-root-highlight-* to icicle-match-highlight-*. ;; 2006/03/21 dadams ;; Added: icicle-common-match-highlight-Completions. ;; icicle-root-highlight-Completions: Changed default face. ;; 2006/03/08 dadams ;; Added: icicle-current-candidate-highlight. ;;;(@* "CHANGE LOG FOR `icicles-fn.el'") ;; ;; 2013/04/22 dadams ;; icicle-read-buffer: Pass all args to read-buffer-function funcall. Thx to Nick Alcock. ;; 2013/04/08 dadams ;; icicle-choose-completion-string: Added versions for Emacs 23.1 and 23.2+. ;; 2013/04/06 dadams ;; icicle-completing-p: ;; Bug fix for Emacs > 24.3. Test minibuffer-completing-file-name, not filename keymaps. ;; 2013/03/11 dadams ;; icicle-try-switch-buffer: If BUFFER is already current, do nothing, to prevent hooks kicking in. ;; 2013/03/07 dadams ;; Updated to use icicle-user-error where appropriate. ;; 2013/03/05 dadams ;; Added: icicle-defaults-at-point. ;; 2013/02/28 dadams ;; eval-after-load crm: Use fset, not defalias. Thx to Michael Heerdegen. ;; 2013/02/26 dadams ;; icicle-(prefix|apropos)-any(-file-name)-candidates-p: ;; Fix for use with Icomplete - take icicle-must-pass-after-match-predicate into account. ;; 2013/02/12 dadams ;; Typo fix: minibuffer-default--* -> minibuffer-default-*. Thx to Christopher Schmidt. ;; 2013/02/10 dadams ;; icicle-bounds-of-thing-at-point: Use SYNTAX-TABLE arg only if it is a syntax table. ;; 2013/02/06 dadams ;; icicle-unpropertize-completion: Added rear-nonsticky. Thx to Christopher Schmidt. ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/02/03 dadams ;; Moved to icicles-mcmd.el: icicle-isearch-complete-past-string. ;; 2012/12/31 dadams ;; icicle-next-candidate: Set icicle-mode-line-help. Do not call icicle-show-help-in-mode-line. ;; icicle-insert-cand-in-minibuffer: ;; Ignore errors in put-text-property. If retrieve singleton cand set, it is read-only (why?). ;; icicle-insert-candidates: Corrected '(face 'icicle-annotation) to '(face icicle-annotation). ;; 2012/12/28 dadams ;; icicle-add-default-to-prompt: Handle nil DEFAULT. Thx to Michael Heerdegen. ;; 2012/12/22 dadams ;; Added: icicle-add-default-to-prompt. ;; icicle-completing-read, icicle-read-string: Use icicle-add-default-to-prompt. ;; 2012/12/21 dadams ;; icicle-unsorted(-file-name)-(prefix|apropos)-candidates: ;; Compute common match in all cases except i-e-i-t-c-m = 0, and set *-common-match-string to it. ;; icicle-save-or-restore-input: ;; Removed test for icicle-expand-input-to-common-match level: expand for all levels. ;; 2012/12/14 dadams ;; Added: icicle-multi-comp-apropos-complete-match. ;; 2012/12/12 dadams ;; icicle-expanded-common-match-1: ;; Use string-match, not icicle-apropos-complete-match-fn, except for first condition (and). ;; icicle-insert-candidates: Wrap funcall of annotation fn with condition-case, just in case. ;; 2012/12/10 dadams ;; icicle-read-file-name-default: Protect minibuffer-local-filename-syntax with boundp. ;; 2012/12/06 dadams ;; Moved minibuffer-with-setup-hook here from icicles-mac.el (and removed eval-when-compile). ;; icicle-read-shell-command, icicle-dired-read-shell-command: ;; Use minibuffer-with-setup-hook unconditionally, since provided here unconditionally. ;; 2012/12/05 dadams ;; icicle-completing-read: Remove HINT before adding it our way. Thx to Christopher Schmidt. ;; 2012/12/02 dadams ;; Added: icicle-read-file-name-default, icicle-ORIG-read-file-name-default. ;; 2012/11/27 dadams ;; icicle-completing-read: ;; For icicle-default-value = t: Append ": " to icicle-default-in-prompt-format-function result. ;; 2012/11/26 dadams ;; icicle-completing-read: Use new option icicle-default-in-prompt-format-function. ;; 2012/11/21 dadams ;; icicle-completing-read: Commented out removing dir part of icicle-default-value in prompt. ;; 2012/11/17 dadams ;; icicle-completing-read: ;; When (eq icicle-default-value t) add DEF to PROMPT. Thx to Michael Heerdegen. ;; 2012/11/10 dadams ;; icicle-custom-type: icicle-get-safe -> get. ;; icicle-fuzzy-candidates: Show all (not no) candidates for empty input, sorted alphabetically. ;; 2012/11/08 dadams ;; Added: icicle-get-safe. ;; icicle-completion-setup-function, icicle-var-(is-of|matches|inherits)-type-p, ;; icicle-var-val-satisfies-type-p, icicle-custom-type, icicle-fit-completions-window, ;; icicle-next-candidate, icicle-recompute-candidates, icicle-save-or-restore-input, ;; icicle-highlight-input-noncompletion: ;; Use icicle-get-safe. ;; 2012/11/07 dadams ;; icicle-read-char-by-name, icicle-read-from-minibuffer: char-to-string -> string. ;; icicle-scatter: Non-backtracking version. ;; 2012/10/27 dadams ;; Added: icicle-member-ignore-case. ;; icicle-insert-candidates: ;; Insert annotation only if icicle-show-annotations-flag. Highlight w/ face icicle-annotation. ;; 2012/10/24 dadams ;; icicle-completion--embedded-envvar-table: Return 0 as the first boundary. Thx to M. Heerdegen. ;; 2012/10/22 dadams ;; icicle-display-candidates-in-Completions: Check Info topic first in icicle-Info-index-cache. ;; icicle-Info-node-is-indexed-by-topic: ;; Return triplet: (TOPIC NODE FILE). Cache triplet in icicle-Info-index-cache (new). ;; 2012/10/21 dadams ;; icicle-take: Use a simpler definition. ;; 2012/10/20 dadams ;; icicle-completion--embedded-envvar-table: Added more of vanilla code. Thx to Michael Heerdegen. ;; 2012/10/18 dadams ;; icicle-read-file-name, icicle-read-number, icicle-read-char-exclusive, ;; icicle-read-string-completing, icicle-read-face-name: ;; Do not augment icicle-proxy-candidates if icicle-exclude-default-proxies is non-nil. ;; For all of them except icicle-read-face-name (already done): Augment, do not just replace. ;; 2012/10/17 dadams ;; icicle-display-candidates-in-Completions: ;; For *Completions* mode line: treat nil icicle-apropos-complete-match-fn like apropos. ;; 2012/10/15 dadams ;; icicle-(highlight|clear)-lighter: Use || to indicate multi-completion. ;; 2012/10/10 dadams ;; icicle-display-candidates-in-Completions: ;; Add lighter and completion mode to *Completions* mode line. ;; icicle-(prefix|apropos)-candidates: ;; Call *-maybe-sort-maybe-truncate even if *-sort-comparer is nil. Needed for truncation. ;; icicle-maybe-sort-maybe-truncate: ;; Handle new icicle-max-candidates value of RESET, from icicle-doremi-increment-max-candidates+ ;; 2012/10/09 dadams ;; icicle-read-face-name: Bind icicle-multi-completing-p to t. ;; 2012/10/05 dadams ;; icicle-next-candidate: Removed setting of icicle-default-directory (unused). ;; 2012/10/02 dadams ;; icicle-file-name-(non)directory, icicle-input-from-minibuffer: ;; string-to-list -> append the string to (), ;; Because Emacs 24 now breaks older byte-compiled code, since it removed string-to-sequence. ;; 2012/10/01 dadams ;; icicle-file-name-(non)directory, icicle-input-from-minibuffer: ;; Rewrote to be more robust: do not hard-code ^G as the REPL-CHAR. Use a char not in string. ;; 2012/09/25 dadams ;; icicle-input-from-minibuffer, icicle-minibuf-input-sans-dir, ;; icicle-highlight-input-noncompletion: ;; Handle the icicle-abs-file-candidates case also - same as the icicle-file-name-input-p case. ;; 2012/09/24 dadams ;; Added: icicle-last-accessed-first-p. ;; icicle-read-shell-command-completing: Pass non-nil NO-ERROR-P arg to icicle-describe-file. ;; icicle-file-type-less-p, icicle-dirs-(first|last)-p, icicle-last-modified-first-p: ;; Use file comparison also if icicle-abs-file-candidates. ;; 2012/09/17 dadams ;; icicle-insert-candidates: ;; Add an extra newline after multi-line candidates only, not after all cands if ANY-MULTILINE-P. ;; 2012/09/08 dadams ;; Added: icicle-read-buffer, icicle-ORIG-read-buffer. ;; icicle-unsorted-(prefix|apropos)-candidates: ;; Use buffer-name alist, if not ignoring space prefix and not internal-complete-buffer. ;; Ensure icicle-buffer-name-input-p to pass icicle-buffer-ignore-space-prefix-flag arg. ;; icicle-unsorted-file-name-(prefix|apropos)-candidates, ;; icicle-apropos-any-file-name-candidates-p: ;; Do not pass icicle-ignore-space-prefix-flag arg to icicle-all-completions. ;; icicle-display-Completions, icicle-apropos-any-candidates-p: ;; Ensure icicle-buffer-name-input-p to pass icicle-buffer-ignore-space-prefix-flag arg. ;; 2012/09/06 dadams ;; Added icicle-string-match-p. Use it. ;; 2012/08/31 dadams ;; icicle-read-from-minibuffer: Improved doc string. ;; 2012/08/28 dadams ;; icicle-read-number: Allow for DEFAULT to be a cons with nil elements. Thx to C. Schmidt. ;; 2012/08/18 dadams ;; Added: icicle-bounds-of-thing-at-point. ;; thing-at-point -> icicle-thing-at-point, everywhere. ;; 2012/08/13 dadams ;; icicle-completing-read-multiple: Doc string improvement. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-choose-completion-string, icicle-ORIG-completing-read, ;; icicle-ORIG-completing-read-multiple, icicle-ORIG-completion-setup-function, ;; icicle-ORIG-dired-smart-shell-command, icicle-ORIG-display-completion-list, ;; icicle-ORIG-face-valid-attribute-values, icicle-ORIG-minibuffer-default-add-completions, ;; icicle-ORIG-read-char-by-name, icicle-ORIG-read-face-name, ;; icicle-ORIG-read-from-minibuffer, icicle-ORIG-read-number, ;; icicle-ORIG-read-string, icicle-ORIG-shell-command, icicle-ORIG-shell-command-on-region, ;; icicle-ORIG-crm-local-completion-map, icicle-ORIG-crm-local-must-match-map. ;; icicle-read-file-name-1: Applied renaming: new name icicle-orig-read-file-name-fn. ;; 2012/07/21 dadams ;; icicle-show-help-in-mode-line: ;; Allow value of property icicle-mode-line-help to be a function. ;; For a file-name candidate, call icicle-help-line-buffer with NO-FILE-P. ;; icicle-help-line-buffer: Added optional arg NO-FILE-P. Include file name, if any. ;; 2012/07/19 dadams ;; icicle-insert-candidates: Fix change from 7/18: ensure icicle-last-completion is non-nil. ;; 2012/07/18 dadams ;; icicle-insert-candidates: Handle annotations. ;; 2012/07/17 dadams ;; icicle-read-char-by-name: Show char and its code point in mode line when cycle. ;; 2012/07/07 dadams ;; Added: icicle-Info-node-is-indexed-by-topic. ;; icicle-display-candidates-in-Completions: ;; Added highlighting of topics pointing to visited Info nodes, for icicle-Info-index. ;; Call icicle-transform-multi-completion on file-name cand for historical-cand highlighting. ;; File-name completion fixes (thx to Michael Heerdegen): ;; Added: icicle-completion--embedded-envvar-table. ;; icicle-unsorted-file-name-prefix-candidates: ;; Use substitute-in-file-name on arg INPUT. ;; For Emacs 24+, bind minibuffer-completion-table to icicle-file-name-completion-table. ;; icicle-insert-cand-in-minibuffer: Removed insert-default-directory from AND as condition. ;; icicle-save-or-restore-input: ;; Removed insert-default-directory from COMMON condition for file-name completion. ;; Pass (NOT INSERT-DEFAULT-DIRECTORY) as 3rd arg to icicle-abbreviate-or-expand-file-name. ;; icicle-abbreviate-or-expand-file-name: Added optional arg DONT-ADD-DEFAULT-DIR-P. ;; Removed #' from lambdas. ;; 2012/06/25 dadams ;; Corrected change of 5/13: Removed call to file-name-as-directory. ;; icicle-alt-act-fn-for-type: Removed backquoting from lambda, since it uses a macro in *-mac.el. ;; 2012/06/24 dadams ;; icicle-read-shell-command-completing: ;; Use shell-command-to-string in *Help* explicitly, not just shell-command. ;; Thx to Christopher Schmidt & Michael Heerdegen. ;; icicle-help-line-(buffer|file): Handle fixnum overflow if buffer or file is too big. ;; icicle-insert-candidates: Remove extra newline at eob when vertical format. ;; 2012/06/21 dadams ;; icicle-prefix-any-file-name-candidates-p: updated for Emacs 23+ (file-name PRED). ;; 2012/06/18 dadams ;; icicle-help-line-buffer: Use format-mode-line if available. ;; 2012/06/09 dadams ;; icicle-display-candidates-in-Completions, icicle-highlight-initial-whitespace: ;; Use point-max if 1+ point is greater. ;; icicle-display-completion-list: ;; Insert help string only if there are completions. ;; Show text "There are no possible..." anyway, even if the show flag is nil. ;; icicle-expand-file-name-20: Move forward-line only if the show flag is non-nil - else no-op. ;; 2012/05/22 dadams ;; icicle-file-remote-p: Aligned with bmkp-file-remote-p - removed ffap; added final string-match. ;; icicle-show-help-in-mode-line, icicle-quote-file-name-part-of-cmd: ;; Test with icicle-file-remote-p before file-exists-p, to avoid Tramp. Thx to Michael Albinus. ;; 2012/05/13 dadams ;; icicle-completion-setup-function (all Emacs versions): ;; Corrected what becomes default-directory: Use substitute-in-file-name, to expand env vars. ;; Use expand-file-name and file-name-as-directory. ;; 2012/04/30 dadams ;; icicle-unsorted-file-name-prefix-candidates: ;; Forgot to use PRED, not default-directory, in second call to try-completion. ;; 2012/04/23 dadams ;; icicle-files-within(-1): If Dired+ available, use diredp-files-within(-1). ;; Moved to dired+.el (and renamed prefix): icicle-directories-within. ;; 2012/04/20 dadams ;; Added: icicle-directories-within (not yet used). ;; icicle-files-within: Added args INCLUDE-DIRS-P, PREDICATE. Remove killed Dired buffers. ;; 2012/04/13 dadams ;; icicle-files-within-1: Allow FILE-LIST to be a function. *-within: Updated doc accordingly. ;; 2012/04/08 dadams ;; icicle-minibuffer-default-add-dired-shell-commands: Make autoload cookie load icicles[.el]. ;; 2012/03/30 dadams ;; icicle-join-nth-parts: ;; Handle a singleton PARTS normally, according to icicle-list-use-nth-parts - do not just ;; return the CAND. If PARTS is nil, return "". ;; 2012/03/16 dadams ;; icicle-display-candidates-in-Completions: ;; Show thumbnails for image-file bookmarks also (see Bookmark+). ;; Call remove-images to remove left-over image overlays (bug fix). ;; icicle-unpropertize-completion: Removed icicle-keep-newline (no longer used). ;; 2012/02/29 dadams ;; icicle-set-difference. Added optional KEY arg. ;; 2012/02/22 dadams ;; icicle-read-char-by-name: Updated per Juri's Emacs 24 patch (see Emacs bug #10857). ;; 2012/02/18 dadams ;; icicle-show-help-in-mode-line: Use property help-echo if icicle-mode-line-help is nil. ;; 2012/02/11 dadams ;; icicle-display-candidates-in-Completions: ;; Always highlight expanded common match now, not just when prefix or *-expand-input is non-nil. ;; icicle-unsorted(-file-name)-(prefix|apropos)-candidates: ;; Set icicle-common-match-string to expansion only if expanding (prefix: 3 or 4, apropos: 4). ;; icicle-save-or-restore-input: ;; Do not save if apropos and not 4 or prefix and not 3 or 4. (Before: checked only for apropos.) ;; icicle-remove-duplicates: ;; Do not use hash table for Emacs 20, even if cl.el loaded, so can byte-compile and use later. ;; 2012/02/08 dadams ;; icicle-remove-duplicates: Redefined to use a hash table. ;; icicle-remove-dups-if-extras: Call icicle-remove-duplicates (not inlined). ;; 2012/02/02 dadams ;; icicle-fuzzy-candidates: Use (min (length input) icicle-swank-prefix-length), not just the var. ;; 2012/01/20 dadams ;; icicle-call-then-update-Completions: Do the sit-for even if only one candidate. ;; 2012/01/17 dadams ;; icicle-insert-candidates: ;; Put mouse-face on final \n also. No longer use property icicle-keep-newline. ;; No longer treat single-newline candidate specially. Thx to Michael Heerdegen. ;; icicle-file-remote-p: Respect new var icicle-network-drive-means-remote-flag: nil means local. ;; icicle-call-then-update-Completions: Corrected logic for triggering re-complete. ;; In particular, REMOTE-TEST = file-remote-p prevents, rather than causes, re-completion. ;; icicle-ms-windows-NET-USE: Corrected hash-table support test: fboundp puthash, not hash-table-p. ;; icicle-choose-completion-string: let -> let* (typo). ;; 2012/01/14 dadams ;; Added: icicle-char-cands-from-charlist, icicle-read-char-maybe-completing, icicle-ucs-names. ;; icicle-read-char-by-name: Added optional arg NAMES. Use icicle-ucs-names, not ucs-names. ;; 2011/12/31 dadams ;; Reversed fix of 2011/04/12 for Emacs < 23: ;; icicle-unsorted-file-name-*, icicle-apropos-any-file-name-candidates-p: ;; Use default-directory, not minibuffer-completion-predicate, for Emacs < 23. ;; 2011/12/28 dadams ;; Removed mention of obsolete option icicle-cycle-into-subdirs-flag. ;; 2011/12/24 dadams ;; icicle-insert-candidates: ;; When only one column, set window width to column width. ;; Use option icicle-Completions-max-columns. ;; icicle-fit-completions-window: Clarify doc string. ;; 2011/12/15 dadams ;; icicle-display-candidates-in-Completions: ;; For face icicle-historical-candidate, expand file names before comparing. ;; 2011/12/06 dadams ;; icicle-read-from-minibuffer: Do not add default value to prompt. ;; 2011/10/21 dadams ;; Added: icicle-propertize. ;; Renamed: icicle-unpropertize to icicle-unpropertize-completion. Applied renaming everywhere. ;; icicle-display-candidates-in-Completions, icicle-kill-a-buffer: Use icicle-propertize. ;; 2011/10/09 dadams ;; Moved here from icicles-mac.el: icicle-try-switch-buffer, select-frame-set-input-focus. ;; Copied here from icicles-mac.el: icicle-assoc-delete-all. ;; Removed autoload cookie for icicle-maybe-cached-action. ;; 2011/10/08 dadams ;; Added: icicle-delete-alist-dups. ;; icicle-completing-read-history: ;; Use prin1, not princ, to convert to strings. Thx to Michael Heerdegen. ;; icicle-key-description: Added PREFIX arg. Use Emacs 22+ form of key-description if available. ;; Changed arg NO-ANGLES to ANGLES. ;; icicle-read-char-by-name: Do not remove VARIATION* names (Unicode). ;; 2011/10/05 dadams ;; icicle-display-candidates-in-Completions: ;; Use same font family, not same font, as orig buff. Only for Emacs 23+, and only when ;; icicle-pre-minibuffer-buffer is defined. Removed dedicated-p condition. Removed zoom-out. ;; 2011/10/02 dadams ;; Added: icicle-read-char-by-name. ;; icicle-display-candidates-in-Completions: Give *Completions* the same font as starting buffer. ;; 2011/09/14 dadams ;; Added: icicle-some. ;; Moved here from icicles-cmd2.el: icicle-flat-list (but no longer used). ;; 2011/09/05 dadams ;; icicle-display-candidates-in-Completions: Act on new option icicle-hide-non-matching-lines-flag. ;; 2011/09/02 dadams ;; Added: icicle-delete-dups. ;; icicle-display-candidates-in-Completions: Don't highlight an empty match. ;; icicle-insert-candidates: ;; If only one column then colwidth should not be more than max-cand-len. ;; If whole cand is a single \n then do not treat it as the last \n (do not remove mouse-face). ;; 2011/08/27 dadams ;; icicle-recentf-make-menu-items, icicle-display-candidates-in-Completions, ;; icicle-command-abbrev-save, icicle-kill-a-buffer: ;; Use icicle-condition-case-no-debug instead of condition-case. Thx to Michael Heerdegen. ;; 2011/08/26 dadams ;; icicle-place-cursor: Put cursor at eob if get invalid-regexp error. ;; icicle-get-candidates-from-saved-set: Use %s, not %S, in error format string. ;; 2011/08/15 dadams ;; icicle-display-completion-list: Do not call (last ...) if COMPLETIONS is null. ;; Added: icicle-all-completions. ;; Use icicle-all-completions, not all-completions, wherever a 4th arg is passed. ;; 2011/08/12 dadams ;; icicle-completing-p: Handle cases of filename must-match maps. ;; icicle-file-name-input-p: Improved doc string. ;; 2011/08/09 dadams ;; Added: icicle-replace-mct-cand-in-mct. ;; 2011/08/07 dadams ;; icicle-display-candidates-in-Completions, ;; icicle-highlight-(initial-whitespace|complete-input|lighter), icicle-case-string-less-p, ;; icicle-expanded-common-match-1, icicle-insert-cand-in-minibuffer, icicle-place-cursor, ;; icicle-(special|extra)-candidates-first-p: Handle absolute file names too: ;; (icicle-file-name-input-p) -> (or (icicle-file-name-input-p) icicle-abs-file-candidates) ;; icicle-display-candidates-in-Completions:: icicle-transform-multi-completion for image-file. ;; 2011/08/03 dadams ;; icicle-lisp-vanilla-completing-read: ;; Handle recent Emacs 24 changes: make-compose-keymap etc. Thx to Stefan Monnier. ;; 2011/07/30 dadams ;; Moved to icicles-cmd2.el and wrapped in eval-after-load hexrgb: ;; icicle-color-*-lessp (except -rgb-), icicle-color-completion-setup, icicle-color-help, ;; icicle-make-color-candidate. ;; 2011/07/27 dadams ;; Use icicle-completions-format everywhere, not icicle-completions-format-internal (removed). ;; icicle-nb-of-cand-in-Completions-horiz: Bind icicle-completions-format to horizontal, not nil. ;; 2011/07/26 dadams ;; icicle-insert-candidates: Vertical multiline: add only one newline, not two. Use \' not $. ;; Removed: icicle-list-end-string (no longer needed). ;; Thx to Michael Heerdegen. ;; 2011/07/20 dadams ;; icicle-mctized-full-candidate: Don't change icicle-completions-format-internal to horizontal. ;; icicle-insert-candidates: If any candidate is multiline then use only one column. ;; Thx to Michael Heerdegen. ;; 2011/07/06 dadams ;; icicle-fit-completions-window: ;; Emacs 22/23 fix: do not call fit-window-to-buffer. Thx to Michael Heerdegen. ;; icicle-read-face-name: Added version for Emacs 24+. ;; 2011/06/05 dadams ;; icicle-unsorted(-file-name)-prefix-candidates, icicle-prefix-any(-file-name)-candidates-p: ;; Add METADATA arg to icicle-completion-(try|all)-completion(s) calls. ;; 2011/06/03 dadams ;; icicle-completion-(all|try)-completion(s): ;; Added optional METADATA arg to handle Emacs 24's new METADATA arg. ;; Replace icicle-help-in-mode-line-flag by icicle-help-in-mode-line-delay everywhere. ;; icicle-show-in-mode-line: Use icicle-help-in-mode-line-delay, not hard-coded 10 sec. ;; 2011/05/31 dadams ;; icicle-read-file-name: Reordered let bindings (cosmetic). ;; 2011/05/22 dadams ;; Added defvars for free vars to quiet byte compiler. ;; 2011/05/12 dadams ;; icicle-candidate-short-help: Do nothing if string is empty (""). ;; 2011/05/07 dadams ;; icicle-insert-cand-in-minibuffer: Go to prompt end before insert. ;; 2011/05/04 dadams ;; icicle-transform-multi-completion: If cand is "" just return it. (Emacs 20 split-string bug.) ;; 2011/05/03 dadams ;; Added: icicle-position, icicle-merge-saved-order-less-p. ;; icicle-display-candidates-in-Completions: Respect icicle-highlight-saved-candidates-flag. ;; 2011/04/20 dadams ;; icicle-completion-setup-function: Last version is for Emacs 23.3 also. Thx to Michael Heerdegen. ;; 2011/04/18 dadams ;; icicle-face-valid-attribute-values: Added Emacs 23+ version. Thx to Aankhen. ;; 2011/04/12 dadams ;; Added defvars for icicle-dirs-done and icicle-files, for free vars. ;; Bind *-files in icicle-dired-read-shell-command. Bind *-dirs-done in icicle-files-within. ;; Use *-files in icicle-*-add-dired-*. Use *-dirs-done in icicle-files-within-1. ;; icicle-color-completion-setup: Renamed (free elsewhere): named-colors -> icicle-named-colors. ;; Applied renaming: prompt -> icicle-prompt. ;; icicle-unsorted-file-name-prefix-candidates, icicle-unsorted-file-name-apropos-candidates, ;; icicle-apropos-any-file-name-candidates-p: ;; Use minibuffer-completion-predicate, not default-directory, in calls to all-completions. ;; Thx to Michael Heerdegen. ;; 2011/03/31 dadams ;; icicle-read-file-name, icicle-read-number, icicle-read-char-exclusive, ;; icicle-read-string-completing, icicle-color-completion-setup: ;; Wrap calls to icicle-var-is-of-type-p with condition-case. Thx to Michael Heerdegen. ;; 2011/03/29 dadams ;; icicle-show-help-in-mode-line: Removed boundp condition for icicle-completing-keys-p. ;; icicle-scroll-or-update-Completions: ;; Applied renaming: icicle-scroll-Completions to icicle-scroll-Completions-forward. ;; icicle-color-completion-setup: prompt -> icicle-prompt. ;; icicle-alt-act-fn-for-type: orig-window -> icicle-orig-window. ;; 2011/03/26 dadams ;; icicle-read-face-name: Need copy-sequence for prompt in later Emacs versions also (forgot). ;; 2011/03/17 dadams ;; icicle-display-candidates-in-Completions: Added 2-pixel margin around thumbnail image. ;; 2011/03/04 dadams ;; icicle-read-file-name: Bind read-file-name-predicate. Thx to Michael Heerdegen. ;; icicle-alt-act-fn-for-type: Ensure orig-window is live before use it. Thx to Michael Heerdegen. ;; 2011/02/22 dadams ;; icicle-display-candidates-in-Completions: Show thumbnail for an image file. ;; Call icicle-fit-completions-window explicitly here. ;; icicle-fit-completions-window: Added optional arg (not used yet). Ensure window is Completions. ;; 2011/02/20 dadams ;; Added: icicle-color-(distance)-(hsv|rgb)-lessp. ;; icicle-color-completion-setup: Added sort orders for HSV and RGB: component order and distance. ;; 2011/02/17 dadams ;; icicle-join-nth-parts: If only one part then don't append the join string. ;; 2011/01/31 dadams ;; icicle-insert-candidates: Fixed test for remainder cands: (= n (* r c)), not (= 0 (mod n r)). ;; 2011/01/11 dadams ;; icicle-choose-completion-string: ;; Removed code that uses base-size, choose-completion-delete-max-match. Just replace all input. ;; 2011/01/05 dadams ;; Added: icicle-file-type-less-p. ;; icicle-highlight-input-noncompletion: When move overlay, specify buffer (for recursive minibuf). ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/23 dadams ;; icicle-expand-file-name-20: Allow for inputs to be nil. ;; 2010/12/18 dadams ;; Moved icicle-assoc-delete-all to icicles-mac.el, since used there. ;; Added autoload cookies for cmds & macro; removed them from non-interactive functions. ;; 2010/12/14 dadams ;; Added: icicle-expand-file-name-20. ;; Renamed: icicle-expand-file-name to icicle-expand-file-or-dir-name. ;; icicle-abbreviate-or-expand-file-name, icicle-expand-file-or-dir-name: ;; Use icicle-expand-file-name-20. ;; icicle-completion-setup-function for Emacs < 22: Fix typo: last-command -> this-command. ;; icicle-expanded-common-match: Removed from doc string: statement that result is regexp-quoted. ;; 2010/12/11 dadams ;; icicle-completion-setup-function: Added a version for Emacs 23.2+. Thx to Michael Heerdegen. ;; 2010/11/20 dadams ;; icicle-toggle-icicle-mode-twice: Soft-require icicles-mode.el. ;; eval-after-load for crm.el: ;; Put toggle-twice on eval-after-load of icicles-mode, instead of doing it if i-m.el is loaded. ;; 2010/11/07 dadams ;; Added helper macro icicle-maybe-cached-action. ;; icicle-alt-act-fn-for-type: use icicle-maybe-cached-action so use same action for all cands. ;; 2010/11/06 dadams ;; icicle-fuzzy-candidates: Filter using icicle-must-pass-after-match-predicate. ;; Respect also extra cands and proxy cands. ;; Let C-g exit completion. ;; 2010/10/25 dadams ;; icicle-read-shell-command-completing: ;; Use icicle-must-pass-after-match-predicate, not icicle-must-pass-predicate. ;; 2010/10/24 dadams ;; icicle-unsorted(-file-name)-(prefix|apropos)-candidates: ;; Respect icicle-must-pass-after-match-predicate. ;; icicle-alt-act-fn-for-type: Use icicle-must-pass-after-match-predicate, not PREDICATE arg. ;; 2010/10/07 dadams ;; Added: icicle-current-TAB-method (function). Use it in place of var everywhere. ;; 2010/10/04 dadams ;; directory-sep-char -> ?/ (It was removed from Emacs 24.) ;; 2010/06/18 dadams ;; icicle-completing-read: ;; Initialize icicle-completions-format-internal to icicle-completions-format. ;; icicle-mctized-full-candidate: ;; Set icicle-completions-format-internal to horizontal for multi-line multi-completions. ;; icicle-insert-candidates: ;; Remove face property from end of candidate to next column. ;; Replace icicle-completions-format by icicle-completions-format-internal. ;; Renamed: bookmarkp-* to bmkp-*. ;; 2010/06/14 dadams ;; icicle-read-from-minibuffer: ;; If add file-name default to prompt, remove dir part first. Thx to Chris Hecker. ;; icicle-next-candidate: Do not icicle-recompute-candidates if this command was repeated. ;; icicle-increment-cand-nb+signal-end: ;; Signal wrap from initial, not from 0. Negative INCR -> start at end. Thx to M. Heerdegen. ;; icicle-call-then-update-Completions: ;; Set icicle-last-input to nil so icicle-save-or-restore-input makes next-candidate recompute. ;; 2010/06/12 dadams ;; icicle-fit-completions-window: Let-bind window-min-height to prevent deletion in Emacs 23. ;; 2010/06/10 dadams ;; icicle-maybe-sort-and-strip-candidates: ;; Set icicle-completion-candidates to result of *maybe...maybe*. (It broke C-~.) ;; 2010/06/09 dadams ;; icicle-isearch-complete-past-string: Use the last-used ring. Thx to Michael Heerdegen. ;; 2010/06/08 dadams ;; icicle-display-candidates-in-Completions: Show also total when truncated: N shown / M. ;; icicle-maybe-sort-maybe-truncate: Save icicle-nb-candidates-before-truncation before truncating. ;; 2010/06/04 dadams ;; Added: icicle-clear-lighter, icicle-maybe-sort-maybe-truncate, icicle-take. ;; icicle-(prefix|apropos)-candidates, icicle-strip-ignored-files-and-sort, ;; icicle-maybe-sort-and-strip-candidates, icicle-display-Completions: ;; Use icicle-maybe-sort-maybe-truncate, not icicle-reversible-sort. ;; icicle-(un)highlight-lighter: Use icicle-clear-lighter (factored out). ;; 2010/05/30 dadams ;; Added: icicle-files-within-1. ;; icicle-files-within: ;; Use icicle-files-within-1. Optionally don't follow symlinks (new arg NO-SYMLINKS-P). ;; Don't process same dir twice. Respect icicle-ignored-directories. Thx to Michael Heerdegen. ;; 2010/05/18 dadams ;; icicle-save-or-restore-input: ;; Use icicle-file-directory-p, not file-directory-p (fails: ~/foo//usr/). Thx to M. Heerdegen. ;; 2010/05/04 dadams ;; icicle-alt-act-fn-for-type: Pass TYPE to icicle-apply-to-saved-candidate. ;; 2010/04/30 dadams ;; icicle(-file-name)-unsorted-(apropos|prefix)-candidates, icicle-fuzzy-candidates: ;; Set icicle-common-match-string to nil when no candidates. ;; 2010/04/29 dadams ;; icicle-unpropertize: Do nothing unless icicle-remove-icicles-props-p. ;; 2010/04/27 dadams ;; icicle-show-help-in-mode-line: Test value, not just boundp, of icicle-completing-keys-p. ;; 2010/04/21 dadams ;; icicle-mode-line-name-less-p: Removed bogus calls to symbol-name. Thx to Michael Heerdegen. ;; 2010/04/20 dadams ;; Added: icicle-dirs-first-p. ;; 2010/04/02/dadams ;; icicle-completing-p: Cache t, not the keymap portion. ;; 2010/03/16 dadams ;; icicle-display-candidates-in-Completions, treating icicle-candidate-properties-alist: ;; For subsequent matches of join string, skip over the last join string (not 1 char). ;; icicle-candidate-short-help: Treat each property individually. ;; 2010/03/13 dadams ;; icicle-reversible-sort: Respect icicle-transform-before-sort-p. ;; 2010/03/10 dadams ;; icicle-show-help-in-mode-line: ;; Put this test first: If candidate is a string with a help property, use that. ;; Use get-file-buffer, not get-buffer, for a visited file. ;; 2010/03/09 dadams ;; icicle-reversible-sort: Added optional KEY arg. Set LIST to sort result and return it. ;; icicle-multi-sort: Set RESULT to funcall result. ;; 2010/03/03 dadams ;; Added: icicle-multi-sort, icicle-make-plain-predicate, icicle-alpha-p. ;; icicle-reversible-sort: Use icicle-sort-comparer and icicle-multi-sort. ;; Reset to unsorted if an error is raised. ;; Applied renamings: icicle-sort-function to icicle-sort-comparer, ;; icicle-sort-functions-alist to icicle-sort-orders-alist. ;; icicle-read-shell-command-completing: Removed extra binding for icicle-sort-function. ;; 2010/01/12 dadams ;; icicle-display-candidates-in-Completions: set-buffer -> with-current-buffer. ;; 2009/12/25 dadams ;; icicle-strip-ignored-files-and-sort: ;; Call completion-ignored-build-apply and icicle-update-ignored-extensions-regexp. ;; 2009/12/21 dadams ;; fset -> defalias. ;; 2009/12/07 dadams ;; Added: icicle-minibuffer-default-add-dired-shell-commands. ;; icicle-dired-read-shell-command: Instead of using minibuffer-default-add-shell-commands, ;; use icicle-minibuffer-default-add-dired-shell-commands. ;; icicle-read-shell-command-completing: Bind insert-default-directory to nil. ;; icicle-dir-prefix-wo-wildcards: Don't ever return nil - return "" if need be. ;; icicle-read-string: ;; Handle a consp default-value when user enters "": use the car. Thx to Sakuma Ryo. ;; 2009/12/03 dadams ;; icicle-completing-read: ;; Make sure we don't use a nil def value for init value. Thx to Sebastian Luque. ;; 2009/11/27 dadams ;; *-display-candidates-in-Completions, *-prefix-candidates, *-fuzzy-candidates: ;; Handle swank completions too. ;; 2009/11/25 dadams ;; icicle-insert-candidates: Handle vertical layout: icicle-completions-format. ;; 2009/11/03 dadams ;; icicle-color-completion-setup: Use hexrgb-defined-colors, not x-defined-colors. ;; No icicle-transform-function, since we use hexrgb.el. ;; 2009/10/25 dadams ;; Added: icicle-dir-prefix-wo-wildcards. Use in icicle-insert-cand-in-minibuffer. ;; icicle-save-or-restore-input: Remove test comparing last completion with current input. ;; icicle-abbreviate-or-expand-file-name: If arg is absolute, do not expand. ;; icicle-display-candidates-in-Completions, icicle-prefix-candidates, ;; icicle-not-basic-prefix-completion-p: ;; Updated for new completion methods. Use *-current-TAB-method, not old fuzzy flag. ;; 2009/10/24 dadams ;; icicle-unsorted-file-name-*-candidates, icicle-*-any-file-name-candidates-p: ;; Got rid of slashed-p. ;; icicle-unsorted-file-name-apropos-candidates: ;; Set icicle-common-match-string to nil if there are no candidates. ;; icicle-apropos-any-file-name-candidates-p: ;; When input is a dir, remove final /, so we don't non-match highlight the / (empty dir). ;; Bind case-fold-search, for apropos matching. ;; icicle-abbreviate-or-expand-file-name: Set DIR to nil if it's relative. ;; 2009/10/22 dadams ;; Added: icicle-file-name-directory. ;; icicle-completion-setup-function, icicle-display-candidates-in-Completions, ;; icicle-save-or-restore-input, icicle-file-name-directory-w-default, ;; icicle-historical-alphabetic-p: ;; Use icicle-file-name-directory, not file-name-directory. ;; 2009/10/17 dadams ;; icicle-completion-try-completion: Return RES. ;; 2009/10/12 dadams ;; icicle-unsorted-prefix-candidates, icicle-prefix-any-candidates-p: ;; Use length of INPUT, not length from point backward to field-beginning. ;; icicle-input-from-minibuffer: Added optional LEAVE-ENVVARS-P arg. ;; icicle-next-candidate, icicle-highlight-complete-input: ;; Call icicle-input-from-minibuffer with LEAVE-ENVVARS-P arg. ;; icicle-completion-all-completions: ;; If not basic completion (Emacs 23) and input ends in $, then append $ to cands also. ;; 2009/09/25 dadams ;; icicle-file-name-prefix-candidates: Use whole input, not just nondirectory. ;; Added: icicle-not-basic-prefix-completion-p. Use where appropriate. ;; 2009/09/19 dadams ;; icicle-unpropertize: Remove the internal text properties added by Icicles. ;; icicle-completing-read, icicle-read-file-name: Call icicle-unpropertize unconditionally. ;; 2009/09/12 dadams ;; icicle-kill-a-buffer: Bind enable-recursive-minibuffers, to confirm modified buffer. ;; 2009/09/05 dadams ;; icicle-msg-maybe-in-minibuffer: Do nothing if icicle-minibuffer-message-ok-p is nil. ;; 2009/08/19 dadams ;; icicle-candidate-short-help: Return (possibly propertized) STRING. ;; 2009/08/09 dadams ;; Added: icicle-insert-cand-in-minibuffer - factored out code from icicle-next-candidate. ;; eval-after-load "crm": ;; Test that icy-mode is available using featurep, not fboundp. Thx to Michael Heerdegen. ;; 2009/07/26 dadams ;; icicle-completing-read, icicle-read-file-name-1: ;; Bind minibuffer-history-variable to itself. ;; 2009/07/13 dadams ;; icicle-read-face-name (Emacs 20 version): Use copy-sequence on prompt, before add prop. ;; 2009/07/12 dadams ;; icicle-display-completion-list: ;; Use different protection (fboundp) for fix for latest Emacs 23 crap (base size in cdr). ;; 2009/07/11 dadams ;; icicle-next-candidate: ;; If icicle-regexp-quote-flag, regexp-quote before string-match for highlighting root. ;; icicle-place-cursor: If icicle-regexp-quote-flag, regexp-quote input to search for it. ;; 2009/07/02 dadams ;; icicle-displayable-cand-from-saved-set: ;; If icicle-readable-to-markers returns an atom, just use that. ;; 2009/06/17 dadams ;; icicle-fit-completions-window: Scale text size initially. ;; 2009/06/07 dadams ;; icicle-get-alist-candidate -> funcall icicle-get-alist-candidate-function. ;; icicle-mctize-all: If PRED is nil, so is NEWPRED (use and instead of when). ;; 2009/05/22 dadams ;; Require icicles-mac.el if load-library doesn't find it. ;; 2009/05/18 dadams ;; icicle-display-candidates-in-Completions: deactivate-mark in *Completions* after display. ;; 2009/05/17 dadams ;; icicle-next-candidate: Updated to reflect thumb-frm.el name changes. ;; 2009/05/17 dadams ;; Added: icicle-toggle-icicle-mode-twice. ;; In eval-after-load crm: Use icicle-toggle-icicle-mode-twice, not icy-mode calls. ;; 2009/05/15 dadams ;; icicle-unhighlight-lighter: Wrap redisplay in condition-case, like elsewhere. ;; 2009/05/11 dadams ;; Added: icicle-upcase. Use in place of upcase everywhere, to work around Emacs 20 bug. ;; Added: icicle-local-keys-first-p. ;; icicle-display-candidates-in-Completions: ;; Don't highlight historical candidate if in icicle-hist-cands-no-highlight. ;; 2009/05/09 dadams ;; icicle-input-from-minibuffer: Keep text properties when pick up input. ;; icicle-highlight-input-noncompletion(-rest): Use an overlay instead of text property. ;; icicle-show-help-in-mode-line: Fix special case for pseudo-key/cmd ..: go up to prefix. ;; 2009/05/07 dadams ;; icicle-display-candidates-in-Completions, in the code that hides common match: ;; Don't reset display property to nil. ;; Use icicle-common-match-string, not current input. ;; icicle-expanded-common-match-1: ;; If input doesn't match candidate, return nil. Throw nil, not input, everywhere. ;; *-unsorted(-file-name)-apropos-candidates, *-apropos-any(-file-name)-candidates-p: ;; Protect calls to icicle-apropos-complete-match-fn with condition-case, for Emacs 20. ;; icicle-place-cursor: Added optional arg. ;; 2009/05/05 dadams ;; icicle-alt-act-fn-for-type: ;; Bind completion-ignore-case, based on read-buffer-completion-ignore-case. ;; 2009/05/03 dadams ;; Use (fboundp 'minibuffer-default-add-completions), not (> emacs-major version 22). ;; 2009/05/01 dadams ;; Renamed: icicle-choose-action-for-type to icicle-alt-act-fn-for-type. ;; icicle-type-actions-alist: Rewrote. Handle both list of objs and single obj. ;; icicle-quote-file-name-part-of-cmd: Rewrote. Quote file name always, and only file name. ;; 2009/04/30 dadams ;; icicle-show-in-mode-line: Clear any message (e.g. Computing completion candidates...). ;; 2009/04/29 dadams ;; icicle-get-alist-candidate: If NO-ERROR-P is 'no-error-no-msg, just return nil (no msg). ;; icicle-choose-action-for-type: Use lax completion. ;; 2009/04/28 dadams ;; icicle-choose-action-for-type: ;; Moved here from icicles-mac.el, changed to a function, and locally bind ;; *-alt-action-fn to icicle-choose-action-for-type function. ;; For undefined TYPE, provide all functions as candidates. ;; Added eval-when-compile of load-library icicles-mac. ;; 2009/04/27 dadams ;; icicle-recompute-candidates: ;; Keep no-display completion mode, if that's current. ;; Set icicle-last-completion-command only if completion type, not user input, changed. ;; icicle-complete-again-update: Added icicle-prefix-complete-no-display to first case. ;; 2009/04/19 dadams ;; Use unless instead of or for fset's. (cosmetic) ;; icicle-completing-read, icicle-read-from-minibuffer, icicle-read-string: ;; Renamed history parameter to HIST-m@%=!$+&^*z, so C-h f output looks less strange. ;; 2009/04/18 dadams ;; Soft-require hexrgb.el unconditionally, not just when there is a window-system. ;; 2009/04/12 dadams ;; icicle-display-candidates-in-Completions: Added number of candidates to mode-line. ;; icicle-show-help-in-mode-line: Use face icicle-show-help-in-mode-line. Fix prefix keys. ;; 2009/04/11 dadams ;; icicle-candidate-short-help: ;; Do nothing if either icicle-help-in-mode-line-flag or tooltip-mode is nil. ;; icicle-show-help-in-mode-line: ;; If no symbol help, try string. ;; Handle lambdas, menu-function-# from easy-menu, and prefix keys. ;; icicle-make-color-candidate: Construct short help only if user will see it. ;; 2009/04/10 dadams ;; Added: icicle-candidate-short-help, icicle-color-completion-setup (from i*-read-color). ;; Moved here from icicle-cmds.el: ;; icicle-remove-color-duplicates, icicle-color-help, icicle-make-color-candidate. ;; icicle-make-color-candidate: Added short help, using icicle-candidate-short-help. ;; icicle-show-help-in-mode-line: ;; Treat :icicle-candidate-help text property on strings. ;; Use candidate, not cand, for stringp clause, and use icicle-transform-multi-completion. ;; Renamed: :icicle-candidate-help to icicle-mode-line-help. ;; 2009/04/08 dadams ;; icicle-show-help-in-mode-line: Treat absolute file names too. ;; 2009/04/07 dadams ;; icicle-show-help-in-mode-line: (bufferp (get-buffer...)...) -> (get-buffer...) Duh. ;; 2009/04/06 dadams ;; Added: icicle-show-help-in-mode-line - from code in icicle-next-candidate: ;; Added arg. Handle: faces, buffer names, file names, :icicle-candidate-help. ;; Added: icicle-help-line-(buffer|file). ;; icicle-next-candidate: Use icicle-show-help-in-mode-line. ;; 2009/04/05 dadams ;; Added: icicle-show-in-mode-line. ;; icicle-next-candidate: Use icicle-show-in-mode-line to show help in mode-line. ;; 2009/04/04 dadams ;; Added: icicle-buffer-smaller-p, icicle-major-mode-name-less-p, ;; icicle-mode-line-name-less-p, icicle-buffer-file/process-name-less-p. ;; 2009/04/03 dadams ;; icicle-read-from-minibuffer: Save filtered default val as icicle-filtered-default-value. ;; icicle-lisp-vanilla-completing-read: Use icicle-filtered-default-value, not DEF, at end. ;; 2009/03/29 dadams ;; icicle-read-shell-command: If non-nil initial-contents, punt to use original (old-*). ;; 2009/03/27 dadams ;; Don't fset minibuffer-default-add-completions unless > Emacs 22. ;; 2009/03/27 dadams ;; icicle-read-from-minibuffer: Use icicle-filter-wo-input on default-value (all values). ;; icicle-completing-read, icicle-read-file-name-1: ;; Use icicle-filter-wo-input on default value only to get init value. ;; Added: icicle-minibuffer-default-add-completions, icicle-first-N. ;; 2009/03/26 dadams ;; icicle-completing-read, icicle-read-file-name-1: ;; Filter default values using icicle-filter-wo-input. ;; icicle-filter-wo-input: Return the candidate, if it passes filtering. ;; 2009/03/16 dadams ;; Added: icicle-recentf-make-menu-items. ;; 2009/03/10 dadams ;; icicle-read-shell-command-completing: Applied renamings: icicle-guess-commands-in-path, ;; icicle-shell-command-candidates-cache, icicle-recompute-shell-command-candidates. ;; Moved to icicles-opt.el and renamed: icicle-shell-command-candidates. ;; 2009/03/08 dadams ;; Added: icicle-quote-file-name-part-of-cmd. ;; icicle-read-shell-command-completing: ;; Call icicle-quote-file-name-part-of-cmd to escape spaces etc. in file names. ;; Removed unneeded minibuffer-local-*-map let bindings. ;; icicle-dired-smart-shell-command: ;; Protected dired-default-directory with fboundp, for Emacs 20. ;; 2009/03/01 dadams ;; icicle-read-from-minibuffer: ;; No longer use icicle-complete-on-demand-cmd and on-demand-map. ;; 2009/02/28 dadams ;; Don't fset old-dired-smart-shell-command here - do after load Dired-X (icicles-mode.el). ;; Added for Emacs 20: definition of replace-regexp-in-string. ;; icicle-read-(number|string-completing): ;; No need for fboundp of replace-regexp-in-string, since provide it now for Emacs 20. ;; icicle-read-file-name: Treat directory candidates as special candidates. ;; icicle-read-shell-command-completing: ;; Candidate help depends on candidate type. ;; Use existing icicle-extra-candidates as its own default, not icicle-file-extras. ;; 2009/02/27 dadams ;; icicle-shell-command: Fixed typo: shell-command -> old-shell-command. ;; icicle-read-shell-command-completing: Append icicle-file-extras to i*-extra-candidates. ;; 2009/02/23 dadams ;; icicle-read-shell-command-completing: ;; Bind icicle-extra-candidates-dir-insert-p, not insert-default-directory, to nil. ;; icicle-next-candidate: Protect dir insertion with icicle-extra-candidates-dir-insert-p. ;; 2009/02/22 dadams ;; icicle-dired-read-shell-command: Use minibuffer-default-add-shell-commands if available. ;; 2009/02/20 dadams ;; icicle-read-from-minibuffer: Treat icicle-complete-on-demand-cmd - on-demand completion. ;; Added: icicle-dired-smart-shell-command, icicle-read-shell-command-completing, ;; icicle-dired-read-shell-command, icicle-extra-candidates-first-p, ;; icicle-require-match-p, icicle-shell-command(-on-region). ;; icicle-read-shell-command: ;; Call icicle-read-shell-command-completing. Define always, not just when mailcap. ;; icicle-dired-guess-shell-command: Just call icicle-read-shell-command-completing. ;; icicle-shell-command-candidates: Cache completions in icicle-shell-command-candidates. ;; icicle-highlight-input-noncompletion(-rest), icicle-highlight-lighter: ;; Use function icicle-require-match-p, not var. ;; icicle-completing-p: Test also whether parent map is a completion map. Always cache. ;; 2009/02/17 dadams ;; icicle-read-shell-command: Handle nil default-value. Thx to Kao Felix. ;; icicle-read-file-name: Append new proxy cands to any existing ones. ;; Don't assume that a proxy cand is a variable. ;; 2009/01/25 dadams ;; Added: *-dired-guess-shell-command, *-read-shell-command, *-shell-command-candidates. ;; 2009/01/17 dadams ;; icicle-display-candidates-in-Completions: Highlight Levenshtein (1) match. ;; icicle-unsorted-apropos(-file-name)-candidates, icicle-display-Completions, ;; icicle-apropos-any(-file-name)-candidates-p: Removed PCM. ;; Added: icicle-levenshtein(-strict|-one)-match, icicle-levenshtein-one-regexp, ;; icicle-substrings-of-length. ;; 2009/01/15 dadams ;; Lose "icicle-" for fboundp's: completion-all-completions, completion-try-completion. ;; 2009/01/14 dadams ;; Added: icicle-remove-dups-if-extras. ;; 2009/01/13 dadams ;; Added: icicle-completion-all-completions, icicle-completion-try-completion. ;; icicle-unsorted(-file-name)-(prefix|apropos)-candidates, icicle-display-Completions, ;; icicle-any-(prefix|apropos)(-file-name)-candidates-p: ;; Respect icicle-respect-completion-styles-p (Emacs 23). ;; icicle-unsorted-file-name-prefix-candidates: Removed matching "^"++(regexp-quote input). ;; icicle(-unsorted)(-file-name)-(prefix|apropos)-candidates: ;; Call icicle-transform-candidates for extra candidates and proxy candidates too. ;; icicle-display-candidates-in-Completions: Highlight extra candidates. ;; icicle-face-valid-attribute-values: ;; Use font-family-list instead of x-font-family-list, if available. ;; 2009/01/03 dadams ;; icicle-call-then-update-Completions: ;; If icicle-last-completion-command is nil, test icicle-current-completion-mode - don't ;; just call icicle-prefix-complete. E.g. icicle-search shouldn't end with a single ;; prefix match. ;; 2008/12/25 dadams ;; Added: icicle-save-raw-input (factored out from icicle-save-or-restore-input). ;; icicle-save-or-restore-input: ;; Change test whether last-command is cycling cmd to add also not being completing cmd. ;; Use icicle-completing-p instead of testing this-command for being a cycling cmd. ;; Use icicle-save-raw-input. ;; icicle-next-candidate: Set icicle-cycling-p (new var) to t. ;; 2008/12/20 dadams ;; icicle-save-or-restore-input: Don't restore last input if this is a completing command. ;; 2008/12/07 dadams ;; icicle-completing-read, icicle-read-file-name-1: ;; Removed icicle-prompt. Don't add completion prompt prefix, except for Emacs 20. ;; 2008/12/06 dadams ;; icicle-call-then-update-Completions: ;; To update, call icicle-last-completion-command, not icicle-(apropos|prefix)-complete. ;; 2008/12/02 dadams ;; icicle-unsorted(-file-name)-apropos-candidates: ;; Call icicle-filter-wo-input before filtering with user input (as the doc string says). ;; 2008/11/28 dadams ;; icicle-recompute-candidates, icicle-save-or-restore-input: ;; Test property icicle-(prefix|apropos)-completing-command, not eq cmds. ;; 2008/11/23 dadams ;; icicle-read-file-name: ;; Don't initialize icicle-proxy-candidates unless icicle-add-proxy-candidates-flag. ;; Don't add + to completion indicator if Emacs 23. ;; 2008/11/22 dadams ;; icicle-completing-read: ;; Bind icicle-fancy-cands-internal-p. Do not call icicle-mctize-all unless fancy cands. ;; icicle-mctized-full-candidate: ;; No-op unless icicle-fancy-cands-internal-p or icicle-whole-candidate-as-text-prop-p. ;; icicle-read-(number|char-exclusive|string-completing|face-name): ;; Put icicle-fancy-candidates property on prompt if proxy candidates. ;; icicle-display-candidates-in-Completions: ;; Don't transform candidates unless icicle-fancy-cands-internal-p. ;; 2008/11/18 dadams ;; icicle-display-candidates-in-Completions: ;; Add icicle-special-candidate property as text property to candidates in ;; icicle-completion-candidates, instead of just to display candidate, so returned also. ;; Added support for icicle-display-string property. ;; For these properties: look up symbol first in minibuffer-completion-table if obarray. ;; 2008/11/14 dadams ;; icicle-display-candidates-in-Completions: ;; Respect icicle-hide-common-match-in-Completions-flag. ;; 2008/11/10 dadams ;; icicle(-unsorted)(-file-name)-(apropos|prefix)-candidates: ;; Moved special and proxy candidates outside match filtering, ;; reversing a change made on 2007/11/18. Dunno why that change was made. ;; But filter special and proxy candidates using the input. ;; 2008/11/09 dadams ;; Added: icicle-join-nth-parts, icicle-display-cand-from-full-cand. ;; icicle-transform-multi-completion: Use icicle-join-nth-parts. ;; icicle-transform-multi-completion: Don't test icicle-list-join-string (always non-nil). ;; icicle-first-matching-candidate: ;; Fix: set res properly, not to the tested value. Thx to Hannes Janetzek. ;; 2008/11/07 dadams ;; icicle-color-name-w-bg: Return input if hexrgb.el is not loaded. Thx to Fabrice Knevez. ;; 2008/11/04 dadams ;; icicle-read-face-name: Soft-require eyedropper.el or palette.el. ;; 2008/11/03 dadams ;; icicle-expanded-common-match: Bug fix for Emacs 20: If error matching, just return INPUT. ;; icicle-highlight-input-noncompletion: Erase any message first before highlighting. ;; 2008/11/02 dadams ;; icicle-display-candidates-in-Completions: For icicle-candidate-properties-alist, use ;; narrowed buffer content, not i-current-completion-in-Completions. ;; 2008/10/24 dadams ;; icicle-first-matching-candidate: ;; Use regexp-quote on CAND. ;; Add icicle-list-end-string to each entry in CANDIDATES. ;; Iteration, not recursion. ;; icicle-get-alist-candidate: Added optional arg NO-ERROR-P. ;; 2008/10/18 dadams ;; Replaced customize-save-variable by funcall icicle-customize-save-variable-function. ;; 2008/10/14 dadams ;; Applied renaming of icicle-completion-help to icicle-minibuffer-help. ;; 2008/10/06 dadams ;; Don't toggle icy-mode after loading crm.el unless icy-mode is defined (!). ;; icicle-ms-windows-NET-USE: If hash tables not available, just run the NET USE process. ;; 2008/10/04 dadams ;; Substitute Icicles version of completing-read-multiple and its maps. Thx to Per Nordlow. ;; Added: (icicle|old)-completing-read-multiple, icicle-define-crm-completion-map, ;; (icicle|old)-crm-local-(completion|must-match)-map. ;; icicle-display-completion-list: Protect against Emacs 23 nonsense with base-size in cdr. ;; 2008/09/30 dadams ;; Added: icicle-ms-windows-NET-USE. Thx to Thomas Lim. ;; icicle-file-remote-p: Use icicle-ms-windows-NET-USE. ;; icicle-highlight-input-noncompletion: Return file-local-p if test shows it's local. ;; icicle-call-then-update-Completions: ;; Treat also known file-local-p return from icicle-highlight-input-noncompletion. ;; Renamed icicle-isearch-complete-1 to icicle-isearch-complete-past-string and moved it ;; here from icicles-mcmd.el. ;; icicle-isearch-complete-past-string: Always use regexp-search-ring. Changed prompt. ;; 2008/09/27 dadams ;; icicle-highlight-input-noncompletion: Fixed typo: implicit-remote -> implicit. ;; 2008/09/20 dadams ;; icicle-(apropos|prefix)-candidates, icicle-maybe-sort-and-strip-candidates: ;; Strip ignored files if icicle-abs-file-candidates. ;; 2008/09/19 dadams ;; icicle-get-candidates-from-saved-set: Added optional arg DONT-EXPAND-FILESETS-P. ;; Use icicle-kill-a-buffer, not kill-buffer. ;; Moved icicle-kill-a-buffer here from icicles-cmd.el. ;; Added: icicle-unpropertize. ;; icicle-completing-read, icicle-read-file-name: Use icicle-unpropertize. ;; 2008/09/16 dadams ;; filesets-get-filelist: Fixed :tree so it includes files in subdirs. ;; Added: icicle-filesets-files-under. ;; 2008/09/15 dadams ;; Added: icicle-saved-fileset-p, icicle-displayable-cand-from-saved-set. ;; icicle-get-candidates-from-saved-set: ;; Rewrote code to convert saved candidates to displayable candidates. ;; Use icicle-displayable-cand-from-*, icicle-saved-fileset-p. Require filesets.el. ;; Moved filesets-get-fileset-from-name into and of first cond clause. ;; Wrapped defun of filesets-get-filelist in eval-after-load. ;; 2008/09/13 dadams ;; Added: icicle-get-candidates-from-saved-set (factored from code in ;; icicle-retrieve-candidates-from-set), filesets-get-filelist (redefined), ;; icicle-explicit-saved-completion-candidates. ;; Moved here from icicles-mcmd.el: icicle-readable-to-markers. ;; 2008/09/04 dadams ;; icicle-read-file-name-1: Removed unused code for non icicle-mode case. ;; 2008/09/03 dadams ;; Removed: icicle-(un)highlight-crosshairs, icicle-unhighlight-crosshairs+cleanup. ;; 2008/09/01 dadams ;; Added: icicle-(un)highlight-crosshairs, icicle-unhighlight-crosshairs+cleanup. ;; 2008/08/29 dadams ;; icicle-mctize-all: ;; Do it for all list collections (new icicle-mctized-full-candidate). ;; Adjust PRED to use cdr only for conses with string cars. ;; icicle-mctized-full-candidate: ;; Treat all kinds of list entries: strings, symbols, and conses with symbol args, etc. ;; 2008/08/25 dadams ;; icicle-display-candidates-in-Completions: Do nothing if NO-DISPLAY-P is 'no-msg. ;; 2008/08/24 dadams ;; icicle-filter-wo-input: Filter out empty-string candidates: "". ;; Added: icicle-minibuf-input-sans-dir. ;; Renamed: icicle-minibuffer-contents-from-minibuffer to icicle-input-from-minibuffer, ;; icicle-minibuffer-contents to icicle-minibuf-input. ;; icicle-display-candidates-in-Completions, icicle-next-candidate, icicle-place-cursor: ;; Use icicle-minibuf-input-sans-dir. ;; 2008/08/23 dadams ;; icicle-display-candidates-in-Completions: ;; Wrap preliminary display of *Completions* in save-selected-window. ;; 2008/08/22 dadams ;; icicle-display-candidates-in-Completions: ;; Display *Completions* before calling with-output-to-temp-buffer and filling it. ;; This is so we can know the window width, to determine the correct formatting. ;; icicle-insert-candidates: ;; Don't use lru window or *-Completions-*-default-width (removed). Failsafe width 40. ;; 2008/08/21 dadams ;; icicle-completing-read: ;; Bind minibuffer-completing-file-name to nil if not completing a file name. ;; Removed setq of minibuffer-completion-table. Already do it in *-lisp-vanilla-*. ;; 2008/08/20 dadams ;; icicle-insert-candidates: ;; Turn off mouse-face after insert candidate. ;; Fixup whitespace correctly: Don't remove whitespace that is part of a candidate. ;; Added: icicle-ding. ;; icicle-read-number: Replaced ding by icicle-ding. ;; 2008/08/18 dadams ;; Moved here from icicles-cmd.el (and renamed from *-less-p): icicle-cdr-lessp. ;; Added: icicle-delete-count, icicle-mctize-all, icicle-mctized-(display|full)-candidate, ;; icicle-part-1-cdr-lessp. ;; Renamed: icicle-delete-if(-not) to icicle-remove-if(-not), ;; icicle-put-alist-candidate to icicle-put-whole-cand-prop, ;; icicle-update-completions to icicle-complete-again-update. ;; icicle-completing-read: Factored out transformation to MCT into new fn icicle-mctize-all. ;; 2008/08/08 dadams ;; icicle-completing-read: Updated doc string for Emacs 23. ;; 2008/08/03 dadams ;; icicle-completing-read: Convert the predicate to apply to just the cdr (= original cons). ;; icicle-save-or-restore-input: Don't save empty string ("") to C-l history. ;; 2008/07/27 dadams ;; Added: icicle-2nd-part-string-less-p. ;; Moved here from icicles-mcmd.el: icicle-transform-multi-completion. ;; 2008/07/19 dadams ;; icicle-choose-completion-string: Don't move to point-max unless in minibuffer. ;; 2008/06/24 dadams ;; Make *-must-match-filename-map an alias for *-filename-completion-map. Use the latter. ;; 2008/06/22 dadams ;; icicle-completing-read, icicle-read-file-name: ;; Remove text properties from result (only) if icicle-unpropertize-*-flag. ;; 2008/06/21 dadams ;; icicle-read-file-name: Remove text properties from result file name. ;; 2008/06/01 dadams ;; icicle-lisp-vanilla-completing-read: Typo: minibuffer-local-must-match-filename-map. ;; Put sort predicate properties on some sort predicate symbols, e.g. icicle-dirs-last-p. ;; 2008/05/22 dadams ;; icicle-read-file-name: Bind minibuffer-completing-file-name to t. ;; icicle-read-file-name-1: Do not prepend ". " if Emacs 23+, since it uses completing-read. ;; icicle-(un)highlight-lighter: Reflect case-sensitivity in lighter. ;; 2008/05/11 dadams ;; icicle-unsorted(-file-name)-apropos-candidates: ;; Pass input to all-completions only if not icicle-apropos-complete-match-fn. ;; 2008/05/11 dadams ;; Renamed icicle-fit-Completions-window to icicle-fit-completions-window. ;; icicle-fit-completions-window: Use current window - not necessarily for *Completions*. ;; 2008/05/06 dadams ;; icicle-highlight-lighter: Wrap redisplay in condition-case to ignore any errors. ;; 2008/05/05 dadams ;; icicle-file-name-input-p: Redefined to just use minibuffer-completing-file-name. ;; 2008/05/01 dadams ;; icicle-lisp-vanilla-completing-read, icicle-lisp-vanilla-completing-read, ;; icicle-read-from-minibuffer, icicle-read-number, icicle-read-string-completing: ;; Adapted to Emacs 23 change to allow list of strings for default value. ;; 2008/04/25 dadams ;; icicle-call-then-update-Completions: ;; nil icicle-test-for-remote-files-flag means don't test for remote file name. ;; icicle-highlight-input-noncompletion: ;; Correction: implicit, not always, in combination with not incremental completion. ;; Added check for icicle-completing-command if value is explicit*. ;; Added check for icicle-test-for-remote-files-flag if *-strict with lax completion. ;; Protect call to icicle-file-remote-p with check of icicle-test-for-remote-files-flag. ;; 2008/04/18 dadams ;; Renamed icicle-init-value-flag to icicle-default-value. ;; icicle-read-from-minibuffer: ;; If icicle-default-value is t, add to prompt. Thx to Dominique Quatrevaux. ;; icicle-completing-read, icicle-read-file-name-1, icicle-read-from-minibuffer: ;; Change icicle-default-value test to rule out t also. ;; icicle-completion-setup-function: ;; Don't call file-name-directory unless minibuffer-completing-file-name. ;; 2008/04/01 dadams ;; icicle-unsorted(-file-name)-apropos-candidates: ;; If icicle-unsorted-apropos-candidates pass input to all-completions. ;; icicle-expanded-common-match-1: ;; Use icicle-apropos-complete-match-fn throughout, but return nil if that is nil. ;; icicle-display-candidates-in-Completions: ;; If icicle-apropos-complete-match-fn is nil, don't try to highlight input match. ;; 2008/03/31 dadams ;; icicle-display-candidates-in-Completions: ;; Allow for no completion type, for No completions msg. ;; 2008/03/30 dadams ;; icicle-read-file-name-1: ;; Bind read-file-name-function to nil. ;; Funcall icicle-old-read-file-name-fn instead of old-read-file-name. ;; icicle-(un)highlight-lighter: Respect icicle-highlight-lighter-flag. ;; Top-level: Moved fset for old-read-file-name to icicles-mode.el and renamed it. ;; 2008/03/29 dadams ;; icicle-completing-read, icicle-read-file-name-1: ;; Combine new faces for single-character minibuffer completion status indicator. ;; Call icicle-highlight-lighter after establishing require-match, not at beginning. ;; No longer use completing-prompt-prefix(-symb). ;; No longer use icicle-reminder-prompt-flag (no longer add help to prompt). ;; Removed: icicle-control-reminder-prompt. ;; icicle-highlight-lighter: ;; Combine faces for highlighting. Indicate multi-command and strict/lax completion. ;; icicle-unhighlight-lighter: Add + for multi-command. Don't bother to propertize strg. ;; icicle-file-remote-p: If name matches Windows drive letter, don't try other remote tests. ;; 2008/03/11 dadams ;; icicle-completing-read-history: ;; Convert cons list elements to strings. Lets you use M-o with command-history. ;; 2008/03/09 dadams ;; Added: icicle-(un)highlight-lighter. ;; icicle-completing-read, icicle-read-file-name: Call icicle-highlight-lighter. ;; 2008/03/08 dadams ;; icicle-completing-p: Replaced where-is-internal test with completion keymaps test. ;; 2008/03/05 dadams ;; icicle-completing-read: ;; Copy TABLE etc. only if candidates are strings. Thx to Damon Permezel for bug report. ;; icicle-files-within: Skip inaccessible directories and unreadable files. Thx to Damon. ;; 2008/02/28 dadams ;; icicle-completing-read: Fixed test for multicompletion: List of strings, not just list. ;; 2008/02/24 dadams ;; Added: icicle-scatter(-match). ;; icicle-display-*-in-Completions: Highlighting of input match can use icicle-scatter. ;; Use icicle-apropos-complete-match-fn in message. ;; icicle-expanded-common-match-1: Use icicle-apropos-complete-match-fn, not string-match. ;; 2008/02/23 dadams ;; icicle-completing-read: ;; Change initial-input to a cons with 0 position if icicle-init-value-flag is *-start. ;; icicle-lisp-vanilla-completing-read: Set position to end of initial-input, by default. ;; Convert zero-based position to one-based. ;; 2008/02/22 dadams ;; icicle-completing-read: ;; For all alist candidates (not just multi-completion): ;; Copy the car and replace the cdr with the whole candidate. ;; icicle-get-alist-candidate: Get and return just whole icicle-whole-candidate property. ;; icicle-completion-setup-function (for Emacs 20): ;; minibuffer-prompt-end -> icicle-minibuffer-prompt-end. ;; 2008/02/16 dadams ;; icicle-get-alist-candidate: ;; Reconstitute whole candidate, by consing string onto data, which is only the cdr now. ;; icicle-completing-read: Use icicle-put-alist-candidate to put candidate data onto string. ;; Added: icicle-put-alist-candidate. Put only the cdr (data), not whole, onto the string. ;; 2008/02/14 dadams ;; Added: icicle-substring-no-properties. ;; 2008/02/11 dadams ;; icicle-read-string-completing: Moved save-match-data so replace-match can use match data. ;; 2008/02/06 dadams ;; icicle-highlight-input-noncompletion: ;; Wait icicle-highlight-input-completion-failure-delay before highlighting. ;; Don't highlight if past icicle-highlight-input-completion-failure-threshold. ;; Combined input-pending test with highlighting test, and moved it before file-name test. ;; Conditionalized face removal. ;; Return nil when input within delay preempts highlighting. ;; icicle-highlight-initial-whitespace: Removed only vestigial whitespace highlighting. ;; icicle-read-number: Moved save-match-data outside cond. ;; 2008/02/03 dadams ;; icicle-choose-completion-string: ;; Go to point-max before insert choice. Respect icicle-dir-candidate-can-exit-p. ;; icicle-completion-setup-function: ;; Set default dir only if this is a completion cmd or not *-comp-base-is-default-dir-p. ;; If icicle-comp-base-is-default-dir-p, set completion-base-size to default-dir length. ;; icicle-read-file-name: Bind ffap vars to prevent slowing down ffap-guesser. ;; 2008/01/29 dadams ;; Added: icicle-(apropos|prefix)-any(-file-name)-candidates-p, ;; icicle-subst-envvar-in-file-name, icicle-highlight-input-noncompletion-rest, ;; icicle-any-candidates-p, icicle-file-remote-p. ;; icicle-minibuffer-contents-from-minibuffer: Use icicle-subst-envvar-in-file-name. ;; icicle-call-then-update-Completions: ;; Reinitialize icicle-input-fail-pos to nil. ;; If we know input is a remote file name from failure highlighting, skip remote test. ;; Use icicle-file-remote-p, not file-remote-p. ;; icicle-highlight-input-noncompletion: Rewrote. ;; Takes no args now. ;; Do nothing if input pending or input is empty. ;; Use icicle-file-remote-p, not file-remote-p. Return value indicating remote file name. ;; Use new values of icicle-highlight-input-completion-failure, including always. ;; First check through last two chars, then icicle-highlight-input-noncompletion-rest. ;; icicle-highlight-input-noncompletion-rest (was in icicle-highlight-input-noncompletion): ;; No longer use icicle-max-chars-noncompletion-highlight. ;; Use icicle-any-candidates-p, so don't compute candidate lists. ;; 2008/01/15 dadams ;; icicle-command-abbrev-save: Added condition-case with message in case of error. ;; icicle-control-reminder-prompt: Added message. ;; 2008/01/13 dadams ;; icicle-read-face-name: Use icicle-transform-multi-completion. ;; icicle-next-candidate: Do not use icicle-transform-multi-completion. ;; icicle-next-candidate, icicle-save-or-restore-input: Do not treat handle-switch-frame. ;; 2008/01/08 dadams ;; Renamed icicle-expanded-common-match to icicle-expanded-common-match-1. ;; New icicle-expanded-common-match uses longest of two tries. ;; icicle-expanded-common-match-1, first loop: Match ecm only up to orig-match-end. ;; icicle-read-file-name: Use icicle-var-is-of-type-p for proxy candidates. ;; icicle-choose-completion-string, icicle-strip-ignored-files-and-sort, ;; icicle-filter-wo-input, icicle-first-matching-candidate, ;; icicle-(proxy-candidate|prefix-keys)-first-p, icicle-var-(matches|inherits)-type-p, ;; icicle-read-(number|face-name|file-name|string-completing), ;; icicle-unsorted(-file-name)-prefix-candidates, icicle-expanded-common-match-1, ;; icicle-next-candidate, icicle-remove-dots: Wrap string-match in save-match-data. ;; icicle-display-candidates-in-Completions: Moved save-match-data locations. ;; 2008/01/05 dadams ;; icicle-next-candidate: Don't refresh Completions if last-command = handle-switch-frame. ;; 2008/01/04 dadams ;; icicle-insert-candidates: Put property icicle-keep-newline on final \n of candidate. ;; 2007/12/31 dadams ;; icicle-choose-completion-string: In minibuffer, delete all input before inserting. ;; 2007/12/27 dadams ;; icicle-unsorted(-file-name)-apropos-candidates: ;; Use null *-apropos-*-match-fn, not function-valued TABLE to inhibit input match. ;; 2007/12/26 dadams ;; icicle-next-candidate: Raise *Completions* frame at the end. ;; 2007/12/24 dadams ;; icicle-unsorted(-file-name)-apropos-candidates: ;; Don't match input regexp if minibuffer-completion-table is a function. ;; icicle-var-inherits-type-p: ;; Recheck var-type match after set var-type to its car. ;; Handle string (regexp) TYPES elements. ;; icicle-value-satisfies-type-p: Skip type check for string type (regexp). ;; icicle-var-is-of-type-p: Doc string. Use icicle-var-matches-type-p. ;; Added: icicle-var-matches-type-p, icicle-custom-type. ;; 2007/12/23 dadams ;; icicle-var-is-of-type-p: ;; Added MODE arg. Use icicle-var-inherits-type-p, icicle-var-val-satisfies-type-p. ;; Redefined as MODE choice, not just a simple or. Treat more cases. ;; Added: icicle-var-inherits-type-p, icicle-var-val-satisfies-type-p, ;; icicle-value-satisfies-type-p. ;; icicle-read-(number|char-exclusive|string-completing|face-name): ;; Don't fill icicle-proxy-candidates unless icicle-add-proxy-candidates-flag. ;; Corrected doc string to refer to icicle-add-proxy-candidates-flag. ;; 2007/12/22 dadams ;; icicle-var-is-of-type-p: ;; Check supertypes also. Use both :validate and :match. ;; Wrap type check in condition-case. Use widget-put instead of plist-put. ;; Added soft require of wid-edit+.el. ;; 2007/12/21 dadams ;; icicle-var-is-of-type-p: Use :validate, not :match, for the test. ;; 2007/12/19 dadams ;; icicle-display-candidates-in-Completions: ;; Ensure icicle-last-input is non-nil in (file-name-directory icicle-last-input). ;; 2007/12/14 dadams ;; icicle-fit-Completions-window: ;; Don't try to get a property if it's not a symbol. Thx to Mike Mattie. ;; 2007/12/11 dadams ;; Added: icicle-read-char-exclusive. ;; icicle-read-face-name: Include face-name vars as proxy candidates. ;; 2007/12/10 dadams ;; icicle-highlight-input-noncompletion: Use face icicle-input-completion-fail-lax also. ;; 2007/12/09 dadams ;; icicle-highlight-input-noncompletion: Respect icicle-max-chars-noncompletion-highlight. ;; 2007/12/08 dadams ;; icicle-read-file-name: ;; Include file-name variables as proxy candidates. Reset icicle-proxy-candidates at end. ;; icicle-read-number: float type is not defined before Emacs 22. ;; icicle-read-string-completing: ;; Set default to "" if nil, but only after completing-read. ;; Set car of hist to var value, replacing var name. Treat consp hist also. ;; 2007/12/03 dadams ;; Renamed icicle-longest-common-match to icicle-expanded-common-match. ;; 2007/12/02 dadams ;; Added: icicle-var-is-of-type-p. ;; icicle-read-(number|string-completing): ;; Use icicle-var-is-of-type-p, to handle compatible types. ;; 2007/11/30 dadams ;; icicle-read-file-name, icicle-read-(number|string-completing), ;; icicle-display-candidates-in-Completions, icicle-proxy-candidate-first-p: ;; Use only membership in icicle-proxy-candidates, not icicle-proxy-candidate property. ;; icicle-choose-completion-string: ;; Condition for exit: could be no minibuffer-completion-table if extra or proxy cands. ;; 2007/11/29 dadams ;; icicle-read-(number|string-completing): ;; Treat icicle-add-proxy-candidates-flag and icicle-proxy-candidates. ;; icicle-display-candidates-in-Completions: Treat empty icicle-completion-candidates. ;; 2007/11/27 dadams ;; Added: icicle-read-number, icicle-read-string-completing. ;; icicle-read-file-name: Remove icicle-proxy-candidate property in unwind-protect. ;; 2007/11/25 dadams ;; Added: icicle-command-abbrev(-save|-used-more-p). ;; 2007/11/24 dadams ;; icicle-longest-common-match, first loop: string-match -> not string-match. ;; len-first -> length of lcm. ;; Added: icicle-proxy-candidate-first-p. ;; 2007/11/18 dadams ;; icicle(-unsorted)(-file-name)-(apropos|prefix)-candidates: ;; Include also icicle-proxy-candidates. ;; Move special and proxy candidates inside match filtering. ;; icicle-display-candidates-in-Completions: ;; Don't expand directory when highlighting special candidate. ;; 2007/11/02 dadams ;; icicle-longest-common-match: ;; First loop: (1) match against at most len-first, (2) put the match into the and test. ;; 2007/10/28 dadams ;; icicle-display-candidates-in-Completions: ;; Always highlight longest common match for prefix completion. ;; icicle-unsorted(-file-name)-prefix-candidates, icicle-fuzzy-candidates: ;; Set icicle-common-match-string, regardless of icicle-expand-input-*-flag. ;; icicle-save-or-restore-input: ;; Update to lcm even if no input change, if completion mode changed. ;; Update to lcm if prefix completing, even if icicle-expand-input-*-flag is nil. ;; Save input for C-l even if this command is an icicle-completing-command (?). ;; Don't reset raw input to "" if cycling, so keep highlight in *Completions*. ;; icicle-longest-common-match: Test prefix through embedded input each time. ;; 2007/10/26 dadams ;; icicle-read-face-name (Emacs 22): Fix the treatment of default value. ;; 2007/10/22 dadams ;; icicle-display-candidates-in-Completions: ;; Highlight only regexp matching part of special candidates. ;; Highlight special cands regardless of icicle-highlight-historical-candidates-flag. ;; 2007/10/02 dadams ;; icicle-next-candidate: ;; Apply abbreviate-file-name to file-name input. Thx to Joonhwan Lee. ;; 2007/09/29 dadams ;; Added: icicle-fuzzy-candidates. ;; icicle-prefix-candidates: Treat fuzzy completion. ;; icicle-display-candidates-in-Completions: ;; For prefix completion, highlight literal input match in Completions. ;; 2007/09/26 dadams ;; icicle-read-from-minibuffer: Removed keep-all arg - see also 2006/06/01. ;; 2007/09/22 dadamms ;; icicle-completing-read, icicle-read-from-minibuffer: ;; Ensure that init arg is string when get it from default arg via icicle-init-*-flag. ;; 2007/09/18 dadams ;; icicle-call-then-update-Completions: ;; Test icicle-current-completion-mode, not icicle-last-completion-command. ;; 2007/09/16 dadams ;; icicle-call-then-update-Completions: ;; Don't complete if file-remote-p. ;; Highlight completion failure only if input > icicle-*-display-min-input-chars. ;; icicle-highlight-input-noncompletion: ;; Don't highlight unless also icicle-incremental-completion-flag. ;; Call icicle-file-name-*-candidates for file-name input. ;; Don't highlight if file-remote-p and reading file name. Instead, remove highlighting. ;; 2007/09/14 dadams ;; icicle-highlight-input-noncompletion, icicle-update-completions, ;; icicle-recompute-candidates: ;; Wrapped condition-case around candidates computation. ;; 2007/09/02 dadams ;; icicle-display-candidates-in-Completions: ;; Restore point and window point to start of candidates in *Completions*. ;; 2007/08/21 dadams ;; icicle-highlight-input-noncompletion: Remove any vestigial highlighting on matched part. ;; 2007/08/19 dadams ;; Added: icicle-lisp-vanilla-completing-read, icicle-highlight-input-noncompletion. ;; icicle-completing-read: ;; Allow reading and returning string candidates with properties: ;; bind minibuffer-allow-text-properties. ;; Put whole candidate on string as text property. ;; Use icicle-lisp-vanilla-completing-read, not old-completing-read. ;; icicle-call-then-update-Completions: Call icicle-highlight-input-noncompletion. ;; icicle-get-alist-candidate: ;; If icicle-whole-candidate-as-text-prop-p, try to get full candidate from text prop. ;; 2007/08/16 dadams ;; icicle-insert-candidates: Don't reset text props if endpos > point. Thx to Chris Hecker. ;; 2007/08/14 dadams ;; icicle-increment-cand-nb+signal-end: Removed audible bell - use visible bell only. ;; 2007/07/22 dadams ;; icicle-read-face-name (Emacs 22 version): ;; Revert multiple branch to not use icicle-make-face-candidate. ;; Moved here from icicles-mode.el: icicle-completing-p. ;; 2007/07/06 dadams ;; icicle-display-candidates-in-Completions: Leave cursor at start of candidates. ;; 2007/07/03 dadams ;; icicle-save-or-restore-input: ;; Add current-raw-input to icicle-previous(-non)-file-*-raw-inputs, respecting max len. ;; Don't save input if current command is C-l or C-L. ;; If don't save raw input, set it to empty string. ;; Added: icicle-put-at-head. ;; icicle-highlight-complete-input: Ensure no error treatment in call to search-forward. ;; icicle-display-candidates-in-Completions: ;; Ensure non-nil current(-raw)-input, for highlight. ;; 2007/06/23 dadams ;; Added: icicle-completing-read-history. ;; Moved here from icicles-cmd.el: icicle-read-from-minibuf-nil-default. ;; 2007/06/20 dadams ;; icicle-make-face-candidate, icicle-read-face-name: ;; Use new string value of icicle-WYSIWYG-Completions-flag. ;; 2007/06/19 dadams ;; icicle-read-face-name: ;; Use a multi-completion, depending on icicle-WYSIWYG-Completions-flag. ;; For Emacs 22, isolate the multiple case and do nothing for it. ;; icicle-make-face-candidate: Treat also whole-number value for icicle-WYSIWYG-*-flag. ;; 2007/06/17 dadams ;; icicle-make-face-candidate: Respect icicle-WYSIWYG-Completions-flag. ;; icicle-display-candidates-in-Completions: highlight saved candidates. ;; icicle-place-overlay: Added priority arg. ;; 2007/06/13 dadams ;; icicle-display-candidates-in-Completions: ;; Upgrade icicle-incremental-completion-p only if redisplaying. Thx Mark Elston. ;; 2007/06/10 dadams ;; Removed unconditional add-hook for icicle-fit-Completions-window. ;; 2007/06/09 dadams ;; icicle-insert-candidates: Don't mouse-face last char of candidate if it is a newline. ;; icicle-display-candidates-in-Completions: Treat icicle-candidate-properties-alist last. ;; 2007/06/07 dadams ;; icicle-read-face-name: Use (icicle-)face-name-history. ;; 2007/06/05 dadams ;; Added soft require of hexrgb.el, but only if window-system. ;; icicle-color*: Protected with featurep hexrgb and error message. ;; 2007/06/01 dadams ;; icicle-completing-read, icicle-read-from-minibuffer, icicle-read-string: ;; Use M@R%M=X!L$S+P&L^T*Z to avoid name capture by minibuffer-history-variable's value. ;; icicle-display-candidates-in-Completions, icicle-historical-alphabetic-p, ;; icicle-most-recent-first-p: ;; Ensure value of minibuffer-history-variable is bound. ;; 2007/05/29 dadams ;; icicle-call-then-update-Completions: Don't recomplete if only one candidate. ;; 2007/05/24 dadams ;; icicle-completing-read, icicle-read-file-name: ;; Fix length test for consp initial-input. Thx to Anupam Sengupta. ;; 2007/05/04 dadams ;; icicle-unsorted-*: C-g quits to top-level. ;; icicle-candidate-set-1, icicle-scroll-or-update-*, icicle-msg-maybe-in-minibuffer: ;; Move to minibuffer window for minibuffer-message. ;; icicle-display-candidates-in-Completions, icicle-highlight-initial-whitespace, ;; icicle-unsorted-file-name-*-candidates, icicle-longest-common-match, ;; icicle-next-candidate, icicle-place-cursor, icicle-highlight-complete-input, ;; icicle-special-candidates-first-p, icicle-case-string-less-p: ;; Use read-file-name-completion-ignore-case, if completing file name. ;; Moved mention of read-file-name-completion-ignore-case and ;; icicle-cycle-into-subdirs-flag from icicle-completing-read to icicle-read-file-name. ;; Added empty defvars for Emacs 22 standard vars, to quiet byte compiler. ;; 2007/04/29 dadams ;; Added: icicle-last-modified-first-p. ;; icicle-call-then-update-Completions: Delete icicle-complete-input-overlay. ;; 2007/04/08 dadams ;; Added: icicle-highlight-candidate-in-Completions, from code in icicle-next-candidate. ;; But changed to: 1) make Completions dedicated and 2) not bind case-fold-search. ;; icicle-next-candidate: Use icicle-highlight-candidate-in-Completions. ;; 2007/04/02 dadams ;; Moved here from icicles-cmd.el: icicle-filter-alist, icicle-first-matching-candidate. ;; 2007/04/01 dadams ;; icicle-insert-candidates: Don't fixup-whitespace if bolp. ;; 2007/03/30 dadams ;; icicle-fit-Completions-window: Don't resize *Completions* window if split horizontally. ;; icicle-insert-candidates: ;; Calculate nb of columns using max-candidate-len, not number of candidates. ;; Indent at least one colwidth, and leave less space between candidates. ;; 2007/03/26 dadams ;; icicle-completion-setup-function: ;; Protected minibuffer-completing-symbol with boundp (not define in Emacs 23). ;; 2007/03/23 dadams ;; icicle-completing-read, icicle-read-file-name: ;; Record require-match in icicle-require-match-p. ;; 2007/03/17 dadams ;; icicle-read-face-name: Undo Emacs 21+ brain-dead treatment of PROMPT arg. ;; 2007/03/14 dadams ;; icicle-fit-Completions-window: ;; Don't let *Completions* take over the frame, so don't lose other window. ;; Respect icicle-Completions-window-max-height property of top-level command. ;; 2007/03/12 dadams ;; Added: icicle-fit-Completions-window. Use in temp-buffer-show-hook. ;; icicle-display-completion-list: ;; Print help lines here, not in icicle-completion-setup-*, so window fit includes them. ;; Put face on string candidates intro string, Possible completions are:. ;; icicle-completion-setup-function: ;; Don't print the help lines here. ;; Updated wrt latest Emacs 22 CVS version. ;; icicle-insert-Completions-help-string: Remove second newline at end. ;; icicle-start-of-candidates-in-Completions: Advance 1 or 2 lines, not 0 or 3. ;; 2007/03/10 dadams ;; icicle-display-completion-list: Rewrote to adjust columns to window width. ;; Added: icicle-insert-candidates. ;; 2007/03/09 dadams ;; Moved icicle-get-alist-candidate here from icicles-cmd.el. ;; 2007/03/07 dadams ;; icicle-choose-completion-string, icicle-next-candidate: ;; Use 0, not t, as frame arg to get-buffer-window. ;; 2007/03/04 dadams ;; icicle-highlight-initial-whitespace: Removed unused local var input-start-position. ;; icicle-completing-read: Do not initialize icicle-candidates-alist. ;; 2007/03/03 dadams ;; icicle-reversible-sort: Don't display Sorting candidates message - too annoying. ;; 2007/03/02 dadams ;; icicle-completion-setup-function for Emacs 22: Don't use file-name-directory if nil. ;; 2007/03/01 dadams ;; icicle-completing-read: Initialize icicle-candidates-alist. ;; 2007/02/24 dadams ;; icicle-next-candidate: ;; Transform multi-completion icicle-last-completion-candidate. ;; If last-command is icicle(mouse)-remove-candidate don't reset common match string or ;; redisplay *Completions*. ;; icicle-recompute-candidates: ;; Don't recompute if icicle-last-completion-command is icicle-mouse-remove-candidate. ;; 2007/02/18 dadams ;; icicle-save-or-restore-input: Use "" if file-name-directory is nil. Thx Shreevatsa R. ;; 2007/02/17 dadams ;; icicle-reversible-sort: No Sorting... message if icicle-edit-update-p. Thx Shreevatsa. ;; 2007/02/05 dadams ;; icicle-completing-read: Added info about multi-completions to doc string. ;; 2007/02/04 dadams ;; icicle-display-candidates-in-Completions: Fixed composition of multiple faces. ;; 2007/02/03 dadams ;; Renamed icicle-icompleting-p to icicle-edit-update-p. ;; Require icicles-var.el. Removed eval-when-compile for require of icicles-opt. ;; 2007/02/02 dadams ;; icicle-case-string-less-p: Use var, not function, icicle-completing-p (else too slow). ;; icicle-reversible-sort: Added sorting progress message. ;; 2007/01/29 dadams ;; icicle-display-candidates-in-Completions: ;; Allow for consp proplist value of icicle-special-candidate. ;; icicle-special-candidates-first-p: Added neither-special case. Treat letter case. ;; Renamed: icicle-case-insensitive-string-lessp to icicle-case-insensitive-string-less-p. ;; Added: icicle-case-string-less-p. ;; icicle-historical-alphabetic-p, icicle-most-recent-first-p, icicle-dirs-last-p, ;; icicle-part-N-lessp, icicle-prefix-keys-first-p: ;; Use icicle-case-string-less-p, not string-lessp. ;; icicle-prefix-keys-first-p: Ignore case. ;; 2007/01/28 dadams ;; Added: icicle-command-names-alphabetic-p. ;; Moved here from icicles-cmd.el: ;; icicle-prefix-keys-first-p, icicle-special-candidates-first-p. ;; 2007/01/23 dadams ;; Added: icicle-read-face-name, icicle-make-face-candidate, ;; icicle-face-valid-attribute-values, icicle-color-name-w-bg. ;; icicle-choose-completion-string: Added Emacs 21 version. ;; icicle-display-candidates-in-Completions: ;; Only highlight past inputs if icicle-highlight-historical-candidates-flag. ;; 2007/01/22 dadams ;; icicle-part-N-lessp, icicle-color-*-lessp: Do nothing if strings are not multipart. ;; icicle-display-candidates-in-Completions: ;; Highlight past inputs after treat *-prop*-alist. ;; icicle-delete-whitespace-from-string: Added optional args. ;; 2007/01/21 dadams ;; Added: icicle-part-*-lessp, icicle-color-*-lessp. ;; 2007/01/20 dadams ;; Added: icicle-display-completion-list. ;; 2007/01/19 dadams ;; icicle-display-candidates-in-Completions: Treat icicle-candidate-properties-alist. ;; 2007/01/15 dadams ;; Added: icicle-reversible-sort. Use it where standard sort function was used. ;; Renamed: icicle-sort-and-strip-ignored to icicle-strip-ignored-files-and-sort, ;; icicle-sort-dirs-last to icicle-dirs-last-p, ;; icicle-sort-case-insensitively to icicle-case-insensitive-string-lessp. ;; Grouped sort functions together. ;; 2007/01/14 dadams ;; icicle-next-candidate: Use icicle-transform-multi-completion. Thx to Rubikitch. ;; icicle-transform-candidates: Updated doc string. ;; 2007/01/12 dadams ;; icicle-next-candidate: Use icicle-list-use-nth-parts. Thx to Rubikitch. ;; icicle-display-candidates-in-Completions: Added message when no-display-p. ;; 2007/01/07 dadams ;; icicle-completing-read: Updated doc string for Emacs 22. ;; 2007/01/06 dadams ;; Added: icicle-abbreviate-or-expand-file-name. ;; icicle-fix-default-directory: Use icicle-abbreviate-or-expand-file-name. ;; icicle-save-or-restore-input: expand-file-name -> icicle-abbreviate-or-expand-file-name. ;; icicle-completion-setup-function: Don't set default-directory to nil if minibuf empty. ;; icicle-read-file-name: Bug fix: Don't set initial-input to icicle-initial-value if "". ;; 2007/01/05 dadams ;; icicle-completing-read, icicle-read-file-name: ;; Use existing string value of icicle-initial-value. Thx to rubikitch for suggestion. ;; 2007/01/01 dadams ;; Added assq-delete-all for Emacs 20 (moved here from icicles-mode.el). ;; Added: icicle-assoc-delete-all. ;; 2006/12/25 dadams ;; Added: icicle-most-recent-first-p. ;; icicle-update-completions: Added optional no-display arg. ;; Moved here from icicles-opt.el: icicle-historical-alphabetic-p. ;; 2006/11/10 dadams ;; icicle-completing-read, icicle-read-file-name: Prefix prompt by + if a multi-command. ;; 2006/10/15 dadams ;; icicle-save-or-restore-input: ;; Change test from cmd is same as last to input is same as last. ;; icicle-rebind-completion-maps: ;; When turn off, bind C-M-mouse-2 and C-down-mouse-2 to nil. ;; icicle-display-candidates-in-Completions: Accumulate (merge) highlight faces. ;; Moved to icicles-mode.el: ;; icicle-bind-isearch-keys, icicle-rebind-completion-maps, ;; icicle-(redefine|restore)-standard-(commands|options), ;; icicle-(redefine|restore)-std-completion-fns), icicle-(re|un)map, ;; icicle-(bind|restore)-completion-keys, icicle-minibuffer-setup, ;; icicle-cancel-*Help*-redirection, icicle-activate-mark, ;; icicle-run-icicle-(pre|post)-command-hook, icicle-set-calling-cmd, ;; icicle-undo-std-completion-faces, icicle-update-ignored-extensions-regexp, ;; icicle-completing-p, icicle-restore-region-face. ;; Removed eval-when-compile of *-face, *-var, *-mac, *-cmd. ;; Removed some defvars for quieting byte compiler. ;; 2006/10/05 dadams ;; icicle-display-candidates-in-Completions: Highlight candidates that are special. ;; 2006/10/03 dadams ;; icicle-display-candidates-in-Completions: ;; Removed predicate filtering, as the pred doesn't necessarily apply to the candidate. ;; This has been in the code forever, so commented it out, in case it is needed ;-). ;; 2006/10/01 dadams ;; icicle-alternative-sort -> icicle-toggle-alternative-sorting. ;; icicle-update-completions: Treat icicle-prefix-word-complete case too. ;; 2006/09/30 dadams ;; Added: icicle-key-description. ;; icicle-(bind|restore)-completion-keys: ;; Bind icicle-candidate-set-(save|retrieve) to C-M-(<|>), not C-(<|>). ;; Bind icicle-toggle-angle-brackets to C-<. ;; No longer remap help-command to icicle-completion-help. ;; Bind icicle-completion-help to C-?. ;; Rename [menu-bar minibuf C-h] to [menu-bar minibuf completion-help]. ;; icicle-completing-p: Bug fix: Use where-is-internal, not minibuffer-completion-table. ;; 2006/09/22 dadams ;; icicle-minibuffer-setup: ;; Apropos-complete, don't prefix-complete, when icicle-show-Completions-initially-flag. ;; 2006/09/17 dadams ;; icicle-completing-p: Ensure minibuffer is active too. ;; 2006/09/16 dadams ;; Bound icicle-insert-key-description to M-q. ;; icicle-completing-read: ;; Use icicle-list-join-string only to join parts of candidate (alist key). ;; Append icicle-list-end-string instead. ;; icicle-msg-maybe-in-minibuffer: Fixed doc string (active -> inactive). ;; 2006/09/12 dadams ;; icicle-minibuffer-setup: Set icicle-pre-minibuffer-buffer. ;; Renamed icicle-switch-to-minibuffer to icicle-insert-completion. ;; 2006/09/03 dadams ;; Renamed icicle-show-Completions-help to icicle-show-Completions-help-flag. ;; 2006/08/27 dadams ;; Bind Quit in Minibuf menu to icicle-abort-minibuffer-input. ;; 2006/08/22 dadams ;; icicle-save-or-restore-input: If icicle-last-completion-candidate is nil, don't try to restore. ;; 2006/08/18 dadams ;; icicle-minibuffer-setup: Reset icicle-last-completion-candidate to nil. ;; icicle-rebind-completion-maps: ;; Added icicle-Info-goto-node to icicle-completion-help-string. ;; 2006/08/15 dadams ;; icicle-(bind|restore)-completion-keys: ;; Bind icicle-help-on-(previous|next)-(apropos|prefix)-candidate. ;; Reorder bindings. Bind C-mouse-2 to 'ignore, not nil. ;; icicle-rebind-completion-maps: Bind icicle-help-on-* in completion-list-mode-map. ;; Added: icicle-barf-if-outside-Completions-and-minibuffer. ;; 2006/08/13 dadams ;; icicle-completing-read, icicle-read-file-name: Use icicle-completing*-prompt-prefix. ;; 2006/08/04 dadams ;; icicle-call-then-update-Completions: ;; Call icicle-last-completion-command, not just prefix or apropos (so prefix-word too). ;; icicle-completing-read, icicle-read-file-name, icicle-next-candidate, ;; icicle-recompute-candidates, icicle-call-then-update-Completions: ;; Use icicle-remove-Completions-window. ;; icicle-(bind|restore)-completion-keys: Bound icicle-pp-eval-expression to M-:. ;; 2006/08/03 dadams ;; icicle-completion-setup-function: Removed useless highlighting code at end (Emacs 20). ;; icicle-rebind-completion-maps: Updated icicle-completion-help-string. ;; 2006/07/30 dadams ;; icicle-call-then-update-Completions: save match-data. ;; 2006/07/29 dadams ;; icicle-activate-mark: Do it only if icicle-completing-p. Thx to Le Wang. ;; icicle-rebind-completion-maps: ;; Updated to use icicle-dispatch-C-.. ;; Added icicle-toggle-search-cleanup to icicle-completion-help-string. ;; icicle-bind-completion-keys: ;; Use icicle-dispatch-C-. instead of icicle-toggle-ignored-extensions. ;; 2006/07/28 dadams ;; icicle-longest-common-match: Treat special case of input such as "$" or "\\>$". ;; 2006/07/24 dadams ;; icicle-call-then-update-Completions: Deactivate mark at the end. Thx to Le Wang. ;; 2006/07/23 dadams ;; Added: icicle-transform-candidates. ;; icicle-rebind-completion-maps, icicle-(bind|restore)-completion-keys: ;; Added icicle-toggle-transforming. ;; icicle-unsorted(-file-name)-*-candidates: Use icicle-transform-candidates. ;; 2006/07/20 dadams ;; Renamed icicle-arrows-respect-* to icicle-cycling-respects-completion-mode-flag. ;; 2006/07/19 dadams ;; Applied patch from Damien Elmes : ;; Added icicle-insert-help-string, icicle-start-of-completions (factored from existing). ;; icicle-completion-setup-function: Use icicle-insert-help-string. ;; icicle-display-candidates-in-Completions: ;; Use icicle-start-of-completions, and adjust loop accordingly. ;; icicle-minibuffer-setup: ;; Reset icicle-current-completion-type. ;; Bind (up|down) to icicle-*-context-candidate, not (previous|next)-history-element. ;; icicle-next-candidate: Use icicle-start-of-completions. ;; icicle-scroll-or-update-Completions: Use icicle-scroll-completions. ;; Renamed: icicle-start-of-completions to icicle-start-of-candidates-in-Completions, ;; icicle-insert-help-string to icicle-insert-Completions-help-string, ;; icicle-current-completion-type to icicle-current-completion-mode, ;; icicle-*-context-candidate to icicle-(next|previous)-candidate-per-mode, ;; icicle-scroll-completions to icicle-scroll-Completions. ;; icicle-minibuffer-setup: ;; Replaced icicle-display-Completions with icicle-prefix-complete, to get initial ;; highlight. ;; 2006/07/18 dadams ;; icicle-call-then-update-Completions: ;; Delete *Completions* window, depending on icicle-Completions-display-min-input-chars. ;; Thx to Damien Elmes. ;; icicle-rebind-completion-maps: Add icicle-toggle-case-sensitivity to help list. ;; icicle-bind-completion-keys: Bind icicle-toggle-case-sensitivity to S-C-a (i.e. C-A). ;; 2006/07/17 dadams ;; icicle-call-then-update-Completions: sit-for delay if no candidates. Thx Damien Elmes. ;; 2006/07/09 dadams ;; icicle-save-or-restore-input: ;; Put back test: current input differs from last cycling candidate (user has edited it). ;; icicle-next-candidate: Removed filtering with predicate (vestigial cruft). ;; 2006/07/08 dadams ;; icicle-save-or-restore-input: Restore if currently cycling, not if not completing. ;; 2006/07/07 dadams ;; icicle-display-candidates-in-Completions: Fixed test for historical candidate. ;; Bound icicle-alternative-sort to M-,. Updated icicle-completion-help-string. ;; 2006/07/05 dadams ;; icicle-save-or-restore-input: ;; For restoring: 1) No longer test if current input = *-last-completion-candidate. ;; 2) No longer test if current input = icicle-initial-value. ;; No longer save icicle-current-input as icicle-last-completion-candidate. ;; Simplified the code. ;; icicle-call-then-update-Completions: Do not set this-command or last-command. ;; Renamed: icicle-current-regexp-input to icicle-current-raw-input. ;; 2006/07/04 dadams ;; icicle-unsorted(-file-name)-prefix-candidates: Update icicle-common-match-string. ;; icicle-unsorted-file-name-prefix-candidates: ;; If prefix matches an empty directory, then use that directory as the sole completion. ;; icicle-next-candidate: Use icicle-*-cycling-command properties. ;; Removed regexp-p arg in calls to icicle-save-or-restore-input. ;; icicle-save-or-restore-input: ;; Update icicle-common-*-string and icicle-current-regexp-input even if not regexp-p. ;; Removed optional regexp-p argument. ;; Do not update icicle-last-completion-candidate. ;; Use icicle-*-*ing-command properties. ;; icicle-recompute-candidates: Use icicle-*-cycling-command properties. ;; 2006/07/03 dadams ;; Bug fixes - ;; icicle-next-candidate: ;; Don't reset icicle-common-match-string if this is an apropos cycling command ;; and last command was an apropos command (cycling or completing). ;; Do icicle-save-or-restore-input a second time, after recompute candidates, ;; to pick up the common match. ;; Always pass icicle-current-input to icicle-place-cursor. ;; icicle-save-or-restore-input: ;; Don't do anything if last command was a cycling command. ;; Don't save input as regexp for C-l if this command is a cycling command, ;; unless it is the first or it follows a completion command. ;; 2006/07/02 dadams ;; icicle-place-cursor: position point & mark at least past prompt. Thx to Peter Povinec. ;; 2006/06/09 dadams ;; icicle(-file-name)-(apropos|prefix)-candidates: Reset icicle-candidate-nb to nil. ;; icicle-recompute-candidates: Don't reset icicle-candidate-nb to nil. ;; icicle-place-cursor: Prevent error on search-forward. ;; 2006/06/08 dadams ;; icicle-save-or-restore-input: Do not restore if current command is completion. ;; Added: icicle-expand-file-name. ;; icicle-next-candidate: Don't pass NTH arg to icicle-display-candidates-in-Completions. ;; 2006/06/06 dadams ;; icicle-control-reminder-prompt: condition-case, since it's on kill-emacs-hook. ;; 2006/06/01 dadams ;; icicle-read-from-minibuffer: Emacs 22 removed the keep-all arg it had added. ;; 2006/05/31 dadams ;; icicle-barf-if-outside*: Simplified. ;; 2006/05/30 dadams ;; Bind icicle-erase-minibuffer-or-history to M-k also in non-completion minibuffer maps. ;; 2006/05/26 dadams ;; Bind icicle-erase-minibuffer-or-history to M-k. ;; Do not remap (or unmap) kill-sentence (it is on M-k in global map). ;; 2006/05/19 dadams ;; Added: icicle-control-reminder-prompt. ;; icicle-reminder-*-flag, icicle-read-file-name: Treat new values of icicle-reminder*. ;; Renamed icicle-inhibit-reminder* to icicle-reminder*. ;; 2006/05/16 dadams ;; icicle-recompute-candidates: Add new saved-last-input arg (replaces icicle-last-input). ;; icicle-next-candidate: Pass saved old last input to icicle-recompute-candidates. ;; 2006/05/15 dadams ;; Reverted change to icicle-unsorted(-file-name)-apropos-candidates, ;; icicle-display-Completions: Use icicle-completion-nospace-flag, not nil. ;; Renamed: icicle-completion-nospace-flag to icicle-ignore-space-prefix-flag. ;; icicle-toggle-incremental-completion: C-#, icicle-toggle-ignored-space-prefix: C-^. ;; 2006/05/13 dadams ;; icicle-unsorted(-file-name)-apropos-candidates, icicle-display-Completions: ;; Use nil, not icicle-completion-nospace-flag. ;; 2006/05/12 dadams ;; icicle-completion-help-string: Added faces and commands. Cleanup. ;; Moved from icicles-cmd.el: icicle-barf-if-outside-*. ;; 2006/05/09 dadams ;; icicle-display-*: Only issue Displaying... message when more candidates than threshold. ;; 2006/05/01 dadams ;; icicle-save-or-restore-input: No-restore test is non-nil, not non-"", icicle-last-input. ;; icicle-minibuffer-setup: Reset icicle-last-input to nil, not "". ;; icicle-next-candidate: Highlight initial whitespace before underline root. ;; 2006/04/28 dadams ;; icicle-save-or-restore-input: ;; Restore empty input if it is not a file name. ;; Don't expand empty common-match-string file-name input (it would lose trailing /). ;; Added: icicle-highlight-initial-whitespace. ;; icicle-next-candidate, icicle-call-then-update-Completions: ;; Use icicle-highlight-initial-whitespace. ;; 2006/04/14 dadams ;; icicle-call-then-update-Completions: Call icicle-update-input-hook. ;; Bound icicle-insert-string-from-variable to C-=. Update icicle-completion-help-string. ;; 2006/04/09 dadams ;; icicle-bind-completion-keys, icicle-minibuffer-setup: ;; Deal with icicle-arrows-respect-completion-type-flag. ;; icicle-display-candidates-in-Completions: ;; Bug fix: regexp-quote common match when highlighting it. ;; icicle-clear-minibuffer: Remove interactive spec. ;; Moved to icicles-cmd.el: icicle-customize-apropos*, icicle-repeat-complex-command. ;; 2006/04/02 dadams ;; Bound icicle-toggle-regexp-quote. ;; 2006/03/31 dadams ;; icicle-next-candidate: ;; Apply icicle-place-cursor to icicle-current-regexp-input if regexp-p. ;; icicle-save-or-restore-input: ;; Don't set icicle-current-regexp-input if this is a next-candidate action. ;; 2006/03/27 dadams ;; icicle-place-overlay: Made generic: added args overlay, face, buffer, properties. ;; 2006/03/25 dadams ;; icicle-call-then-update-Completions: Corrected use of icicle-incremental-completion*. ;; 2006/03/24 dadams ;; Renamed icicle-expand-input-to-common-match to icicle-longest-common-match. Rewrote it. ;; icicle-call-then-update-Completions: ;; Use icicle-incremental-completion-delay and -threshold. ;; Mapped icicle-delete-char. ;; 2006/03/23 dadams ;; icicle-expand-input-to-common-match: ;; Return the longest common match. Don't set icicle-common-match-string here. ;; icicle-unsorted-*apropos-candidates: Set icicle-common-match-string here explicitly. ;; Added: icicle-maybe-sort-and-strip-candidates. Use in icicle-candidate-set-1. ;; 2006/03/22 dadams ;; icicle-display-candidates-in-Completions: ;; Removed root arg (always use icicle-current-input). ;; Always highlight normal match part. ;; Highlight common-match part if icicle-expand-input-to-common-match-flag. ;; icicle-save-or-restore-input: ;; Update regexp even if not icicle-expand-input-to-common-match-flag. ;; icicle-recompute-candidates: If no candidates, then delete *Completions* window. ;; icicle-next-candidate: Set default-directory only if icicle-file-name-input-p. ;; Applied renamings of icicle-match-* faces. ;; 2006/03/21 dadams ;; icicle-expand-input-to-common-match: ;; Bug fixes: ;; If no overlap between first and second candidates, then no common match. ;; If no match with another candidate, then no common match. ;; Input must match computed common match. ;; When checking others, check only the added (pre|suf)fix, and reduce those as needed. ;; icicle-save-or-restore-input: ;; Bug fixes: ;; When icicle-expand-input-to-common-match-flag, expand using directory from the ;; input, not the default-directory. Thx to cacher3.ericsson.net for report. ;; Do test for case-only difference only when case-fold-search. ;; If input is a directory (with slash), then use it as is. ;; Save icicle-current-regexp-input if no icicle-common-match-string too. ;; icicle-display-candidates-in-Completions: Use icicle-common-match-highlight-Completions. ;; 2006/03/20 dadams ;; icicle-save-or-restore-input: Set icicle-current-regexp-input too. ;; Corrected letter-case test. ;; 2006/03/19 dadams ;; Added: icicle-expand-input-to-common-match. ;; icicle-unsorted*-apropos-candidates: ;; Set icicle-common-match-string if icicle-expand-input-to-common-match-flag. ;; icicle-save-or-restore-input: ;; Added regexp-p arg. Update input to icicle-common-match-string if appropriate. ;; icicle-next-candidate: Reset icicle-common-match-string. ;; 2006/03/17 dadams ;; icicle-file-(read|writ)able-p: Put non-empty string condition first. ;; Added: icicle-delete-whitespace-from-string. ;; icicle-files-within: Moved here from icicle-cmd.el. ;; 2006/03/14 dadams ;; Removed: icicle-reset-icicle-completing-p. ;; icicle-completing-read, icicle-read-file-name: Removed icicle-icicle-completing-p. ;; icicle-display-*: Added Displaying... message. ;; 2006/03/13 dadams ;; Added: icicle-file-(read|writ)able-p. Bound them to C-{ and C-} in minibuffer. ;; icicle-rebind-completion-maps, icicle-bind-completion-keys: Added the new commands. ;; icicle-recompute-candidates: Forgot icicle-keep-only-past-inputs in other branch. ;; 2006/03/10 dadams ;; icicle-save-or-restore-input: Bug fix (thx Toby Cubitt) - Not relative to default dir. ;; Use directory-file-name, so don't include /. ;; Use file-name-nondirectory, not file-relative-name if not cycling into subdirs. ;; Renamed icicle-minibuffer-contents to icicle-minibuffer-contents-from-minibuffer. ;; Added new icicle-minibuffer-contents, which can be called outside minibuffer. ;; 2006/03/08 dadams ;; icicle-place-overlay: Use new face, icicle-current-candidate-highlight. ;; 2006/03/05 dadams ;; Bound icicle-toggle-incremental-completion to C-^ in minibuffer. ;; Updated icicle-completion-help-string with C-^ binding. ;; icicle-display-candidates-in-Completions: ;; Allow for on-the-fly changes to icicle-incremental-completion-flag. ;; 2006/03/01 dadams ;; Added: icicle-clear-minibuffer. Use in icicle-next-candidate. ;; 2006/02/27 dadams ;; icicle-call-then-update-Completions: Set last-command to fn arg. ;;;(@* "CHANGE LOG FOR `icicles-mac.el'") ;; ;; **************************************************************************************************** ;; NOTE: If you byte-compile Icicles (recommended), then WHENEVER `icicles-mac.el' is updated, you ;; must load `icicles-mac.el' (not just `icicles-mac.elc'), then compile it, then RECOMPILE *ALL* ;; of the other Icicles source files as well. This is normal for Lisp: code that depends on ;; macros needs to be byte-compiled anew after loading the updated macros. ;; **************************************************************************************************** ;; ;; 2013/04/17 dadams ;; icicle-buffer-bindings: For icicle-bufflist: use icicle-buffer-prefix-arg-filtering. ;; 2013/04/15 dadams ;; icicle-buffer-bindings: (New) C-u C-u C-u means invisible buffers only. ;; 2013/03/31 dadams ;; icicle-buffer-bindings: (New) C-u C-u means visible buffers only. ;; 2013/03/07 dadams ;; Added: icicle-user-error. ;; icicle-define(-search)-bookmark-command(-1): Use icicle-user-error. ;; 2013/01/26 dadams ;; icicle-define-file-command: Ensure non-nil icicle-last-input before apply directory-file-name. ;; 2012/12/06 dadams ;; Removed minibuffer-with-setup-hook - moved to icicles-fn.el (and removed eval-when-compile). ;; 2012/12/01 dadams ;; Moved to icicles-opt.el: icicle-kbd, icicle-edmacro-parse-keys, icicle-read-kbd-macro. ;; 2012/10/08 dadams ;; icicle-define-sort-command: alphabetically -> alphabetical in doc string. ;; 2012/10/06 dadams ;; Added: minibuffer-with-setup-hook for code byte-compiled using Emacs < 22. ;; 2012/10/04 dadams ;; icicle-define-file-command: ;; When call expand-file-name, wrap i-last-input with directory-file-name, to use parent dir. ;; 2012/09/28 dadams ;; naked-edmacro-parse-keys: ;; Better fix for M-TAB. Do not assume that function keys are lowercase. ;; Handle angle brackets even if ANGLES is nil. But keep vanilla bug #12535 if non-nil. ;; 2012/09/27 dadams ;; icicle-edmacro-parse-keys: Fix handling of M-TAB. Function keys are lowercase. ;; So M-TAB returns [134217737], but M-tab returns [M-tab]. ;; 2012/09/24 dadams ;; icicle-file-bindings: Pass non-nil NO-ERROR-P arg to icicle-describe-file. ;; 2012/09/11 dadams ;; icicle-buffer-bindings: Remove minibuffers from icicle-bufflist. ;; 2012/09/08 dadams ;; icicle-buffer-bindings: ;; Bind icicle-buffer-complete-fn to internal-complete-buffer for Emacs 22+. ;; Bind icicle-buffer-name-input-p to t. ;; Remove bindings of icicle-ignore-space-prefix-flag and bufflist. ;; (bufflist used icicle-ignore-space-prefix-flag to remove SPC buffers.) ;; icicle-define-command: ;; If icicle-buffer-name-input-p then use icicle-read-buffer (it is new), not completing-read. ;; 2012/07/24 dadams ;; icicle-buffer-bindings: If icicle-ignore-space-prefix-flag & VANILLA then remove internal bufs. ;; 2012/07/19 dadams ;; icicle-buffer-bindings: Positive prefix arg now includes Dired buffers, along with file bufs. ;; 2012/07/05 dadams ;; Removed #' from lambdas. ;; 2012/04/22 dadams ;; icicle-buffer-bindings: C-u keeps only derived-mode buffers. ;; Use backquote for lambda to handle free var THIS-MODE. ;; 2012/03/10 dadams ;; icicle-define-bookmark-command-1, icicle-define-search-bookmark-command: ;; First code, last code: When autofile, call icicle-(un)bind-file-candidate-keys. ;; Use icicle-make-bookmark-candidate (new) to define icicle-candidates-alist. ;; Bind icicle-full-cand-fn to icicle-make-bookmark-candidate, for icicle-autofile-action. ;; 2012/01/20 dadams ;; icicle-define-bookmark-command-1: Added info about refreshing tags to doc string of tags cmds. ;; 2011/11/27 dadams ;; icicle-define-bookmark-command-1: ;; Calculate the alist first, before binding things like icicle-list-use-nth-parts, that are ;; inappropriate for the completing-read used to define the alist (in specific-file|buffer case). ;; 2011/10/21 dadams ;; icicle-define-sort-command: Use icicle-propertize. ;; 2011/10/12 dadams ;; Moved the Miscellaneous stuff to icicles.el: indent & font-lock for macros etc. ;; eval-when-compile require cl.el, even for later Emacs versions (incf). ;; 2011/10/10 dadams ;; Removed all autoload cookies. ;; Moved icicle(-search)-define-bookmark*-command* here from icicles-cmd2.el. ;; icicle-byte-compile-eval-after-load-flag: Moved to icicles.el. ;; icicle-maybe-byte-compile-after-load: Moved to icicles-face.el and icicles-cmd2.el. ;; icicle-try-switch-buffer, select-frame-set-input-focus: Moved to icicles-fn.el. ;; icicle-assoc-delete-all, icicle-remove-if: Copied to icicles-fn.el. ;; 2011/10/08 dadams ;; Added: icicle-kbd ;; Moved here from icicles-cmd2.el: icicle-read-kbd-macro, icicle-edmacro-parse-keys. ;; icicle-read-kbd-macro: Changed NO-ANGLES to ANGLES, and made it the prefix arg. ;; icicle-edmacro-parse-keys: Changed NO-ANGLES to ANGLES. Updated to match Emacs 24. ;; Changed regexp for non-angles match to use non-whitespace. ;; Use characterp or char-valid-p, depending on Emacs version. ;; 2011/09/08 dadams ;; font-lock-add-keywords - Use font-lock-keyword-face for icicle-condition-case-no-debug. ;; 2011/08/27 dadams ;; icicle-condition-case-no-debug: Redefined so it respects debug-on-quit and keeps other handlers. ;; 2011/08/24 dadams ;; Added top-level puts for common-lisp-indent-function. ;; icicle-condition-case-no-debug, icicle-with-selected-window: Removed declare declaration. ;; 2011/08/22 dadams ;; icicle-maybe-byte-compile-after-load: Require bytecomp.el. ;; font-lock-add-keywords: Quote font-lock-function-name-face, for Emacs 20. ;; 2011/08/21 dadams ;; Added: icicle-condition-case-no-debug. Thx to Michael Heerdegen. ;; icicle-define(-file)-command: Use icicle-condition-case-no-debug. ;; 2011/08/16 dadams ;; Added: icicle-maybe-byte-compile-after-load, icicle-byte-compile-eval-after-load-flag. ;; icicle-(buffer|file)-bindings: Use append, not backquote syntax. ;; 2011/08/12 dadams ;; icicle-file-bindings: Removed binding of icicle-ignore-space-prefix-flag (to *-buffer-ignore-*). ;; 2011/05/22 dadams ;; icicle-define(-file)-command: Use #',FUNCTION instead of ',FUNCTION. ;; icicle-with-selected-window, icicle-(buffer|file)-bindings: ;; Use #' with lambdas (not really needed). ;; 2011/05/03 dadams ;; icicle-buffer-bindings, icicle-file-bindings: ;; Had to revert definition for Emacs > 20, but keep it for Emacs 20. Thx to Michael Heerdegen. ;; 2011/04/29 dadams ;; icicle-buffer-bindings, icicle-file-bindings: ;; Do not bind icicle-sort-comparer. Instead, set it the first time ;; (per icicle-(buffer|file)-sort-first-time-p). ;; No side effects to icicle-sort-orders-alist. ;; If icicle-(buffer|file)-sort is non-nil then put it at the beginning. ;; Use old backquote syntax for post-bindings - needed because of vanilla Emacs 20 bug. ;; 2011/04/25 dadams ;; icicle-file-bindings: Bind icicle-candidate-help-fn to icicle-describe-file w/ curr pref arg. ;; 2011/04/12 dadams ;; icicle-buffer-bindings, icicle-file-bindings: Added optional POST-BINDINGS arg. ;; 2011/04/02 dadams ;; icicle-buffer-bindings: Bind (new) icicle-bufflist, not bufflist. ;; 2011/03/29 dadams ;; Renamed: orig-(buff|window) to icicle-orig-(buff|window). ;; 2011/01/17 dadams ;; Require cl.el at compile time for Emacs 20. ;; 2011/01/06 dadams ;; icicle-buffer-bindings: Zero prefix arg limits candidates to buffers with same mode as current. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; icicle-assoc-delete-all: Moved here from icicles-fn.el, since used here. ;; Added autoload cookies. ;; 2010/10/25 dadams ;; icicle-(buffer|file)-bindings: ;; Use icicle-must-pass-after-match-predicate, not icicle-must-pass-predicate ;; 2010/10/09 dadams ;; icicle-define(-file)-command: Update generated doc: down/up for modal, end/home for prefix. ;; 2010/06/05 dadams ;; icicle-file-bindings: Put back non-insertion for non-ido-like case. ;; 2010/06/04 dadams ;; icicle-(buffer|file)-bindings: Bind vars that depend on icicle-(buffers|files)-ido-like-flag. ;; 2010/03/03 dadams ;; Applied renamings: icicle-sort-function to icicle-sort-comparer, ;; icicle-sort-functions-alist to icicle-sort-orders-alist. ;; 2009/12/21 dadams ;; fset -> defalias. ;; 2009/12/13 dadams ;; icicle-define-sort-command: Add REVERSED to msg if reversed. ;; 2009/10/22 dadams ;; icicle-define-file-command: Use icicle-file-name-directory, not file-name-directory. ;; 2009/09/17 dadams ;; Added: icicle-file-bindings. ;; 2009/09/16 dadams ;; Added: icicle-buffer-bindings. ;; icicle-define(-file)-command: Macroexpand bindings, (e.g. to use icicle-buffer-bindings). ;; 2009/04/28 dadams ;; Moved icicle-choose-action-for-type to icicles-fn.el and changed to a function. ;; 2009/04/26 dadams ;; Added: icicle-choose-action-for-type, icicle-with-selected-window. ;; 2008/08/31 dadams ;; icicle-define(-file)-command: Select window before call select-frame-set-input-focus. ;; 2008/08/18 dadams ;; icicle-try-switch-buffer: Do nothing if icicle-inhibit-try-switch-buffer is non-nil. ;; Use renaming from icicles-fn.el: icicle-complete-again-update. ;; 2008/03/29 dadams ;; icicle-define(-file)-command: Do not call icicle-highlight-lighter. ;; 2008/03/09 dadams ;; icicle-define(-file)-command: Call icicle-highlight-lighter. ;; 2007/11/25 dadams ;; icicle-define(-file)-command: ;; Bound minibuffer variables, so they are restored after action function ;; (in case it uses minibuffer for completion). ;; Return nil after, not before select-frame-set-input-focus. ;; Added optional arg not-interactive-p. ;; Quiet the byte compiler for Emacs versions before 22. ;; 2007/10/14 dadams ;; icicle-define(-file)-command: ;; Updated generated doc to reflect icicle-act-before-cycle-flag. ;; 2007/05/01 dadams ;; icicle-define(-file)-command: Reset icicle-candidate-action-fn after reading input. ;; 2007/04/15 dadams ;; icicle-define(-file)-command: ;; Simplified action fn: Removed unwind-protect and outer condition-case, ;; so don't return error msg now, and only set minibuf focus if succeed. ;; icicle-define(-file)-command, icicle-try-switch-buffer: Removed "%s" from handlers. ;; 2007/02/06 dadams ;; icicle-define(-file)-command: Mention mouse bindings in command doc strings. ;; 2007/01/15 dadams ;; Added: icicle-define-sort-command. ;; Updated font-lock-add-keywords. Added lisp-indentation-hack (commented out). ;; 2007/01/06 dadams ;; font-lock-add-keywords: 2 or 3, not 1 or 2, is index after add icicle-define-add-to-*. ;; Use lax matching, so no error if no match. ;; 2007/01/01 dadams ;; Added: icicle-define-add-to-alist-command. ;; Removed compile-time require of icicles-var.el. ;; font-lock-add-keywords: ;; "\\>[ \t'\(]*\\(\\sw+\\)?", not "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)". ;; Added icicle-define-add-to-alist-command. ;; 2006/10/14 dadams ;; Require icicles-var.el. ;; Moved conditional eval-when-compile to top level. ;; 2006/09/24 dadams ;; icicle-define(-file)-command: Corrected bindings mentioned in doc strings. ;; 2006/08/27 dadams ;; icicle-define(-file)-command: Ensure orig-window is live before using it. ;; 2006/08/23 dadams ;; Added: icicle-try-switch-buffer. Use it in icicle-define(-file)-command. ;; 2006/08/03 dadams ;; icicle-define(-file)-command: ;; (error (error-message-string...)) -> (error "%s" (error-message-string...)). ;; 2006/05/16 dadams ;; icicle-define(-file)-command: Treat cases where user wiped out orig-buff or orig-window. ;; 2006/03/31 dadams ;; icicle-define(-file)-command: Wrap action fn in unwind-protect to select minibuf frame. ;; 2006/03/11 dadams ;; icicle-define-file-command: Expand file in directory of icicle-last-input. ;; 2006/03/08 dadams ;; icicle-define(-file)-command: Bug fix (thx to TobyCubitt): ;; Make sure icicle-candidate-action-fn runs FUNCTION in original buffer and window. ;; 2006/03/07 dadams ;; icicle-define(-file)-command: Mention in doc string that BINDINGS are not in effect ;; within icicle-candidate-action-fn. ;;;(@* "CHANGE LOG FOR `icicles-mcmd.el'") ;; ;; 2013/04/18 dadams ;; icicle-(un)bind-buffer-candidate-keys: ;; Rewrote to use (new) option icicle-buffer-candidate-key-bindings. ;; 2013/04/08 dadams ;; icicle-choose-completion: Added version for Emacs 23.2+. Return completion number now. ;; icicle-mouse-choose-completion: Do not define for Emacs 23.2+ (uses icicle-choose-completion). ;; 2013/04/01 dadams ;; Added: icicle-top-level. ;; 2013/03/31 dadams ;; Added: icicle-(keep-only|remove|keep/remove)-buffer-cands-for-visible. ;; icicle-(un)bind-buffer-candidate-keys: Bind/unbind C-x v +/-. ;; 2013/03/26 dadams ;; icicle-candidate-set-complement: ;; When icicle-must-pass-predicate, e.g., after narrowing, filter display candidates using it. ;; Added code from icicle-candidate-set-retrieve-1 to recomplete (can cycle immediately etc.). ;; 2013/03/16 dadams ;; icicle(-complete-and)-(widen|narrow)-candidates, icicle-regexp-quote-input: ;; Put properties icicle(-apropos)-completing-command. ;; 2013/03/07 dadams ;; Updated to use icicle-user-error where appropriate. ;; icicle(mouse)-choose-completion: Added live-buffer test, per Emacs 24. ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/02/03 dadams ;; Added: icicle-isearch-history-complete, icicle-isearch-history-insert. ;; Moved here from icicles-fn.el: icicle-isearch-complete-past-string. ;; 2013/01/30 dadams ;; icicle-insert-history-element: Do not clear minibuffer. ;; icicle-multi-inputs-act: Raise error if no action function defined. ;; 2013/01/26 dadams ;; Added: icicle-multi-inputs-save (to be bound to M-S), icicle-roundup (to be bound to M-r), ;; icicle-multi-inputs-act (to be bound to M-R), icicle-insert-candidate-action, ;; icicle-split-input. ;; icicle-insert-history-element: Define as a multi-command. ;; icicle-insert-candidate-action: Do nothing if CAND is nil or "". ;; icicle-help-string-(non-)completion: Updated for new commands/keys. ;; 2013/01/11 dadams ;; icicle-help-string(-non)-completion: Removed M-s, M-r. ;; 2013/01/06 dadams ;; icicle-autofile-action: Updated calls to bmkp-*, to add nil NO-UPDATE-P argument. ;; 2013/01/05 dadams ;; Added: icicle-file-all-tags-narrow, icicle-file-all-tags-regexp-narrow, ;; icicle-file-some-tags-narrow, icicle-file-some-tags-regexp-narrow, ;; icicle-(un)bind-(buffer|file)-candidate-keys: Factored. ;; icicle-(un)bind-file-candidate-keys: Added: *-file-(all|some)-tags(-regexp)-narrow. ;; icicle-remove-cand-from-lists, icicle-narrow-candidates-with-predicate: ;; Handle Emacs > 23.1 correctly: it no longer uses read-file-name-predicate. ;; 2013/01/01 dadams ;; icicle-change-sort-order: completion--flush-all-sorted-completions, so Icomplete+ updates order. ;; 2012/12/31 dadams ;; icicle-successive-action, icicle-insert-completion, icicle-candidate-set-retrieve-1, ;; icicle-keep-only-past-inputs: ;; Set icicle-mode-line-help instead of using icicle-show-help-in-mode-line. ;; icicle-insert-completion: Use icicle-current-completion-in-Completions and ;; icicle-nb-of-cand-at-Completions-pos only if in *Completions*. ;; icicle-(prefix|apropos)-complete-1: ;; Replace local var mode-line-help with icicle-mode-line-help. ;; Do not call icicle-show-help-in-mode-line (using icicle-post-command-hook now). ;; 2012/12/20 dadams ;; icicle-(prefix|apropos)-complete-1: Handle new option icicle-TAB/S-TAB-only-completes-flag. ;; 2012/12/15 dadams ;; icicle-narrow-candidates: ;; Rename current-candidates to icicle-cands-to-narrow (now a global var, but bound only here). ;; Bind icicle-narrow-regexp if icicle-compute-narrowing-regexp-p. ;; 2012/12/12 dadams ;; icicle-narrow-candidates: ;; Use icicle-must-pass-predicate, not icicle-must-pass-after-match-predicate. ;; Added a cond clause for function-valued minibuffer-completion-table other than file input. ;; icicle-apropos-complete-and-widen: Updated when condition wrt *-apropos-complete-and-narrow. ;; 2012/11/28 dadams ;; icicle-toggle-transforming: Rewrote to be more useful when both are useful functions. ;; 2012/11/08 dadams ;; icicle-digit-argument, icicle-successive-action, icicle-(prefix|apropos)-complete-1, ;; icicle-switch-to-Completions-buf, icicle-keep-only-past-inputs, ;; icicle-remove-buffer-cands-for-mode: ;; Use icicle-get-safe. ;; 2012/11/07 dadams ;; icicle-successive-action, icicle-(prefix|apropos)-complete-1, icicle-switch-to-Completions-buf: ;; Protect calls to get with symbolp. ;; 2012/10/27 dadams ;; Added: icicle-toggle-annotation. ;; icicle-help-string-completion: Added icicle-toggle-annotation. ;; icicle-toggle-transforming: Use new variable icicle-toggle-transforming-message. ;; 2012/10/22 dadams ;; icicle-(un)bind-buffer-candidate-keys: Remove soft-require conditions for C-x F and C-x R. ;; 2012/10/21 dadams ;; Added: icicle-toggle-include-cached-files, icicle-toggle-include-recent-files. ;; icicle-(un)bind-buffer-candidate-keys: ;; Bind icicle-toggle-include-(cached|recent)-files to C-x F and C-x R. ;; 2012/10/10 dadams ;; icicle-doremi-increment-max-candidates+: ;; C-u sets to RESET, not nil, so icicle-maybe-sort-maybe-truncate can reset lighter. ;; 2012/10/09 dadams ;; icicle-prefix-complete-1: When icicle-multi-completing-p and match join string, show warning. ;; 2012/10/05 dadams ;; icicle-(prefix|apropos)-complete-(1|2), icicle(-mouse)-candidate-action-1: ;; Removed setting of icicle-default-directory (unused). ;; 2012/10/02 dadams ;; Added: icicle-looking-at-p, icicle-looking-back-at-p. ;; Removed: icicle-looking(-back)-at-anychar-regexp-p. ;; icicle(-delete)-(forward|backward)(-delete)-char(-untabify)-dots, icicle-transpose-chars-dots: ;; Rewrote and renamed *-dots to *-magic, to handle join string too. ;; 2012/09/24 dadams ;; Added: icicle-sort-by-last-file-access-time. ;; icicle-describe-file: Added optional arg NO-ERROR-P. ;; icicle-current-sort-functions: Use file comparison also if icicle-abs-file-candidates. ;; icicle-help-on-candidate(-symbol): Pass non-nil NO-ERROR-P arg to icicle-describe-file. ;; 2012/09/17 dadams ;; icicle(-help-on)-(next|previous)-(prefix-|apropos-)candidate(-per-mode)((-alt)-action|-help): ;; NTH is prefix arg. Plain C-u means use first candidate. ;; icicle-(next|previous)-line: ;; Move to (next|previous) line when CURR-COL is 1 (fixes bug for multi-line candidates). ;; 2012/09/08 dadams ;; icicle-dispatch-M-_: Call icicle-toggle-ignored-space-prefix normally, not interactively. ;; icicle-help-string-completion: *-buffer-ignore-space-prefix-flag, not *-ignore-space-prefix*. ;; icicle-candidate-set-complement: ;; Ensure icicle-buffer-name-input-p to pass icicle-buffer-ignore-space-prefix-flag arg. ;; icicle-toggle-ignored-space-prefix: Removed optional arg BUFFER-INSTEAD-P. ;; It now toggles icicle-buffer-ignore-space-prefix-flag, not icicle-ignore-space-prefix-flag. ;; 2012/09/06 dadams ;; Use icicle-string-match-p. ;; 2012/09/03 dadams ;; icicle-history: Let first TAB or S-TAB cycle, depending on icicle-default-cycling-mode. ;; Put properties icicle(-prefix|-apropos)-completing-command on it. ;; Set icicle-last-completion-command per icicle-default-cycling-mode. Use instead of apropos. ;; Do not set last-command to icicle-history. ;; 2012/09/02 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Non-nil icicle-show-Completions-initially-flag means consider this is the second (S-)TAB. ;; 2012/08/27 dadams ;; icicle-make-directory: ;; Use (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)) as default dir-name. ;; 2012/08/21 dadams ;; icicle-resolve-file-name: Call tap-put-thing-at-point-props after load thingatpt+.el. ;; 2012/08/18 dadams ;; icicle-resolve-file-name: Call tap-define-aliases-wo-prefix. ;; bounds-of-thing-at-point -> icicle-bounds-of-thing-at-point. ;; 2012/08/14 dadams ;; icicle-abort-recursive-edit: Call 1on1-fit-minibuffer-frame. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-choose-completion, icicle-ORIG-exit-minibuffer, ;; icicle-ORIG-minibuffer-complete-and-exit, icicle-ORIG-mouse-choose-completion, ;; icicle-ORIG-next-history-element, icicle-ORIG-sit-for, icicle-ORIG-switch-to-completions. ;; 2012/08/05 dadams ;; icicle-exit-minibuffer: If no faces to keep then remove all faces (they are Icicles faces). ;; 2012/07/24 dadams ;; icicle-toggle-ignored-space-prefix: Added prefix arg, so you can toggle buffer option. ;; 2012/07/21 dadams ;; icicle-help-on-candidate(-symbol): If available, use describe-buffer for buffers. ;; 2012/07/17 dadams ;; Removed: icicle-maybe-byte-compile-after-load (macro), ;; icicle-byte-compile-eval-after-load-flag (option). ;; Removed all calls to icicle-maybe-byte-compile-after-load. ;; 2012/07/14 dadams ;; icicle-mouse-candidate-action-1: Fix for Emacs 24. Use code similar to i*-candidate-action-1: ;; Set icicle-last-input, not icicle-last-completion-candidate, to choice. ;; Update default-directory. Remove candidate only if choice = icicle-last-completion-candidate. ;; icicle-(prefix|apropos)-complete-1: Do not use icicle-transform-sole-candidate. ;; 2012/07/13 dadams ;; Added: icicle-toggle-network-drives-as-remote. ;; icicle-help-string-completion: Added icicle-toggle-network-drives-as-remote. ;; 2012/07/12 dadams ;; icicle-help-string-completion: Better representation of option values. ;; 2012/07/10 dadams ;; icicle-other-history: Updated doc - now available for any minibuffer input, not just completion. ;; 2012/07/02 dadams ;; Moved here (since loaded first) from icicles-cmd2.el: icicle-byte-compile-eval-after-load-flag. ;; 2012/06/29 dadams ;; icicle-current-sort-functions: Do not exclude if PRED is icicle-allowed-sort-predicate. ;; icicle-help-on-candidate-symbol: select-frame-set-input-focus after apropos-command regexp. ;; Removed #' from lambdas. ;; 2012/06/27 dadams ;; icicle-retrieve-previous-input: ;; icicle-highlight-initial-whitespace and icicle-place-cursor. ;; Update icicle-current-raw-input unconditionally, so can continue to cycle. ;; 2012/06/25 dadams ;; icicle-describe-file: Removed extra space in format line File Type. Thx to Christopher Schmidt. ;; 2012/06/24 dadams ;; icicle-previous-line: Hitting up key on 1st cand looped in vertical mode bc of extra \n at eob. ;; 2012/06/17 dadams ;; icicle-narrow-candidates: ;; Use read-file-name with icicle-must-pass-after-match-predicate for all Emacs Versions. ;; Thx to Michael Heerdegen. Use backquote+comma to eliminate free var in lambda. ;; 2012/06/09 dadams ;; icicle-choose-completion, icicle-nb-of-cand-in-Completions-horiz, icicle-insert-dot, ;; icicle-switch-to-Completions-buf, icicle-current-completion-in-Completions, ;; icicle-move-to-next-completion: ;; Use point-min if 1- point is less. ;; icicle-move-to-next-completion: ;; Adjust use of icicle-show-Completions-help-flag. Wrap when bobp. When wrap to end, back up ;; over final space, which has no mouse-face, else previous-single-property-change DTWT. ;; icicle-previous-line: Handle new behavior of nil icicle-show-Completions-help-flag. ;; 2012/06/08 dadams ;; Added macro icicle-maybe-byte-compile-after-load here too (for next). ;; icicle-yank-secondary: Use eval-after-load of second-sel.el instead of fboundp yank-secondary ;; (for arbitrary load order). Added icicle-maybe-byte-compile-after-load. ;; 2012/06/03 dadams ;; icicle-(next|previous)-(prefix|apropos)-candidate-action: ;; Put non-nil value on icicle-action-command, so M-x avoids key reminder for multi-command use. ;; 2012/05/22 dadams ;; icicle-help-on-candidate(-symbol): ;; Test with icicle-file-remote-p before file-exists-p, to avoid Tramp. ;; 2012/05/14 dadams ;; icicle-help-on-candidate: ;; Do not use transform multi-completion candidate before passiting it to *-candidate-help-fn. ;; 2012/05/13 dadams ;; icicle-candidate-set-save-1: Use icicle-saved-completion-candidates as default variable. ;; 2012/05/11 dadams ;; icicle-sit-for: Bind inhibit-quit to t so C-g is handled as icicle-abort-recursive-edit. ;; icicle-(prefix|apropos)-complete-1: ;; Set icicle-next-(prefix|apropos)-complete-cycles-p to t unconditionally (except for WORD-P). ;; 2012/04/22 dadams ;; Added: icicle-(un)bind-buffer-candidate-keys, ;; icicle-(remove|keep-only)-buffer-cands-for(-derived)-mode. ;; 2012/04/09 dadams ;; Changed last-command-char to last-command-event. ;; Fixed typos: double single-quotes in autoload cookies. ;; 2012/04/08 dadams ;; Make autoload cookies for commands load icicles[.el] explicitly. ;; 2012/03/31 dadams ;; Removed soft-require of pp+.el (not used directly, but used by icicles-opt.el if available). ;; 2012/03/28 dadams ;; Changed FILE arg in autoloads by removing .el, so .elc will be loaded if available. ;; 2012/03/10 dadams ;; icicle-autofile-action: ;; Bind/restore completion vars around reading tags. ;; Re-complete at end, instead of icicle-update-and-next, so can see updates. ;; icicle-mouse-candidate-action-1: ;; No need to call icicle-update-and-next if called icicle-remove-candidate-display-others. ;; 2012/02/28 dadams ;; Reverted last change - it broke completion (called from *-prefix-*). ;; Trying a thoughtless hack: If INPUT then do not recompute completions. ;; 2012/02/27 dadams ;; icicle-input-is-a-completion-p: If icicle-last-completion-candidate is nil, compute candidates. ;; Fix for bug: entering a candidate without hitting (S-)TAB. ;; 2012/02/14 dadams ;; icicle-candidate-set-save-1: ;; Distinguish in-minibuffer use from top-level use. Raise error if user cancels fileset create. ;; 2012/02/13 dadams ;; icicle-candidate-set-save-1, icicle-add-file-to-fileset: ;; Use (list ...), not '(...), so get a new cons cell. ;; 2012/02/11 dadams ;; Support for new values of icicle-expand-input-to-common-match (no expansion etc.). ;; Added: icicle-cycle-expand-to-common-match. ;; icicle-help-string-completion: Added icicle-cycle-expand-to-common-match. ;; icicle-retrieve-last-input: Handle both prefix (3) and apropos (4) incremental expansion. ;; icicle-(prefix|apropos)-complete-1: ;; Handle all cases of icicle-expand-input-to-common-match: 0,1 (display only) vs 2 vs 3,4. ;; icicle-toggle-expand-to-common-match: Swap with icicle-expand-input-to-common-match-alt (new). ;; Doc strings: Applied renamings and key changes. ;; icicle-widen-candidates, icicle-regexp-quote-input: ;; Do not turn off icicle-expand-input-to-common-match. Just bind it while apropos-complete. ;; icicle-widen-candidates: Remove directory from raw input (bug fix). ;; icicle-apropos-complete-and-narrow: Use function, not var, icicle-current-TAB-method (bug fix). ;; icicle-candidate-set-save-1: Prompt to create new fileset if fileset entered does not exist. ;; 2012/02/08 dadams ;; Renamed: icicle-add/remove-tags-and-refresh to icicle-autofile-action. ;; icicle-autofile-action: Handle create/set case too. not just add and remove. ;; icicle-(un)bind-file-candidate-keys: Bind C-x a a to icicle-autofile-action for create/set. ;; 2012/02/02 dadams ;; Added aliases: cycle-icicle-(incremental-completion|sort-order|(S)-TAB-completion-method). ;; icicle-apropos-complete-and-exit: Removed binding of icicle-expand-input-to-common-match-flag. ;; icicle-toggle-dot: Do not call icicle-barf-if-outside-minibuffer. ;; icicle-cycle-image-file-thumbnail, icicle-next-(S-)TAB-completion-method, ;; icicle-change-sort-order: ;; Minibuffer message mentions also the next (following) value. ;; 2012/01/31 dadams ;; icicle-retrieve-previous-input: ;; Do not invoke icicle-call-then-update-Completions when inserting. IOW, do not re-complete. ;; icicle-(prefix|apropos)-complete-1: Reverted change for sole-completion: Expand (complete) it. ;; icicle-apropos-complete-1, multi-match case for file names: ;; Do not apply icicle-file-name-directory to icicle-last-input if it is nil. ;; icicle-remove-cand-from-lists: Fixed for Emacs 22 file names: compare CAND with just MCT-CAND. ;; Fixed for Emacs 23+: use minibuffer-completion-predicate always. ;; 2012/01/27 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Reverted part of 2012-01-20 chg, for mult matches: it picked up mult keys hit with no delay. ;; 2012/01/24 dadams ;; Added: icicle-toggle-completions-format. ;; icicle-help-string-completion: Updated to add icicle-toggle-completions-format. ;; 2012/01/20 dadams ;; Renamed icicle-toggle-incremental-completion to icicle-cycle-incremental-completion. ;; icicle-apropos-complete-and-exit: ;; Bind icicle-expand-input-to-common-match-flag and icicle-prefix-complete-and-exit-p also. ;; Complete based on icicle-current-completion-mode, not just apropos. ;; Use icicle-candidates-alist if appropriate. ;; icicle-cycle-incremental-completion: cycle among t, nil, and always, instead of toggle t & nil. ;; icicle-retrieve-previous-input: Just use icicle-call-then-update-Completions. ;; icicle-(prefix|apropos)-complete-1: ;; When sole cand, icicle-edit-update-p and not icicle-expand-input-*, show cand in Completions. ;; icicle-apropos-complete-2: ;; Removed arg and setting it. Return input-sans-dir needed for setting real mode-line help. ;; 2012/01/19 dadams ;; icicle-prefix-complete-2: ;; Removed first arg and setting it. Return condition needed for setting real mode-line help. ;; icicle-prefix-complete-1: ;; Conditionally set mode-line help, using return value of icicle-prefix-complete-2. ;; 2012/01/17 dadams ;; icicle-mouse-choose-completion, icicle-mouse-candidate-action-1, icicle-mouse-remove-candidate, ;; icicle-current-completion-in-Completions: ;; No longer add back a newline if property icicle-keep-newline. Thx to Michael Heerdegen. ;; 2012/01/13 dadams ;; icicle-(un)bind-file-candidate-keys: Corrected to handle also minibuffer-local-must-match-map. ;; 2012/01/08 dadams ;; icicle-(prefix|apropos)-complete-1: Protect icicle-ido-like-mode with boundp for Emacs 20. ;; 2011/12/31 dadams ;; icicle-apropos-complete-1: Remove extra icicle-edit-update-p (typo) in condition. ;; 2011/12/29 dadams ;; Added: icicle-(prefix|apropos)-complete-2. ;; icicle-(prefix|apropos)-complete-1: ;; When completing initially or icicle-incremental-completion-flag is non-nil & non-t, expand ;; input to common match. ;; 2011/12/28 dadams ;; icicle-(prefix|apropos)-complete-1: ;; If icicle-ido-like-mode and icicle-top-level-when-sole-completion-flag do not throw to top ;; if sole candidate is a directory. ;; 2011/12/19 dadams ;; icicle-(next|previous)-line: Use line-end-position, not end-of-line + point. ;; 2011/12/15 dadams ;; icicle-keep-only-past-inputs: For file-name candidates, expand file names before comparing. ;; 2011/11/05 dadams ;; icicle-nb-Completions-cols: Ensure return value is at least 1. Thx to Michael Heerdegen. ;; 2011/10/21 dadams ;; icicle-all-candidates-action-1: Bind icicle-minibuffer-message-ok-p to non-nil for LISTP. ;; icicle-erase-minibuffer-or-history-element, icicle-(change|reverse)-sort-order, ;; icicle-toggle-(ignoring-comments|dot|WYSIWYG-Completions|~-for-home-dir|C-for-actions), ;; icicle-toggle-((-alternative)-sorting|angle-brackets|proxy-candidates|transforming), ;; icicle-toggle-(incremental-completion|expand-to-common-match|remote-file-testing), ;; icicle-toggle-(highlight-all-current|hiding-(common-match|non-matching-lines)), ;; icicle-toggle-(show-multi-completion|ignored-space-prefix|regexp-quote|literal-replacement), ;; icicle-toggle-(highlight-(historical|saved)-candidates|ignored-extensions), ;; icicle-toggle-search-replace-(common-match|whole-word)), ;; icicle-toggle-search-(cleanup|complementing-domain), icicle-toggle-case-sensitivity, ;; icicle-cycle-image-file-thumbnail, icicle-next(-S)-TAB-completion-method: ;; Use icicle-propertize. ;; icicle-toggle-dot: Barf if not in minibuffer. ;; 2011/10/18 dadams ;; icicle-(apropos|prefix)-complete-1: ;; Simplify sole-candidate case and correct it for nil *-expand-input-to-common-*. ;; Thx to Michael Heerdegen. ;; 2011/10/08 dadams ;; icicle-next-TAB-completion-method, icicle-read+insert-file-name, ;; icicle-(un)bind-file-candidate-keys: ;; Use icicle-kbd. ;; icicle-insert-key-description: Made it OK for Emacs 20 too. ;; icicle-toggle-angle-brackets: Added no-op message for Emacs 20. ;; icicle-mouse-candidate-action-1: Wrap icicle-help-on-candidate with with-current-buffer. ;; For key-completion cand, use current buffer if no i*-orig-buff. ;; 2011/09/21 dadams ;; icicle-(prefix|apropos)-complete-1: Use file-name-as-directory instead of concat with /. ;; 2011/09/09 dadams ;; icicle-switch-to-Completions-buf: ;; Do not set icicle-current-input to minibuffer content. Use that content sans dir, locally. ;; If icicle-candidate-nb is defined, use it: just call icicle-move-to-next-completion. ;; icicle-insert-completion: ;; Set icicle-last-completion-candidate to COMPLETION. ;; Set icicle-candidate-nb to icicle-nb-of-cand-at-Completions-pos (point). ;; Use icicle-insert-cand-in-minibuffer COMPLETION, not just insert of directory + COMPLETION. ;; Set icicle-last-input to icicle-current-input. Set icicle-cycling-p to t. ;; Call icicle-show-help-in-mode-line. ;; 2011/09/07 dadams ;; icicle-erase-minibuffer-or-history-element, icicle-prefix-complete-1, ;; icicle-apropos-complete(-1|-no-display), icicle-all-candidates-action-1, icicle-describe-file, ;; icicle-apply-to-saved-candidate, icicle-narrow-candidates(-with-predicate): ;; Use icicle-condition-case-no-debug instead of condition-case. Thx to Michael Heerdegen. ;; 2011/09/06 dadams ;; Added: icicle-resolve-file-name. ;; icicle-minibuffer-help: Call help-setup-xref, for back/forward buttons. ;; 2011/09/05 dadams ;; Added: icicle-dispatch-C-x., icicle-toggle-hiding-non-matching-lines. ;; icicle-help-string-completion: Added hiding no-match lines. Use icicle-dispatch-C-x.. ;; 2011/08/30 dadams ;; icicle-backward-delete-char-untabify, icicle-delete(-backward)-char: ;; Put delete-selection prop, so region is deleted. ;; 2011/08/26 dadams ;; Make sure to pass format string as first arg to calls to functions error and message. ;; icicle-candidate-set-save-1: Use %s, not %S, in error format string. ;; 2011/08/19 dadams ;; Fix C-u in minibuffer for Emacs 24: ;; Don't bother to define icicle-ensure-overriding-map-is-bound for Emacs 24+. ;; icicle-(universal|digit|negative)-argument: ;; Use save&set-overriding-map, not icicle-ensure-*, for Emacs 24. ;; 2011/08/15 dadams ;; icicle-candidate-set-complement: ;; Apply icicle-must-pass-after-match-predicate to correct the initial domain subtracting from. ;; Use icicle-all-completions instead of its definition inline. ;; 2011/08/13 dadams ;; Added: icicle-toggle-search-complementing-domain, toggle-icicle-search-complementing-domain. ;; icicle-insert-string-from-variable: Completion candidates now include all string-valued vars. ;; 2011/08/12 dadams ;; Added: icicle-add/remove-tags-and-refresh, icicle-(un)bind-file-candidate-keys. ;; 2011/08/07 dadams ;; icicle-help-on-candidate: For icicle-candidate-help-fn case: icicle-transform-multi-completion. ;; 2011/07/27 dadams ;; Use icicle-completions-format everywhere, not icicle-completions-format-internal (removed). ;; 2011/07/21 dadams ;; Renamed: icicle-nb-of-candidate-in-Completions to icicle-nb-of-cand-at-Completions-pos. ;; 2011/07/06 dadams ;; Applied renaming of icicle-Completions-frame-at-right-flag to icicle-move-Completions-frame. ;; icicle-raise-Completions-frame: Handle left value of icicle-move-Completions-frame also. ;; 2011/06/26 dadams ;; icicle-minibuffer-help: Use insert, not princ, with icicle-help-string-completion. ;; icicle-minibuffer-help, icicle-help-string-completion: ;; Use help-commands-to-key-buttons, not substitute-command-keys, if available. ;; Soft-require help-fns+.el for help-commands-to-key-buttons. ;; 2011/06/03 dadams ;; icicle-next-candidate-per-mode: ;; Set this-command according to direction, per NTH. If NTH is nil set it to 1. For Icomplete+. ;; Replace icicle-help-in-mode-line-flag by icicle-help-in-mode-line-delay everywhere. ;; 2011/05/22 dadams ;; Added defvars for free vars to quiet byte compiler. ;; 2011/05/10 dadams ;; icicle-toggle-ignoring-comments: Toggle also ignore-comments-flag from thing-cmds.el. ;; 2011/05/07 dadams ;; Added: icicle-toggle-ignoring-comments. Bound to C-M-;. ;; Changed key for icicle-regexp-quote-input from C-M-; to M-% everywhere. ;; 2011/05/04 dadams ;; icicle-transform-sole-candidate: Do nothing if for some reason icicle-current-input is nil. ;; 2011/05/03 dadams ;; Added: icicle-plus-saved-sort, icicle-toggle-highlight-saved-candidates. ;; icicle-help-string-completion: Mention icicle-toggle-highlight-saved-candidates. ;; 2011/04/29 dadams ;; icicle-help-string-completion: Corrected current values shown for sort comparers. ;; 2011/04/25 dadams ;; icicle-describe-file: Sync'd with help-fns+.el - include autofile bookmark info. ;; icicle-help-on-candidate(-symbol): Add current-prefix-arg to call to icicle-describe-file. ;; 2011/04/02 dadams ;; icicle-search-define-replacement: Use (new) icicle-scan-fn-or-regexp, not scan-fn-or-regexp. ;; 2011/03/29 dadams ;; Added: icicle-scroll-(back|for)ward. ;; Renamed: icicle-scroll-Completions(-up) to icicle-scroll-Completions-(back|for)ward. ;; orig-buf(f) -> icicle-orig-buff. ;; icicle-help-on-candidate: Removed boundp condition for icicle-completing-keys-p. ;; Applied renaming: icicle-scroll-Completions-backward-p to icicle-scroll-Completions-reverse-p. ;; 2011/03/20 dadams ;; icicle-help-on-candidate-symbol: Don't bind help-xref-following. Thx to Michael Heerdegen. ;; 2011/03/17 dadams ;; icicle-candidate-set-complement: ;; Added condition-case: Emacs 23.2+ all-completions has no 4th arg. ;; icicle-delete-backward-char-dots, icicle-replace-input-w-parent-dir: ;; Use delete-char, not delete-backward-char (Emacs 23.2+ changed it to interactive only). ;; Added soft require of filesets.el when byte-compile. ;; 2011/03/15 dadams ;; icicle-describe-file: Added thumbnails for image files. ;; 2011/03/04 dadams ;; icicle-remove-cand-from-lists, icicle-narrow-candidates-with-predicate: ;; Corrected code for updating the predicate. ;; Test using emacs version, not boundp of read-file-name-predicate (since Icicles binds it now). ;; 2011/03/02 dadams ;; Added: icicle-all-exif-data. ;; icicle-describe-file: Show all EXIF data, using icicle-all-exif-data. ;; 2011/02/26 dadams ;; Added: icicle-Completions-popup-choice(-1), icicle-substitute-keymap-vars. ;; icicle-Completions-mouse-3-menu: ;; Rewrote to use option icicle-Completions-mouse-3-menu-entries instead of hard-coding menus. ;; icicle-candidate-set-define (cosmetic): Use when, not if, to raise error. ;; icicle-candidate-set-(difference|union|intersection|complement), : Added start-progress message. ;; 2011/02/23 dadams ;; icicle-help-string-completion, icicle-Completions-mouse-3-menu: ;; Add icicle-cycle-image-file-thumbnail. ;; icicle-Completions-mouse-3-menu: Handle prefix args (change menu items to reflect). ;; 2011/02/22 dadams ;; Added: icicle-cycle-image-file-thumbnail. ;; icicle-describe-file: Show also EXIF data for an image file. ;; icicle-remove-Completions-window: ;; No-op if Completions is selected or minibuf is selected and Completions was last selected. ;; 2011/02/20 dadams ;; icicle-history: If history is command-history, convert its entries to strings for completion. ;; icicle-history, icicle-keep-only-past-inputs: Clarify doc: current completion mode is kept. ;; 2011/01/20 dadams ;; icicle-read+insert-file-name: Bind icicle-must-pass-after-match-predicate to nil. ;; icicle-insert-string-at-point: ;; A numeric prefix arg when use ALTERNATIVES means evaluate grabbed sexp and insert the value. ;; 2011/01/17 dadams ;; icicle-remove-Completions-window: Bury buffer. ;; icicle-toggle-highlight-all-current: barf if not in minibuf or Completions. ;; icicle-dispatch-C-^: Use icicle-searching-p. ;; 2011/01/05 dadams ;; Added: icicle-sort-by-file-type. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; Added more autoload cookies for commands. Thx to Richard Kim. ;; Specify command and file for commands defined by Icicles macros. ;; 2010/12/17 dadams ;; icicle-remove-Completions-window: Added FORCE arg. Remove if FORCE or interactive. ;; icicle-abort-recursive-edit: Call icicle-remove-Completions-window with FORCE arg. ;; 2010/12/14 dadams ;; icicle-retrieve-previous-input: ;; Added optional arg ALLOW-EMPTY-P (not used yet in calls). ;; Remove "" systematically, unless ALLOW-EMPTY-P. ;; Non-interactively, use last-recorded if current try is "" (unless ALLOW-EMPTY-P). ;; icicle-toggle-highlight-all-current: Turn off incremental completion while erase minibuffer. ;; icicle-insert-input: Apply renaming: icicle-expand-file-name to icicle-expand-file-or-dir-name. ;; 2010/12/02 dadams ;; icicle-retrieve-previous-input: Exclude "" from past-input cycling. ;; 2010/11/30 dadams ;; icicle-mouse-save-then-kill: If soft-require of mouse3.el, then use a simpler definition. ;; 2010/11/27 dadams ;; icicle-insert-list-join-string, icicle-pp-eval-expression-in-minibuffer: ;; Protect with 1on1-fit-minibuffer-frame-flag and soft-require of fit-frame.el. ;; icicle-(apropos|prefix)-complete-1: Soft-require of fit-frame.el for 1on1-fit-minibuffer-frame. ;; 2010/11/23 dadams ;; icicle-minibuffer-help: ;; Don't switch to minibuf window unless start in minibuf or *Completions*. Thx to M. Heerdegen. ;; 2010/11/08 dadams ;; icicle-next-TAB-completion-method, icicle-next-S-TAB-completion-method: ;; Set the icicle-last-top-level-command property only when set the first temporary method. ;; 2010/11/07 dadams ;; icicle-apply-to-saved-candidate: Do not sit-for if icicle-all-candidates-action. ;; Applied renaming of icicle-all-candidates-action-p to icicle-all-candidates-action. ;; 2010/11/06 dadams ;; icicle-apropos-complete-and-narrow: Do not regexp-quote if non-basic prefix completion. ;; icicle-next-TAB-completion-method, icicle-next-S-TAB-completion-method: ;; Prefix arg now means the new method is only for the current top-level command. ;; Put properties on icicle-last-top-level-command to implement this. ;; icicle-candidate-set-retrieve-1: Do icicle-apropos-complete-no-display if that was the last one. ;; 2010/11/05 dadams ;; icicle-mouse-save-then-kill: Redefined for Emacs 24 (they changed mouse-save-then-kill). ;; icicle-candidate-set-retrieve-1: Call icicle-apropos-complete upon minibuffer setup. ;; 2010/11/04 dadams ;; icicle-nb-of-candidate-in-Completions: Treat nil value the same as horizontal value. ;; 2010/10/24 dadams ;; icicle-insert-string-from-variable, icicle(-mouse)-candidate-read-fn-invoke, ;; icicle-narrow-candidates, icicle-save-predicate-to-variable: ;; Use icicle-must-pass-after-match-predicate, not PREDICATE arg. ;; 2010/10/09 dadams ;; icicle-minibuffer-help, icicle-help-string-completion, icicle-help-on-candidate (doc string): ;; Updated for change toward modal cycling. Fix for swank bindings and M-_ toggle. ;; Applied renaming of icicle-cycling-respects-completion-mode to icicle-default-cycling-mode. ;; icicle-toggle-search-replace-whole: Corrected toggle binding in doc string. ;; 2010/10/08 dadams ;; icicle-narrow-candidates: Set icicle-current-completion-mode to apropos. ;; icicle-apropos-complete-and-narrow: ;; Protect regexp-quote by ensuring non-nil icicle-last-input. Removed yesterday's change. ;; 2010/10/07 dadams ;; icicle-next-TAB-completion-method: ;; If icicle-current-TAB-method is nil, set to first one. member -> memq. ;; Use icicle-current-TAB-method function, not variable, everywhere else. ;; icicle-apropos-complete-and-narrow: ;; If completion mode is prefix, then prefix-complete first. Thx to Michael Heerdegen. ;; 2010/10/06 dadams ;; icicle-next-TAB-completion-method: ;; Use car of icicle-TAB-completion-methods, not basic, as default. Thx to Michael Heerdegen. ;; 2010/10/04 dadams ;; directory-sep-char -> ?/ (It was removed from Emacs 24.) ;; 2010/09/26 dadams ;; icicle-regexp-quote-input: ;; Handle no mark in minibuffer. Use end of prompt, not point-min. Thx to Michael Heerdegen. ;; icicle-column-wise-cand-nb: Bound NB (missing let binding). ;; 2010/06/18 dadams ;; icicle-nb-of-candidate-in-Completions(-horiz), icicle-move-to-next-completion: ;; Replace icicle-completions-format by icicle-completions-format-internal. ;; icicle-scroll-Completions: Do nothing if *Completions* is not displayed. ;; 2010/06/16 dadams ;; Added: icicle-col-wise-cand-nb. ;; Renamed icicle-nb-of-candidate-in-Completions to icicle-nb-of-cand-in-Completions-horiz. ;; Rewrote icicle-nb-of-candidate-in-Completions to handle vertical format also. ;; icicle-candidate-set-save-selected-1: ;; After setting BEG to next face chg, if BEG > END then raise error. ;; After setting END to previous fact chg, BEG > END then swap. ;; After extending, if BEG > END then swap. ;; 2010/06/14 dadams ;; icicle-narrow-candidates: Handle Emacs 23.2+: Use completing-read with read-file-name-internal. ;; icicle-search-define-replacement: ;; Wrap *-remove-Completions-window in save-selected-window. Thx to M. Heerdegen. ;; icicle-help-on-candidate-symbol: Show combined help for fns, vars, and faces (Emacs 22+). ;; 2010/06/11 dadams ;; Added: icicle-make-directory. ;; icicle-read+insert-file-name: Bind icicle-make-directory to C-c +. ;; 2010/06/08 dadams ;; icicle-doremi-increment-max-candidates+: Plain C-u resets icicle-max-candidates to nil. ;; 2010/06/07 dadams ;; icicle-exit-minibuffer: Do not fiddle with faces if not in minibuffer. Thx to M. Heerdegen. ;; icicle-prefix-complete-1: ;; Sole completion case: Move removal of *Completions* before the top-level throw. ;; 2010/06/04 dadams ;; Added: icicle-doremi-increment-max-candidates+. ;; Renamed by adding +: icicle-doremi-increment-swank-(timeout|prefix-length). ;; icicle-help-string-completion: Mention missing doremi toggle keys. ;; icicle-doremi-zoom-Completions+: Show *Completions* if not shown. ;; 2010/05/15 dadams ;; icicle-all-candidates-action-1: Bind *-minibuffer-message-ok-p, *-help-in-mode-line-flag to nil. ;; 2010/05/09 dadams ;; Added: icicle-dispatch-M-_. ;; Removed: icicle-dispatch-C-comma. ;; icicle-help-string-completion: ;; Removed extra arg to format (icicle-key-descriptions-use-<>-flag). Corrected arg order. ;; Updated to reflect binding changes. ;; icicle-toggle-highlight-all-current: Focus to minibuffer before show msg. ;; 2010/05/04 dadams ;; icicle-change-sort-order: Use save-selected-window. Thx to Michael Heerdegen. ;; icicle-apply-to-saved-candidate: ;; Only call sit-for if current-message. Added TYPE arg. Thx to Michael H. ;; 2010/05/03 dadams ;; icicle-toggle-remote-file-testing: Updated for Emacs 23.2+ Thx to Michael Albinus. ;; 2010/04/30 dadams ;; icicle-(apropos|prefix)-complete-1: Run icicle-no-match-hook when no candidates. ;; 2010/04/28 dadams ;; icicle-remove-cand-from-lists: Fix pred a la icicle-mctize-all. Thx to M. Heerdegen. ;; 2010/04/27 dadams ;; icicle-apply-to-saved-candidate: Added sit-for for non-C-u case, to see any msg displayed. ;; icicle-help-on-candidate: Test value, not just boundp, of icicle-completing-keys-p. ;; 2010/04/26 dadams ;; icicle-toggle-highlight-all-current: ;; Save/restore cand nb. Re-complete, rehighlight. Go to current cand only if it is defined. ;; 2010/04/21 dadams ;; Added: icicle-sit-for (Emacs 23+), so user input interrupts sit-for after C-u in minibuffer. ;; 2010/04/20 dadams ;; Added: icicle-sort-by-directories-first. ;; icicle-nb-of-candidate-in-Completions: ;; Bind icicle-completions-format to nil (for calls to *-move-to-next-*). Thx to M. Heerdegen. ;; 2010/04/13 dadams ;; icicle-(apropos|prefix)-complete-1: Fixed recent file-name completion bugs. ;; When icicle-whole-candidate-as-text-prop-p is t and icicle-expand-input-to-common-match-flag ;; is nil, expand the input, unless it is a directory. ;; Expand file-name input to the common match for the current candidate. ;; 2010/04/11 dadams ;; icicle-(apropos|prefix)-complete-1: Fix last fix: ;; Put whole-cand prop on sole candidate only if not a dir, and use icicle-expanded-common-match. ;; 2010/04/09 dadams ;; icicle-(apropos|prefix)-complete-1: When sole candidate, set icicle-current-input to it. ;; Needed, in order to get icicle-whole-candidate property when ;; icicle-expand-input-to-common-match-flag is nil. Thx to Michael Heerdegen. ;; 2010/03/13 dadams ;; Added: icicle-toggle-show-multi-completion. ;; 2010/03/03 dadams ;; Applied renamings: icicle-sort-function to icicle-sort-comparer ;; icicle-sort-functions-alist to icicle-sort-orders-alist, ;; icicle-alternative-sort-function to icicle-alternative-sort-comparer, ;; icicle-last-sort-function to icicle-last-sort-comparer. ;; 2010/03/02 dadams ;; icicle-remove-Completions-window: Do nothing unless *Completions* is shown. ;; icicle-delete-windows-on: Do nothing unless buffer is visible. ;; Do not delete frame if it is the only one. ;; 2010/01/12 dadams ;; icicle-mouse-choose-completion, icicle-insert-string-at-point, ;; icicle-mouse-candidate-action-1, icicle-mouse-remove-candidate, ;; icicle-mouse-candidate-read-fn-invoke, icicle-Completions-mouse-3-menu, ;; icicle-mouse-save/unsave-candidate: ;; set-buffer -> with-current-buffer. ;; icicle-mouse-candidate-read-fn-invoke, icicle-Completions-mouse-3-menu, ;; icicle-mouse-save/unsave-candidate: ;; Removed unused local var BUFFER. ;; icicle-mouse-choose-completion: Removed unused local var ORIG-BUFFER. ;; 2009/12/21 dadams ;; icicle-narrow-candidates: ;; Add fn to minibuffer-setup-hook to make the reference buffer be the new minibuffer. ;; fset -> defalias. ;; 2009/12/13 dadams ;; icicle-change-sort-order: Add REVERSED to msg when reversed. ;; 2009/11/27 dadams ;; Added: icicle-doremi-increment-swank-(prefix-length|timeout). ;; *-next-TAB-completion-method, *-prefix-complete-1: Handle swank completions too. ;; *-next-TAB-completion-method: Bind icicle-doremi-increment-swank-(prefix-length|timeout). ;; 2009/11/26 dadams ;; icicle-next-TAB-completion-method: Do not set icicle-inhibit-sort-p to t for fuzzy. ;; 2009/11/25 dadams ;; Added: icicle-completions-format, icicle-row-wise-cand-nb. ;; icicle-move-to-next-completion: Handle completions laid out vertically. ;; 2009/11/07 dadams ;; Renamed Icicles doremi cmds (added +). Applied other doremi cmd renamings (added +). ;; 2009/10/25 dadams ;; icicle-prefix-complete-1: When sole cand, use the candidate, but without any dir. ;; Renamed: icicle-next-apropos-match-function to icicle-next-S-TAB-completion-method, ;; icicle-toggle-fuzzy-completion to icicle-next-TAB-completion-method (rewrote). ;; icicle-(prefix|apropos)-complete-1: Updated no/sole msgs per new completion methods. ;; icicle-Completions-mouse-3-menu: Updated with the new command names. ;; Updated icicle-help-string-completion. ;; 2009/10/24 dadams ;; icicle-(apropos|prefix)-complete-1: ;; Removed code treating empty dir via *-any-*-p and (""). ;; When only one candidate, set *-last-completion-candidate to: ;; If file-name completion: ;; If empty input, the input; if dir candidate, input + /; else the sole candidate. ;; Else the sole candidate. ;; 2009/10/22 dadams ;; icicle-insert-input, icicle-candidate-action-1, icicle-keep-only-past-inputs, ;; icicle-apropos-complete-and-(narrow|widen): ;; Use icicle-file-name-directory, not file-name-directory. ;; 2009/10/21 dadams ;; icicle-prefix-complete-1: ;; For empty dir we use "" as pseudo-cand. Ensure not "" when later test for / last char. ;; 2009/10/12 dadams ;; Added: icicle-input-is-a-completion-p. ;; icicle-minibuffer-complete-and-exit, icicle-input-is-a-completion-p: ;; Use icicle-input-is-a-completion-p. ;; icicle-prefix-complete-1: ;; For file-name input: Set, and use, current input without substituting env vars. ;; When sole candidate ends in /, add a / to current input also. ;; 2009/09/26 dadams ;; icicle-narrow-candidates(-with-predicate): Bind icicle-progressive-completing-p to t. ;; 2009/09/25 dadams ;; icicle-prefix-complete-1, icicle-transform-sole-candidate: ;; Use icicle-current-input, not (car icicle-completion-candidates). ;; Don't set icicle-current-input to (car icicle-completion-candidates) if no-catch. ;; 2009/09/12 dadams ;; icicle-delete-candidate-object: Message if no candidates, in non-ALLP case also. ;; icicle-delete-candidate-object-1: Bind icicle-completion-candidates to save & restore it. ;; icicle-candidate-action-1, icicle-remove-candidate-display-others, ;; icicle-delete-candidate-object, icicle-help-on-candidate, ;; icicle-candidate-read-fn-invoke: ;; Bind icicle-help-in-mode-line-flag to nil, to avoid help-display delay. ;; icicle-update-and-next: Do nothing if user hit another key and there are more candidates. ;; 2009/09/05 dadams ;; icicle-narrow-candidates: Don't raise an error if no candidates. E.g. C-~. ;; Use backward and forward as the values of icicle-cycling-command prop for nav commands. ;; Apply renaming of icicle-acting-on-next/prev (removed -p). ;; icicle-successive-action: Bind it to value of icicle-cycling-command (nav direction). ;; icicle-all-candidates-list-alt-action: Raise error if null icicle-completion-candidates. ;; icicle-search-define-replacement: Prevent immediate incremental completion kicking in. ;; icicle-(widen|narrow)-candidates(-with-predicate): ;; Use literal text for (S-)TAB in error message, to avoid S-iso-*. ;; 2009/09/02 dadams ;; icicle-(prefix|apropos)-complete-1, icicle-narrow-candidates(-with-predicate): ;; Impose icicle-top-level-when-sole-completion-delay when *-flag is non-nil. ;; 2009/08/27 dadams ;; icicle-goto/kill-failed-input: Do nothing if the overlay is nowhere. ;; icicle-mouse-yank-secondary: If yank-secondary is defined, then pass prefix arg also. ;; 2009/08/23 dadams ;; icicle-narrow-candidates-with-predicate: Added optional arg PREDICATE. ;; 2009/08/20 dadams ;; icicle-successive-action: Don't call icicle-show-help-in-mode-line unless string arg. ;; 2009/08/11 dadams ;; icicle-all-candidates-action-1: Added ALTP arg. Use in call to *-candidate-action-1. ;; icicle-all-candidates(-list)-alt-action: Use new ALTP arg in call with *-alt-action-fn. ;; icicle-successive-action: Bind icicle-acting-on-next/prev-p around call to action fn. ;; icicle(-mouse)-candidate-action-1: ;; No longer bind icicle-* to selves. You must do it in the action fn if you need it. ;; icicle-help-string-completion: C-| -> M-| for Replace all. ;; icicle-change-history-variable: Protect with boundp: *-populate-interactive-history-flag. ;; Wrap require of icicles-var.el in eval-and-compile. ;; 2009/08/01 dadams ;; icicle-change-history-variable: ;; Add icicle-interactive-history to choices only if *-populate-interactive-history-flag. ;; 2009/07/29 dadams ;; icicle-other-history: ;; Call icicle-use-interactive-command-history only if Emacs 23+ and non-nil history. ;; 2009/07/27 dadams ;; icicle-help-string-completion: Mention icicle-other-history. ;; 2009/07/26 dadams ;; Added: icicle-change-history-variable, icicle-other-history, ;; icicle-use-interactive-command-history. ;; icicle-history: ;; Use icicle-cycling-p instead of get icicle-cycling-command, to avoid completion cmds. ;; 2009/07/02 dadams ;; icicle-candidate-set-save-1: If icicle-get-alist-candidate-function returns nil, use CAND ;; 2009/06/26 dadams ;; icicle-doremi-zoom-Completions, icicle-doremi-candidate-width-factor: ;; Use new key-list options, doremi-...-keys (not -key). You will need the latest DoReMi. ;; 2009/06/18 dadams ;; doremi-buffer-font-size: Changed increment (doremi-*-key) bindings to =, -, M-=, M-i. ;; icicle-help-string-completion: Added icicle-doremi-zoom-Completions. ;; 2009/06/17 dadams ;; Added: icicle-doremi-zoom-Completions. ;; icicle-doremi-candidate-width-factor: If no candidates, show message; don't use colors. ;; 2009/06/07 dadams ;; icicle-get-alist-candidate -> funcall icicle-get-alist-candidate-function. ;; 2009/05/27 dadams ;; icicle-minibuffer-complete-and-exit: ;; Don't exit if any completion is done, unless icicle-require-match-p is t. ;; 2009/05/22 dadams ;; Require icicles-mac.el if load-library doesn't find it. ;; 2009/05/18 dadams ;; icicle-candidate-set-save-selected-1: If empty inactive region and MOREP, raise error. ;; 2009/05/17 dadams ;; icicle-toggle-C-for-actions: Use icicle-toggle-icicle-mode-twice, not icy-mode calls. ;; 2009/05/15 dadams ;; icicle-(prefix|apropos)-complete-1: Fit minibuffer frame after inserting current input. ;; 2009/05/11 dadams ;; icicle-upcase-if-ignore-case, icicle-next-apropos-match-function: Use icicle-upcase. ;; 2009/05/09 dadams ;; Added: icicle-looking(-back)-at-anychar-regexp-p, icicle-(forward|backward)-char-dots, ;; icicle-backward-delete-char-untabify-dots, icicle-delete-backward-char-dots, ;; icicle-delete-char-dots, icicle-transpose-chars-dots. icicle-insert-dot(-command), ;; icicle-anychar-regexp, icicle-toggle-dot, icicle-convert-dots. ;; icicle-backward-delete-char-untabify, icicle-delete-backward-char, icicle-delete-char, ;; icicle-transpose-chars: Handle dots. ;; icicle-prefix-complete: Convert dots and set icicle-dot-string-internal. ;; icicle-goto/kill-failed-input: Use overlay. ;; icicle-help-string-completion, icicle-Completions-mouse-3-menu: ;; Added dot toggling. Changed binding for icicle-toggle-hiding-common-match. ;; 2009/05/08 dadams ;; icicle-(prefix|apropos)-complete-1: Fixed typo introduced 2009-05-05. ;; 2009/05/07 dadams ;; icicle-retrieve-(previous|last)-input: Call icicle-place-cursor with optional second arg. ;; 2009/05/05 dadams ;; toggle-icicle-case-sensitivity: Treat read-buffer-completion-ignore-case also (Emacs 23). ;; 2009/05/03 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Don't stop cycling if last command was an action (treat as if it was a cycling cmd). ;; icicle-all-candidates(-list)(-alt)-action, icicle(-mouse)-candidate(-alt)-action, ;; icicle-delete-candidate-object, icicle(-mouse)-help-on-candidate: ;; Put property icicle-action-command. ;; 2009/05/02 dadams ;; icicle-candidate-alt-action: Respect icicle-alternative-actions-alist. ;; icicle-minibuffer-help: Corrected wrt alt action-for-all keys. ;; 2009/04/30 dadams ;; icicle-next-(prefix|apropos)-candidate, icicle-(prefix|apropos)-complete-1, ;; icicle-successive-action: ;; Reset icicle-next-(apropos|prefix)-complete-cycles-p to nil, as appropriate. ;; icicle-prefix-complete-1: Show mode-line help only at very end, and even after cycling. ;; 2009/04/29 dadams ;; icicle-apply-to-saved-candidate: ;; Pass no-error-no-msg to icicle-get-alist-candidate function. ;; If icicle-get-alist-candidate finds no function, get function from car of entry. ;; icicle-apropos-complete-and-(narrow|widen): Handle icicle-apropos-complete-no-display. ;; 2009/04/27 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Set icicle-last-completion-command to icicle-*-complete-no-display if arg NO-DISPLAY. ;; icicle-history: If icicle-last-completion-command is nil, call icicle-apropos-complete. ;; 2009/04/26 dadams ;; Wrap load of icicles-mac in eval-when-compile, and use load-library, not require. ;; Require icicles-opt before icicles-var (not important). ;; 2009/04/20 dadams ;; Added: icicle-(previous|next)-candidate-per-mode-alt-action. ;; 2009/03/19 dadams ;; mouse-choose-completion: Don't fset unless standard function is defined. ;; Use when/unless instead of or for fset's. (cosmetic) ;; 2009/04/15 dadams ;; Added: icicle-(next|previous)-candidate-per-mode-help. ;; icicle-successive-action: Set mode only if known. Leave it alone for per-mode functions. ;; icicle-(apropos|prefix)-complete-1: ;; Don't show help in mode-line when icicle-top-level-when-sole-completion-flag = t. ;; 2009/04/12 dadams ;; icicle-successive-action: Inhibit help in mode line until after action is finished. ;; 2009/04/06 dadams ;; icicle-(prefix|apropos)-complete-1, icicle-candidate-set-retrieve-1, ;; icicle-keep-only-past-inputs: ;; Call icicle-show-help-in-mode-line for completed input. ;; icicle-(prefix|apropos)-complete-1: ;; Don't highlight complete input or show help if icicle-*-complete-and-exit-p is bound. ;; 2009/04/04 dadams ;; Renamed: icicle-sort-by-last-use to icicle-sort-by-last-use-as-input. ;; icicle-change-sort-order: Purge any nil entries from icicle-sort-functions-alist. ;; icicle-current-sort-functions: Respect icicle-buffer-name-sort-predicate. ;; icicle-reverse-sort-order: Echo icicle-current-sort-order. ;; 2009/03/16 dadams ;; icicle-candidate-action-1: Respect icicle-use-candidates-only-once-alt-p. ;; 2009/03/10 dadams ;; icicle-remove-Completions-window: Wrap with condition-case, to ignore "Attempt..." error. ;; 2009/03/01 dadams ;; Added: icicle-completing-read+insert, icicle-read+insert-file-name. ;; 2009/02/28 dadams ;; No soft require of subr-21.el now, since provide replace-regexp-in-string for Emacs 20. ;; 2009/02/23 dadams ;; icicle-mouse-choose-completion, icicle-(prefix|apropos)-complete-1, ;; icicle-insert-completion, icicle-mouse-candidate-action-1, icicle-update-and-next, ;; icicle-narrow-candidates(-with-predicate), icicle-keep-only-past-inputs, ;; icicle-insert-input: ;; Protect dir insertion with icicle-extra-candidates-dir-insert-p. ;; icicle-choose-completion: Use icicle-extra-candidates-dir-insert-p to reset base-size=0. ;; 2009/02/20 dadams ;; Added: icicle-sort-extra-candidates-first. ;; icicle-candidate-action-1: Use function icicle-require-match-p, not variable. ;; 2009/02/17 dadams ;; icicle-exit-minibuffer: Don't put nil face property on input. Thx to Daniel Clemente. ;; 2009/02/04 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Do not set icicle-current-input to icicle-last-input unless also icicle-cycling-p. ;; Do not cycle unless also was already cycling or icicle-next-*-complete-cycles-p. ;; Set icicle-next-*-complete-cycles-p, at end, to save whether input was completed some. ;; 2009/02/01 dadams ;; Added: icicle-up-directory, icicle-replace-input-w-parent-dir. ;; 2009/01/24 dadams ;; icicle-narrow-candidates(-with-predicate): ;; Bind icicle-apropos-complete-match-fn to icicle-last-apropos-complete-match-fn. ;; icicle-next-apropos-match-function: Save new value as *-last-apropos-complete-match-fn. ;; 2009/01/18 dadams ;; icicle-(prefix|apropos)-complete-1: ;; Don't set icicle-current-input to icicle-last-input if icicle-edit-update-p. ;; 2009/01/17 dadams ;; icicle-next-apropos-match-function: ;; Add Levenshtein distance in message: (1). ;; Don't do icicle-complete-again-update - too slow. ;; 2009/01/14 dadams ;; icicle-remove-cand-from-lists: Treat icicle-remove-dups-if-extras also. ;; 2009/01/13 dadams ;; icicle-delete-windows-on: Delete frame even if it has a minibuffer, if it's not active. ;; 2008/12/26 dadams ;; Added: icicle-widen-candidates, icicle-apropos-complete-and-widen. ;; Added icicle-widen-candidates to icicle-Completions-mouse-3-menu. ;; 2008/12/25 dadams ;; icicle-retrieve-previous-input: Corrected logic following cycling. ;; Remember whether repeated C-l calls follow cycling: local var was-cycling-p. ;; If so, then use current raw input for second C-l. Otherwise use previous raw input. ;; Use icicle-cycling-p instead of testing if this command is a cycling command. ;; Handle case of "" raw input, which is never in list of saved raw inputs. ;; Restore current raw input after re-completing. ;; icicle-(prefix|apropos)-complete-1: Reset icicle-cycling-p (new var) to nil. ;; icicle-regexp-quote-input: Reset icicle-expand-input-to-common-match-flag to nil. ;; 2008/12/22 dadams ;; Added: icicle-regexp-quote-input. ;; Added it to icicle-help-string-completion, icicle-Completions-mouse-3-menu. ;; 2008/12/21 dadams ;; icicle-minibuffer-complete-and-exit: ;; Rewrote to fit new Emacs 23 behavior. Thx to Daniel Clemente. ;; Test minibuffer-completion-confirm first, before we auto-complete. ;; icicle-last-input -> icicle-current-input (bug fix bc of call to *-no-display). ;; icicle-prefix-complete-1: Bind free var word-complete-input. ;; icicle-(apropos|prefix)-complete-1: No messages if NO-DISPLAY-P is 'no-msg. ;; 2008/12/20 dadams ;; icicle-(apropos|prefix)-complete-1, icicle-narrow-candidates(-with-predicate): ;; Expand file-name choice if thrown to icicle-read-top. ;; 2008/12/10 dadams ;; icicle-(apropos|prefix)-complete-1: Don't pick up icicle-last-input unless also: ;; (1) same completion mode, (2) icicle-completion-candidates is not nil. ;; icicle-prefix-complete-1: If WORD-P, don't pick up icicle-last-input unless same command. ;; Bind minibuffer-message-timeout to 0 during minibuffer-complete-word. ;; icicle-apropos-complete-1: ;; Typo in last cond clause: prefix -> apropos, in i-apropos-completing-command. ;; 2008/12/06 dadams ;; icicle-prefix-complete-1: Fixes for word completion. ;; Don't initialize *-current-input to *-last-input if word-p and icicle-edit-update-p. ;; Recompute candidates after word complete also if editing or didn't repeat last command. ;; Cycle if last command was not a prefix completion and input doesn't end in `-'. ;; 2008/12/05 dadams ;; Let repeated completion commands cycle. Thx to Andrey Zhdanov for the suggestion. ;; icicle-(apropos| prefix)-complete-1: ;; Call icicle-next-candidate, not scroll, when repeated. Special treatment for word. ;; icicle-(apropos|prefix)-complete*: ;; Put icicle(-apropos|-prefix)-cycling-command property on command symbols. ;; 2008/12/02 dadams ;; icicle-minibuffer-complete-and-exit: ;; Updated for Emacs 23's minibuffer-confirm-exit-commands. ;; 2008/11/29 dadams ;; icicle-prefix-word-complete: ;; Redefined to use (new) icicle-prefix-complete-1. ;; Put property icicle-completing-command. ;; icicle-prefix-complete-1: ;; Useful now also for icicle-prefix-word-complete. Added arg word-p. ;; icicle-(prefix|apropos)-complete-1, icicle-switch-to-Completions-buf: ;; Test property icicle-prefix-completing-command, not eq cmds. ;; icicle-(prefix|apropos)(-word)-complete(-no-display): ;; Put property icicle-(prefix|apropos)-completing-command. ;; icicle-next-candidate-per-mode: Use case, not cond. ;; icicle-end-of-line+: Bind inhibit-field-text-motion, call end-of-line to get past prompt. ;; 2008/11/18 dadams ;; icicle-minibuffer-complete-and-exit: Allow exit if input matches a current candidate. ;; icicle-exit-minibuffer: Remove all Icicles minibuffer faces, but only those. ;; 2008/11/14 dadams ;; Added: icicle-toggle-hiding-common-match. ;; icicle-help-string-completion, icicle-Completions-mouse-3-menu: Mention it. ;; 2008/11/10 dadams ;; icicle-minibuffer-complete-and-exit: ;; Use icicle-exit-minibuffer, not old-exit-minibuffer, so remove *Completions*. ;; 2008/11/09 dadams ;; icicle-maybe-multi-completion-completing-p, icicle-transform-sole-candidate: ;; Don't test icicle-list-join-string (always non-nil). ;; 2008/11/03 dadams ;; icicle-(apropos|prefix)-complete-1: Added message Computing completion candidates... ;; 2008/11/02 dadams ;; icicle-upcase-if-ignore-case: condition-case, to prevent error on bad chars (Emacs 20). ;; 2008/10/27 dadams ;; Added: icicle-upcase-if-ignore-case. ;; icicle-minibuffer-complete-and-exit, icicle-(prefix|apropos)-complete-1: ;; Use icicle-upcase-if-ignore-case. ;; 2008/10/24 dadams ;; icicle-minibuffer-complete-and-exit: If icicle-candidates-alist, then just filter it. ;; 2008/10/18 dadams ;; Replaced customize-save-variable by funcall icicle-customize-save-variable-function. ;; 2008/10/14 dadams ;; Added: icicle-help-string(-non)-completion. ;; icicle-help-string-completion: ;; Renamed from icicle-update-help-string in icicles-mode.el. ;; Moved common part to icicles-var.el as icicle-general-help-string. ;; Renamed: icicle-completion-help to icicle-minibuffer-help. ;; icicle-minibuffer-help: If not completing, use icicle-help-string-non-completion. ;; Move Send an Icicles bug report to the bottom. ;; 2008/10/11 dadams ;; icicle-(next|previous)-line: Fixed so it highlights also candidates in first column. ;; icicle-kill-failed-input: Made it two-stage. Renamed to icicle-goto/kill-failed-input. ;; 2008/10/10 dadams ;; Added: icicle-(next|previous)-candidate-per-mode-action. ;; 2008/10/09 dadams ;; Updated icicle-Completions-mouse-3-menu for C-<. ;; 2008/10/08 dadams ;; Added: icicle-candidate-set-retrieve-more, icicle-candidate-set-retrieve-1. ;; icicle-candidate-set-retrieve: Use icicle-candidate-set-retrieve-1. ;; icicle-insert-string-at-point: ;; Use icicle-pre-minibuffer-buffer, not (cadr (buffer-list)). Thx to Andrey Zhdanov. ;; icicle-beginning-of-line+: Don't move into prompt. Thx to Andrey Zhdanov. ;; 2008/10/06 dadams ;; icicle-self-insert: Do self-insert-command if executing-kbd-macro. Thx to Tomer Levin. ;; 2008/10/01 dadams ;; icicle-completion-help: Use icicle-update-help-string, not icicle-completion-help-string. ;; 2008/09/30 dadams ;; Renamed icicle-isearch-complete-1 to icicle-isearch-complete-past-string and moved it ;; to icicles-fn.el. ;; 2008/09/20 dadams ;; icicle-toggle-ignored-extensions: Append $ to each extension. ;; icicle-dispatch-C-.: Use icicle-searching-p as the condition, not *-file-name-input-p. ;; 2008/09/14 dadams ;; icicle-(minibuffer|apropos)-complete-and-exit: Set icicle-last-input to current input. ;; icicle-minibuffer-complete-and-exit: Use apropos completion if that's the current mode. ;; 2008/09/13 dadams ;; icicle-candidate-set-save-1: Save to fileset if zero prefix arg. ;; icicle-candidate-set-retrieve: Retrieve also from a fileset. ;; No default value for completing-read. ;; Added: icicle-add-file-to-fileset. ;; Renamed: ;; icicle-candidate-set-save-to-cache-file to icicle-candidate-set-save-persistently, ;; icicle-candidate-set-retrieve-from-cache-file to *-candidate-set-retrieve-persistent. ;; icicle-candidate-set-save-persistently: Added arg FILESETP. ;; icicle-add/update-saved-completion-set: No default value for completing-read. ;; icicle-retrieve-candidates-from-set: ;; Factored out code as icicle-get-candidates-from-saved-set - use it. Don't return name. ;; Moved to icicles-fn.el: icicle-readable-to-markers. ;; 2008/09/09 dadams ;; icicle-candidate-set-save(-selected-1): Added NO-ERROR-P arg. ;; icicle-candidate-set-save-selected: Call *-save-selected-1 with NO-ERROR-P arg. ;; icicle-candidate-set-save-1: Raise error if set to save is empty and not NO-ERROR-P. ;; 2008/09/08 dadams ;; icicle-apropos-complete-and-narrow: ;; If currently prefix completing, escape current input before apropos completing. ;; 2008/09/07 dadams ;; icicle-minibuffer-complete-and-exit: ;; Use *-prefix-complete-no-display and *-display-candidates-in-Completions when needed. ;; 2008/09/06 dadams ;; icicle-minibuffer-complete-and-exit: Rewrote, based on icicle-apropos-complete-and-exit. ;; icicle-prefix-complete-1: ;; Wrap most of single-candidate case in (boundp 'icicle-prefix-complete-and-exit-p). ;; 2008/09/04 dadams ;; icicle-minibuffer-complete-and-exit: Temporary bug workaround. ;; 2008/08/31 dadams ;; icicle-completion-help, icicle-pp-eval-expression-in-minibuffer, ;; icicle-delete-candidate-object-1, icicle-apply-to-saved-candidate, ;; icicle-toggle-highlight-all-current: ;; Select window before call select-frame-set-input-focus. ;; 2008/08/29 dadams ;; icicle-minibuffer-complete-and-exit: Update icicle-last-input to minibuffer contents. ;; 2008/08/28 dadams ;; icicle-(apropos|prefix)-complete-1, icicle-narrow-candidates(-with-predicate): ;; Update minibuffer-history-variable before throw result. ;; icicle-help-on-candidate: Renamed alacarte-menu-items-alist to lacarte-menu-items-alist. ;; 2008/08/27 dadams ;; icicle-kill-failed-input: Reverted mistaken change to use start of *Completions* (duh). ;; 2008/08/25 dadams ;; icicle-minibuffer-complete-and-exit: Call icicle-prefix-complete-no-display with no-msg ;; arg, instead of binding minibuffer-message-timeout to 0. ;; icicle-(apropos|prefix)-complete-no-display: Added optional NO-MSG-P arg. ;; 2008/08/24 dadams ;; icicle-minibuffer-complete-and-exit: Rewrote to not call original Emacs version. ;; Use today's renamings from icicles-fn.el. ;; icicle-raise-Completions-frame: Don't do anything unless one-window-p and option = t. ;; icicle-choose-completion, *-kill-failed-input, *-current-completion-in-Completions: ;; Check point wrt candidates start position, not bobp. ;; icicle-current-completion-in-Completions: ;; "No completion here" error after, not before, we set beg wrt mouse-face change. ;; icicle-mouse-candidate-action-1: Call icicle-update-and-next if there are still cands. ;; 2008/08/21 dadams ;; icicle-candidate-set-retrieve: If completing files, remove directory from candidates. ;; 2008/08/20 dadams ;; icicle-mouse-candidate-action-1: Remove mouse-face property from choice. ;; 2008/08/19 dadams ;; icicle-mouse-remove-candidate: ;; Set icicle-last-completion-candidate. Needed for *-remove-candidate-display-others. ;; icicle-mouse-candidate-action-1: Removed unused vars: buffer, base-size. ;; Added: icicle-delete-candidate-object-1, with explicit CAND arg and NO-DISPLAY-P option. ;; icicle-delete-candidate-object: Added optional ALLP arg. ;; icicle-delete-current-candidate-object: Added optional CAND arg. ;; icicle-update-and-next: Don't try to move to cand in *Completions* if number not known. ;; 2008/08/18 dadams ;; Added: icicle-remove-cand-from-lists, icicle-update-and-next. ;; icicle-narrow-candidates-with-predicate: Update predicate correctly, with lexical-let. ;; icicle-remove-candidate, icicle-delete(-current)-candidate-object: ;; Removed stuff from doc string about removing all that match. ;; icicle-delete-candidate-object, icicle-remove-candidate-display-others: ;; Use icicle-remove-cand-from-lists (with mctized candidate) and icicle-update-and-next. ;; icicle-delete-current-candidate-object: Changed first condition: ;; (and icicle-candidates-alist (consp (car val))) to ;; (or icicle-whole-candidate-as-text-prop-p icicle-candidates-alist) ;; icicle-remove-candidate-display-others: ;; Added optional ALLP arg. ;; Reinitialize icicle-last-completion-candidate properly (as elsewhere). ;; icicle(-mouse)-candidate-action-1: Use ALLP arg for *-remove-candidate-display-others. ;; icicle-history: Don't set minibuffer-completion-predicate if it is nil. ;; Use renamings from icicles-fn.el: ;; icicle-complete-again-update, icicle-remove-if, icicle-put-whole-cand-prop. ;; icicle-narrow-candidates: Do not bind icicle-whole-candidate-as-text-prop-p to nil. ;; icicle-Completions-mouse-3-menu: Removed icicle-scroll-Completions from menu. ;; 2008/08/17 dadams ;; icicle-narrow-candidates-with-predicate: ;; (read-file-name|minibuffer-completion)-predicate: Removed `, in front. ;; icicle-scroll-Completions: Added optional arg (for mouse wheel reversal). ;; Added: icicle-scroll-Completions-up. ;; 2008/08/03 dadams ;; Added: icicle-all-candidates-list(-alt)-action. ;; icicle-all-candidates(-alt)-action: ;; Act on saved candidates, if any. Use list function, if normal is nil. ;; icicle-all-candidates-action-1: ;; Use icicle-candidate-action-1 (with cand arg (new)), not funcall, to apply fn-var. ;; Act on saved candidates, if any. ;; Do not call icicle-abort-recursive-edit at the end. ;; icicle-candidate-action-1: ;; Added optional CAND arg. ;; Save stuff before funcall, in case FN-VAR does its own completion. ;; icicle-mouse-candidate-action-1: Save stuff before funcall, in case FN-VAR completes. ;; icicle-remove-candidate-display-others: ;; When no candidates left, just call icicle-abort-recursive-edit. ;; icicle-help-on-candidate: Added optional CAND arg. ;; Renamed: icicle-candidate-alternative-action-fn to icicle-candidate-alt-action-fn. ;; 2008/07/27 dadams ;; Added: icicle-sort-by-2nd-parts-alphabetically, icicle-maybe-multi-completion-*. ;; icicle-current-sort-functions: Treat icicle-multi-completion-sort-predicate property. ;; icicle-dispatch-C-comma: Call icicle-change-sort-order interactively (bug fix). ;; icicle-reverse-sort-order: Display candidates, possibly in reverse order (bug fix). ;; Moved from here to icicles-fn.el: icicle-transform-multi-completion. ;; 2008/07/16 dadams ;; icicle-mouse-choose-completion: No error if minibuffer is not active. ;; icicle-completion-help and top-level: Don't require help-mode.el unless Emacs 22+. ;; eval-when-compile require's of fit-frame.el, linkd.el. ;; 2008/06/24 dadams ;; icicle-narrow-candidates: Emacs < 22: Set minibuffer-completing-file-name to nil. ;; 2008/06/21 dadams ;; icicle(-mouse)-choose-completion, icicle-current-completion-in-Completions, ;; icicle-mouse-candidate-action-1: ;; buffer-substring-no-properties -> buffer-substring. ;; *NOTE*: THIS REVERSES A FIX made on 2008/02/03. Dunno why that fix was made. ;; 2008/06/03 dadams ;; Added: icicle-toggle-C-for-actions. ;; icicle-Completions-mouse-3-menu: Added icicle-toggle-C-for-actions. ;; 2008/06/01 dadams ;; Added: icicle-current-sort-functions. Predicate tests various contexts using properties. ;; icicle-change-sort-order: Use icicle-current-sort-functions. ;; Added new sort order, defining function icicle-sort-special-candidates-first. ;; 2008/05/27 dadams ;; icicle-isearch-complete-1: Use ring symbols, not their values. ;; 2008/05/25 dadams ;; icicle-isearch-complete: Rewrote. Handle minibuffer search. ;; Added: icicle-isearch-complete-1, from stuff in icicle-isearch-complete. ;; Treat string case. Allow recursive minibuffers. Don't use icicle-isearch-resume. ;; Removed: icicle-isearch-resume. ;; 2008/05/22 dadams ;; icicle-toggle-case-sensitivity: Added prefix arg and update lighter. ;; 2008/05/03 dadams ;; icicle-history: Bind minibuffer-completing-file-name to nil. ;; 2008/05/02 dadams ;; (put 'icicle(-mouse)-yank-secondary 'delete-selection 'yank) ;; 2008/04/25 dadams ;; Added: icicle-toggle-remote-file-testing. ;; icicle-Completions-mouse-3-menu: ;; Added icicle-toggle-remote-file-testing (C-^). ;; icicle-toggle-ignored-space-prefix is now bound to M-_, not C-^. ;; icicle-dispatch-C-^: ;; icicle-toggle-remote-file-testing, not icicle-toggle-ignored-space-prefix. ;; 2008/04/18 dadams ;; Renamed icicle-init-value-flag to icicle-default-value. ;; 2008/04/13 dadams ;; icicle-pp-eval-expression-in-minibuffer: Treat prefix arg (added optional arg). ;; icicle-apply-to-saved-candidate: Use icicle-pp-eval-expression, not pp-eval-expression. ;; 2008/04/02 dadams ;; icicle-apropos-complete-and-narrow: No longer bind icicle-top-level-when-*-flag to t. ;; 2008/03/31 dadams ;; icicle-apropos-complete-1: Allow for no completion type, for No completion msg. ;; 2008/03/29 dadams ;; icicle-pp-eval-expression-in-minibuffer, icicle-narrow-candidates(-with-predicate): ;; Removed binding of icicle-reminder-prompt-flag. ;; 2008/03/25 dadams ;; icicle-(apropos|prefix)-complete-1: ;; When not regexp-matching, use substitute-in-file-name on input, to convert \ to /. ;; 2008/03/23 dadams ;; icicle-scroll-Completions: Respect and update icicle-scroll-Completions-backward-p. ;; 2008/03/19 dadams ;; Added: icicle-insert-newline-in-minibuffer. ;; Renamed i*-pp-eval-expression to *-in-minibuffer. Calls new icicle-pp-eval-expression. ;; 2008/03/12 dadams ;; icicle-completion-help: Add buttons for Commentary (icicles-doc*.el). ;; 2008/03/11 dadams ;; icicle-add/update-saved-completion-set: Clarify error msg for unwritable file. ;; 2008/03/07 dadams ;; Renamed icicle-abort-minibuffer-input to icicle-abort-recursive-edit. ;; 2008/03/02 dadams ;; icicle-describe-file: ;; Use default dir if arg is nil. Error if no readable file. Removed save-excursion. ;; 2008/02/24 dadams ;; icicle-apropos-complete-1: Use icicle-apropos-match-fns-alist lookup for message. ;; icicle-Completions-mouse-3-menu: Added item for icicle-next-apropos-match-function. ;; Added: icicle-next-apropos-match-function. ;; 2008/02/22 dadams ;; icicle-retrieve-candidates-from-set: ;; Like logic for alist in icicle-completing-read: ;; Do icicle-readable-to-markers, then copy car and replace cdr with whole candidate. ;; Removed RAW arg from call to find-file-noselect. ;; Wrap Lisp read in condition-case. ;; Renamed, added un: icicle(-mouse)-save-candidate to icicle(-mouse)-save/unsave-candidate. ;; icicle-add/update-saved-completion-set: Changed default name to just add .icy. ;; icicle-candidate-set-save-1, icicle-retrieve-candidates-from-set: ;; Wrap write/read to/from cache file in condition-case. ;; 2008/02/16 dadams ;; icicle-retrieve-candidates-from-set: ;; Convert alist cands to propertized strings, using i*-put-alist-* and i*-readable-to-*. ;; Set icicle-candidates-alist to reconstituted retrieved candidates. ;; icicle-candidate-set-save-1: ;; Convert to readable alist from propertized text, using i*-markers-to-*, i*-get-alist-*. ;; Added: icicle-readable-to-markers, icicle-markers-to-readable. ;; 2008/02/15 dadams ;; icicle-delete-windows-on: ;; Enable recursive minibuffers for interactive use. Thx to Simon Marshall. ;; 2008/02/14 dadams ;; icicle-add/update-saved-completion-set: Remove properties from completion-set string. ;; icicle-change-sort-order, icicle-retrieve-previous-input, ;; icicle-insert-string-from-variable, icicle(-mouse)-candidate-read-fn-invoke, ;; icicle-narrow-candidates, icicle-save-predicate-to-variable, ;; icicle-candidate-set-retrieve, icicle-candidate-set-save-1, ;; icicle-add/update-saved-completion-set, icicle-isearch-complete: ;; Bind icicle-whole-candidate-as-text-prop-p to nil. ;; 2008/02/07 dadams ;; icicle-delete-windows-on: ;; Delete frame if one-window-p and not a standalone minibuffer. Thx to Simon Marshall. ;; 2008/02/03 dadams ;; icicle-mouse-choose-completion: ;; Use absolute file name for choice and prepend dir in minibuffer. Set base-size to 0. ;; Don't remove *Completions* window. ;; icicle-mouse-candidate-action-1: Use absolute file name for choice. ;; icicle-mouse-choose-completion, icicle-mouse-candidate-action-1, ;; icicle-current-completion-in-Completions: buffer-substring -> *-no-properties. ;; icicle-nb-of-candidate-in-Completions: Update last-nb before the test, in loop. ;; icicle-prefix-complete-1: If input matches empty dir, use that dir as sole completion. ;; Don't remove *Completions* window until after minibuffer msg. ;; icicle-move-to-next-completion: Use icicle-show-Completions-help-flag, not hard-coded 3. ;; icicle-candidate-action-1: For require-match case also, remove cand and display others. ;; Added: icicle-choose-completion. ;; 2008/01/30 dadams ;; Added: icicle-yank-secondary, icicle-mouse-yank-secondary. ;; 2008/01/29 dadams ;; icicle-(apropos|prefix)-complete-1: ;; If icicle-incremental-completion-flag is explicit*, treat like incremental completion. ;; icicle-apropos-complete-1: ;; Distinguish non-existent dir from empty dir: icicle-apropos-any-file-name-candidates-p. ;; icicle-highlight-input-noncompletion takes no args now. ;; 2008/01/13 dadams ;; icicle-mouse-choose-completion, icicle-insert-completion, ;; icicle-mouse-candidate-action-1, icicle-mouse-save-candidate: ;; Do not use icicle-transform-multi-completion. ;; icicle-retrieve-last-input, icicle-(apropos|prefix)-complete-1: ;; Do not treat handle-switch-frame. ;; icicle-mouse-candidate-action-1: Add back \n only if it has property icicle-keep-newline. ;; icicle-mouse-remove-candidate: Removed cruft. ;; icicle-remove-candidate-display-others: save-selected-window around Completions display. ;; icicle-help-on-candidate: Rewrote. ;; Do not use icicle-transform-multi-completion except where appropriate. ;; Always use icicle-candidate-help-fn as first priority, if defined. ;; Give help for prefix keys too during key completion. ;; icicle-help-on-candidate-symbol: No call to icicle-candidate-help-fn here. ;; 2008/01/04 dadams ;; icicle-mouse-choose-completion, icicle-current-completion-in-Completions: ;; Add candidate's final \n only if it has property icicle-keep-newline. ;; 2007/01/01 dadams ;; icicle-narrow-candidates: For Emacs < 22, don't tack dir onto file name if absolute. ;; icicle-candidate-set-save-1: Only redisplay candidates if *Completions* was displayed. ;; 2007/12/31 dadams ;; icicle-mouse-choose-completion, icicle-mouse-candidate-action-1: ;; Add back candidate's final \n that is missing mouse-face. ;; Return icicle-candidate-nb, as doc string says. ;; icicle-mouse-candidate-action-1: Delete current input from minibuffer before acting. ;; Added: icicle-insert-list-join-string. ;; Don't mention that C-o is bound to icicle-candidate-action. ;; 2007/12/26 dadams ;; icicle-transform-multi-completion: Empty input after join string means empty part. ;; icicle-help-on-candidate: Don't call icicle-raise-Completions-frame. ;; 2007/12/11 dadams ;; icicle-change-sort-order: ;; Don't include icicle-proxy-candidate-first-p unless icicle-add-proxy-candidates-flag. ;; 2007/12/10 dadams ;; icicle-exit-minibuffer, icicle-kill-failed-input: ;; Face icicle-input-completion-fail-lax also. ;; 2007/12/09 dadams ;; icicle-exit-minibuffer: Remove icicle-input-completion-fail face from input. ;; icicle-kill-failed-input: Rehighlight after deleting highlighted part. ;; 2007/12/08 dadams ;; icicle-(next|previous)-line: Rewrote for variable number of columns. ;; Added: , icicle-(beginning|end)-of-line+. ;; 2007/12/03 dadams ;; Renamed longest common match (lcm) to expanded common match (ecm). ;; 2007/11/30 dadams ;; icicle-help-on-candidate-symbol: ;; Use fboundp, not functionp, to get describe-function for macros too. ;; 2007/11/28 dadams ;; Renamed describe-bindings-in-map to describe-keymap. ;; icicle-toggle-proxy-candidates: Swap values for saved and unsaved. ;; 2007/11/25 dadams ;; Added: icicle-sort-by-abbrev-frequency. ;; icicle-help-on-candidate-symbol: Treat command abbrevs via apropos for their commands. ;; 2007/11/24 dadams ;; Added: icicle-sort-proxy-candidates-first. ;; 2007/11/22 dadams ;; icicle-help-on-candidate-symbol: Use describe-bindings-in-map for a keymap. ;; 2007/11/17 dadams ;; Added: icicle-toggle-proxy-candidates. Added to icicle-Completions-mouse-3-menu also. ;; 2007/11/04 dadams ;; Require subr-21 if replace-regexp-in-string is not defined. ;; Require icicles-mac (don't wrap in eval-when-compile). ;; icicle-Completions-mouse-3-menu: Added the latest toggle commands. ;; 2007/10/28 dadams ;; Added: icicle-toggle-expand-to-common-match, icicle-toggle-search-replace-common-match. ;; icicle-retrieve-last-input: ;; Treat prefix completion like non-nil expand-input-to-common-match-flag. ;; icicle-search-define-replacement: Bind icicle-update-input-hook to nil. ;; icicle-toggle-highlight-all-current: ;; Save icicle-candidate-nb around rehighlighting. ;; Call icicle-search-action to get back to current candidate and highlight it. ;; 2007/10/27 dadams ;; icicle-search-define-replacement: ;; Bind candidates, input, and cand #, to restore after read replacement string. ;; 2007/10/26 dadams ;; icicle-toggle-highlight-all-current: select-frame-set-input-focus to minibuffer. ;; 2007/10/22 dadams ;; icicle-doremi-*: Use 4 arrows - one command hands off to the other. ;; 2007/10/21 dadams ;; Added: icicle-doremi-inter-candidates-min-spaces, icicle-doremi-candidate-width-factor. ;; 2007/10/14 dadams ;; Updated doc strings to reflect icicle-act-before-cycle-flag. ;; 2007/10/13 dadams ;; icicle-candidate-action-1: ;; Don't set icicle-last-completion-candidate if string. Used for repeated C-next. ;; icicle-remove-candidate-display-others, icicle-history: ;; Treat also the case where cand is a string, not a consp. ;; 2007/10/07 dadams ;; icicle-delete-candidate-object: Respect icicle-deletion-action-flag. ;; 2007/10/02 dadams ;; icicle-(apropos|prefix)-complete-1: ;; Apply abbreviate-file-name to file-name input. Thx to Joonhwan Lee. ;; icicle-toggle-fuzzy-completion: Removed soft require of fuzzy-match+.el. ;; 2007/09/29 dadams ;; Added: icicle-toggle-fuzzy-completion. ;; icicle-Completions-mouse-3-menu: Added icicle-toggle-fuzzy-completion. ;; icicle-prefix-complete-1: Adjust feedback messages for fuzzy completion. ;; icicle-(apropos|prefix)-complete-1: ;; Only set icicle-default-directory if (icicle-file-name-input-p). ;; 2007/09/25 dadams ;; icicle-narrow-candidates: Treat icicle-whole-candidate-as-text-prop-p case. ;; icicle-kill-failed-input: Rewrote. ;; 2007/09/21 dadams ;; icicle-narrow-candidates: ;; Emacs<22, file-name completion: Append directory to each candidate. Thx Ian Perryman. ;; 2007/09/14 dadams ;; icicle-(apropos|prefix)-complete-1, icicle-prefix-word-complete: ;; Wrapped condition-case around candidates computation. ;; 2007/08/25 dadams ;; icicle-mouse-candidate-action-1: Use buffer-substring, not buffer-*-no-properties. ;; 2007/08/21 dadams ;; icicle-(apropos|prefix)-complete-1: ;; Reset icicle-input-fail-pos. Call icicle-highlight-input-noncompletion when no match. ;; 2007/08/19 dadams ;; Added: icicle-kill-failed-input. ;; 2007/08/18 dadams ;; icicle-previous-apropos-candidate-alt-action: Fixed typo. Thx to Hadron Quark. ;; 2007/07/29 dadams ;; icicle-apply-to-saved-candidate: ;; Added use-icicle-candidates-alist-p arg. Use icicle-get-alist-candidate. ;; Report original error message also. ;; icicle-candidate-action-1: Do nothing if icicle-last-completion-candidate not a string. ;; 2007/07/27 dadams ;; icicle-successive-action: ;; icicle-act-first-then-navigate-p -> icicle-act-before-cycle-flag. ;; 2007/07/08 dadams ;; icicle-all-candidates(-alt)-action: ;; Use icicle-all-candidates(-alternative)-action-fn if defined. ;; icicle-all-candidates-action-1: Added listp arg. ;; icicle-mouse-save-candidate: ;; Deactivate mark and redisplay completions, to show save highlight. ;; 2007/07/07 dadams ;; Added: icicle-candidate-set-save(-more)-selected(-1), ;; icicle-mouse-candidate-set-save(-more), icicle-mouse-save-then-kill. ;; icicle-insert-completion: If no current completion, return to minibuffer anyway. ;; Update icicle-current-input with inserted candidate. ;; icicle-Completions-mouse-3-menu: ;; Added icicle-candidate-set-save-(more(-selected)|-selected). ;; icicle-save-candidate: If no defined icicle-candidate-nb, then just display message. ;; icicle-candidate-set-save(-more): ;; Use icicle-candidate-set-save-1: Intern variable in standard obarray also. Redisplay ;; candidates and reselect minibuffer after reading file/var name. Put eof error in ;; minibuf. Deactivate mark and redisplay completions. Separate msg if reset. ;; icicle-candidate-set-retrieve: If nothing to restore, don't restore nothing. ;; If single candidate to restore, no *Completions* display. ;; Else, update candidate display. ;; 2007/07/04 dadams ;; icicle-Completions-mouse-3-menu: Added icicle-retrieve-(next|\previous)-input. ;; 2007/07/03 dadams ;; Added: icicle-insert-history-element, icicle-retrieve-(next|previous)-input. ;; icicle-history, icicle-keep-only-past-inputs: ;; Don't retrieve last input unless following a cycling command. ;; icicle-history: ;; Do an initial icicle-apropos-complete unless icicle-last-completion-command. ;; If not following a cycling command, call icicle-last-completion-command (don't set it ;; to empty string) and reset icicle-last-input to nil. ;; icicle-Completions-mouse-3-menu: ;; icicle-retrieve-(next|previous)-input, not icicle-retrieve-last-input. ;; Redefined next-history-element, instead of using defadvice. ;; 2007/06/23 dadams ;; icicle-search-define-replacement: Use icicle-completing-read-history, not read-string. ;; Use icicle-search-replacement-history. ;; 2007/06/17 dadams ;; Added: icicle-toggle-WYSIWYG-Completions. ;; icicle-switch-to-Completions-buf, icicle-move-to-next-completion: ;; Added priority in call to icicle-place-overlay. ;; 2007/06/13 dadams ;; Added: icicle-candidate-set-save-more. ;; icicle-candidate-set-save: Unify messages. ;; 2007/06/12 dadams ;; Added: icicle(-mouse)-save-candidate. ;; icicle-candidate-set-retrieve: Insert candidate if there is only one retrieved. ;; icicle-insert-completion: Added optional completion arg for non-interactive insertion. ;; 2007/06/10 dadams ;; icicle-candidate-action-1: Treat icicle-require-match-p. ;; 2007/06/09 dadams ;; icicle-candidate-action-1, icicle-mouse-candidate-action-1: ;; Remove candidate if icicle-use-candidates-only-once-flag. ;; icicle-candidate-action-1: ;; Let users act on non-candidate too (arbitrary input). ;; 2007/06/07 dadams ;; Renamed: icicle-function-history to icicle-function-name-history, ;; icicle-variable-history to icicle-variable-name-history. ;; Use standard history variable if bound, else use Icicles history variable: ;; function-name-history, variable-name-history ;; 2007/06/01 dadams ;; icicle-erase-minibuffer-or-history-element, icicle-history: ;; Ensure value of minibuffer-history-variable is bound. ;; icicle-keep-only-past-inputs: If value of minibuffer-history-variable unbound, set nil. ;; icicle-keep-only-past-inputs, icicle-history: ;; Assume value of minibuffer-history-variable is a symbol - don't test that. ;; 2007/05/29 dadams ;; icicle-insert-thing: Added optional arg no-replace-p. Make sure end points are defined. ;; icicle-insert-string-from-variable: Call icicle-insert-thing with no-replace-p arg. ;; icicle-minibuffer-complete-and-exit: Set window-point to end of minibuffer. ;; 2007/05/15 dadams ;; icicle-completion-help and top level: ;; Soft require help-mode, not (featurep 'help-mode) and (fboundp 'define-button-type). ;; 2007/05/08 dadams ;; Added: icicle-save-predicate-to-variable. ;; icicle-Completions-mouse-3-menu: Added icicle-save-predicate-to-variable to menu. ;; icicle-narrow-candidates-with-predicate: Quoted the predicate that is read. ;; 2007/05/07 dadams ;; Added: icicle-narrow-candidates-with-predicate. ;; icicle-Completions-mouse-3-menu: Added icicle-narrow-candidates-with-predicate (M-&). ;; 2007/05/06 dadams ;; icicle-completion-help: Updated text at top of help buffer. ;; icicle-customize-button: Capitalized group Icicles. ;; Changed S-C- to C-S- and M-C- to C-M- in doc. ;; 2007/05/04 dadams ;; icicle-candidate-read-fn-invoke, icicle-keep-only-*-inputs, icicle-retrieve-last-input, ;; icicle-candidate-set-(retrieve|save|swap|difference|union|intersection|complement), ;; icicle-all-candidates(-alt)-action, icicle-pp-eval-expression, ;; icicle-insert-string-from-variable: ;; Can call from *Completions* too, so can choose from mouse-3 menu during multi-command. ;; icicle-candidate-set-save, icicle-retrieve-last-input, icicle-insert-*-from-variable: ;; Select minibuffer window. ;; icicle-toggle-case-sensitivity: Use setq-default for case-fold-search. ;; icicle-switch-to-Completions-buf: ;; Use read-file-name-completion-ignore-case, if completing file name. ;; Added empty defvars for Emacs 22 standard vars, to quiet byte compiler. ;; 2007/05/02 dadams ;; Added: icicle-dispatch-M-q, icicle-toggle-search-whole-word. ;; Removed: icicle-dispatch-C-backquote. ;; 2007/04/29 dadams ;; Added: icicle-sort-by-last-file-modification-time (sort order). ;; 2007/04/19 dadams ;; icicle-successive-action: No longer interactive. Moved barfing to calling commands. ;; 2007/04/17 dadams ;; Added: icicle-dispatch-M-comma, icicle-search-define-replacement, ;; icicle-dispatch-C-backquote, icicle-toggle-literal-replacement. ;; 2007/04/08 dadams ;; Added: icicle-all-candidates-alt-action, icicle-all-candidates-action-1. ;; icicle-candidate-action-1, icicle-delete-candidate-object, icicle-help-on-candidate, ;; icicle-candidate-read-fn-invoke: ;; Use negative test for prefix mode, not positive test for apropos. ;; 2007/04/07 dadams ;; Added: icicle-successive-action, icicle-toggle-search-replace-whole, ;; icicle-dispatch-C-comma. ;; Defined navigating action and help functions using icicle-successive-action. ;; 2007/03/31 dadams ;; icicle-(apropos|prefix)-complete-1: ;; Accept sole completion if icicle-top-level-when-sole-completion-flag. ;; icicle-narrow-candidates: ;; Use read-file-name only for Emacs 22 or later. ;; Accept sole completion only if icicle-top-level-when-sole-completion-flag. ;; icicle-apropos-complete-and-narrow: Bind icicle-top-level-when-*-flag to t. ;; 2007/03/30 dadams ;; icicle-narrow-candidates: Suppress sole-completion minibuffer-message. ;; 2007/03/23 dadams ;; Added: icicle-apropos-complete-and-narrow. Thx to Marian Schubert for the suggestion. ;; icicle-narrow-candidates: Use icicle-require-match-p as REQUIRE-MATCH arg. ;; 2007/03/09 dadams ;; Changed require to eval-when-compile require for icicles-mac.el. ;; 2007/03/08 dadams ;; icicle-delete-current-candidate-object: Rewrote. ;; Value of var can be an arbitrary alist, a list of strings, or a list of symbols. ;; icicle-remove-candidate-display-others: Rewrote. ;; Set icicle-last-completion-candidate based on icicle-candidate-nb or 0. ;; Delete icicle-last-completion-candidate completely from icicle-completion-candidates. ;; Update minibuffer-completion-predicate or read-file-name-predicate to remove for ;; completion. ;; Use with-current-buffer, not save-window-excursion, to visit *Completions*. ;; icicle-remove-candidate: ;; Updated doc string to mention Emacs < 22 limitation for file-name candidates. ;; icicle-retrieve-last-input: Don't reset icicle-last-completion-command if interactive. ;; 2007/03/07 dadams ;; icicle-switch-to-Completions-buf, icicle-remove-candidate-display-others, ;; icicle-help-on-candidate, icicle-delete-windows-on: ;; Use 0, not t, as frame arg to get-buffer-window. ;; 2007/03/06 dadams ;; icicle-remove-candidate: Don't reset to first cand matching input if no last cand. ;; icicle-change(alternative)-sort-order, icicle-reverse-sort-order, ;; icicle-keep-only-past-inputs, icicle-toggle-sorting: Respect icicle-inhibit-sort-p. ;; Renamed icicle-get-current-candidate to icicle-get-alist-candidate. ;; 2007/03/04 dadams ;; icicle-remove-candidate-display-others: ;; Use local var for cand-nb, because icicle-candidate-nb can change. ;; If no last candidate, reset to first candidate matching input. ;; Allow for icicle-candidate-nb not being defined here: ;; Use icicle-get-current-candidate. Move to next completion only if cand-nb defined. ;; Use mapconcat only when delete multi-completion. ;; Move to next completion in *Completions* only if icicle-candidate-nb was defined. ;; Insert default-directory too, if icicle-file-name-input-p. ;; icicle-insert-completion: Insert default-directory too, if icicle-file-name-input-p. ;; icicle-(apropos|prefix)-complete-1, icicle-keep-only-past-inputs: ;; Don't include directory when set icicle-last-completion-candidate. ;; icicle-(apropos|prefix)-complete-1: ;; Don't include directory when testing input membership in icicle-completion-candidates. ;; 2007/03/02 dadams ;; icicle-delete-candidate-object: ;; Corrected message target (object). Added sit-for. ;; Use local var for cand-nb, because icicle-candidate-nb can change. ;; 2007/02/27 dadams ;; icicle-delete-candidate-object: Added message. ;; icicle-delete-current-candidate-object: Don't erase minibuffer or update completions. ;; 2007/02/24 dadams ;; Added: icicle(-mouse)-candidate-alt-action, icicle(-mouse)-candidate-action-1, ;; icicle-(previous|next)-(apropos|prefix)-candidate-alt-action, ;; icicle(-mouse)-remove-candidate, icicle-remove-candidate-display-others, ;; icicle-delete-candidate-object, icicle-delete-current-candidate-object. ;; icicle-insert-completion: ;; Invoke icicle-transform-multi-completion. Use with-current-buffer (window-buffer). ;; icicle(-mouse)-candidate-action: Use icicle(-mouse)-candidate-action-1. ;; 2007/02/06 dadams ;; icicle-completion-help: Added extra help if completing and if multi-command. ;; 2007/02/03 dadams ;; Renamed icicle-icompleting-p to icicle-edit-update-p. ;; 2007/02/02 dadams ;; Updated doc strings of toggle commands to mention the minibuffer bindings. ;; 2007/01/29 dadams ;; icicle-change-sort-order: Don't sort icicle-sort-functions-alist entries for use. ;; Define alphabetical sort order using icicle-case-string-less-p, not string-lessp. ;; 2007/01/23 dadams ;; Added: icicle-toggle-highlight-historical-candidates. ;; icicle-Completions-mouse-3-menu: Updated wrt toggles. ;; 2007/01/21 dadams ;; icicle-narrow-candidates: ;; Use minibuffer-history-variable, not regexp-history. Thx to Jost for bug report. ;; 2007/01/20 dadams ;; icicle-mouse-(choose-completion|candidate-action): ;; Use icicle-transform-multi-completion. ;; 2007/01/15 dadams ;; Added: icicle-change(-alternative)-sort-order, icicle-reverse-sort-order, ;; icicle-current-sort-order, icicle-sort-*. ;; icicle-transform-sole-candidate: Set icicle-last-*-candidate to transformed cand. ;; icicle-help-on-candidate: Use icicle-transform-multi-completion. ;; icicle-Completions-mouse-3-menu: Updated with new sort-order bindings. ;; icicle-toggle-alternative-sorting: Better message. ;; Require icicles-mac.el. ;; 2007/01/14 dadams ;; Added: icicle-transform-multi-completion, icicle-transform-sole-candidate. ;; icicle-(apropos|prefix)-complete-1: Use icicle-transform-sole-candidate. Thx Rubikitch. ;; icicle-help-on-candidate(-symbol): ;; Use with-current-buffer to describe mode in Emacs 20 also. ;; 2007/01/13 dadams ;; Added: icicle-describe-file, icicle-help-on-candidate-symbol. ;; icicle-help-on-candidate: ;; If existing symbol, describe it. Else if buffer or file, describe it. Else, convert ;; string to symbol and describe it. Use icicle-help-on-candidate-symbol. ;; 2007/01/10 dadams ;; icicle-switch-to/from-minibuffer: Error message if minibuffer is not active. ;; 2007/01/06 dadams ;; icicle-(apropos|prefix)-complete-1: ;; expand-file-name -> icicle-abbreviate-or-expand-file-name. ;; Added: icicle-toggle-~-for-home-dir. ;; icicle-prefix-complete-1: ;; Set icicle-default-directory only if also icicle-file-name-input-p. ;; 2007/01/01 dadams ;; icicle-add/update-saved-completion-set: Use icicle-assoc-delete-all, not delete of assoc. ;; Runtime, not compile-time, require of icicles-var.el, icicles-opt.el. ;; 2006/12/29 dadams ;; icicle-insert-string-at-point: ;; Treat nil return of alternative text-grabbing function. ;; Echo the text-grabbing function when icicle-default-thing-insertion = alternatives. ;; icicle-ensure-overriding-map-is-bound: Separate treatment for diff Emacs versions. ;; 2006/12/25 dadams ;; icicle-keep-only-past-inputs: ;; Added optional recent-first arg: Use icicle-most-recent-first-p as sort function. ;; Update cands list if repeat. Do not scroll Completions; update it unconditionally. ;; Added: icicle-candidate-set-truncate. ;; Uncommented describe-mode code, since RMS fixed Emacs bug that caused infinite recursion. ;; 2006/12/24 dadams ;; Added: icicle-Completions-mouse-3-menu. ;; 2006/12/23 dadams ;; icicle-narrow-candidates: Bug fix: Treat file-name completion with read-file-name. ;; icicle-help-on-candidate: Call non-nil icicle-candidate-help-fn on candidate. ;; 2006/12/18 dadams ;; icicle-apply-to-saved-candidate: Remove print arg and use current-prefix-arg instead. ;; icicle-ensure-overriding-map-is-bound: Protect overriding-map-is-bound with boundp. ;; Bug fix for Emacs 21: protect help-xref with get type button-category-symbol. ;; 2006/12/17 dadams ;; Added: icicle(-mouse)-candidate-read-fn-invoke, icicle-apply-to-saved-candidate. ;; 2006/12/10 dadams ;; Created from minibuffer and *Completions* commands in icicles-cmd.el. ;;;(@* "CHANGE LOG FOR `icicles-mode.el'") ;; ;; 2013/04/23 dadams ;; Added: icicle-minibuf-(act-on-all|candidate-set|edit|history|save-retrieve)-menu-map, ;; Minibuf menu: Factored with submenus: ;; Act on All Candidates, Candidate Set, Edit, History, Save/Retrieve Candidates. ;; icicle-define-icicle-maps: Put buffer stuff on Buffers > Icicles, not File > Icicles > Buffers. ;; 2013/04/08 dadams ;; icicle-(redefine|restore)-std-completion-fns: ;; icicle-mouse-choose-completion is only for Emacs < 23.2. ;; 2013/04/05 dadams ;; icicle-mode: Call ad-activate for all enabled advice. ;; 2013/04/04 dadams ;; Added: defadvice for ess-completing-read. ;; icicle-mode: Turn that defadvice on/off. ;; 2013/04/03 dadams ;; Added: defadvice for ess-* completion functions. ;; icicle-mode: Turn that defadvice on/off. ;; 2013/04/02 dadams ;; icicle-define-minibuffer-maps: Bind C-M-T to icicle-top-level in completion-list-mode-map. ;; 2013/02/28 dadams ;; icicle-(redefine|restore)-(standard-functions|std-completion-fns), ;; eval-after-load (comint|ess-site|gud|info|bbdb-com|dired-aux|dired-x|recentf|icicles-mode): ;; Use fset, not defalias. Thx to Michael Heerdegen. ;; 2013/02/16 dadams ;; icicle-mode: Removed list of commands from doc string - just refer to file headers. ;; 2013/02/09 dadams ;; Moved autoload cookies for icicle-mode, icy-mode to icicles.el (with full doc string). ;; 2013/02/04 dadams ;; Removed all autoload cookies, except for icicle-mode, icy-mode. ;; 2013/02/03 dadams ;; Renamed: *-(bind|restore)-custom-completion-keys to *-(bind|restore)-custom-minibuffer-keys. ;; icicle-(un)bind-isearch-keys: (Un)Bind keys of new option icicle-isearch-history-insert-keys. ;; icicle-define-minibuffer-maps: ;; Use icicle-(bind|restore)-custom-minibuffer-keys instead of individual define-keys. ;; icicle-(bind|restore)-custom-minibuffer-keys: ;; Added parameter OPTION, instead of just hard-coding icicle-completion-key-bindings. ;; 2013/01/26 dadams ;; icicle-define-minibuffer-maps: ;; Bind icicle-multi-inputs-act (M-R), icicle-multi-inputs-save (M-S). ;; Add to menus: icicle-multi-inputs-act, icicle-multi-inputs-save, icicle-roundup. ;; icicle-bind-completion-keys: ;; Add to menus: icicle-multi-inputs-act, icicle-multi-inputs-save, icicle-roundup. ;; 2013/01/04 dadams ;; icicle-define-minibuffer-maps: Undefine/restore M-s, M-r for minibuffer-local(-ns|-isearch)-map. ;; 2012/12/31 dadams ;; Added: icicle-show-current-help-in-mode-line. ;; icicle-mode: Add/remove icicle-show-current-help-in-mode-line to/from icicle-post-command-hook. ;; icicle-minibuffer-setup: Initialize icicle-mode-line-help to nil. ;; 2012/12/02 dadams ;; icicle-(redefine|restore)-std-completion-fns: Added icicle(-ORIG)-read-file-name-default. ;; 2012/12/01 dadams ;; Added: icicle-bind-custom-completion-keys, icicle-restore-custom-completion-keys (factored out). ;; Removed load of icicles-mac.el (icicle-kbd is now a function in icicles-opt.el). ;; icicle-(bind|restore)-completion-keys: Use icicle-(bind|restore)-custom-completion-keys. ;; Escape semicolon (;) in icicle-kbd string args (just for Emacs 20 M-; in Lisp code). ;; 2012/11/27 dadams ;; icicle-define-icicle-maps: Added icicle-apropos-value to icicle-apropos-menu-map. ;; 2012/11/20 dadams ;; icicle-bind-completion-keys: Fixed typos for M-; and C-M-; introduced by M-; or C-M-q, Emacs 20. ;; 2012/10/27 dadams ;; Handle new BBDB version also. ;; icicle-define-icicle-maps: Added icicle-toggle-annotation. ;; icicle-(bind|restore)-completion-keys: Bind icicle-toggle-annotation to C-x C-a. ;; icicle-mode: Added icicle-toggle-annotation to doc string. ;; 2012/10/05 dadams ;; icicle-minibuffer-setup: Removed binding of icicle-default-directory (unused). ;; 2012/10/01 dadams ;; icicle-define-icicle-maps: Protect dired-get-marked-files with condition-case. ;; 2012/09/15 dadams ;; icicle-define-icicle-maps, icicle-(bind|restore)-other-keymap-keys: ;; Added icicle-visit-marked-file-of-content(-other-window). ;; 2012/09/08 dadams ;; icicle-define-icicle-maps: *-buffer-ignore-space-prefix-flag, not *-ignore-space-prefix-flag. ;; icicle-(redefine|restore)-std-completion-fns: Added icicle(-ORIG)-read-buffer. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-bbdb-complete-name, icicle-ORIG-comint-dynamic-complete, ;; icicle-ORIG-comint-dynamic-complete-filename, ;; icicle-ORIG-comint-replace-by-expanded-filename, ;; icicle-ORIG-dired-read-shell-command, icicle-ORIG-ess-complete-object-name, ;; icicle-ORIG-gud-gdb-complete-command, icicle-ORIG-read-file-name, ;; icicle-ORIG-read-shell-command, icicle-ORIG-crm-local-completion-map, ;; icicle-ORIG-crm-local-must-match-map. ;; icicle-(redefine|restore)-standard-(functions|widgets|completion-fns): ;; Use new prefix, icicle-ORIG-, not old-. ;; icicle-(redefine|restore)-std-completion-fns: ;; Applied renaming to new: icicle-orig-read-file-name-fn. ;; Top level aliasing to save originals: Use new prefix, icicle-ORIG-, not old-. ;; 2012/08/03 dadams ;; icicle-(un)bind-key-completion-keys-(for-map-var|in-keymaps-from): Added optional arg KEYS. ;; icicle-(bind|restore)-other-keymap-keys: ;; (Un-)bind icicle-key-complete-keys-for-minibuffer in minibuffer-local-map, for key completion. ;; 2012/07/31 dadams ;; Added: icicle-(redefine|restore)-standard-widgets. ;; icicle-mode: Added call to icicle-(redefine|restore)-standard-widgets. ;; 2012/07/13 dadams ;; icicle-(bind|restore)-completion-keys: Bind icicle-toggle-network-drives-as-remote to C-x :. ;; 2012/07/10 dadams ;; icicle-define-minibuffer-maps, icicle-(bind|restore)-completion-keys: ;; Bind C-M-pause in all minibuffer maps, not just completion maps. ;; 2012/07/08 dadams ;; Defalias old-comint-completion-at-point for Emacs 24+. Thx to Christopher Schmidt, M. Heerdegen. ;; 2012/06/08 dadams ;; icicle-define-minibuffer-maps: fboundp of icicle-yank-secondary, not yank-secondary. ;; 2012/05/25 dadams ;; Added icicle-dired-insert-as-subdir to menu icicle-dired-dir-menu-map. ;; 2012/05/15 dadams ;; Added to and reorg'd Search, Go To menus. Added submenus Bookmarks & Definitions. ;; Added to menus: icicle-search-define-replacement, icicle-search-w-isearch-string, ;; icicle-search-(overlay|char), icicle-imenu-*, icicle-search-THINGs, icicle-search-*-marked, ;; icicle-search-*-bookmark. ;; icicle-dired-multiple-menu-map: Added icicle-dired-save-marked-to-variable. ;; 2012/05/13 dadams ;; Added: icicle-dired-recursive-marked-menu-map. Put *-recursive commands on it. ;; Bind *recursive commands to same keys as non-recursive, but on M-+ prefix key. ;; 2012/05/10 dadams ;; Corrected guard condition for diredp-menu-bar-recursive-marked-menu. ;; 2012/05/07 dadams ;; Applied renaming of icicle-search-dired-marked to icicle-search-dired-marked-recursive. ;; 2012/05/06 dadams ;; Put icicle-search-dired-marked also on diredp-menu-bar-recursive-marked-menu, if available. ;; 2012/04/23 dadams ;; Enable icicle-search-dired-marked in icicle-dired-multiple-menu-map only if Dired+ is loaded. ;; Bind icicle-search-dired-marked in dired-mode-map only if Dired+ is loaded. ;; Removed :enable conditions for icicle-bookmark+-menu-map - it is always in bookmark-bmenu-mode. ;; 2012/04/21 dadams ;; (put 'icicle-mode 'custom-mode-group 'Icicles), so `C-u customize-mode icicle-mode' works. ;; icicle-mode: Change :group to Icicles from Icicles-Miscellaneous. ;; Updated list of top-level commands in doc string, and moved it to the end. ;; 2012/04/09 dadams ;; Fixed typo: double single-quotes in autoload cookie. ;; 2012/04/08 dadams ;; Make autoload cookies for commands load icicles[.el] explicitly. ;; Removed autoload cookie from icicle-bind-isearch-keys (non-interactive). ;; 2012/04/06 dadams ;; Replaced C-? with M-? as the binding for icicle-minibuffer-help (works for terminals also). ;; 2012/04/04 dadams ;; Added to menus: *-w-*-satisfying, icicle-apropos-options-of-type. Changed item names a bit. ;; 2012/04/02 dadams ;; icicle-mode: Propertize ON / OFF. ;; 2012/03/01 dadams ;; icicle-unbind-key-completion-keys-in-keymaps-from: Corrected last fix: follow symbol first. ;; 2012/02/29 dadams ;; icicle-unbind-key-completion-keys-in-keymaps-from: Skip autoload keymaps. ;; 2012/02/28 dadams ;; icicle-unbind-key-completion-keys-in-keymaps-from: Handle symbol keymaps: follow until a list. ;; 2012/02/26 dadams ;; Update to reflect Bookmark+ changes (bindings etc.). ;; icicle-bookmark-menu-map: Major changes. ;; Added items: ;; *-bookmark-(file-this-dir|autofile)-(all|some)-tags(-regexp), ;; *-bookmark-(temporary|autofile), *-bookmark(-autonamed)(-this-buffer), ;; *-bookmark-specific-(files|buffers), *-bookmark-(image|bookmark-file). ;; For icicle-touche-pas-aux-menus-flag case also: put bookmarks items on a submenu now. ;; Share the submenus - write only once. ;; Reuse (copy of) bmkp-* menu items, so Icicles cmds replace similar Bookmark+ cmds, in place. ;; icicle-define-icicle-maps: Reordered. ;; 2012/02/11 dadams ;; Bind icicle-toggle-expand-to-common-match to C-", not C-;. ;; Bind icicle-cycle-expand-to-common-match (new) to C-M-". ;; Doc strings: Applied renamings and key changes. ;; 2012/01/31 dadams ;; icicle-define-icicle-maps: Added: icicle-cycle-image-file-thumbnail. ;; Corrected typo for icicle-toggle-completions-format. ;; 2012/01/24 dadams ;; icicle-mode doc string: Added icicle-toggle-completions-format. ;; icicle-define-icicle-maps: Add icicle-toggle-completions-format to menus. ;; icicle-(bind|restore)-completion-keys: Bind icicle-toggle-completions-format to C-M-^. ;; 2012/01/20 dadams ;; Bind icicle-apropos-complete-and-exit in all completion maps, not just must-match map. ;; Apply renaming of icicle-toggle-incremental-completion to *-cycle-*. ;; 2011/10/21 dadams ;; icicle-(bind|restore)-completion-keys: Typo: M-g -> M-q, for icicle-dispatch-M-q. ;; 2011/10/08 dadams ;; eval-when-compile icicles-mac.el. ;; icicle-define-minibuffer-maps: Use new option icicle-candidate-help-keys. ;; icicle-(bind|restore)-completion-keys: Use new options icicle-candidate-(action|help)-keys. ;; icicle-bind-other-keymap-keys, icicle-(un)bind-isearch-keys, icicle-restore-other-keymap-keys, ;; icicle-define-minibuffer-maps, icicle-(bind|restore)-completion-keys: ;; Use icicle-kbd (and do not use kbd). ;; icicle-define-icicle-maps: Do not include icicle-toggle-angle-brackets for Emacs 20. ;; 2011/10/04 dadams ;; icicle-define-icicle-maps: Put all search commands on icicle-search-key-prefix. ;; icicle-(bind|restore)-other-keymap-keys: Mode-specific search cmds are on M-s M-s m, not M-s i. ;; 2011/09/08 dadams ;; icicle-bind-isearch-keys: Replace lambda with icicle-search-w-isearch-string. ;; 2011/09/06 dadams ;; icicle-define-minibuffer-maps, icicle-(bind|restore)-completion-keys: ;; Bind icicle-resolve-file-name to C-x C-f. ;; 2011/09/05 dadams ;; icicle-mode: Update doc string: icicle-toggle-hiding-non-matching-lines. ;; icicle-define-icicle-maps: Added icicle-toggle-hiding-non-matching-lines to menus. ;; icicle-bind-completion-keys: Bind C-x . to icicle-dispatch-C-x. (new). ;; 2011/09/02 dadams ;; icicle-(bind|restore)-other-keymap-keys: ;; Test fn memq in icicle-functions-to-redefine, not just non-nil icicle-functions-to-redefine. ;; Removed remap/unmap of Info commands. ;; Restore completion-at-point, not comint-dynamic-complete, for Emacs 24. ;; At end: defalias old-Info commands (instead of remapping in icicle-(bind|restore)-*-keys). ;; 2011/08/13 dadams ;; Bound icicle-toggle-search-complementing-domain to C-M-~ and added to menus. ;; 2011/08/12 dadams ;; icicle-define-minibuffer-maps: Removed code that binds C-x m, C-backspace, C-c +. ;; Do that in icicle-bind-file-candidate-keys now. ;; 2011/08/07 dadams ;; icicle-mode: Updated doc string for bookmark commands. ;; 2011/05/22 dadams ;; Added defvars for free vars to quiet byte compiler. ;; 2011/05/07 dadams ;; Changed key for icicle-regexp-quote-input from C-M-; to M-% everywhere. ;; Bound icicle-toggle-ignoring-comments to C-M-;. ;; icicle-mode doc string, icicle(-options)-menu-map: Added icicle-toggle-ignoring-comments. ;; 2011/05/03 dadams ;; icicle-define-icicle-maps: Add icicle-toggle-highlight-saved-candidates to menus. ;; icicle-(bind|restore)-completion-keys: Bind icicle-plus-saved-sort to C-M-+. ;; Bind icicle-toggle-highlight-saved-candidates to S-pause. ;; icicle-mode doc string: Mention icicle-toggle-highlight-saved-candidates. ;; 2011/04/12 dadams ;; icicle-define-icicle-maps: Added Icicles submenu for Bookmark+ menu. ;; icicle-(bind|restore)-other-keymap-keys: ;; Bound icicle-bookmark-save-marked-files(-as-project|-more) in bookmark-bmenu-mode-map. ;; 2011/03/29 dadams ;; icicle-define-minibuffer-maps, icicle-bind-completion-keys: ;; Bound C-M-(v|V) to icicle-scroll-(forward|backward). ;; Applied renaming: icicle-scroll-Completions(-up) to icicle-scroll-Completions-(back|for)ward. ;; 2011/03/26 dadams ;; icicle-define-icicle-maps: Added tags commands. ;; 2011/03/06 dadams ;; icicle-define-icicle-maps: ;; Added to Options (sub)menu: icicle-toggle-search-whole-word. ;; Removed from Options: icicle-toggle-highlight-all-current, icicle-regexp-quote-input. ;; Removed redundant :visible icicle-mode's for icicle-menu-map. ;; Added :help entries. ;; Corrected: icicle-bookmark-bookmark-list, icicle-bookmark-desktop: not other-window. ;; icicle-define-minibuffer-maps, icicle-(bind|restore)-completion-keys: ;; Added: icicle-toggle-highlight-all-current, icicle-regexp-quote-input, ;; icicle-erase-minibuffer-or-history-element (2), icicle-insert-list-join-string, ;; icicle-insert-key-description, icicle-insert-string-from-variable (2), ;; icicle-insert-string-at-point. ;; 2011/02/22 dadams ;; icicle-(bind|restore)-completion-keys: Bind C-x t to icicle-cycle-image-file-thumbnail. ;; icicle-mode: Do not add icicle-fit-completions-window to temp-buffer-show-hook. ;; Do it explicitly in icicle-display-candidates-in-Completions now. ;; Renamed: icicle-*-standard-commands to icicle-(redefine|restore)-standard-functions. ;; And rewrote them to just use new option icicle-functions-to-redefine. ;; Replaced: icicle-redefine-standard-commands-flag with icicle-functions-to-redefine everywhere. ;; Added: old-comint-dynamic-complete-filename. ;; 2011/02/17 dadams ;; icicle-(redefine|restore)-standard-commands: Use icicle-read-color for read-color. ;; 2011/01/20 dadams ;; icicle-define-minibuffer-maps, icicle-(bind|restore)-completion-keys: ;; Bind/restore keys C-M-S-[cf] (*-completing-read+insert-keys, *-read+insert-file-name-keys). ;; 2011/01/18 dadams ;; Require advice.el. ;; 2011/01/01 dadams ;; icicle-define-icicle-maps: Typo: icicle-search-tags-menu-map -> icicle-menu-map. Thx Le Wang. ;; 2010/12/26 dadams ;; Added autoload cookies to load icicles.el when command icicle-mode is invoked. ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; Added more autoload cookies for commands. Thx to Richard Kim. ;; 2010/11/23 dadams ;; icicle-define-icicle-maps: Added "in minibuf" to :key for C-?. Thx to Michael Heerdegen. ;; 2010/11/21 dadams ;; icicle-(redefine|restore)-standard-commands: ;; defalias lisp-complete-symbol unconditionally (it's still needed in some places for Emacs 23). ;; 2010/11/20 dadams ;; For eval-after-load's: ;; Protect eval of icicle-mode with boundp. ;; If the library is already loaded, then add the eval-after-load to icicles-mode.el instead. ;; Uncommented the code for simple.el for Emacs 23+. ;; dolist eval-after-load at end: Removed test for icicles-mode feature. ;; 2010/11/10 dadams ;; Define lisp-completion-at-point to return Icicles fn (don't defalias). Thx to M. Heerdegen. ;; 2010/11/06 dadams ;; icicle-top-level-prep: Reset current TAB and S-TAB methods, if temporary. ;; 2010/11/03 dadams ;; icicle-(redefine|restore)-standard-commands: ;; Updated for Emacs 23.2+: defalias lisp-completion-at-point instead. Thx to Michael Heerdegen. ;; 2010/10/21 dadams ;; icicle-minibuffer-setup:: Revert last change: this must NOT be local. ;; 2010/10/19 dadams ;; icicle-minibuffer-setup: Use non-nil LOCAL arg to add-hook for icicle-top-level-prep. ;; 2010/10/09 dadams ;; icicle-define-cycling-keys: ;; Define modal keys uncondiationally (no icicle-cycling-respects-completion-mode). ;; Define modal keys first, then non-modal. Remove no bindings (make no bindings to nil). ;; Removed hard-coded bindings for mouse wheel - handled by vars now, as before. ;; icicle-define-minibuffer-maps: ;; Hard-code down/up in completion-list-mode-map - do not reuse prefix completion keys. ;; Applied renaming of icicle-cycling-respects-completion-mode to icicle-default-cycling-mode. ;; 2010/10/08 dadams ;; icicle-minibuffer-setup: Don't set icicle-current-completion-mode in recursive minibuffer. ;; icicle-define-cycling-keys: Unconditionally define mouse wheel for modal cycling. ;; 2010/10/07 dadams ;; Use icicle-current-TAB-method function, not variable, everywhere. ;; 2010/10/06 dadams ;; icicle-define-cycling-keys: Let all non-conflicting non-modal keys remain: modal just ;; overwrites the conflicting non-modal. Thx to Michael Heerdegen. ;; 2010/07/17 dadams ;; w3m - > url. Add URL jump bindings. Replace w3m by url otherwise. ;; 2010/06/11 dadams ;; icicle-define-minibuffer-maps: Bind/restore C-c + to icicle-make-directory in file-name maps. ;; 2010/06/04 dadams ;; icicle-mode doc string: Mention missing doremi commands. ;; icicle-define-icicle-maps: Added Swank items and Max # of Completions, :visible for separator. ;; icicle-(bind|restore)-completion-keys: Bind icicle-doremi-increment-max-candidates+ to C-x #. ;; Apply renamings of icicle-doremi* (added +). ;; 2010/05/26 dadams ;; Add to command-history only if an interned symbol. Thx to Michael Heerdegen. ;; 2010/05/22 dadams ;; icicle-(bind|restore)-completion-keys: Bind icicle-candidate-read-fn-invoke to ESC C-m also. ;; 2010/05/17 dadams ;; icicle-define-icicle-maps: Changed :enable conditions for *-goto*-marker. Thx to M. Heerdegen. ;; 2010/05/15 dadams ;; icicle-mode: Updated doc string for bookmark commands. ;; 2010/05/09 dadams ;; Key-binding changes: icicle-change-sort-order is C-, icicle-dispatch-M-_ is M-_. ;; 2010/04/21 dadams ;; icicle-(redefine|restore)-std-completion-fns: Added icicle-sit-for for Emacs 23. ;; 2010/04/02 dadams ;; icicle-mode: Updated doc string: list of commands. ;; 2010/04/02 dadams ;; icicle-mode: Update doc string for change from regions to bookmarks. ;; icicle-define-icicle-maps: ;; Remove Icicles region stuff from menus. ;; Added to menus: icicle-search-bookmarks-together, icicle-search-bookmark, ;; icicle-select-bookmarked-region. ;; 2010/03/28 dadams ;; Applied renaming: icicle-search-all-regions to icicle-search-region. ;; Use icicle-search-region-bookmark in menus. ;; 2010/03/14 dadams ;; icicle-define-minibuffer-maps: Use featurep, not soft-require, for bookmark+.el. ;; Added bookmark+ to final dolist for eval-after-load. ;; 2010/03/13 dadams ;; icicle-define-icicle-maps: ;; Bound icicle-toggle-show-multi-completion to M-m in minibuffer, and added to menus. ;; Applied renaming of icicle-add-buffer-name-flag to icicle-show-multi-completion-flag. ;; 2010/02/17 dadams ;; Applied rename of icicl-redefined-functions to icicle-inhibit-advice-functions. ;; 2010/02/13 dadams ;; icicle-mode: ;; Fill icicle-advice-info-list from advised fns among icicle-redefined-functions. ;; Reactivate advised fns (in icicle-advice-info-list) when turn mode off. ;; Added to doc string: icicle-bookmark-(dired|desktop|bookmark-list|man)-other-window. ;; icicle-define-icicle-maps: Use (featurep 'recentf) instead of soft-requiring it. ;; icicle(-bookmark)-menu-map: Added type-specific bookmark jump commands. ;; eval-after-load's: Add (when (featurep 'icicles-mode)...) to ensure this file was loaded. ;; 2010/01/28 dadams ;; icicle-define-minibuffer-maps, icicle-restore-completion-keys: ;; Restore C-g correctly if delete-selection-mode. ;; 2009/12/25 dadams ;; icicle-mode: Call completion-ignored-build-disable to disable the advice. ;; 2009/12/21 dadams ;; Final dolist: Move loaded-library test outside of eval-after-load. ;; Update the test for Emacs 22+ (not just assoc). Thx to Kevin Ryde. ;; Combine eval-after-load's for dired-x. Remove eval-after-load for simple.el (preloaded). ;; fset -> defalias. ;; 2009/12/13 dadams ;; icicle-define-minibuffer-maps: ;; Bind C-x m to icicle-bookmark-file-other-window in file-name completion maps. ;; 2009/11/29 dadams ;; Don't reference minibuffer-local-must-match-filename-map unless bound (obsolete in 23.2). ;; 2009/11/27 dadams ;; icicle-(bind|restore)-completion-keys: Bind/restore C-x 1, C-x 2. ;; 2009/11/07 dadams ;; Applied doremi cmd renamings (added +). ;; 2009/10/25 dadams ;; icicle-mode, icicle-define-icicle-maps, icicle-bind-completion-keys: ;; Updated doc string, menus, keys for completion-method command renamings. ;; 2009/09/26 dadams ;; icicle-minibuffer-setup: Don't complete if icicle-progressive-completing-p. ;; 2009/09/16 dadams ;; icy-mode: Add icicle-insert-buffer to doc string. ;; icicle-define-icicle-maps: Added icicle-insert-buffer to icicle-menu-map. ;; 2009/09/10 dadams ;; icicle-bind-key-completion-keys-in-keymaps-from: Don't exclude menu maps. ;; 2009/09/03 dadams ;; icicle-add-menu-item-to-cmd-history: Wrap in condition-case, since on pre-command-hook. ;; 2009/08/18 dadams ;; icicle-add-menu-item-to-cmd-history: ;; Ensure this-command-keys-vector is not empty. Thx to Kai Tetzlaff and Lennart Borgman. ;; 2009/08/09 dadams ;; icicle-minibuffer-setup: Set region background for recursive minibuffers too. ;; icicle-restore-region-face: Don't restore unless going back to top level. ;; 2009/08/01 dadams ;; Added: icicle-add-menu-item-to-cmd-history. Thx to Lennart Borgman. ;; icy-mode: add/remove pre-command-hook, respecting icicle-menu-items-to-history-flag. ;; call-interactively defadvice: Do not save let savehist save icicle-interactive-history. ;; 2009/07/29 dadams ;; Change advice for call-interactively: ;; Use it only for Emacs 23+. Disable it to begin with. ;; Add only (non-mouse command) symbols to history. ;; icy-mode (Emacs 23+): ;; Enable/disable advice icicle-save-to-history when mode is turned on/off. ;; Enable the advics only if non-nil icicle-populate-interactive-history-flag. ;; icy-mode (Emacs 20-21): Remove advice icicle-save-to-history. ;; 2009/07/26 dadams ;; Advise call-interactively to save command to icicle-interactive-history. ;; icicle-(bind|restore)-completion-keys: Bind/restore C-M-pause as icicle-other-history. ;; 2009/07/13 dadams ;; Emacs 22+: ;; Added describe-face defadvice (icicle-respect-WYSIWYG). icicle-mode: (de)activate it. ;; 2009/06/18 dadams ;; icicle-mode: Added icicle-doremi-zoom-Completions to doc string. ;; 2009/06/17 dadams ;; icicle-(bind|restore)-completion-keys: Bind icicle-doremi-zoom-Completions to C-x -. ;; icicle-define-icicle-maps: ;; Add icicle-doremi-zoom-Completions to Options menu. ;; Change visible condition for all doremi stuff to ensure *Completions* is showing. ;; 2009/05/27 dadams ;; icicle-retrieve-(next|previous)-input: Removed unused (always nil) arg DONT-COMPLETE-P. ;; 2009/05/22 dadams ;; icicle-define-icicle-maps: Added icicle-Info-virtual-book to menu. ;; Require icicles-cmd[12].el. ;; 2009/05/17 dadams ;; dolist eval-after-load at end: Use icicle-toggle-icicle-mode-twice, not icy-mode calls. ;; 2009/05/09 dadams ;; icicle-define-icicle-maps: Added icicle-toggle-dot to options menu. Updated C-x . key. ;; icicle-(bind|restore)-completion-keys: ;; Bind *-toggle-dot to C-M-., *-toggle-hiding-common-match to C-x ., ;; *-insert-dot-command to .. ;; icy-mode: Mention icicle-toggle-dot in doc string. ;; 2009/05/02 dadams ;; icicle-minibuffer-setup: Set icicle-cmd-reading-input to this-command. ;; 2009/04/30 dadams ;; icicle-minibuffer-setup: Reset icicle-next-(prefix|apropos)-complete-cycles-p to nil. ;; 2009/04/20 dadams ;; icicle-bind-completion-keys: Don't bind C-S-(up|down|next|prior) explicitly. ;; icicle-restore-completion-keys: ;; Restore: icicle-(prefix|apropos)-cycle-(previous|next)-alt-action-keys, ;; icicle-modal-cycle-(up|down)-alt-action-keys. ;; Don't restore C-S-(up|down|next|prior) explicitly. ;; icicle-define-cycling-keys: ;; Bind/Restore: icicle-(prefix|apropos)-cycle-(previous|next)-alt-action-keys, ;; icicle-modal-cycle-(up|down)-alt-action-keys. ;; 2009/04/19 dadams ;; icicle-redefine-standard-commands: Added defalias for customize-apropos-options-of-type. ;; eval-after-loads: Use when/unless instead of and/or for fset's. (cosmetic) ;; 2009/04/18 dadams ;; icicle-mode: Mention in doc string: you might want to customize keys if no window mgr. ;; 2009/04/16 dadams ;; icicle-restore-completion-keys, icicle-define-cycling-keys: ;; Use icicle-(prefix|apropos)-cycle-(previous|next)-help-keys. ;; 2009/04/15 dadams ;; icicle-bind-completion-keys: Removed bindings for C-M-(up|down|prior|next). ;; icicle-restore-completion-keys: Unbind icicle-modal-cycle-(up|down)-help-keys. ;; icicle-define-cycling-keys: Bind/unbind all help keys (including modal ones). ;; 2009/03/27 dadams ;; icicle-(redefine|restore)-standard-commands: ;; Added icicle-minibuffer-default-add-completions. ;; 2009/03/16 dadams ;; icicle-define-icicle-maps: Use :visible for Icicle submenus themselves. ;; icicle-(redefine|restore)-standard-commands: Added icicle-recentf-make-menu-items. ;; Added eval-after load for recentf.el. ;; 2009/03/15 dadams ;; icicle-mode: Added to doc string: icicle-recompute-shell-command-candidates, ;; icicle-remove-file-from-recentf-list. ;; icicle-define-icicle-maps: Added icicle-remove-file-from-recentf-list to menus. ;; 2009/03/10 dadams ;; icicle-mode: Don't reset icicle-shell-*-cache if icicle-guess-commands-in-path is load. ;; Applied renaming: icicle-shell-command-candidates to *-cache ;; 2009/03/01 dadams ;; icicle-define-minibuffer-maps: ;; Bind icicle-completing-read+insert, icicle-read+insert-file-name. Add to Minibuf menu. ;; 2009/02/28 dadams ;; fset old-dired-smart-shell-command after load Dired-X. ;; 2009/02/20 dadams ;; icicle-mode: Reset icicle-shell-command-candidates to nil. ;; icicle-minibuffer-setup: ;; Use function icicle-require-match-p, not var. ;; Do not reset icicle-completing-p to nil (reset by icicle-require-match-p). ;; icicle-(redefine|restore)-standard-commands: ;; Redefine dired-read-shell-command, not dired-guess-shell-command. ;; Redefine: dired-smart-shell-command, shell-command(-on-region). ;; Added eval-after load for dired-read-shell-command for dired-aux.el (and for dired-x.el). ;; eval-after-load for read-shell-command: Don't do it only when mailcap can be loaded. ;; 2009/02/01 dadams ;; icicle-define-minibuffer-maps: Bind C-backspace to icicle-up-directory. ;; 2009/01/25 dadams ;; icicle-(redefine|restore)-standard-commands: ;; Aliases for dired-guess-shell-command, read-shell-command. Also eval-after-load's. ;; 2009/01/23 dadams ;; icicle-(bind|restore)-other-keymap-keys: ;; For sh-mode-map, remap comint-dynamic-complete, don't (un)bind TAB. Thx to Seb Luque. ;; 2009/01/18 dadams ;; Renamed Open Dired for Saved Completion Candidates to Open Dired for Chosen Files. ;; 2009/01/06 dadams ;; Added to dolist of eval-after-load's: net-utils, rlogin, idlw-shell. ;; 2009/01/05 dadams ;; icicle-(bind|restore)-other-keymap-keys: Treat keys for Shell Script, Ielm, Tcl, and GUD. ;; icicle-(redefine|restore)-standard-commands: ;; Handle: comint-dynamic-complete-filename, gud-gdb-complete-command. ;; Added eval-after-load for gud. ;; Added to dolist of eval-after-load's: ielm, gud, sh-script, tcl. ;; 2009/01/04 dadams ;; Added ESS support: ;; icicle-(redefine|restore)-standard-commands: ;; Added: (icicle|old)-comint-replace-by-expanded-filename, ;; (icicle|old)-ess-complete-object-name. ;; Added eval-after-load for ess-site and for old-comint-replace-by-expanded-filename. ;; Thx to Sebastian Luque. ;; 2008/12/30 dadams ;; icicle-mode: Don't add/remove hook icicle-shell-hook-fn. ;; Don't call icicle-(un)bind-isearch-keys. ;; Renamed: icicle-rebind-other-keymap-keys to icicle-bind-other-keymap-keys. ;; icicle-(bind|restore)-other-keymap-keys: ;; Call icicle-(un)bind-isearch-keys here. ;; Bind/restore icicle-comint-command here. ;; Don't use eval-after-load. Instead, define keys if the maps are defined. ;; Bind/restore shell keys only if icicle-redefine-standard-commands-flag is true. ;; icicle-minibuffer-setup: ;; Remove redundant code that calls icicle-define-cycling-keys for each minibuffer map. ;; icicle-define-minibuffer-maps: ;; Restore C-g to abort-recursive-edit in minibuffer-local-must-match-map. ;; icicle-(redefine|restore)-standard-commands: ;; Test fboundp of old-*, not *, for bbdb and comint. ;; Do not defalias comint-dynamic-complete-filename or shell-dynamic-complete-*. ;; icicle-remap: Moved to icicles-opt.el. ;; At end of file: ;; eval-after-load comint and bbdb: Turn off icy-mode before fset old-*. ;; eval-after-load each of the other keymap libraries: Toggle icy-mode. ;; 2008/12/26 dadams ;; Bind icicle-widen-candidates to M-+, and add it to Minibuf menu. ;; Bind icicle-apropos-complete-and-widen to S-backspace. ;; 2008/12/22 dadams ;; Forgot to add/remove icicle-shell-hook-fn to shell-mode-hook for Emacs 20. ;; icicle-bind-completion-keys, icicle-define-icicle-maps: Added icicle-regexp-quote-input. ;; 2008/12/21 dadams ;; icicle-(redefine|restore)-standard-commands: Added comint-*, shell-*. ;; Renamed *-(rebind|restore)-non-completion-keys to *-(rebind|restore)-other-keymap-keys. ;; icy-mode: Add/remove icicle-shell-hook-fn to shell-mode-hook. ;; icicle--(rebind|restore)-other-keymap-keys: ;; Don't rebind Info keys unless icicle-redefine-standard-commands-flag. ;; Wrap Dired key bindings in eval-after-load. ;; icicle-restore-other-keymap-keys: Corrected (updated) Dired keys. ;; 2008/12/07 dadams ;; icicle-minibuffer-setup: ;; Add completing prompt prefix here, using icicle-completion-prompt-overlay. ;; Removed icicle-prompt. ;; 2008/12/05 dadams ;; icicle-(bind|restore)-completion-keys: Bind C-v, M-v to scroll *Completions* window. ;; 2008/11/14 dadams ;; icicle-toggle-hiding-common-match: ;; icy-mode: Mention it in doc string, icicle-define-icicle-maps: Add it to menus. ;; icicle-bind-completion-keys: Bind it to C-M-. ;; icicle-minibuffer-setup: ;; Use (cadr (buffer-list)), not other-buffer, for icicle-pre-minibuffer-buffer ;; 2008/11/04 dadams ;; icicle-define-icicle-maps: No longer bind icicle-generic-S-tab keys (obsolete). ;; Renamed: ;; *-(un)bind-S-TAB-in-keymaps-from to *-(un)bind-key-completion-keys-in-keymaps-from, ;; *-(un)bind-S-TAB-for-map-variable to *-(un)bind-key-completion-keys-for-map-var. ;; icicle-(un)bind-key-completion-keys-in-keymaps-from: ;; icicle-generic-S-tab-keys -> icicle-key-complete-keys. ;; Respect icicle-complete-key-anyway-flag. ;; icicle-define-minibuffer-maps: *-generic-S-tab-keys -> *-previous-candidate-keys. ;; icicle-(bind|restore)-completion-keys: *-generic-S-tab-keys -> *-apropos-complete-keys. ;; icicle-(un)bind-isearch-keys: *-generic-S-tab-keys -> *-search-from-isearch-keys. ;; 2008/11/03 dadams ;; Applied renamings from icicles-cmd.el. ;; 2008/11/01 dadams ;; Require cl.el at compile time for all Emacs versions, not just 20. ;; 2008/10/14 dadams ;; icy-mode: No longer call icicle-update-help-string. ;; Renamed: *-update-help-string to *-help-string-completion and moved to icicles-mcmd.el. ;; Renamed: icicle-rebind-completion-maps to icicle-define-minibuffer-maps. ;; Applied renaming from icicles-mcmd.el: icicle-completion-help to icicle-minibuffer-help. ;; icicle-define-minibuffer-maps: ;; Bound icicle-minibuffer-help also in non-completion minibuffer maps and *Completions*. ;; Bound icicle-yank-secondary in minibuffer-local-isearch-map also. ;; icicle-(bind|restore)-completion-keys: Only bind icicle-minibuffer-help if not inherited. ;; 2008/10/12 dadams ;; icicle-rebind-non-completion-keys (and undo in icicle-restore-non-completion-keys): ;; Ibuffer mode: Bind M-s i to icicle-search-ibuffer-marked and add to Operate menu. ;; Buffer Menu mode: Bind M-s i to icicle-search-buff-menu-marked. ;; Dired mode: Change binding of icicle-search-dired-marked from M-s to M-s i. ;; Removed vestigial binding to C-M-r. ;; Make eval-after-load for "info" unconditional. ;; 2008/10/11 dadams ;; icicle-update-help-string, icicle-(bind|restore)-completion-keys: ;; icicle-kill-failed-input -> icicle-goto/kill-failed-input. ;; icicle-define-cycling-keys: Typo: icicle-apropos-cycle-previous-keys -> *-action*. ;; 2008/10/10 dadams ;; icicle-minibuffer-setup: ;; Make icicle-current-completion-mode respect *-cycling-respects-completion-mode-flag. ;; Initial *Completions* display respects icicle-cycling-respects-completion-mode-flag. ;; icicle-minibuffer-setup, icicle-bind-completion-keys: Use icicle-define-cycling-keys. ;; icicle-restore-completion-keys: Restore (C-)up, (C-)down, (C-)next, (C-)prior. ;; Added: icicle-define-cycling-keys. ;; 2008/10/08 dadams ;; icicle-bind-completion-keys: ;; Bind icicle-candidate-set-retrieve-more to C-<. Add to Minibuf menu. ;; icicle-define-icicle-maps, icicle-update-help-string: Remove C-< for angle brackets. ;; icicle-minibuffer-setup: ;; Set icicle-pre-minibuffer-buffer to (other-buffer nil t), not (cadr (buffer-list). ;; 2008/10/04 dadams ;; icicle-(redefine|restore)-std-completion-fns: ;; Substitute Icicles version of completing-read-multiple and maps. Thx to Per Nordlow. ;; icy-mode doc string: Typo - thx to Richard Kim. ;; 2008/10/01 dadams ;; icicle-update-help-string: Added current values for toggles. Moved toggles near top. ;; Added: icicle-S-iso-lefttab-to-S-TAB. ;; 2008/09/30 dadams ;; icicle-bind-isearch-keys: For icicle-generic-S-tab-keys, read the search string using ;; icicle-isearch-complete-past-string. ;; 2008/09/13 dadams ;; Use renamings from icicles-mcmd.el: ;; icicle-candidate-set-save-to-cache-file to icicle-candidate-set-save-persistently, ;; icicle-candidate-set-retrieve-from-cache-file to *-candidate-set-retrieve-persistent. ;; 2008/09/11 dadams ;; icicle-define-icicle-maps: Added icicle-grep-saved-file-candidates to menus. ;; 2008/09/09 dadams ;; Use renamings from icicles-cmd.el: ;; icicle-candidate-set-dired-marked-save-* to icicle-dired-save-marked-*. ;; Bind: icicle-dired-save-marked-* to C(-M)->, not C(-M)-), ;; icicle-dired-saved-file-candidates-other-window to C-M-<, not C-M-r, ;; icicle-dired-save-marked-(to-variable|as-project) to C-M-}, C-}, ;; icicle-dired-project-other-window to C-{. ;; Add to Dired > Multiple (or Operate) > Icicles menu: icicle-dired-save-marked-as-project. ;; Add to Dired > Dir and File > Icicles menus: icicle-dired-project-other-window. ;; Removed from File > Icicles menu: icicle-dired-saved-file-candidates. ;; 2008/08/22 dadams ;; icicle-update-help-string: Removed mention of icicle-Completions-window-default-width. ;; 2008/08/21 dadams ;; icicle-define-icicle-maps: Replace icicle-find-file(-*) with icicle-file. ;; icicle-mode doc string, icicle-update-help-string: Updated for new cmds icicle-file etc. ;; Define BBDB aliase only if BBDB is loaded. ;; 2008/08/17 dadams ;; icicle-rebind-completion-maps: Bind mouse wheel for completion-list-mode-map. ;; 2008/08/12 dadams ;; icicle-define-icicle-maps: Add :keys for icicle-goto(-global)-marker. ;; 2008/08/08 dadams ;; icicle-define-icicle-maps: ;; Added icicle-goto(-global)-marker to icicle-(bookmark|search)-menu-map. ;; Soft require of menu-bar+.el, instead of just eval-when-compile. ;; 2008/08/07 dadams ;; icicle-(redefine|restore)-*: Don't use symbol-function for target of defalias. ;; 2008/08/04 dadams ;; Use condition-case when require mb-depth+.el. ;; icicle-(rebind|restore)-completion-maps, icicle-bind-completion-keys: ;; Updated Minibuf menu to add icicle-clear-current-history. ;; icicle-restore-completion-keys: ;; Added: (alt-)action(-list)-all, icicle-save-predicate-to-variable. ;; 2008/08/03 dadams ;; icicle-mode: Updated doc string. ;; icicle-update-help-string: Added clear-history stuff and changed bindings. ;; icicle-rebind-completion-maps: Added binding: icicle-clear-current-history (M-i). ;; icicle-bind-completion-keys: ;; Added to Minibuf menu: icicle-all-candidates(-list)(-alt)-action. ;; Added bindings: icicle-all-candidates-list-action (M-!), ;; icicle-all-candidates-list-alt-action (M-|), ;; icicle-clear-current-history (M-i). ;; Changed bindings: ;; icicle-all-candidates-alt-action (C-S-insert to C-|) ;; icicle-toggle-expand-to-common-match (C-| to C-;), ;; icicle-toggle-search-replace-common-match (C-M-| to M-;), ;; ;; 2008/08/01 dadams ;; icicle-mode: Std mb-depth.el renamed *-indicate-depth-mode to *-depth-indicate-mode. ;; 2008/07/30 dadams ;; icicle-update-help-string: Make C-M-) more obvious for clearing saved candidates. ;; 2008/07/23 dadams ;; Renamed: icicle-map to icicle-apply. ;; 2008/07/21 dadams ;; icicle-(redefine|restore)-standard-commands: Added icicle-bbdb-complete. ;; 2008/06/03 dadams ;; icy-mode: Added icicle-toggle-C-for-actions to doc string. ;; icicle-define-icicle-maps: Added icicle-toggle-C-for-actions to menus. ;; icicle-update-help-string: ;; Mention icicle-insert-history-element, icicle-toggle-C-for-actions. ;; icicle-bind-completion-keys: Bindings according to icicle-use-C-for-actions-flag. ;; icicle-(bind|restore)-completion-keys: Bind/unbind M-g. ;; 2008/05/27 dadams ;; Renamed: icicle-(un)bind-isearch-completion-keys to icicle-(un)bind-isearch-keys. ;; icicle-bind-isearch-keys: Bind S-TAB to icicle-search, C-o to isearch-(m)occur. ;; Likewise, icicle-unbind-isearch-keys. ;; 2008/05/25 dadams ;; Renamed: icicle-bind-isearch-keys to icicle-bind-isearch-completion-keys. ;; Added: icicle-unbind-isearch-completion-keys. ;; icy-mode: icicle-(un)bind-isearch-completion-keys instead of updating isearch-mode-hook. ;; icicle-bind-isearch-completion-keys: ;; Don't bind anything in minibuffer-local-isearch-map (overridden by icicle-mode-map). ;; 2008/05/22 dadams ;; icicle-update-help-string: Mention C-u for read-file-name-completion-ignore-case. ;; 2008/05/11 dadams ;; Moved icicle-bind-top-level-commands to icicles-opt.el (and added optional arg). ;; Renamed icicle-fit-Completions-window to icicle-fit-completions-window. ;; 2008/05/10 dadams ;; Renamed: icicle-bind-top-level-commands-alist to icicle-top-level-key-bindings. ;; icicle-bind-top-level-commands: Don't eval the key (binding). ;; 2008/05/07 dadams ;; icicle-define-icicle-maps: Use icicle-bind-top-level-commands instead of hard-coding. ;; icicle-update-help-string: icicle-bind-*-flag -> icicle-bind-*-alist. ;; 2008/04/25 dadams ;; icicle-(redefine|restore)-std-completion-fns: ;; Never set icicle-old-read-file-name-fn to icicle-read-file-name. ;; Thx to Alexey Romanov and Per Nordlow. ;; icicle-define-icicle-maps, icicle-(bind|restore)-completion-keys: ;; Bound icicle-toggle-remote-file-testing (C-^). ;; icicle-toggle-ignored-space-prefix is now bound to M-_, not C-^. ;; icicle-update-help-string: Updated bindings accordingly. ;; 2008/04/18 dadams ;; Renamed icicle-init-value-flag to icicle-default-value. ;; 2008/03/30 dadams ;; icicle-(redefine|restore)-std-completion-fns: ;; Set and swap read-file-name-function and icicle-old-read-file-name-fn for Emacs 22+. ;; Top-level: ;; Moved fset old-read-file-name here, renamed it orig-read-file-name. Not for Emacs 22. ;; 2008/03/29 dadams ;; icicle-mode: No longer use icicle-control-reminder-prompt on kill-emacs-hook. ;; icicle-update-help-string: ;; Removed: icicle-completing(-mustmatch)-prompt-prefix, icicle-reminder-prompt-flag. ;; icicle-rebind-completion-maps: Remove code setting icicle-prompt-suffix (removed). ;; 2008/03/26 dadams ;; Added icicle-Info-menu to icicle-mode doc string and icicle-update-help-string. ;; icicle-define-icicle-maps: Added icicle-Info-menu to menus. ;; icicle-(rebind|restore)-non-completion-keys: Bind/restore icicle-Info-menu-cmd. ;; 2008/03/23 dadams ;; Added: icicle-handle-switch-frame. ;; icicle-(rebind|restore)-non-completion-keys: ;; Bind switch-frame to icicle-handle-switch-frame globally, and restore. ;; 2008/03/19 dadams ;; Remap (pp-)eval-expression to new icicle-pp-eval-expression. ;; Replace lambdas by icicle-pp-eval-expression-in-minibuffer. ;; Use icicle-pp-eval-expression-in-minibuffer (new) in help string. ;; icicle-rebind-completion-maps: Bind M-: to icicle-pp-eval-expression-in-minibuffer. ;; Bind icicle-insert-newline-in-minibuffer in all minibuffer maps (likewise, non-icy). ;; Bind C-g in minibuffer-local-must-match-map, even if inherit. ;; icicle-bind-completion-keys: Don't bind in must-match if it inherits: ;; C-a, C-e, C-=, M-k, M-o, M-., M-:, C-M-y, M-S-(backspace|delete) ;; 2008/03/09 dadams ;; icicle-mode: Add icicle-unhighlight-lighter to minibuffer-exit-hook. ;; 2008/03/07 dadams ;; icicle-abort-minibuffer-input: Thx to Damon Permezel. ;; Make it always call abort-recursive-edit. Renamed to icicle-abort-recursive-edit. ;; 2008/02/28 dadams ;; icicle-define-icicle-maps: Don't bind pop-tag-mark (M-*) in icicle-mode-map for Emacs 21. ;; 2008/02/26 dadams ;; Remapped where-is to icicle-where-is. ;; Added to Describe > Icicles menu: icicle-describe-option-of-type, icicle-where-is. ;; Bound icicle-select-frame to C-x 5 o in Icicle mode. ;; 2008/02/24 dadams ;; icicle-define-icicle-maps: Bound icicle-next-apropos-match-function to M-(. ;; Add icicle-next-apropos-match-function to icicle-update-help-string and mode doc string. ;; 2008/02/23 dadams ;; Renamed: icicle-search-tag to icicle-find-tag, ;; icicle-find-tag(-other-window) to icicle-find-first-tag(-other-window). ;; icicle-define-icicle-maps: Added icicle-tags-search to Tags menu and Search menu. ;; 2008/02/22 dadams ;; Renamed: icicle(-mouse)-save-candidate to icicle(-mouse)-save/unsave-candidate. ;; 2008/02/13 dadams ;; Remapped: find-tag (M-.) to icicle-search-tag, instead of icicle-find-tag ;; pop-tag-mark (M-*) to icicle-pop-tag-mark. ;; icicle-define-icicle-maps: ;; Added icicle-search-tag and icicle-pop-tag-mark to menus. ;; Removed icicle-find-tag from menu. Renamed icicle-find-tag-other-window menu item. ;; 2008/02/07 dadams ;; icicle-(redefine|restore)-std-completion-fns: Protect read-number with fboundp. ;; 2008/02/03 dadams ;; icicle-(redefine|restore)-std-completion-fns: Added (icicle|old)-choose-completion. ;; 2008/01/30 dadams ;; Bound icicle-yank-secondary and icicle-mouse-yank-secondary. ;; 2008/01/15 dadams ;; Require dired.el. Soft-require dired+.el. Thx to Fabrice Knevez. ;; 2008/01/13 dadams ;; icicle-(rebind|restore)-non-completion-keys: ;; Bound [handle-switch-frame] to icicle-skip-this-command globally. ;; Added: icicle-skip-this-command. ;; 2008/01/02 dadams ;; icicle-(rebind|restore)-non-completion-keys: Bound icicle-search-dired-marked to M-s. ;; icicle-define-icicle-maps: Added icicle-search-dired-marked to Dired>Multiple>Icicles. ;; 2008/01/01 dadams ;; icicle-*-non-completion-keys: Bound icicle-candidate-set-dired-marked-save(-more). ;; icicle-define-icicle-maps: Added Icicles submenu for Dired > Multiple (Operate) menu. ;; 2007/12/31 dadams ;; Bound icicle-insert-list-join-string to C-M-j. Update icicle-update-help-string. ;; 2007/12/24 dadams ;; icicle-rebind-completion-maps: Bound C-j to also refit the minibuffer frame. ;; 2007/12/20 dadams ;; Bound icicle-dired-saved-file-candidates-other-window in Dired to C-M-r. ;; Bound icicle-describe-option-of-type to C-h C-o, not C-h M-o. ;; 2007/12/18 dadams ;; icicle-define-icicle-maps: Bind icicle-describe-option-of-type to C-h M-o. ;; 2007/12/14 dadams ;; icicle-mode: Only add to kill-emacs-hook if icicle-customize-save-flag is non-nil. ;; 2007/12/13 dadams ;; icicle-update-help-string: spell out options, don't abbreviate using *. ;; 2007/12/08 dadams ;; Bound icicle-(beginning|end)-of-line+. ;; 2007/12/07 dadams ;; icicle-rebind-completion-maps: Removed obsolete stuff from doc string. ;; 2007/12/03 dadams ;; Renamed longest common match (lcm) to expanded common match (ecm). ;; 2007/11/29 dadams ;; icicle-minibuffer-setup: If icicle-add-proxy-candidates-flag is nil, swap candidate sets. ;; Reset icicle-saved-proxy-candidates to nil. ;; 2007/11/27 dadams ;; icicle-(redefine|restore)-std-completion-fns: Added read-number. ;; 2007/11/25 dadams ;; icicle-define-icicle-maps: Bound icicle-command-abbrev to C-x SPC. ;; icicle-mode: Use icicle-command-abbrev-save on kill-emacs-hook. ;; Changed binding of icicle-doremi-inter-candidates-min-spaces from C-x SPC to C-x |. ;; 2007/11/23 dadams ;; icicle-rebind-completion-maps: ;; Use icicle-prefix-cycle-(next|previous)-keys, instead of hardcoding. ;; icicle-(bind|restore)-completion-keys: ;; Use icicle-(apropos|prefix)-cycle-(next|previous)-keys, instead of hardcoding. ;; Restore explicit vanilla bindings last. ;; 2007/11/22 dadams ;; icicle-(bind|restore)-completion-keys: ;; Explicitly bind/restore (C-)up, (C-)down, (C-)next, (C-)(C-)prior, instead of ;; remapping next-line etc. ;; 2007/11/21 dadams ;; icicle-rebind-completion-maps: Explicitly bind C-j to icicle-self-insert. ;; icicle-(bind|restore)-completion-keys, icicle-update-help-string: ;; Removed C-o binding for icicle-candidate-action. ;; 2007/11/17 dadams ;; Added doc, menus, bindings (C-M-_): icicle-toggle--proxy-candidates. ;; 2007/11/05 dadams ;; icicle-define-icicle-maps: Moved [Icy] items to Icicles submenus. ;; Added: icicle-(bookmark|custom|describe|edit|file|frames|info|search(-tags))-menu-map. ;; 2007/11/03 dadams ;; icicle-define-icicle-maps, icicle-bind-S-TAB-in-keymaps-from, ;; icicle-unbind-S-TAB-in-keymaps-from, icicle-rebind-completion-maps, ;; icicle-bind-completion-keys: ;; Bind icicle-generic-S-tab-keys instead of hard-coded S-(iso-left)tab. ;; icicle-(bind|restore)-completion-keys: ;; Bind/restore icicle-prefix-complete-keys, ;; icicle-(apropos|prefix)-complete-keys-no-display, not hard-coded keys. ;; icicle-bind-isearch-keys: Bind icicle-isearch-complete-keys, not hard-coded. ;; Renamed icicle-modal-cycle-(up|down)-key to icicle-modal-cycle-(up|down)-keys, ;; icicle-word-completion-key to icicle-word-completion-keys. ;; 2007/10/31 dadams ;; icicle-define-icicle-maps: ;; Moved options to new Icicles submenu of Options menu, and removed [Icy]. Added :keys. ;; Added: icicle-options-menu-map. ;; 2007/10/28 dadams ;; Added doc, menus, bindings (C-|, C-M-|): ;; icicle-toggle-(expand-to-common-match|search-replace-common-match). ;; 2007/10/21 dadams ;; icicle-(bind|restore)-completion-keys: Bind C-x w and C-x SPC. ;; icicle-define-icicle-maps: Add Do Re Mi items. ;; icicle-mode, icicle-update-help-string: Mention C-x w and C-x SPC. ;; 2007/09/29 dadams ;; icicle-mode, icicle-define-icicle-maps, icicle-update-help-string: ;; Added icicle-toggle-fuzzy-completion (and icicle-fuzzy-completion-flag to help string). ;; icicle-(bind|restore)-completion-keys: Bind/unbind icicle-toggle-fuzzy-completion to C-(. ;; 2007/09/20 dadams ;; icicle-(bind|restore)-completion-keys: Bind C-j to icicle-self-insert / exit-minibuffer. ;; 2007/09/18 dadams ;; Added: icicle-update-help-string. Use in icy-mode, not in icicle-rebind-completion-maps. ;; Removed icicle-toggle-WYSIWYG-Completions (it has no minibuffer binding). ;; 2007/08/25 dadams ;; icy-mode, icicle-completion-help-string: ;; icicle-clear-option -> clear-option. Added toggle alias. ;; 2007/08/21 dadams ;; icicle-completion-help-string: Mention C-M-l. ;; 2007/08/19 dadams ;; icicle-minibuffer-setup: Reset icicle-input-fail-pos. ;; icicle-(bind|restore)-completion-keys: ;; (Re|un)map reposition-window to icicle-kill-failed-input. ;; 2007/08/03 dadams ;; icicle-mode: Remove icicle* hooks from local, not global, hooks. ;; 2007/07/22 dadams ;; icicle-(redefine|restore)-standard-commands: Added customize-face(-other-window). ;; Moved icicle-completing-p to icicles-fn.el. ;; Require icicles-cmd.el. ;; 2007/07/06 dadams ;; icicle-rebind-completion-maps: ;; Moved icicle-Completions-mouse-3-menu to C-mouse-3. ;; Added icicle(-mouse)-candidate-set-save(-more)-selected, icicle-candidate-set-retrieve, ;; icicle-retrieve-previous-input. ;; icicle-completion-help-string: Added icicle-candidate-set-save(-more)-selected. ;; icicle-bind-completion-maps: ;; Removed icicle-insert-history-element (inherited). ;; Added: icicle-candidate-set-save-more(-selected), icicle-mouse-save-then-kill. ;; 2007/07/04 dadams ;; icicle-rebind-completion-maps, icicle-(bind|restore)-completion-keys: ;; Added icicle-insert-history-element to Minibuf menu. ;; icicle-(bind|restore)-completion-keys: ;; Added icicle-retrieve-(next|previous)-input to Minibuf menu. ;; 2007/07/03 dadams ;; icicle-rebind-completion-maps, icicle-bind-completion-keys: ;; Bind icicle-insert-history-element to M-o in all minibuffer maps. ;; icicle-bind-completion-keys, icicle-completion-help-string: ;; icicle-retrieve-(next|previous)-input, not icicle-retrieve-last-input. ;; icicle-(redefine|restore)-std-completion-fns: ;; defalias next-history-element to icicle-next-history-element. ;; Removed defadvice for next-history-element. Redefine in icicles-mcmd.el instead. ;; 2007/06/22 dadams ;; Bound icicle-search-keywords and added to menus and help strings. ;; 2007/06/20 dadams ;; Removed M-o binding for icicle-toggle-WYSIWYG-Completions. ;; 2007/06/19 dadams ;; icicle-bind-completion-keys: Add icicle-save-predicate-to-variable to menus. ;; icicle-completion-help-string: ;; Mention icicle-save-predicate-to-variable and icicle-insert-string-from-variable. ;; 2007/06/18 dadams ;; icy-mode doc string, icicle-completion-help-string: Added icicle-customize-face. ;; icicle-define-icicle-maps: Added icicle-customize-face to menus. ;; 2007/06/17 dadams ;; Bound icicle-toggle-WYSIWYG-Completions to M-o. ;; icicle-minibuffer-setup: Reinitialize icicle-saved-candidate-overlays. ;; 2007/06/16 dadams ;; icicle-(bind|restore)-completion-keys: Bound C-M-(help|f1). ;; 2007/06/15 dadams ;; icicle-completion-help-string: Added and cleaned up set stuff. ;; icicle-(bind|restore)-completion-keys: Cleanup. Added menu items. ;; 2007/06/14 dadams ;; Swap bindings for C-insert and insert. ;; 2007/06/13 dadams ;; Bound C-insert and C-> to icicle-save-candidate and icicle-candidate-set-save-more. ;; 2007/06/12 dadams ;; icicle-rebind-completion-maps: Bound icicle-mouse-save-candidate to M-S-mouse-2. ;; 2007/06/10 dadams ;; icicle-mode: comint-mode-hook, compilation(-minor)-mode-hook, temp-buffer-show-hook. ;; 2007/06/08 dadams ;; icy-mode: Added icicle-find-tag* to doc string. ;; icicle-define-icicle-maps: ;; Added icicle-find-tag*. Remap find-tag* to icicle-find-tag*. ;; Corrected Info menu. ;; icicle-completion-help-string: Added icicle-find-tag*. ;; 2007/05/28 dadams ;; icicle-restore-non-completion-keys: Unbind S-tab. ;; Added: icicle-unbind-S-TAB-for-map-variable, icicle-unbind-S-TAB-in-keymaps-from. ;; icicle-bind-S-TAB-in-keymaps-from: Treat S-tab and S-iso-lefftab separately. ;; icicle-define-icicle-maps: Added icicle-imenu-* to Icicles/Search menus. ;; 2007/05/22 dadams ;; Make [Icy] menu items invisible when not in Icicle mode. Add :keys where appropriate. ;; icicle-define-icicle-maps, icicle-rebind-completion-maps, ;; icicle-(bind|restore)-completion-keys: ;; icicle-menu-item-any-version -> menu-item. Explicit put of enable property -> :enable. ;; Don't require icicles-mac.el. ;; icicle-bind-completion-keys: Added icicle-narrow-candidates, and corrected :enable forms. ;; 2007/05/21 dadams ;; icicle-define-icicle-maps: ;; Remap minibuffer-keyboard-quit to icicle-abort-minibuffer-input. Needed, even though ;; local-must-match inherits from local-completion in Emacs 22, because delsel.el binds ;; C-g to minibuffer-keyboard-quit in minibuffer maps. ;; menu-item-any-version -> icicle-menu-item-any-version. ;; Added Icicles/Search menu items: ;; Search (Buffer|File|Saved Region|All Saved Regions|Definition|Text Property). ;; Renamed: Search a Region -> Search Saved Region, Choose a Region -> Choose Saved Region, ;; Add Current Region to List -> Save Current Region. ;; 2007/05/20 dadams ;; Enable menu-bar Minibuf: ;; icicle-rebind-completion-maps: ;; Use menu-item-any-version. ;; Don't define menu for maps if it is defined by parent map. ;; Add Enter and Help items for *-local-map. ;; Add Enter, Help and Quit items for *-local-(ns|isearch)-map. ;; icicle-bind-completion-keys: ;; Use menu-item-any-version. ;; Add Enter item for *-local-completion-map, unless defined by parent map. ;; icicle-restore-completion-keys: ;; Use menu-item-any-version. ;; Add Enter and Quit items for *-local-completion-map, unless defined by parent map. ;; Do not unmap kill-region(-wimpy). ;; Bind [(control pause)] to nil. ;; 2007/05/13 dadams ;; icicle-restore-completion-keys: Restore some forgotten minibuf menu items. ;; 2007/05/08 dadams ;; Bound icicle-save-predicate-to-variable to C-M-&. ;; 2007/05/06 dadams ;; icicle-rebind-completion-maps: Updated icicle-completion-help-string. ;; Added defvars to quiet byte compiler. ;; Changed S-C- to C-S- and M-C- to C-M- in doc. ;; 2007/05/03 dadams ;; Remap icicle-yank-function, not yank. ;; icicle-define-icicle-maps: Bind icicle-search-word. ;; icicle-mode, icicle-completion-help-string: Add icicle-search-word to doc. ;; 2007/05/02 dadams ;; Bound M-q to icicle-dispatch-M-q, not to icicle-insert-key-description. ;; Bound C-` to icicle-toggle-regexp-quote, not to icicle-dispatch-C-backquote. ;; Bound C-M-` to icicle-toggle-literal-replacement. ;; Update icicle-completion-help-string. ;; 2007/04/20 dadams ;; icicle-minibuffer-setup: Don't reset icicle-search-context-level here. ;; 2007/04/17 dadams ;; Bound M-, to icicle-dispatch-M-comma, not to icicle-change-alternative-sort-order. ;; Bound C-` to icicle-dispatch-C-backquote, not to icicle-toggle-regexp-quote. ;; 2007/04/10 dadams ;; icicle-minibuffer-setup: Initialize icicle-search-context-level. ;; 2007/04/09 dadams ;; Bound icicle-imenu to C-c =. ;; 2007/04/08 dadams ;; Bound icicle-all-candidates-alt-action to C-S-insert. ;; 2007/04/07 dadams ;; icicle-completion-help-string: Updated. ;; Bound icicle-dispatch-C-comma to C-,. ;; Bound in menu: icicle-toggle-search-replace-whole. ;; Bound icicle-(next|previous)-(apropos|prefix)-candidate-alt-action (forgot). ;; 2007/04/02 dadams ;; Bound icicle-search-text-property to C-c ". Added it to icicle-completion-help-string. ;; 2007/03/23 dadams ;; Bound icicle-apropos-complete-and-narrow to S-SPC. Mention in *-completion-help-string. ;; 2007/03/14 dadams ;; Added: icicle-top-level-prep. ;; Removed: icicle-reset-candidates-alist. ;; Do top-level stuff in icicle-minibuffer-setup, not in icicle-mode. ;; icicle-minibuffer-setup: Add icicle-top-level-prep to pre-command-hook. ;; icicle-mode: Remove icicle-top-level-prep from pre-command-hook. ;; 2007/03/07 dadams ;; icicle-cancel-Help-redirection: Use 0, not t, as frame arg to get-buffer-window. ;; 2007/03/02 dadams ;; icicle-bind-S-TAB-in-keymaps-from: Bound S-iso-lefttab also. ;; 2007/03/02 dadams ;; icicle-define-icicle-maps: ;; Bound S-iso-lefttab also to icicle-generic-S-tab. Thx to Shreevatsa R. ;; 2007/02/28 dadams ;; Added: icicle-reset-candidates-alist. ;; icicle-mode: Use icicle-reset-candidates-alist. ;; 2007/02/27 dadams ;; icicle-minibuffer-setup: Wait icicle-incremental-completion-delay before initial display. ;; 2007/02/24 dadams ;; Bound: delete, S-mouse-2 to icicle(-mouse)-remove-candidate, ;; C-S-RET, C-S-mouse-2 to icicle(-mouse)-candidate-alt-action, ;; S-delete to icicle-delete-candidate-object. ;; Don't remap icicle-kill-region(-wimpy) to delete key. ;; 2007/02/17 dadams ;; Added: icicle-bind-S-TAB-in-keymaps-from, icicle-bind-S-TAB-for-map-variable. ;; icicle-rebind-non-completion-keys: ;; Bind S-TAB to keymaps in icicle-keymaps-for-key-completion. ;; 2007/02/02 dadams ;; icicle-completing-p: Cache the value in variable icicle-completing-p. ;; icicle-minibuffer-setup: Reset icicle-completing-p to nil. ;; icicle-activate-mark: Use var, not function, icicle-completing-p, but after minibuf test. ;; 2007/01/23 dadams ;; icicle-(redefine|restore)-std-completion-fns: ;; Added icicle-read-face-name, icicle-face-valid-attribute-values. ;; icicle-define-icicle-maps, icicle-rebind-completion-maps: ;; Updated wrt toggles. Added icicle*-highlight-historical-candidates*. ;; icicle-bind-completion-keys: Added icicle-toggle-highlight-historical-candidates. ;; 2007/01/22 dadams ;; Renamed icicle-regions to icicle-region-alist (forgot occurrences here). ;; 2007/01/20 dadams ;; icicle-(redefine|restore)-std-completion-fns: Added icicle-display-completion-list. ;; 2007/01/15 dadams ;; Moved C-, binding from icicle-toggle-sorting to icicle-change-sort-order. ;; Moved icicle-toggle-alternative-sorting from M-, to C-M-,. ;; Bound icicle-change-alternative-sort-order to M-,. ;; Updated list of options in icicle-completion-help-string. ;; 2007/01/12 dadams ;; Removed: icicle-override-maps-w-minibuffer-map, icicle-restore-overriding-local-map. ;; Not used in minibuffer hooks. ;; Removed [pause] bindings from minibuffer maps. ;; Removed remap of yank in minibuffer maps. ;; No longer bind icicle-remove-Completions-window in minibuffer maps. ;; 2007/01/11 dadams ;; Renamed: icicle-define-icicle-mode-map to icicle-define-icicle-maps. ;; icicle-define-icicle-maps: Use icicle-menu-map. Don't recreate it. ;; Bound [pause] to icicle-switch-to/from-minibuffer in all minibuffer maps. ;; 2007/01/10 dadams ;; Added: icicle-override-maps-w-minibuffer-map, icicle-restore-overriding-local-map, ;; icicle-(rebind|restore)-non-completion-keys. ;; Added: icicle-rebind-global: This used to be called icicle-remap. ;; icicle-(remap|unmap): Different purpose and use now. Redefined to use remapping when ;; available (as was done before for self-insert-command). ;; icicle-mode: ;; Add, remove as minibuffer setup and exit hooks: icicle-override-maps-w-minibuffer-map, ;; icicle-restore-overriding-local-map. ;; Call icicle-(rebind|restore)-non-completion-keys. ;; icicle-define-icicle-mode-map: ;; Use icicle-remap where previously used substitute-key-definition for top-level cmds. ;; Moved to icicle-(rebind|restore)-non-completion-keys: ;; binding of Info commands in Info map and S-tab in all keymaps (to *-rebind-* only). ;; icicle-(bind|restore)-completion-keys: Use new icicle-(remap|unmap) where possible. ;; Use icicle-rebind-global and substitute-key-definition for keys defined in vanilla ;; completion maps. ;; 2007/01/06 dadams ;; icicle-mode: Update doc and bind icicle-toggle-~-for-home-dir to M-~. ;; 2007/01/01 dadams ;; Moved assq-delete-all to icicles-fn.el. ;; Require at runtime, not compile-time: icicles-var.el, icicles-fn.el. ;; 2006-12-31 dadams ;; icicle-define-icicle-mode-map: Delete icicle-mode entry from minor-mode-map-alist. ;; icicle-mode: Unbind icicle-mode-map when the mode is turned off. ;; Added assq-delete-all for Emacs 20. ;; Use current-global-map function, not global-map variable. ;; 2006/12/25 dadams ;; Bound icicle-candidate-set-truncate to M-$. ;; 2006/12/24 dadams ;; icicle-bind-completion-keys: transpose-yank(-pop) -> yank(-pop): typo. ;; Bound mouse-3 to icicle-Completions-mouse-3-menu in completion-list-mode-map. ;; 2006/12/22 dadams ;; Bound icicle-exchange-point-and-mark. ;; :group 'icicles -> :group 'Icicles-Miscellaneous. ;; 2006/12/17 dadams ;; Bound icicle(-mouse)-candidate-read-fn-invoke. ;; 2006/12/16 dadams ;; icicle-define-icicle-mode-map: Protect icicle-kmacro with fboundp. ;; 2006/12/12 dadams ;; Added icicle-customize-*-group, icicle-kill-buffer, icicle-delete-windows to I. menu. ;; Added + to multi-command menu items. ;; 2006/12/11 dadams ;; Added icicle-customize-apropos* and icicle-Info-* to menu-bar menus. ;; 2006/12/10 dadams ;; Updated user options list in icicle-completion-help-string. ;; Updated list of icicle-opt stuff used here. ;; 2006/12/06 ;; icicle-select-minibuffer-contents: ;; Use icicle-minibuffer-prompt-end, not point-min. Thx to Erik Postma. ;; 2006/11/26 dadams ;; Added icicle-regions stuff. ;; 2006/11/24 dadams ;; icicle-redefine-standard-options: Treat icicle-kmacro-ring-max. ;; Bind icicle-kmacro to f5 ;; Replaced icicle-select-window-or-frame by icicle-other-window-or-frame. ;; Removed binding of icicle-select-frame. ;; Do not require mb-depth+.el for Emacs 21 (do it only for Emacs 22). ;; 2006/11/23 dadams ;; Bound icicle-execute-named-keyboard-macro to C-x M-e. ;; 2006/11/18 dadams ;; Soft require mb-depth+.el instead of minibuf-depth.el. ;; 2006/11/17 dadams ;; Bind icicle-select-window-or-frame to whatever other-window(-or-frame) is bound to. ;; Bind icicle-select-frame to whatever other-frame is bound to. ;; 2006/11/09 dadams ;; Bind icicle-dispatch-C-^, not icicle-toggle-ignored-space-prefix, to C-^. ;; icicle-rebind-completion-maps: Updated doc string for icicle-dispatch-C-^. ;; 2006/11/05 dadams ;; Bound icicle-occur to C-c '. Added it to menu-bar menus. ;; 2006/10/18 dadams ;; icy-mode: Invoke icicle-define-icicle-mode-map unconditionally, not just first time. ;; 2006/10/16 dadams ;; icicle-define-icicle-mode-map: Try to avoid binding S-TAB to menu maps. ;; 2006/10/15 dadams ;; icicle-define-icicle-mode-map: Simplified, corrected binding of S-TAB for key completion. ;; Use a separate map for the menu bar. ;; Moved here from icicles-fn.el: ;; icicle-bind-isearch-keys, icicle-rebind-completion-maps, ;; icicle-(redefine|restore)-standard-(commands|options), ;; icicle-(redefine|restore)-std-completion-fns, icicle-(re|un)map, ;; icicle-(bind|restore)-completion-keys, icicle-minibuffer-setup, ;; icicle-cancel-*Help*-redirection, icicle-activate-mark, ;; icicle-run-icicle-(pre|post)-command-hook, icicle-set-calling-cmd, ;; icicle-undo-std-completion-faces icicle-update-ignored-extensions-regexp, ;; icicle-completing-p, icicle-restore-region-face. ;; Renamed: icicle-cancel-*Help*-redirection to icicle-cancel-Help-redirection. ;; Moved here from icicles-cmd.el: icicle-select-minibuffer-contents, next-history-element. ;; Moved to icicles-cmd.el: icicle-generic-S-tab. ;; Require icicles-opt.el. ;; Added eval-when-compile's and defvars to quite byte compiler. ;; 2006/09/23 dadams ;; icicle-define-icicle-mode-map: Corrected binding of icicle-yank-insert. ;; 2006/09/22 dadams ;; icicle-minibuffer-setup: Set this-command and last-command, for scrolling *Completions*. ;; 2006/09/18 dadams ;; icicle-mode: Picked up all global prefixes for S-TAB. ;; 2006/09/17 dadams ;; Added: icicle-generic-S-tab. Bound to S-TAB. ;; icicle-mode: ;; Bound icicle-complete-keys to prefix keys followed by S-TAB. ;; Added run-hooks for Emacs 22 version. ;; 2006/09/12 dadams ;; Bound icicle-switch-to/from-minibuffer to [pause]. ;; 2006/08/27 dadams ;; Bound icicle-abort-minibuffer-input to what abort-recursive-edit is normally bound to. ;; And add it to Icicle menu. ;; 2006/08/23 dadams ;; Bound icicle-delete-window to what delete-window and delete-windows-for are normally ;; bound to. ;; Put use of Info-mode-map inside an eval-after-load. ;; 2006/08/18 dadams ;; Added icicle-Info-goto-node-cmd to icicle-mode doc string. ;; Substitute it for Info-goto-node binding. ;; 2006/08/13 dadams ;; Added icicle-Info-index-cmd to icicle-mode doc string. ;; Substitute it for Info-index binding. ;; 2006/08/04 dadams ;; Added icicle-plist to menus. ;; icicle-doc treats faces too now. ;; 2006/08/03 dadams ;; Bound icicle-insert-yank to what yank is normally bound to. ;; icicle-mode: Updated doc string. ;; 2006/07/29 dadams ;; icy-mode, icicle-define-icicle-mode-map: Added missing toggle commands. ;; 2006/07/22 dadams ;; Changed binding of C-c C-s for icicle-search to C-c ` for icicle-search-generic. ;; Removed: add-hooks for icicle-compilation-search - see icicles-cmd.el. ;; 2006/06/08 dadams ;; Converted global bindings in icicles-keys.el to icicle-mode-map bindings here. ;; Added f10 binding for icicle-execute-menu-command. ;; 2006/05/19 dadams ;; icicle-mode: (add-hook 'kill-emacs-hook 'icicle-control-reminder-prompt). ;; 2006/05/18 dadams ;; Change :init-value to nil, per new Emacs convention. ;; 2006/05/13 dadams ;; icicle-mode: Updated doc string. ;; 2006/05/10 dadams ;; icicle-define-icicle-mode-map: Added menu item Send Bug Report. ;; 2006/04/03 dadams ;; icicle-define-icicle-mode-map: Added icicle-toggle-(regexp-quote|incremental-completion). ;; 2006/03/16 dadams ;; icicle-mode: Turn on minibuffer-indicate-depth-mode (Emacs 22 only). ;; Added soft require of minibuf-depth.el for Emacs 22. ;; 2006/03/14 dadams ;; Do not use icicle-reset-icicle-completing-p as minibuffer-exit-hook. ;; 2006/03/07 dadams ;; Corrected menu items for icicle-doc (no name regexp input, just doc regexp). ;; 2006/03/05 dadams ;; Moved here from icicle-opt.el: icicle-mode, icicle-mode-hook. ;; Moved here from icicle-fn.el: icicle-mode-map. ;; Added: icicle-define-icicle-mode-map. ;;;(@* "CHANGE LOG FOR `icicles-opt.el'") ;; ;; 2013/04/22 dadams ;; Reverted the change of 2012/02/28. Emacs does not DTRT for push if require only when compile. ;; Must use eval-and-compile to require cl.el, not eval-when-compile, for Emacs 20. ;; 2013/04/18 dadams ;; Added: icicle-buffer-candidate-key-bindings, icicle-buffer-prefix-arg-filtering. ;; *-completion-key-bindings, *-completion-list-key-bindings, *-minibuffer-key-bindings: ;; Removed C-? binding - use only M-?. ;; 2013/04/03 dadams ;; icicle-comint-dynamic-complete-replacements: Removed entries for ess-complete-*. ;; 2013/04/01 dadams ;; icicle-minibuffer-key-bindings: Added icicle-top-level binding (C-M-T). ;; 2013/03/18 dadams ;; icicle-top-level-key-bindings: Temporarily removed icicle-dabbrev-completion for Emacs 24+. ;; 2013/02/26 dadams ;; Added (put 'icicle-kbd 'pure t). ;; 2013/02/04 dadams ;; Removed all autoload cookies. ;; 2013/02/04 dadams ;; Removed autoload cookies for icicle-(minibuffer|completion(-list))-key-bindings ;; 2013/02/03 dadams ;; Added: icicle-completion-list-key-bindings, icicle-isearch-history-insert-keys, ;; icicle-minibuffer-key-bindings. ;; Removed: icicle-previous-candidate-keys. ;; icicle-apropos-complete-keys, icicle-search-from-isearch-keys: use backtab for Emacs 24+. ;; icicle-comint-dynamic-complete-replacements: Fixed :type - the first need not be a symbol. ;; Moved icicle-key-definition before first use, which is now icicle-completion-key-bindings. ;; icicle-(top-level|completion)-key-bindings: Fixed :type to be > Emacs 21, not > Emacs 20. ;; icicle-isearch-complete-keys: Removed M-o from the default value and adapted doc string. ;; 2013/01/26 dadams ;; icicle-completion-key-bindings: Added M-r binding for icicle-roundup. ;; 2013/01/18 dadams ;; No longer require icicles-face.el, since now need only hexrgb.el (see next). ;; icicle-region-background: Use hexrgb-increment*, not icicle-increment-*. ;; 2012/12/21 dadams ;; Added: icicle-buffer-skip-hook, icicle-find-file-of-content-skip-hook. Thx to C. Schmidt. ;; 2012/12/20 dadams ;; Added: icicle-TAB/S-TAB-only-completes-flag. ;; 2012/12/02 dadams ;; Removed autoload cookie from icicle-completion-key-bindings. ;; 2012/12/01 dadams ;; Added: icicle-completion-key-bindings. ;; Moved here from icicles-mac.el: icicle-kbd, icicle-edmacro-parse-keys, icicle-read-kbd-macro. ;; icicle-kbd: Now a function, not a macro. ;; 2012/11/28 dadams ;; Removed: icicle-transform-function - moved to icicles-var.el. ;; 2012/11/27 dadams ;; icicle-default-in-prompt-format-function: ;; Removed ": " from default value. Prepend instead of replace, now. ;; icicle-top-level-key-bindings: Added icicle-apropos-value. ;; 2012/11/26 dadams ;; Added: icicle-default-in-prompt-format-function. ;; 2012/11/21 dadams ;; icicle-image-files-in-Completions: ;; Do not test, here, whether display is graphic (for Emacs daemon). Thx to Christopher Schmidt. ;; 2012/11/18 dadams ;; icicle-default-value: Updated doc string to reflect adding def to prompt for value t. ;; 2012/11/08 dadams ;; icicle-widgets-to-redefine: Predicate makes sure it is also a symbol. ;; 2012/11/03 dadams ;; icicle-widgets-to-redefine: Fix to not include nil. ;; 2012/11/02 dadams ;; icicle-widgets-to-redefine: Include color widget only if can load wid-edit+.el. ;; icicle-functions-to-redefine: Added bbdb-complete-mail. ;; 2012/10/27 dadams ;; Added: icicle-show-annotations-flag. ;; 2012/10/26 dadams ;; icicle-search-replace-whole-candidate-flag: Correct key in doc string: M-_, not C-,. ;; 2012/10/21 dadams ;; Added: icicle-buffer-include-cached-files-nflag, icicle-buffer-include-recent-files-nflag. ;; 2012/10/10 dadams ;; icicle-shell-command-candidates-cache: ;; Removed autoload cookie due to default value dependency. Thx to Michael Heerdegen. ;; 2012/10/05 dadams ;; Added: icicle-kill-visited-buffers-flag. ;; 2012/10/02 dadams ;; icicle-list-join-string: ;; Make display prop cover whole string and display \n rather than just hide ^G part. ;; Important for cursor movement: join string acts like one char. ;; 2012/09/08 dadams ;; Removed: icicle-ignore-space-prefix-flag. ;; icicle-buffer-ignore-space-prefix-flag: Updated doc to be self-contained. ;; 2012/08/26 dadams ;; icicle-thing-at-point: ;; If SYNTAX-TABLE is nil, then do not use with-syntax-table. Removed SYNTAX-TABLE args. ;; 2012/08/21 dadams ;; Call tap-put-thing-at-point-props after load thingatpt+.el. ;; 2012/08/18 dadams ;; Added: icicle-thing-at-point. ;; Invoke tap-define-aliases-wo-prefix if thingatpt+.el is loaded. ;; thing-at-point -> icicle-thing-at-point. ;; 2012/08/06 dadams ;; icicle-functions-to-redefine: Updated doc string for new name prefix icicle-ORIG-. ;; 2012/08/05 dadams ;; icicle-widgets-to-redefine: Added color to the default value. ;; 2012/08/03 dadams ;; Added: icicle-key-complete-keys-for-minibuffer. ;; icicle-key-complete-keys: Updated default value, since Emacs bug #1281 was fixed. ;; 2012/07/31 dadams ;; Added: icicle-widgets-to-redefine, icicle-widgetp. ;; 2012/07/24 dadams ;; icicle-TAB-completion-methods-per-command: Fix bug when delete entries: set them to nil first. ;; icicle-buffer-ignore-space-prefix-flag: Updated doc string - C-u M-_ now toggles this. ;; 2012/07/21 dadams ;; icicle-comint-dynamic-complete-replacements: ;; Added entry for pcomplete and comint/shell file-name completion. Thx to C. Schmidt. ;; 2012/07/16 dadams ;; icicle-comint-dynamic-complete-replacements: ;; Added (shell-command-completion 'icicle-shell-dynamic-complete-command). ;; 2012/07/13 dadams ;; icicle-network-drive-means-remote-flag: Update doc string for toggle, C-x :. ;; 2012/07/08 dadams ;; icicle-functions-to-redefine: Updated comint stuff for Emacs 24: comint-completion-at-point. ;; Thx to Christopher Schmidt and Michael Heerdegen. ;; 2012/07/07 dadams ;; Added: icicle-Info-visited-max-candidates. ;; Added reminder about icicle-(increment|toggle)-option to doc strings for boolean|integer|number. ;; 2012/07/05 dadams ;; Removed #' from lambdas. ;; 2012/06/29 dadams ;; icicle-inhibit-advice-functions: Exclude commands that are not redefined in certain releases. ;; icicle-command-abbrev-alist: Added :tag strings. ;; 2012/06/09 dadams ;; icicle-show-Completions-help-flag: Do not defvaralias it to completion-show-help. Updated doc. ;; 2012/05/07 dadams ;; Applied renaming of icicle-search-dired-marked to icicle-search-dired-marked-recursive. ;; 2012/04/03 dadams ;; icicle-top-level-key-bindings: Protect icicle-complete-thesaurus-entry binding with fboundp. ;; icicle-top-level-when-sole-completion-delay: Increased default value from 0.7 to 1.0. ;; 2012/04/01 dadams ;; Moved to icicle-top-level-key-bindings from icicle-functions-to-redefine: ;; customize-*, dabbrev-completion, repeat-complex-command. ;; icicle-top-level-key-bindings: Added replacements for apropos* commands. ;; 2012/02/28 dadams ;; for Emacs 20: Use eval-when-compile, not eval-and-compile, to require cl.el. ;; 2012/02/26 dadams ;; icicle-top-level-key-bindings: Update to reflect Bookmark+ changes (bindings). ;; icicle-touche-pas-aux-menus-flag: Clarify doc string. ;; 2012/02/11 dadams ;; ** NOTE ** Incompatible renamings and value changes. Update any corresponding customizations. ;; Renamed: icicle-expand-input-to-common-match-flag to icicle-expand-input-to-common-match, ;; icicle-incremental-completion-flag to icicle-incremental-completion. ;; Added: icicle-expand-input-to-common-match-alt. ;; icicle-expand-input-to-common-match: Values are now 0 to 4 (split prefix and sole-match). ;; Doc strings: applied renamings and key changes. ;; 2012/01/31 dadams ;; Added: icicle-doremi-submenu. Added it to icicle-Completions-mouse-3-menu-entries. ;; icicle-Completions-toggle-submenu: ;; Added: remote-file-testing, ignoring-(space-prefix|comments), completions-format, ;; multi-completions, search-complementing-domain. Rearranged. ;; icicle-*-submenu: Added some missing key shortcuts. ;; 2012/01/17 dadams ;; Added: icicle-network-drive-means-remote-flag. ;; 2012/01/14 dadams ;; Added: icicle-zap-to-char-candidates. ;; icicle-top-level-key-bindings: Added entry for icicle-zap-to-char (M-z). ;; 2012/01/13 dadams ;; icicle-prefix-complete-keys: Added [?\t]. ;; 2012/01/08 dadams ;; icicle-top-level-key-bindings: Added remappings to icicle-yank-pop-commands. ;; Typo: bmkp-autonamed-this-buffer-jump (name). ;; icicle-files-ido-like-flag: Mention in doc string that it has no effect for Emacs 20. ;; 2012/01/02 dadams ;; icicle-bind-top-level-commands: ;; Must be in Icicle mode, so icicle-mode-map is defined. Otherwise you cannot customize ;; icicle-top-level-key-bindings outside Icicle mode. ;; 2011/12/28 dadams ;; Removed obsolete option icicle-cycle-into-subdirs-flag and all mention of it. ;; 2011/12/24 dadams ;; Added: icicle-Completions-max-columns. ;; icicle-recenter: Changed the :value setting to -4 from nil. ;; 2011/12/14 dadams ;; icicle-top-level-key-bindings: Added icicle-bookmark-image(-other-window). ;; 2011/12/06 dadams ;; icicle-default-value: Updated doc wrt new behavior for icicle-read-from-minibuffer. ;; 2011/11/01 dadams ;; icicle-top-level-key-bindings: Added: icicle-bookmark-(autonamed(-this-buffer)|autofile| ;; bookmark-file|temporary)(-other-window). ;; 2011/10/10 dadams ;; Removed use of icicle-kbd in option values, because byte-compile of defcustom does not eval. ;; Removed eval-when-compile to load icicles-mac. ;; 2011/10/08 dadams ;; Added: icicle-candidate-(action|help)-keys. ;; eval-when-compile icicles-mac.el. ;; icicle-(apropos|prefix)-complete(-no-display)-keys, icicle-key-complete-keys, ;; icicle-apropos-cycle-(next|previous)((-alt)-action|help)-keys, icicle-isearch-complete-keys, ;; icicle-modal-cycle-(down|up)((-alt)-action|help)-keys, icicle-completing-read+insert-keys ;; icicle-previous-candidate-keys, icicle-read+insert-file-name-keys, ;; icicle-search-from-isearch-keys, icicle-top-level-key-bindings, icicle-word-completion-keys: ;; Use icicle-kbd (and do not use kbd). ;; 2011/10/04 dadams ;; Added: icicle-search-key-prefix. ;; 2011/10/02 dadams ;; icicle-functions-to-redefine: Added read-char-by-name to default value. ;; 2011/09/18 dadams ;; icicle-search-highlight-threshold: Added possibility of a t value. ;; icicle-image-files-in-Completions: Removed quote for image-only value. ;; 2011/09/05 dadams ;; Added: icicle-hide-non-matching-lines-flag. ;; icicle-Completions-toggle-submenu: Added icicle-toggle-hiding-non-matching-lines to menu. ;; icicle-hide-common-match-in-Completions-flag: Updated doc string (new toggle key). ;; 2011/09/04 dadams ;; Renamed: icicle-complete-keys-self-insert-flag to icicle-complete-keys-self-insert-ranges. ;; Define it only for Emacs 22+. ;; Made it an alist of char ranges, for Emacs 23+. ;; 2011/09/02 dadams ;; icicle-functions-to-redefine: Added: Info-goto-node, Info-index, Info-menu. ;; 2011/08/30 dadams ;; icicle-thing-at-point-functions: ;; symbol-name-nearest-point -> icicle-thing-at-point-functions ;; region-or-word-nearest-point -> word-nearest-point ;; 2011/08/13 dadams ;; icicle-top-level-key-bindings: Map bmkp-autofile-set to icicle-bookmark-a-file. ;; 2011/08/07 dadams ;; icicle-top-level-key-bindings: Bind icicle-find-file-tagged(-other-window) to C-x j t a a. ;; 2011/07/30 dadams ;; Moved icicle-increment-color-value to icicles-face.el. ;; Require icicles-face.el only if hexrgb.el has been loaded. ;; 2011/07/27 dadams ;; icicle-completions-format, icicle-search-whole-word-flag: Updated doc string. ;; 2011/07/26 dadams ;; Removed: icicle-list-end-string (no longer needed). Thx to Michael Heerdegen. ;; 2011/07/06 dadams ;; Renamed icicle-Completions-frame-at-right-flag to icicle-move-Completions-frame. ;; icicle-move-Completions-frame: Allow for moving frame to the left also. ;; 2011/06/03 dadams ;; Renamed icicle-help-in-mode-line-flag to icicle-help-in-mode-line-delay and changed to 5 secs. ;; 2011/05/24 dadams ;; icicle-functions-to-redefine: Removed (dired-)read-shell-command - turned off by default now. ;; 2011/05/22 dadams ;; icicle-init-value-flag/icicle-default-value: Added 3rd arg for make-obsolete-variable. ;; 2011/05/14 dadams ;; Removed: icicle-thing-types. Better to get the list dynamically. ;; 2011/05/13 dadams ;; Added: icicle-thing-types. ;; 2011/05/07 dadams ;; Added: icicle-ignore-comments-flag. ;; 2011/05/03 dadams ;; Added: icicle-highlight-saved-candidates-flag. ;; icicle-Completions-toggle-submenu: Added icicle-toggle-highlight-saved-candidates to menu. ;; 2011/04/26 dadams ;; icicle-top-level-key-bindings: ;; Added icicle-(un)tag-a-file, icicle-find-file-(all|some)-tags-*. ;; If you have customized it, re-customize it from scratch or you will miss the new bindings. ;; 2011/04/02 dadams ;; NOTE: IF you customized icicle-top-level-key-bindings and you use Bookmark+, then you will want ;; to REMOVE THAT CUSTOMIZATION AND CUSTOMIZE AGAIN. Otherwise, you will miss Icicles ;; multi-command versions of the new Bookmark+ commands. ;; icicle-top-level-key-bindings: ;; Added icicle-bookmark-file-this-dir-((all|some)-tags(-regexp))(-other-window). ;; 2011/03/31 dadams ;; Renamed icicle-target-window-recenter-amount to icicle-recenter & moved from icicles-var.el. ;; 2011/03/26 dadams ;; icicle-top-level-key-bindings: ;; Added: bmkp-file-(all|some)-tags(-regexp)-jump(-other-window). ;; Fixed typos: bmkp-(all|some)-tags-regexp-jump (forgot -regexp). Use fboundp, not featurep. ;; 2011/03/22 dadams ;; Added autoload cookies for defconsts. ;; 2011/02/26 dadams ;; Added: icicle-Completions-(misc|save/retrieve|sets|sorting|this-candidate|toggle)-submenu, ;; icicle-Completions-mouse-3-menu-entries. ;; 2011/02/22 dadams ;; Added: icicle-image-files-in-Completions, icicle-functions-to-redefine. ;; Removed: icicle-redefine-standard-commands-flag. ;; 2011/01/17 dadams ;; Added runtime require of cl.el for Emacs 20. (Emacs 20 does not handle defcustom well.) ;; 2011/01/12 dadams ;; Changed default value of icicle-Completions-text-scale-decrease from 0.66 to 0.75. ;; 2011/01/02 dadams ;; icicle-region-background: ;; Use frame param background-mode, not frame-background-mode. Thx to Le Wang. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/12/18 dadams ;; Added some missing autoload cookies. ;; 2010/12/17 dadams ;; icicle-thing-at-point-functions: Added to default: list-nearest-point-as-string (1,2,3). ;; 2010/11/12 dadams ;; Added: icicle-(S-)TAB-completion-methods-per-command. ;; 2010/11/10 dadams ;; icicle-top-level-key-bindings: In :set, protect icicle-mode-map with boundp. ;; 2010/10/25 dadams ;; Removed: icicle-search-context-match-predicate (was not used). ;; icicle-(buffer|file)-predicate: Mention that they (now) apply after matching. ;; 2010/10/24 dadams ;; icicle-S-TAB-completion-methods-alist: Added ("Jaro-Winkler" . fuzzy-match). ;; 2010/10/09 dadams ;; Corrections per move to emphasize modal cycling: ;; Renamed: icicle-cycling-respects-completion-mode to icicle-default-cycling-mode. ;; icicle-default-cycling-mode: Default value is prefix, not nil. New value descriptions and doc. ;; icicle-modal-cycle-*-keys: Put back wheel keys. Removed mention of *-cycling-respects-*-mode. ;; icicle-prefix-cycle-*-keys: Use end/home, not down/up as default values. ;; No mention of being used also for *Completions*. ;; icicle-act-before-cycle-flag: Updated doc string. ;; 2010/10/08 dadams ;; icicle-modal-cycle-*-keys: Removed mouse-wheel keys - they are added systematically now. ;; 2010/10/07 dadams ;; icicle-TAB-completion-methods: Removed :set, :initialize (handle it differently now). ;; 2010/10/06 dadams ;; icicle-TAB-completion-methods: Added :set and :initialize. Thx to Michael Heerdegen. ;; icicle-modal-cycle-(up|down)((-alt)-action|-help)-keys: Bound mouse wheel also (Emacs 22+). ;; 2010/07/17 dadams ;; icicle-top-level-key-bindings: Added *url-jump(-other-window). ;; 2010/06/18 dadams ;; Renamed: bookmarkp-* to bmkp-*. ;; 2010/06/09 dadams ;; icicle-isearch-complete-keys: ;; Added [escape tab] to default binding (isearch bizarrie). Added C-M-TAB for all platforms. ;; 2010/06/08 dadams ;; icicle-bookmark-refresh-cache-flag: Changed the default value to t to avoid confusion. ;; 2010/06/05 dadams ;; Set icicle-top-level-when-sole-completion-delay to 0.7 from 0.0. ;; 2010/06/04 dadams ;; Added: icicle-(buffers|files)-ido-like-flag, icicle-max-candidates. ;; icicle-ignored-directories: Protect default value with boundp. ;; icicle-type-actions-alist: Added (maximize|restore|toggle-max)-frame(-horizontally|-vertically). ;; 2010/05/30 dadams ;; Added: icicle-ignored-directories. ;; 2010/05/15 dadams ;; icicle-top-level-key-bindings: Updated Icicles versions of bookmark jump commands. ;; icicle-keymaps-for-key-completion: Added bookmarkp-jump-map bookmarkp-jump-other-window-map. ;; 2010/04/30 dadams ;; Added: icicle-no-match-hook. ;; 2010/04/09 dadams ;; Remap find-file-read-only(-other-window) to icicle-find-file-read-only(-other-window). ;; 2010/04/02 dadams ;; Removed: icicle-region-alist, icicle-region-auto-open-files-flag, ;; icicle-region-bookmarks-flag, icicle-regions-name-length-max. ;; icicle-top-level-key-bindings: Removed bookmarkp-bookmark-list-jump-other-window. ;; bookmarkp*: Use condition (featurep 'bookmark+). ;; 2010/03/31 dadams ;; Removed extra code redefining some bookmark commands. ;; 2010/03/28 dadams ;; Removed: icicle-region-alist, icicle-region-auto-open-files-flag, ;; icicle-region-bookmarks-flag, icicle-regions-name-length-max. ;; 2010/03/14 dadams ;; Added: icicle-bookmark-refresh-cache-flag. ;; 2010/03/13 dadams ;; Renamed icicle-add-buffer-name-flag to icicle-show-multi-completion-flag. Doc string. ;; 2010/03/09 dadams ;; icicle-color-themes: Initialize to (). Do real init in cmd icicle-color-theme. ;; 2010/03/03 dadams ;; Renamed: icicle-sort-function to icicle-sort-comparer, ;; icicle-sort-functions-alist to icicle-sort-orders-alist ;; icicle-alternative-sort-function to icicle-alternative-sort-comparer. ;; Redefined to allow multi-sorting: icicle-sort-comparer, icicle-sort-orders-alist. ;; 2010/02/17 dadams ;; Moved icicle-redefined-functions here from icicles-var.el ;; and renamed to icicle-inhibit-advice-functions. ;; Moved to icicles-face.el: icicle-increment-color-(hue|saturation). ;; So now require icicles-face.el. ;; Corrected alphabetical order. ;; 2010/02/13 dadams ;; icicle-top-level-key-bindings: Bound icicle-bookmark-*-jump-other-window. ;; 2010/01/24 dadams ;; icicle-thing-at-point-functions: ;; Use region-or-word-nearest-point, not word-nearest-point. Change order. ;; 2010/01/17 dadams ;; icicle-top-level-key-bindings: Added Icicles remappings for bookmarkp-*-jump-other-*. ;; 2009/12/25 dadams ;; icicle-top-level-key-bindings: Bind ESC-M-x to lacarte-execute-command. ;; 2009/12/13 dadams ;; icicle-top-level-key-bindings: Map dired(-other-window) to icicle-dired(-other-window). ;; 2009/12/07 dadams ;; icicle-guess-commands-in-path: Changed default value to nil. ;; 2009/11/27 dadams ;; Added: icicle-swank-prefix-length, icicle-swank-timeout. ;; icicle-TAB-completion-methods: Treat swank method also. ;; 2009/11/24 dadams ;; Added: icicle-completions-format. ;; icicle-color-themes: Fix: delete singleton list with string, not symbol bury-buffer. ;; 2009/11/22 dadams ;; icicle-color-themes: Use color-theme-initialize instead of load-library, to load themes. ;; 2009/11/21 dadams ;; icicle-color-themes: (load-library "color-theme-library"), for color theme version 6.6.0. ;; 2009/10/25 dadams ;; Added: icicle-TAB-completion-methods. ;; Removed: icicle-fuzzy-completion-flag, icicle-prefix-completion-is-basic-flag. ;; Renamed: icicle-apropos-match-fns-alist to icicle-S-TAB-completion-methods-alist. ;; 2009/10/12 dadams ;; icicle-top-level-key-bindings: Added bindings for icicle-bookmark(-other-window). ;; icicle-prefix-completion-is-basic-flag: Make it a constant for pre-Emacs 23. ;; 2009/10/06 dadams ;; icicle-keymaps-for-key-completion: Added bookmark-bmenu-mode-map to default value. ;; icicle-sort-functions-alist: Use a separate defcustom for Emacs 20, since no :type alist. ;; 2009/09/25 dadams ;; Added: icicle-prefix-completion-is-basic-flag. ;; Changed default value of: ;; icicle-candidate-width-factor from 70 to 80 ;; icicle-Completions-text-scale-decrease from 0.8 to 0.66. ;; 2009/09/16 dadams ;; icicle-top-level-key-bindings: Added remap for icicle-insert-buffer. ;; 2009/09/05 dadams ;; icicle-keymaps-for-key-completion: Added facemenu-keymap. ;; icicle-search-replace-common-match-flag: Fixed doc string: C-M-| -> M-;. ;; icicle-expand-input-to-common-match-flag: Fixed doc string: C-| -> C-;. ;; 2009/09/02 dadams ;; Added: icicle-region-bookmarks-flag, icicle-top-level-when-sole-completion-delay. ;; icicle-region-alist: Updated doc string. Added :group Icicles-Searching. ;; 2009/08/19 dadams ;; icicle-bookmark-name-length-max: ;; Changed default value from 40 to 70. It is now the total name length. Updated doc. ;; 2009/08/01 dadams ;; Added: icicle-menu-items-to-history-flag. ;; 2009/07/29 dadams ;; Added: icicle-populate-interactive-history-flag. ;; 2009/06/17 dadams ;; Added: icicle-Completions-text-scale-decrease. ;; 2009/05/20 dadams ;; icicle-keymaps-for-key-completion: Added prefix-key maps senator-mode-map, ;; srecode-mode-map, jde-mode-map, jde-jdb-mode-map. Thx to Daniel Clemente. ;; 2009/05/17 dadams ;; icicle-type-actions-alist: Updated to reflect thumb-frm.el name changes. ;; 2009/05/10 dadams ;; icicle-list-join-string: Don't set display property for Emacs 21 (Emacs bug). ;; 2009/05/09 dadams ;; Added: icicle-dot-string, icicle-dot-show-regexp-flag, icicle-anychar-regexp, ;; 2009/05/07 dadams ;; icicle-list-join-string: Use copy-sequence in default value, so users see original sexp. ;; 2009/05/02 dadams ;; Added: icicle-alternative-actions-alist. ;; 2009/05/01 dadams ;; Added function to icicle-type-actions-alist: icicle-shell-command-on-file. ;; 2009/04/26 dadams ;; Added: icicle-type-actions-alist, icicle-use-anything-candidates-flag. ;; 2009/04/20 dadams ;; Added: icicle-(prefix|apropos)-cycle-(next|previous)-alt-action-keys, ;; icicle-modal-cycle-(down|up)-alt-action-keys. ;; 2009/04/18 dadams ;; Soft-require hexrgb.el unconditionally, not just when there is a window-system. ;; icicle-region-background: If frame background is unspecified, consider it white. ;; Don't use frame background unless it is a valid color name. ;; Use region background if cannot compute saturation. ;; 2009/04/16 dadams ;; Added: icicle-(prefix|apropos)-cycle-(next|previous)-help-keys. ;; 2009/04/15 dadams ;; Added: icicle-modal-cycle-(up|down)-help-keys. ;; 2009/04/05 dadams ;; Added: icicle-help-in-mode-line-flag. ;; 2009/03/10 dadams ;; Moved here from icicles-fn.el: icicle-shell-command-candidates. ;; Moved here from icicles-var.el: icicle-shell-command-candidates. ;; Renamed: icicle-shell-command-candidates (fn) to icicle-compute-shell-command-candidates, ;; icicle-shell-command-candidates (var) to icicle-shell-command-candidates-cache, ;; icicle-guess-cmds-in-path-flag to icicle-guess-commands-in-path. ;; icicle-guess-commands-in-path: Boolean -> choice. Default is now first-use. ;; icicle-compute-shell-command-candidates: Don't update cache variable here. ;; icicle-shell-command-candidates-cache: Initialize per icicle-guess-commands-in-path. ;; 2009/03/08 dadams ;; Added: icicle-quote-shell-file-name-flag. ;; 2009/03/01 dadams ;; Added: icicle-completing-read+insert-keys, icicle-read+insert-file-name-keys. ;; Removed: icicle-complete-on-demand-keys. ;; 2009/02/20 dadams ;; Added: icicle-complete-on-demand-keys (not yet used). ;; Renamed: icicle-dired-guess-all-shell-cmds-flag to icicle-guess-cmds-in-path-flag. ;; 2009/01/25 dadams ;; Added: icicle-dired-guess-all-shell-cmds-flag. ;; 2009/01/17 dadams ;; Added: icicle-levenshtein-distance. ;; icicle-apropos-match-fns-alist: Added icicle-levenshtein(-strict)-match. ;; 2009/01/05 dadams ;; Added ess-complete-* to icicle-comint-dynamic-complete-replacements. ;; 2009/01/01 dadams ;; Added: icicle-comint-dynamic-complete-replacements. ;; 2008/12/30 dadams ;; Moved icicle-remap here from icicles-mode.el. ;; 2008/12/06 dadams ;; icicle-incremental-completion-flag: Changed :type to choice from boolean. ;; 2008/12/02 dadams ;; Removed: icicle-file-ignore-space-prefix-flag. ;; 2008/11/28 dadams ;; Moved here from icicles-var.el: icicle-apropos-match-fns-alist. ;; 2008/11/14 dadams ;; Added: icicle-hide-common-match-in-Completions-flag. ;; 2008/11/04 dadams ;; Removed: icicle-generic-S-tab-keys. ;; Added (split icicle-generic-S-tab-keys in 4): ;; icicle-apropos-complete-keys, icicle-key-complete-keys, icicle-previous-candidate-keys, ;; icicle-search-from-isearch-keys. ;; Added: icicle-complete-key-anyway-flag. ;; 2008/11/03 dadams ;; Applied renamings from icicles-cmd.el. ;; 2008/10/26 dadams ;; Added: icicle-file-*. ;; 2008/10/18 dadams ;; Added: icicle-customize-save-variable-function. ;; 2008/10/17 dadams ;; Added: icicle-bookmark-name-length-max. ;; icicle-top-level-key-bindings: Remapped bookmark-set to icicle-bookmark-cmd. ;; 2008/10/11 dadams ;; icicle-highlight-input-completion-failure: Updated doc string. ;; 2008/10/10 dadams ;; Added: icicle-(apropos|prefix)-cycle-(next|previous)-action-keys, ;; icicle-modal-cycle-(down|up)-action-keys. ;; icicle-cycling-respects-completion-mode-flag: ;; Renamed to icicle-cycling-respects-completion-mode. ;; It's now a choice of nil, t, apropos, prefix. Thx to Andrey Zhdanov. ;; 2008/09/30 dadams ;; icicle-highlight-input-completion-failure: Changed default value to implicit-strict. ;; 2008/09/13 dadams ;; Added: icicle-filesets-as-saved-completion-sets-flag. ;; 2008/08/28 dadams ;; icicle-top-level-key-bindings: ;; Renamed alacarte-execute-menu-command to lacarte-execute-menu-command. ;; 2008/08/22 dadams ;; Removed: icicle-Completions-window-default-width (obsolete). ;; 2008/08/21 dadams ;; icicle-top-level-key-bindings: ;; Replace icicle-find-file(-other-window) with icicle-file(-other-window). ;; icicle-generic-S-tab-keys: Mention bug workaround in doc string. Thx to Kevin Rodgers. ;; 2008/08/20 dadams ;; Added: icicle-inhibit-ding-flag. ;; 2008/08/12 dadams ;; icicle-top-level-key-bindings: ;; Remap set-mark-command (C-SPC) and pop-global-mark (C-x C-SPC). ;; 2008/08/11 dadams ;; icicle-key-definition, icicle-top-level-key-bindings: ;; Change :match-alternatives to (symbolp) from (commandp). ;; icicle-top-level-key-bindings: Added condition for minibuffer-keyboard-quit. ;; 2008/08/06 dadams ;; Bind icicle-kmacro to S-f4, not f5. Thx to Andrew Hyatt. ;; 2008/06/22 dadams ;; Added: icicle-unpropertize-completion-result-flag. ;; 2008/06/03 dadams ;; Added: icicle-use-C-for-actions-flag. ;; 2008/05/27 dadams ;; icicle-isearch-complete-keys: Removed S-TAB, added M-o. ;; 2008/05/25 dadams ;; icicle-isearch-complete-keys: Added M-TAB and C-M-TAB (if Windows). ;; Change [] notation to `' notation for keys in doc strings. ;; 2008/05/24 dadams ;; icicle-isearch-complete-keys: Use explicit ([S-tab] [S-iso-lefttab]) for Emacs < 22. ;; 2008/05/19 dadams ;; icicle-generic-S-tab-keys: Use explicit ([S-tab] [S-iso-lefttab]) for Emacs < 22. ;; 2008/05/11 dadams ;; icicle-top-level-key-bindings: Added :set and :initialize. ;; Moved icicle-bind-top-level-commands here from icicles-mode.el, and added optional arg. ;; 2008/05/10 dadams ;; Added widget icicle-key-definition (new custom type). ;; Renamed: icicle-bind-top-level-commands-alist to icicle-top-level-key-bindings. ;; icicle-top-level-key-bindings: ;; Redefined: New :type, using icicle-key-definition or choice of restricted-sexp. ;; Changed order of entry elements. Use kbd. No eval for command to be remapped. ;; Don't bind f5 unless have kmacro. ;; Moved icicle-yank-function before icicle-top-level-key-bindings (needed by it). ;; 2008/05/07 dadams ;; icicle-region-alist, icicle-sort-functions-alist: ;; Removed Emacs 20 version (alist works for Emacs 20 also). ;; Replaced icicle-bind-top-level-commands-flag with icicle-bind-top-level-commands-alist. ;; icicle-isearch-complete-keys: ;; Changed default value from ([S-tab] [S-iso-lefttab]) to ([backtab]). ;; 2008/05/05 dadams ;; icicle-generic-S-tab-keys: ;; Changed default value from ([S-tab] [S-iso-lefttab]) to ([backtab]). ;; 2008/04/26 dadams ;; Added: icicle-test-for-remote-files-flag. Updated C-^ to M-_ ;; icicle-ignore-space-prefix-flag: Update doc string: M-_, not C-^. ;; 2008/04/18 dadams ;; Renamed icicle-init-value-flag to icicle-default-value. ;; icicle-default-value: Updated to reflect t value. ;; 2008/04/13 dadams ;; Added: icicle-pp-eval-expression-print-(length|level). ;; 2008/03/30 dadams ;; Added: icicle-highlight-lighter-flag. ;; 2008/03/29 dadams ;; Removed: icicle-completing(-mustmatch)-prompt-prefix, icicle-reminder-prompt-flag. ;; Updated doc string of icicle-customize-save-flag. ;; 2008/03/21 dadams ;; icicle-reminder-prompt-flag: Changed default value to nil. ;; 2008/02/23 dadams ;; icicle-init-value-flag: Added insert-start value. Renamed insert value to insert-end. ;; 2008/02/06 dadams ;; Added: icicle-highlight-input-completion-failure-(delay|threshold). ;; 2008/01/29 dadams ;; Removed: icicle-max-chars-noncompletion-highlight. ;; Renamed: icicle-*-input-completion-failure-flag to icicle-*-input-completion-failure. ;; icicle-*-input-completion-failure: Added values (implicit*, always) and renamed others. ;; 2007/12/31 dadams ;; icicle-list-join-string: Add display property to hide the ^G. ;; 2007/12/26 dadams ;; icicle-region-background: ;; Put initialization back inside defcustom. ;; Change test for color from Emacs version to widget test. ;; 2007/12/24 dadams ;; Added: icicle-option-type-prefix-arg-list. ;; 2007/12/14 dadams ;; Added: icicle-customize-save-flag. ;; 2007/12/09 dadams ;; Added: icicle-max-chars-noncompletion-highlight. ;; 2007/12/03 dadams ;; Renamed longest common match (lcm) to expanded common match (ecm). ;; 2007/11/25 dadams ;; Added: icicle-command-abbrev-(alist|match-all-parts-flag|priority-flag). ;; 2007/11/23 dadams ;; Added: icicle-(apropos|prefix)-cycle-(next|previous)-keys. ;; 2007/11/17 dadams ;; Added: icicle-add-proxy-candidates-flag. ;; 2007/11/02 dadams ;; Added: icicle-generic-S-tab-keys, icicle-prefix-complete-keys, ;; icicle-(apropos|prefix)-complete-no-display-keys, icicle-isearch-complete-keys. ;; Renamed icicle-modal-cycle-(up|down)-key to icicle-modal-cycle-(up|down)-keys, ;; icicle-word-completion-key to icicle-word-completion-keys. ;; 2007/10/29 dadams ;; icicle-define-alias-commands-flag, icicle-deletion-action-flag, ;; icicle-list-nth-parts-join-string: Added type and group. ;; 2007/10/28 dadams ;; Added: icicle-search-replace-common-match-flag. ;; 2007/10/23 dadams ;; icicle-highlight-input-initial-whitespace-flag: ;; Mention icicle-highlight-input-completion-failure-flag in doc string. ;; 2007/10/21 dadams ;; icicle-candidate-width-factor, icicle-inter-candidates-min-spaces: Mention Do Re Mi. ;; 2007/10/14 dadams ;; icicle-act-before-cycle-flag: Default value is now nil. ;; 2007/10/07 dadams ;; Added: icicle-deletion-action-flag. ;; 2007/09/28 dadams ;; Added: icicle-fuzzy-completion-flag. ;; 2007/08/25 dadams ;; Added: icicle-anything-transform-candidates-flag, icicle-define-alias-commands-flag. ;; 2007/08/19 dadams ;; Added: icicle-highlight-input-completion-failure-flag. ;; 2007/08/16 dadams ;; icicle-region-alist, icicle-sort-functions-alist: Use alist as :type for recent Emacs. ;; 2007/07/27 dadams ;; Added: Moved icicle-act-first-then-navigate-p here from icicles-var.el, as option *-flag. ;; Thx to Juri Linkov for suggestion. ;; 2007/07/03 dadams ;; Added: icicle-completion-history-max-length, icicle-C-l-uses-completion-flag. ;; icicle-expand-input-to-common-match-flag: Updated doc string accordingly. ;; 2007/06/20 dadams ;; icicle-WYSIWYG-Completions-flag: Use string value, not whole number, for sample text. ;; 2007/06/19 dadams ;; icicle-WYSIWYG-Completions-flag: Allow also a whole-number value, for separate swatch. ;; 2007/06/17 dadams ;; Added: icicle-WYSIWYG-Completions-flag. ;; 2007/06/12 dadams ;; icicle-region-background: Use different value for dark-background frames. ;; 2007/06/09 dadams ;; Added: icicle-use-candidates-only-once-flag. ;; 2007/06/05 dadams ;; Don't require hexrgb.el if no window system. ;; icicle-increment-color-*: Protected with featurep hexrgb and error message. ;; 2007/05/06 dadams ;; Added: icicle-search-context-match-predicate. ;; 2007/05/02 dadams ;; Added: icicle-search-whole-word-flag, icicle-yank-function. ;; icicle-regexp-quote-flag: Updated doc string to mention search. ;; 2007/04/20 dadams ;; Added: icicle-search-highlight-context-levels-flag, icicle-increment-color-saturation. ;; 2007/04/17 dadams ;; Added: icicle-search-replace-literally-flag. ;; 2007/04/15 dadams ;; icicle-search-replace-whole-candidate-flag: Changed default value to t. ;; 2007/04/07 dadams ;; Added: icicle-search-replace-whole-candidate-flag. ;; 2007/03/31 dadams ;; Added: icicle-top-level-when-sole-completion-flag. ;; icicle(-regexp)-search-ring-max: Default is 1/10th what it was. ;; 2007/03/30 dadams ;; Added: icicle-candidate-width-factor, icicle-inter-candidates-min-spaces. ;; 2007/03/12 dadams ;; Added: icicle-Completions-window-max-height. ;; icicle-show-Completions-help-flag: defvaralias it to completion-show-help (if bound). ;; 2007/03/10 dadams ;; Added: icicle-Completions-window-default-width. ;; 2007/02/27 dadams ;; Changed default value of icicle-incremental-completion-delay to 0.7. ;; 2007/02/22 dadams ;; icicle-buffer-sort: Use icicle-buffer-sort-*...*-last, not nil, as default value. ;; 2007/02/20 dadams ;; Changed icicle-region-auto-open-files-flag default value to nil. ;; 2007/02/19 dadams ;; icicle-region-alist: Added buffer's file to alist entry. ;; Added: icicle-region-auto-open-files-flag. ;; 2007/02/17 dadams ;; Added: icicle-keymaps-for-key-completion. ;; 2007/02/06 dadams ;; Added: icicle-add-buffer-name-flag. ;; 2007/01/29 dadams ;; icicle-sort-function: Use icicle-case-string-less-p as value, not string-lessp. ;; 2007/01/23 dadams ;; Added: icicle-highlight-historical-candidates-flag. ;; Updated doc strings of *-flag to mention toggles. ;; 2007/01/18 dadams ;; Renamed: icicle-regions to icicle-region-alist. ;; 2007/01/15 dadams ;; Added: icicle-change-sort-order-completion-flag, icicle-sort-functions-alist. ;; icicle-cycle-into-subdirs-flag, icicle-sort-function: Updated doc string. ;; 2007/01/14 dadams ;; Added: icicle-list-nth-parts-join-string. ;; 2007/01/08 dadams ;; icicle-reminder-prompt-flag: Reduced default value from 20 to 7 Emacs sessions. ;; 2007/01/06 dadams ;; Added: icicle-use-~-for-home-dir-flag. Thanks to Timothy Stotts for the suggestion. ;; 2006/12/29 dadams ;; icicle-thing-at-point-functions: Added ffap-guesser as first alternative text grabber. ;; icicle-default-thing-insertion: Changed default value to icicle-default-thing-insertion. ;; 2006/12/25 dadams ;; Moved to icicles-fn.el: icicle-historical-alphabetic-p. ;; 2006/12/22 dadams ;; Assigned Icicles subgroups, instead of group Icicles. ;; 2006/12/10 dadams ;; icicle-regions: Corrected (forgot repeat). ;; 2006/11/26 dadams ;; Added: icicle-regions(-name-length-max). ;; 2006/11/24 dadams ;; Added: icicle-kmacro-ring-max. ;; 2006/11/23 dadams ;; Added: icicle-TAB-shows-candidates-flag. Thx to Tamas Patrovics for the suggestion. ;; 2006/11/09 dadams ;; icicle-search-highlight-all-flag -> icicle-search-highlight-threshold. ;; Added: icicle-search-highlight-all-current-flag. ;; 2006/10/28 dadams ;; icicle-region-background: Changed :type to 'color for Emacs 21+. ;; icicle(-alternative)-sort-function, icicle-buffer-sort, icicle-transform-function: ;; function -> choice of nil or function. ;; icicle-buffer-configs: Added :tag's. ;; icicle-saved-completion-sets: Corrected doc string. ;; 2006/10/21 dadams ;; Added: icicle-complete-keys-self-insert-flag. ;; 2006/10/14 dadams ;; icicle-list-end-string: Added :type and :group. ;; Moved conditional eval-when-compile to top level. ;; 2006/10/04 dadams ;; Added: icicle-special-candidate-regexp. ;; 2006/10/03 dadams ;; icicle-list-join-string: Replaced ^G^J by \007\012, to be able to upload to Emacs Wiki. ;; 2006/10/01 dadams ;; icicle-alternative-sort-function: Updated doc string - it's now a general toggle. ;; 2006/09/30 dadams ;; Added: icicle-key-descriptions-use-*-flag. ;; 2006/09/16 dadams ;; Added: icicle-list-end-string. ;; 2006/09/03 dadams ;; Renamed icicle-show-Completions-help to icicle-show-Completions-help-flag. ;; 2006/08/13 dadams ;; Added: icicle-completing(-mustmatch)-prompt-prefix. ;; 2006/07/28 dadams ;; icicle-change-region-background-flag: ;; Default value takes no account of delete-selection mode. Improved doc string. ;; icicle-region-background: ;; Don't make region invisible if hexrgb.el was not loaded. ;; Change value, not hue, if grayscale frame background. Improved doc string. ;; 2006/07/23 dadams ;; Added: icicle-transform-function. ;; icicle-sort-function: Added Note to doc string. ;; 2006/07/20 dadams ;; Added: icicle-modal-cycle-(up|down)-key. ;; Renamed icicle-arrows-respect-* to icicle-cycling-respects-completion-mode-flag. ;; 2006/07/19 dadams ;; Applied patch from Damien Elmes : ;; Added: icicle-show-completions-help. Renamed it to icicle-show-Completions-help. ;; 2006/07/18 dadams ;; Added: icicle-Completions-display-min-input-chars. Thx to Damien Elmes. ;; 2006/07/10 dadams ;; icicle-historical-alphabetic-p: Fallback directory if no previous input. ;; 2006/07/07 dadams ;; Added: icicle-alternative-sort-function, icicle-historical-alphabetic-p. ;; 2006/07/04 dadams ;; icicle-expand-input-to-common-match-flag: Updated doc string. ;; 2006/06/09 dadams ;; icicle-region-background: Use nil in defcustom. Initialize separately. ;; 2006/06/08 dadams ;; icicle-bind-top-level-commands-flag: Updated doc string. ;; 2006/05/19 dadams ;; Renamed icicle-inhibit-reminder* to icicle-reminder*. ;; Changed its functionality to use a countdown. ;; 2006/05/16 dadams ;; Added: icicle-bind-top-level-commands-flag. ;; 2006/05/15 dadams ;; Renamed: icicle-completion-nospace-flag to icicle-ignore-space-prefix-flag. ;; Added: icicle-buffer-ignore-space-prefix-flag. ;; icicle-ignore-space-prefix-flag: Changed default value to nil. ;; 2006/05/09 dadams ;; icicle-incremental-completion-threshold: Updated doc string (msg "Displaying..."). ;; 2006/04/28 dadams ;; Added: icicle-highlight-input-initial-whitespace-flag. ;; 2006/04/14 dadams ;; Added: icicle-input-string, icicle-search-cleanup-flag, icicle-update-input-hook. ;; icicle-list-join-string: Added :type and :group. ;; 2006/04/09 dadams ;; Added: icicle-arrows-respect-completion-type-flag. ;; 2006/04/07 dadams ;; Added: icicle-search-highlight-all-flag. ;; 2006/04/02 dadams ;; Added: icicle-regexp-quote-flag. ;; 2006/03/24 dadams ;; Added: icicle-incremental-completion-(delay|threshold). ;; 2006/03/20 dadams ;; icicle-expand-input-to-common-match-flag: Changed default value to t. ;; 2006/03/19 dadams ;; Added: icicle-expand-input-to-common-match-flag. ;; 2006/03/17 dadams ;; Removed: icicle-cache-file. ;; Added: icicle-saved-completion-sets. ;; 2006/03/13 dadams ;; Added: icicle-cache-file. ;; 2006/03/08 dadams ;; icicle-default-thing-insertion: Use substitute-command-keys in :tag. ;; 2006/03/05 dadams ;; Moved from here to icicle-mode.el: icicle-mode, icicle-mode-hook. ;; Added: icicle-touche-pas-aux-menus-flag. ;; 2006/03/03 dadams ;; icicle-list-join-string: Changed value to ^G^J. Clarified doc string. ;;;(@* "CHANGE LOG FOR `icicles-var.el'") ;; ;; 2013/04/04 dadams ;; Added: icicle-ess-use-ido. ;; 2013/03/23 dadams ;; Added: icicle-Info-tag-table-posn. ;; 2013/03/07 dadams ;; Updated to use icicle-user-error where appropriate. ;; 2013/02/16 dadams ;; icicle-general-help-string: Removed list of commands - just refer to file headers. ;; 2013/02/03 dadams ;; icicle-general-help-string: ;; Updated for *-(minibuffer|completion(-list))-key-* (add), *-previous-candidate-keys (remove). ;; 2013/01/26 dadams ;; Added: icicle-multi-inputs-action-fn. ;; 2012/12/31 dadams ;; Added: icicle-mode-line-help. ;; 2012/12/15 dadams ;; Added: icicle-cands-to-narrow, icicle-compute-narrowing-regexp-p, icicle-narrow-regexp. ;; 2012/12/02 dadams ;; Added: icicle-read-file-name-internal-fn. ;; 2012/12/01 dadams ;; Removed load of icicles-mac.el (icicle-kbd is now a function in icicles-opt.el). ;; 2012/11/28 dadams ;; Added: icicle-transform-function - moved here from icicles-opt.el. ;; Removed: icicle-vardoc-last-initial-option-cand-set. ;; 2012/11/26 dadams ;; Added: icicle-apropos-value-last-initial-cand-set. ;; 2012/10/27 dadams ;; Added: icicle-toggle-transforming-message. Updated icicle-general-help-string. ;; 2012/10/22 dadams ;; Added: icicle-Info-index-cache. ;; 2012/10/18 dadams ;; Added: icicle-path-variables. ;; Added: icicle-exclude-default-proxies. (Used by *-directory-list to exclude non-file proxies.) ;; 2012/10/09 dadams ;; Added: icicle-multi-completing-p. ;; 2012/10/05 dadams ;; Removed: icicle-default-directory (unused). ;; 2012/09/08 dadams ;; Added: icicle-buffer-name-input-p, icicle-buffer-complete-fn. ;; icicle-general-help-string: Removed reference to icicle-ignore-space-prefix-flag. ;; 2012/08/06 dadams ;; Renamed: icicle-old-read-file-name-fn to icicle-orig-read-file-name-fn. ;; 2012/07/07 dadams ;; Added: icicle-file-name-completion-table. Thx to Michael Heerdegen. ;; 2012/06/29 dadams ;; Added: icicle-allowed-sort-predicate. ;; 2012/06/28 dadams ;; icicle-search-map: Bound icicle-grep-saved-file-candidates (M-s M-s g). ;; 2012/05/14 dadams ;; icicle-candidate-help-fn: Updated doc string to mention transforming multi-completion cands. ;; 2012/05/07 dadams ;; Applied renaming of icicle-search-dired-marked to icicle-search-dired-marked-recursive. ;; 2012/04/23 dadams ;; icicle-search-modes: Treat dired-mode like bookmark-bmenu-mode: error if no Dired+. ;; 2012/04/13 dadams ;; icicle-search-modes: For Dired, use icicle-search-dired-get-files, not dired-get-marked-files. ;; icicle-re-no-dot: Made it a defconst. ;; 2012/02/11 dadams ;; icicle-current-raw-input, icicle-general-help-string, icicle-incremental-completion-p: ;; Doc updates for input-expansion changes, including option name change (no -flag). ;; 2012/01/14 dadams ;; Added: icicle-read-char-history. ;; 2011/12/28 dadams ;; Removed mention of obsolete option icicle-cycle-into-subdirs-flag. ;; 2011/12/14 dadams ;; Added: icicle-bookmark-list-names-only-p. ;; 2011/10/14 dadams ;; icicle-search-map: Bound x and X to the XML-element search commands. ;; 2011/10/08 dadams ;; eval-when-compile icicles-mac.el. ;; icicle-read-expression-map, icicle-search-map, icicle-universal-argument-map: Use icicle-kbd. ;; 2011/10/04 dadams ;; Added: icicle-search-map. ;; 2011/09/27 dadams ;; Added: icicle-search-modes (var). ;; 2011/09/14 dadams ;; Added: icicle-hist-var. ;; icicle-prompt: Changed default value to nil from "". ;; 2011/09/05 dadams ;; icicle-general-help-string: Added icicle-hide-non-matching-lines-flag. ;; Removed -other-window from *-bookmark-(bookmark-list|desktop). ;; 2011/08/13 dadams ;; Added: icicle-search-complement-domain-p. ;; 2011/08/12 dadams ;; Added: icicle-full-cand-fn. ;; 2011/08/07 dadams ;; icicle-abs-file-candidates: Update doc string: now an alist (for COLLECTION arg). ;; 2011/07/27 dadams ;; Removed icicle-completions-format-internal. ;; 2011/07/26 dadams ;; Removed: icicle-list-end-string (no longer needed). Thx to Michael Heerdegen. ;; 2011/07/24 dadams ;; Updated icicle-general-help-string for new commands. ;; 2011/07/06 dadams ;; Applied renaming of icicle-Completions-frame-at-right-flag to icicle-move-Completions-frame. ;; 2011/05/03 dadams ;; icicle-general-help-string: Mention icicle-toggle-highlight-saved-candidates. ;; 2011/04/29 dadams ;; Added: icicle-buffer-sort-first-time-p, icicle-file-sort-first-time-p, icicle-new-last-cmd, ;; icicle-orig-must-pass-after-match-pred. ;; 2011/04/02 dadams ;; Added: icicle-bufflist, icicle-pref-arg, icicle-scan-fn-or-regexp. ;; Moved to icicles-cmd2.el: ;; icicle-orig-(buff|win)-key-complete, icicle-orig-extra-cands, icicle-orig-menu-bar, ;; icicle-orig-(font|frame|pixelsize|pointsize), icicle-orig-show-initially-flag, ;; icicle-orig-sort-orders-alist, icicle-this-cmd-keys. ;; 2011/03/31 dadams ;; Renamed icicle-target-window-recenter-amount to icicle-recenter & moved to icicles-opt.el. ;; 2011/03/29 dadams ;; Added: icicle-key-prefix-description, icicle-orig-(buff|window|font|frame|pixelsize|pointsize), ;; icicle-orig-(buff|win)-key-complete, icicle-completing-keys-p, icicle-prompt, ;; icicle-orig-(pt|win)-explore, icicle-orig-show-initially-flag, icicle-orig-extra-cands, ;; icicle-other-window, icicle-target-window-recenter-amount, icicle-this-cmd-keys. ;; Renamed: icicle-scroll-Completions-backward-p to icicle-scroll-Completions-reverse-p. ;; icicle-complete-keys-alist: Removed conditional definition (just don't use it before Emacs 22). ;; 2011/01/17 dadams ;; Removed compile-time require of cl.el. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2010/11/07 dadams ;; Renamed: icicle-all-candidates-action-p to icicle-all-candidates-action. Now can cache action. ;; 2010/10/25 dadams ;; Removed mention of icicle-search-context-match-predicate (no longer exists). ;; 2010/10/24 adams ;; Added: icicle-must-pass-after-match-predicate. ;; icicle-must-pass-predicate: Clarified doc string. ;; 2010/10/09 dadams ;; icicle-general-help-string: ;; Applied renaming of icicle-cycling-respects-completion-mode to icicle-default-cycling-mode. ;; 2010/10/07 dadams ;; icicle-current-TAB-method: Use nil, not basic, as default value. ;; 2010/06/18 dadams ;; Added: icicle-completions-format-internal. ;; 2010/06/08 dadams ;; Added: icicle-nb-candidates-before-truncation. ;; 2010/06/04 dadams ;; Added: icicle-lighter-truncation. ;; icicle-general-help-string: Mention missing doremi commands. ;; 2010/04/29 dadams ;; Added: icicle-remove-icicles-props-p. ;; 2010/04/02 dadams ;; icicle-general-help-string: Updated. ;; 2010/04/02 dadams ;; Added: icicle-bookmark-types. ;; icicle-general-help-string: Updated to reflect move from saved regions to bookmarks. ;; 2010/03/13 dadams ;; Added: icicle-transform-before-sort-p. ;; Removed: icicle-sorted-bookmark-alist. ;; Applied renaming of icicle-add-buffer-name-flag to icicle-show-multi-completion-flag. ;; 2010/03/03 dadams ;; Added: icicle-sorted-bookmark-alist, icicle-reverse-multi-sort-p. ;; Renamed: icicle-last-sort-function to icicle-last-sort-comparer. ;; icicle-general-help-string: Applied renaming to icicle-sort-orders-alist. ;; Applied renamings: icicle-sort-function to icicle-sort-comparer, ;; icicle-sort-functions-alist to icicle-sort-orders-alist, ;; icicle-alternative-sort-function to icicle-alternative-sort-comparer. ;; 2010/02/17 dadams ;; Moved icicle-redefined-functions to icicles-opt.el ;; and renamed to icicle-inhibit-advice-functions ;; 2010/02/14 dadams ;; Added: icicle-advice-info-list, icicle-redefined-functions. ;; 2009/11/07 dadams ;; Applied doremi cmd renamings (added +) to help text. ;; 2009/10/25 dadams ;; Added: icicle-current-TAB-method. ;; Updated icicle-general-help-string with new command names. ;; 2009/09/26 dadams ;; Added: icicle-progressive-completing-p. ;; 2009/09/25 dadams ;; Removed: icicle-respect-completion-styles-p. See option *-TAB-respects-*-styles-flag. ;; 2009/09/05 dadams ;; Added: icicle-minibuffer-message-ok-p. ;; Renamed icicle-acting-on-next/prev-p to icicle-acting-on-next/prev. ;; 2009/07/26 dadams ;; Added: icicle-command-abbrev-history (belated), icicle-interactive-history. ;; 2009/05/17 dadams ;; icicle-predicate-types-alist: Updated to reflect thumb-frm.el name changes. ;; 2009/05/11 dadams ;; Added: icicle-hist-cands-no-highlight. ;; 2009/05/09 dadams ;; Added: *-input-completion-fail-overlay, *-anychar-regexp, *-dot-string-internal. ;; 2009/05/02 dadams ;; Added: icicle-cmd-reading-input. ;; 2009/04/28 dadams ;; Renamed: icicle-object-predicate-types to icicle-predicate-types-alist. ;; icicle-predicate-types-alist: ;; Converted to alist, with cdr's from icicle-type-actions-alist. Added more entries. ;; Removed: icicle-object-named-types. ;; 2009/04/03 dadams ;; Added: icicle-filtered-default-value. ;; 2009-03/16 dadams ;; Added: icicle-use-candidates-only-once-alt-p. ;; 2009/03/15 dadams ;; icicle-general-help-string: Added: icicle-recompute-shell-command-candidates, ;; icicle-remove-file-from-recentf-list. ;; 2009/03/10 dadams ;; Moved icicle-shell-command-candidates to icicles-opt.el and renamed: *-cache. ;; 2009/03/01 dadams ;; Added: icicle-completing-read+insert-candidates. ;; Removed: icicle-complete-on-demand-cmd. ;; 2009/02/23 dadams ;; Added: icicle-extra-candidates-dir-insert-p. ;; 2009/02/20 dadams ;; Added: icicle-shell-command-candidates, icicle-complete-on-demand-cmd. ;; 2009/02/04 dadams ;; Added: icicle-next-prefix-complete-cycles-p, icicle-next-apropos-complete-cycles-p. ;; 2009/01/24 dadams ;; Added: icicle-last-apropos-complete-match-fn. ;; 2009/01/13 dadams ;; Added: icicle-respect-completion-styles-p (internal var, for now). ;; 2008/12/25 dadams ;; Added: icicle-cycling-p. ;; 2008/12/07 dadams ;; Added: icicle-completion-prompt-overlay. Removed: icicle-prompt. ;; 2008/12/02 dadams ;; Added: icicle-confirm-exit-commands. ;; 2008/11/28 dadams ;; Moved to icicles-opt.el: icicle-apropos-match-fns-alist. ;; 2008/11/22 dadams ;; Added: icicle-fancy-candidates-p, icicle-fancy-cands-internal-p. ;; 2008/11/03 dadams ;; Applied renamings from icicles-cmd.el. ;; 2008/11/02 dadams ;; Added: icicle-(doc|vardoc|fundoc|plist)-last-initial(-option)-cand-set. ;; 2008/10/14 dadams ;; Added: icicle-general-help-string. ;; Removed: icicle-completion-help-string. ;; 2008/10/06 dadams ;; icicle-ms-windows-drive-hash: Set it to nil if make-hash-table is undefined. ;; 2008/09/30 dadams ;; Added: icicle-ms-windows-drive-hash. ;; 2008/09/20 dadams ;; icicle-ignored-extensions-regexp: Append $ to each extension. ;; Added: icicle-abs-file-candidates. ;; 2008/08/28 dadams ;; Renamed: alacarte-menu-items-alist to lacarte-menu-items-alist. ;; 2008/08/18 dadams ;; Added: icicle-inhibit-try-switch-buffer. ;; 2008/08/12 dadams ;; Added: icicle-apply-nomsg. ;; 2008/08/10 dadams ;; Added: icicle-explore-final-choice, icicle-explore-final-choice-full. ;; 2008/08/03 dadams ;; Added: icicle-all-candidates-list-alt-action-fn. ;; Renamed: icicle-all-candidates-action-fn to icicle-all-candidates-list-action-fn, ;; icicle-candidate-alternative-action-fn to icicle-candidate-alt-action-fn. ;; 2008/03/30 dadams ;; Added: icicle-old-read-file-name-fn. ;; 2008/03/29 dadams ;; Removed: icicle-prompt-suffix. ;; 2008/03/23 dadams ;; Added: icicle-scroll-Completions-backward-p. ;; 2008/03/19 dadams ;; Added: icicle-read-expression-map. ;; 2008/03/10 dadams ;; Added: icicle-frame-alist. ;; 2008/02/24 dadams ;; Added: icicle-apropos-match-fns-alist. ;; 2008/02/21 dadams ;; Added: icicle-Info-only-rest-of-book-p. ;; 2008/02/03 dadams ;; Added: icicle-comp-base-is-default-dir-p, icicle-dir-candidate-can-exit-p. ;; 2008/01/18 dadams ;; Moved icicle-complete-keys-alist here from icicles-cmd.el ;; 2008/01/04 dadams ;; Added: icicle-doc-history. ;; 2007/12/27 dadams ;; Added: icicle-apropos-complete-match-fn. ;; 2007/12/05 dadams ;; icicle-proxy-candidate-regexp: Removed * doc-string prefix. ;; 2007/11/25 dadams ;; Added: icicle-commands-for-abbrev. ;; 2007/11/17 dadams ;; Added: icicle(saved)-proxy-candidates, icicle-proxy-candidate-regexp. ;; 2007/10/06 dadams ;; icicle-object-named-types: Added file type. ;; 2007/08/19 dadams ;; Added: icicle-input-fail-pos. ;; 2007/08/18 dadams ;; Added: icicle-whole-candidate-as-text-prop-p. ;; 2007/07/29 dadams ;; Added: icicle-object-named-types, icicle-object-predicate-types. ;; 2007/07/27 dadams ;; Moved icicle-act-first-then-navigate-p to icicles-opt.el as icicle-act-before-cycle-flag. ;; 2007/07/08 dadams ;; Added: icicle-all-candidates(-alternative)-action-fn. ;; 2007/07/03 dadams ;; Added: icicle-previous-raw(-non)-file-name-inputs. ;; 2007/06/23 dadams ;; Added: icicle-search-replacement-history. ;; 2007/06/17 dadams ;; Added: icicle-saved-candidate-overlays. ;; 2007/06/07 dadams ;; Added: icicle-face-name-history. ;; Renamed: frame-name-history to icicle-frame-name-history, ;; icicle-font-history to icicle-font-name-history, ;; icicle-function-history to icicle-function-name-history, ;; icicle-variable-history to icicle-variable-name-history. ;; 2007/05/29 dadams ;; icicle-insert-string-at-pt-*: Initialize to nil, not 0. ;; 2007/05/25 dadams ;; Added: icicle-char-property-value-history. ;; 2007/05/06 dadams ;; Added defvars to quiet byte compiler. ;; 2007/04/28 dadams ;; Added: icicle-search-in-context-fn. ;; 2007/04/20 dadams ;; Added: icicle-search-level-overlays. ;; 2007/04/15 dadams ;; Added: icicle-search-context-regexp. ;; 2007/04/10 dadams ;; Added: icicle-search-context-level. ;; 2007/04/08 dadams ;; Added: icicle-all-candidates-action-p. ;; icicle-candidate-action-fn: Corrected doc string: reversed success and failure values. ;; 2007/04/07 dadams ;; Added: icicle-search-replacement, icicle-searching-p, icicle-act-first-then-navigate-p. ;; 2007/04/02 dadams ;; Added: icicle-text-property-value-history. ;; Added: icicle-text-properties-alist (commented out). ;; 2007/03/23 dadams ;; Added: icicle-require-match-p. ;; 2007/03/14 dadams ;; Added: icicle-last-top-level-command. ;; 2007/03/06 dadams ;; Added: icicle-inhibit-sort-p. ;; icicle-candidates-alist: Improved doc string. ;; 2007/02/20 dadams ;; Added: icicle-delete-candidate-object, icicle-candidate-alternative-action-fn. ;; 2007/02/03 dadams ;; Renamed icicle-icompleting-p to icicle-edit-update-p. ;; 2007/02/02 dadams ;; Added: icicle-completing-p. ;; 2007/01/29 dadams ;; icicle-last-sort-function: Use icicle-case-string-less-p, not string-lessp. ;; 2007/01/19 dadams ;; Added: icicle-candidate-properties-alist. ;; 2007/01/15 dadams ;; Added: icicle-reverse-sort-p. ;; 2007/01/14 dadams ;; icicle-list-use-nth-parts: Updated doc string for new icicle-list-nth-parts-join-string. ;; 2007/01/12 dadams ;; Added: icicle-list-use-nth-parts. ;; Removed icicle-saved-overriding-local-map. ;; 2007/01/11 dadams ;; Added: icicle-menu-map, icicle-minor-mode-map-entry. ;; 2007/01/10 dadams ;; Added: icicle-saved-overriding-local-map. ;; 2007/01/05 dadams ;; icicle-initial-value: Updated doc string to mention you can bind it. ;; 2006/12/25 dadams ;; Added: icicle-saved-completion-candidates-internal. ;; 2006/12/23 dadams ;; Added: icicle-candidate-help-fn. ;; 2006/12/17 dadams ;; Added: icicle-saved-completion-candidate. ;; 2006/11/24 dadams ;; Added: icicle-universal-argument-map, icicle-kmacro-alist, icicle-saved-kmacro-ring-max, ;; icicle-kmacro-history. ;; 2006/11/18 dadams ;; Added: frame-name-history, icicle-bookmark-history, icicle-buffer-config-history, ;; icicle-color-history, icicle-color-theme-history, icicle-completion-set-history, ;; icicle-dictionary-history, icicle-font-history, icicle-function-history, ;; icicle-kill-history, icicle-search-history, icicle-variable-history, ;; 2006/11/09 dadams ;; icicle-search-refined-overlays: Updated doc string: icicle-search-highlight-threshold. ;; 2006/10/14 dadams ;; Moved conditional eval-when-compile to top level. ;; 2006/09/24 dadams ;; icicle-last-transform-function: Corrected default value. ;; 2006/09/12 dadams ;; Added: icicle-pre-minibuffer-buffer. ;; 2006/08/20 dadams ;; icicle-current-completion-mode: Updated doc string. ;; 2006/08/04 dadams ;; Removed icicle-apropos-completing-p (not used). ;; 2006/07/23 dadams ;; Added: icicle-last-transform-function. ;; 2006/07/22 dadams ;; Added: icicle-search-command, icicle-search-final-choice. ;; 2006/07/20 dadams ;; Renamed icicle-arrows-respect-* to icicle-cycling-respects-completion-mode-flag. ;; 2006/07/19 dadams ;; Applied patch from Damien Elmes : Added: icicle-current-completion-type. ;; Renamed: icicle-current-completion-type to icicle-current-completion-mode. ;; 2006/07/05 dadams ;; Renamed: icicle-current-regexp-input to icicle-current-raw-input. ;; 2006/06/18 dadams ;; Added: icicle-apropos-completing-p. ;; 2006/04/30 dadams ;; Added: icicle-candidate-entry-fn. ;; Renamed: icicle-search-candidates to icicle-candidates-alist. ;; 2006/04/14 dadams ;; Renamed icicle-search-refined-overlay to icicle-search-refined-overlays. ;; Added: icicle-search-candidates. ;; 2006/04/07 dadams ;; Added: icicle-search-overlays. ;; Renamed icicle-search-overlay to icicle-search-current-overlay. ;; 2006/03/27 dadams ;; Added: icicle-search-refined-overlay. ;; 2006/03/26 dadams ;; Added: icicle-search-overlay. ;; 2006/03/25 dadams ;; Added: icicle-saved-candidates-variables-obarray. ;; 2006/03/20 dadams ;; Added: icicle-common-match-string, icicle-current-regexp-input. ;; 2006/03/14 dadams ;; Removed: icicle-icicle-completing-p. ;; 2006/03/13 dadams ;; Added: icicle-re-no-dot. ;; 2006/03/05 dadams ;; Moved to icicles-mode.el: icicle-mode-map. ;; 2006/03/04 dadams ;; Moved options stuff to Options menu, when available. ;; Moved apropos stuff to Apropos menu, when available. ;; Moved describe stuff to Describe menu, when available. ;; 2006/03/03 dadams ;; Added to Icicles menu: icicle-complete-thesaurus-entry, icicle-apropos*, ;; option-setting cmds, buffer-config cmds icicle-(var|fun)doc. ;; Require apropos-fn+var.el. ;;;(@* "CHANGE LOG FOR `icicles.el'") ;; ;; 2012/03/11 dadams ;; Font-lock keywords for emacs-lisp-mode, for all Emacs versions, 20-24. ;; 2013/03/10 dadams ;; Font-lock keywords for emacs-lisp-mode: ;; Changed \\>[ \t'\(]*\\(\\sw+\\)? to \\>[ \t'\(]*\\(\\(\\sw\\|\\s_\\)+\\)? ;; (see Emacs bug #13755). ;; Added for font-lock and common-lisp-indent-function: ;; icicle-define(-search)-bookmark(-other-window)-command. ;; 2013/03/07 dadams ;; Define font-lock-keywords for icicle-user-error. ;; 2013/02/16 dadams ;; icicle-mode: Removed list of commands from autoload doc string - just refer to file headers. ;; 2013/02/09 dadams ;; Added autoload cookies for icy-mode, icicle-mode, to provide full doc string for info. ;; 2012/08/06 dadams ;; Renamed old-* to icicle-ORIG-*: ;; icicle-ORIG-bbdb-complete-name, icicle-ORIG-choose-completion, ;; icicle-ORIG-choose-completion-string, icicle-ORIG-color, icicle-ORIG-comint-dynamic-complete, ;; icicle-ORIG-comint-dynamic-complete-filename, icicle-ORIG-comint-replace-by-expanded-filename, ;; icicle-ORIG-completing-read, icicle-ORIG-completing-read-multiple, ;; icicle-ORIG-completion-setup-function, icicle-ORIG-crm-local-completion-map, ;; icicle-ORIG-crm-local-must-match-map, icicle-ORIG-dired-read-shell-command, ;; icicle-ORIG-dired-smart-shell-command, icicle-ORIG-display-completion-list, ;; icicle-ORIG-ess-complete-object-name, icicle-ORIG-exit-minibuffer, ;; icicle-ORIG-face-valid-attribute-values, icicle-ORIG-file, ;; icicle-ORIG-gud-gdb-complete-command, icicle-ORIG-minibuffer-complete-and-exit, ;; icicle-ORIG-minibuffer-default-add-completions, icicle-ORIG-mouse-choose-completion, ;; icicle-ORIG-next-history-element, icicle-ORIG-read-char-by-name, icicle-ORIG-read-color, ;; icicle-ORIG-read-face-name, icicle-ORIG-read-file-name, icicle-orig-read-file-name-fn, ;; icicle-ORIG-read-from-minibuffer, icicle-ORIG-read-number, icicle-ORIG-shell-command, ;; icicle-ORIG-read-shell-command, icicle-ORIG-read-string, icicle-ORIG-shell-command-on-region, ;; icicle-ORIG-sit-for, icicle-ORIG-switch-to-completions, icicle-ORIG-widget-color-complete. ;; 2012/07/17 dadams ;; Removed: icicle-byte-compile-eval-after-load-flag. ;; 2012/02/28 dadams ;; Removed eval-when-compile for Emacs < 20. ;; 2011/12/11 dadams ;; Ensure icicles-mac is loaded if icicles.el is not byte-compiled, and is loaded when compiled. ;; 2011/10/12 dadams ;; Moved the Miscellaneous stuff here from icicles-mac.el: indent & font-lock for macros etc. ;; 2011/10/10 dadams ;; Moved here from icicles-mac.el: icicle-byte-compile-eval-after-load-flag. ;; Removed require of icicles-mac.el. ;; 2011/06-24 dadams ;; Updated load order: mac, face, opt, var, fn, mcmd, cmd1, cmd2, mode. ;; 2010/12/26 dadams ;; Removed autoload cookies except simple ones & ones with sexp on same line. Thx to Richard Kim. ;; 2009/05/22 dadams ;; Require icicles-cmd[12]. ;; 2009/04/13 dadams ;; Removed the part of Thierry's text that mentioned emacsclient (no relation to Icicles). ;; 2008/12/02 dadams ;; Don't warn, if daemonp. Thx to Thierry Volpiatto. ;; 2007/07/22 dadams ;; Require icicles-cmd.el before icicles-mode.el. ;; 2007/06/07 dadams ;; Moved all doc to new files icicles-doc1.el and icicles-doc2.el. ;; 2007/05/12 dadams ;; Moved Search Enhancements subsections to top level: Isearch Completion, ;; Icicles Search Commands, Overview, Search and Replace. ;; 2007/05/06 dadams ;; Changed S-C- to C-S- and M-C- to C-M- in doc. ;; 2007/04/20 dadams ;; Require icicles-face.el after icicles-opt.el. ;; 2007/03/09 dadams ;; Renamed sections .*Removal of Duplicates to .*Removing Duplicates and ;; More on Multi-Commands to More About Multi-Commands. ;; 2007/02/24 dadams ;; Added section More on Multi-Commands. ;; Added subsection Chipping Away the Non-Elephant to Nutshell View. ;; 2007/02/03 dadams ;; Updated section Sorting Candidates and Removal of Duplicates. ;; 2007/01/28 dadams ;; Added: subsection Using Progressive ... Process of Elimination. ;; 2007/01/21 dadams ;; Added: section Text Properties in *Completions*. ;; 2007/01/19 dadams ;; Added: section Programming Multi-Completions. ;; 2007/01/16 dadams ;; Added linkd links. Cleanup. ;; 2007/01/15 dadams ;; Added: section Sorting Candidates and Removal of Duplicates. ;; Renamed: ;; icicle-sort-and-strip-ignored to icicle-strip-ignored-files-and-sort, ;; icicle-dirs-last-p to icicle-dirs-last-p, ;; icicle-sort-case-insensitively to *-case-insensitive-string-lessp. ;; 2007/01/12 dadams ;; Updated section Multi-Completions for icicle-list-use-nth-parts. ;; 2007/01/06 dadams ;; File-Name and Directory-Name Completion Tips: Mention icicle-use-~-for-home-dir-flag. ;; 2006/11/23 dadams ;; Added icicle-TAB-shows-candidates-flag. ;; 2006/11/10 dadams ;; Multi-Commands: Mention prompt prefix +. ;; 2006/11/05 dadams ;; icicle-occur is bound to C-c '. Search commands use multiple buffers. ;; Added Nutshell subsection Perform Multiple Operations In One Command. ;; 2006/10/19 dadams ;; Added Goggle Matching section. ;; 2006/10/16 dadams ;; Added key completion to Nutshell View. ;; 2006/10/14 dadams ;; Renamed: icicle-cancel-*Help*-* to icicle-cancel-Help-*. ;; Moved conditional eval-when-compile to top level. ;; 2006/10/01 dadams ;; Updated for new alternative-sort toggle: ;; History Enhancements, Key Completion, Customization *, Key Bindings. ;; 2006/09/30 dadams ;; Changed bindings of icicle-candidate-set-(save|retrieve) from C-<, C-> to C-M-<, C-M->. ;; Added icicle-key-descriptions-use-<>-flag in Customization section. ;; 2006/09/17 dadams ;; Added section Key Completion. ;; 2006/09/12 dadams ;; Added section Moving Between the Minibuffer and Other Buffers. ;; 2006/08/23 dadams ;; Added sections Icicles Mult M-x and Defining Icicles Multi M-x. ;; 2006/08/18 dadams ;; Added section Icicles Info Enhancements. ;; 2006/08/13 dadams ;; Documented icicle-completing(-mustmatch)-prompt-prefix. ;; 2006/06/17 dadams ;; Rewrote Multi-Commands, Defining Icicles Commands (Including Multi-Commands), and ;; Defining Multi-Commands the Hard Way. ;; Renamed: Defining Icicles Commands: + (Including Multi-Commands). ;; Defining Multi-Commands: + the Hard Way. ;; Added: Defining Multiple-Choice Menus. ;; 2006/06/08 dadams ;; Removed require of icicle-keys.el (obsolete). ;; 2006/05/26 dadams ;; Mention M-k as icicle-erase-minibuffer-or-history-element. ;; Don't mention M-S-backspace and M-S-delete any more. ;; 2006/05/19 dadams ;; Renamed icicle-inhibit-reminder* to icicle-reminder*. ;; Updated its doc to reflect new functionality. ;; 2006/05/18 dadams ;; Change install instructions to include turning on Icicle mode. ;; 2006/05/16 dadams ;; Require icicles-keys.el when icicle-bind-top-level-commands-flag. ;; Updated doc to reflect new library icicles-keys.el. ;; 2006/05/15 dadams ;; Renamed: ici*-nospace-flag to icicle-ignore-space-prefix-flag. ;; Updated doc of icicle-ignore-space-prefix-flag. ;; Added doc of icicle-buffer-ignore-space-prefix-flag. ;; 2006/04/14 dadams ;; Added section Inserting a Regexp from a Variable. ;; 2006/04/09 dadams ;; Added descriptions of icicle-arrows-respect-completion-type-flag. ;; 2006/03/19 dadams ;; Added description of icicle-expand-input-to-common-match-flag. ;; 2006/03/07 dadams ;; Correct the description of icicle-doc - match against only the doc, not the symbol name. ;; 2006/03/06 dadams ;; Reordered Commentary sections, putting Emacs-Lisp stuff later. ;; 2006/03/05 dadams ;; Mention icicle-touche-pas-aux-menus-flag. ;; 2006/03/03 dadams ;; Clarified Multi-Completions description. ;; 2006/03/01 dadams ;; Added: icicle-(complete|insert)-thesaurus-entry. ;; 2006/02/27 dadams ;; Split into multiple libraries: *-cmd, *-face, *-fn, *-mac, *-mode, *-opt, *-var. ;; 2006/02/25 dadams ;; Added: icicle-narrow-candidates (bound to M-*), icicle-icicle-completing-p, ;; icicle-set-calling-cmd, icicle-reset-icicle-completing-p, ;; icicle-run-icicle-(pre|post)-command-hook. ;; Add all hooks in icicle-mode only, except for minibuffer-local hooks (pre- and ;; post-command). ;; Remove all hooks when exit Icicle mode. ;; icicle-completing-read, icicle-read-file-name: ;; Add catch icicle-read-top. Set icicle-icicle-completing-p. ;; Separate case of not Icicle mode from other no-prompt cases. ;; Reordered some groups of functions. ;; 2006/02/24 dadams ;; icicle-candidate-set-1: Treat empty set. ;; 2006/02/21 dadams ;; icicle-prefix-complete: Implemented icompletion here, like icicle-apropos-complete-1. ;; icicle-call-then-update-Completions: ;; Use icicle-last-completion-command, not icicle-apropos-complete. ;; Renamed icicle-apropos-icompleting-p to icicle-icompleting-p. ;; Added: icicle-(kill|delete)(-backward)-*, icicle-yank etc. Bound them. ;; Added: icicle-call-then-update-Completions. ;; Added: icicle-incremental-completion-p. ;; Use instead of icicle-incremental-completion-flag everywhere. ;; Upgrade from t in icicle-display-candidates-in-Completions. ;; Reset in icicle-minibuffer-setup. ;; icicle-isearch-complete: Use search-ring symbol as history arg to completing-read. ;; icicle-display-candidates-in-Completions, icicle-keep-only-past-inputs, icicle-history: ;; Ensure that minibuffer-history-variable is a list. ;; Fixed typos: icicle-keep-past-inputs -> icicle-keep-only-past-inputs. ;; 2006/02/20 dadams ;; icicle-insert-string-at-point: Treat negative prefix arg. ;; Added: icicle-signum. ;; icicle-insert-thing: Remove text properties of string to insert. ;; 2006/02/19 dadams ;; icicle-thing-at-point-functions: Added function to grab successive text. ;; icicle-insert-string-at-point: Treat successive-grab fn and prefix arg. ;; Added: icicle-default-thing-insertion, icicle-default-thing-insertion-flipped-p, ;; icicle-insert-string-at-pt-(start|end), icicle-successive-grab-count, ;; icicle-insert-thing. ;; Renamed: icicle-insert-string-near-point to icicle-insert-string-at-point. ;; 2006/02/18 dadams ;; icicle-retrieve-last-input: Don't reset icicle-last-completion-command if not interactive ;; icicle-candidate-set-complement, icicle-keep-only-past-inputs: ;; Use icicle-retrieve-last-input. ;; icicle-keep-only-past-inputs: ;; Rewrote modeled on icicle-apropos-complete: ;; Take into account singleton and empty candidate set. ;; Provide input to icicle-display-ca*. ;; Set icicle-last-completion-command. ;; icicle-history: Force redisplay of *Completions*. Don't set this-command. ;; icicle-completing-read: Ensure icicle-initial-value is not nil. ;; icicle-save-or-restore-input: Don't restore empty input. ;; icicle-recompute-candidates: ;; Don't recompute if last completion cmd was icicle-keep-only-past-inputs. ;; Added: icicle-historical-candidate, icicle-keep-only-past-inputs. ;; icicle-display-candidates-in-Completions: Use icicle-historical-candidate. ;; Bind icicle-keep-only-past-inputs to M-pause in minibuffer completion maps. ;; 2006/02/17 dadams ;; Added: icicle-complete-input-overlay, icicle-highlight-complete-input, ;; icicle-complete-input. ;; icicle-(prefix|apropos)-complete(-1): Use icicle-highlight-complete-input. ;; Added icicle-inhibit-reminder-prompt-flag. Thx to Jonathan Simms for the suggestion. ;; icicle-completing-read, icicle-read-file-name: Use icicle-inhibit-reminder-prompt-flag. ;; 2006/02/12 dadams ;; icicle-read-string: Finished bug fix of 2/11. Thx to Andrey Zhdanov. ;; 2006/02/11 dadams ;; icicle-insert-string-near-point: Always start with first function. ;; read-from-minibuffer: Bug fix: don't use def if init is consp. Thx to Andrey Zhdanov. ;; 2006/02/09 dadams ;; Added: icicle-insert-string-near-point, icicle-thing-at-point-functions, ;; icicle-thing-at-pt-fns-pointer. ;; Bound icicle-insert-string-near-point. ;; Added Commentary section "Inserting Text Found Near the Cursor" ;; Require: thingatpt+.el, thingatpt.el. ;; Bug fix: icicle-execute-extended-command(-1): Take care of last-command and this-command. ;; 2006/02/08 dadams ;; icicle-completing-read: Treat consp case of initial-input. ;; icicle-read-file-name: Fixed bug introduced 02/02: ;; Don't ensure initial-input is not null. ;; 2006/02/07 dadams ;; Bug fix: Files menu find-file stuff was bound to *recent-file*. ;; 2006/02/03 dadams ;; icicle-init-value-flag: Use nil as the default value. ;; Added: icicle-read-from-minibuffer, icicle-read-string. ;; Use in icicle-(redefine|restore)-standard-commands. ;; 2006/02/02 dadams ;; icicle-completing-read, read-file-name: ;; Respect icicle-init-value-flag only if default value not nil. ;; read-file-name: Ensure initial-value is not null. Initialize icicle-initial-value. ;; Respect icicle-init-value-flag. ;; 2006/01/29 dadams ;; icicle-completing-read, icicle-read-file-name: Remove binding of ESC-TAB. ;; icicle-lisp-complete-symbol: Enable recursive minibuffers if in minibuffer. ;; Commentary: Combine lisp-complete-symbol with dabbrev. ;; Updated bindings listed in icicle-completion-help-string. ;; 2006/01/28 dadams ;; New feature: icicle-lisp-complete-symbol (added). Added to Commentary and moved section. ;; Corrected fix of 2005/12/14: ;; icicle-minibuffer-setup: Save region background at recursion level 1. ;; icicle-saved-region-background: defvar to nil. ;; Added: icicle-increment-color-hue. Use in icicle-region-background. ;; Added: icicle-(re)set-option-to-(nil|t), icicle-clear-option, icicle-toggle-option, ;; icicle-binary-option-p. ;; 2006/01/26 dadams ;; Added: icicle(-saved)(-regexp)-search-ring-max, ;; icicle-(redefine|restore)-standard-options. ;; icicle-mode: Use icicle-(redefine|restore)-standard-options. ;; Use icicle-(redefine|restore)-standard-commands for Emacs 21+ also (forgot?) ;; icicle-(redefine|restore)-*: Use defalias, not fset. ;; 2006/01/24 dadams ;; New feature: icicle-isearch-complete. ;; Added: icicle-isearch-complete, icicle-isearch-resume, icicle-bind-isearch-keys. ;; icicle-mode: add/remove isearch-mode-hook. ;; Minor bug fix: initial value was treated as icicle-last-completion-candidate. ;; Added: icicle-initial-value. ;; icicle-completing-read, icicle-read-file-name: ;; Set icicle-initial-value, not icicle-last-completion-candidate. ;; icicle-next-candidate: ;; Initialize icicle-last-completion-candidate to icicle-initial-value. ;; icicle-save-or-restore-input: ;; Don't change icicle-current-input if = icicle-initial-value ;; Renamed: icicle-init-value to icicle-init-value-flag. ;; 2006/01/23 dadams ;; Use command remapping for self-insert-command in Emacs 22. ;; Changed icicle-(re|un)map to defsubst. ;; Removed Commentary section on icicle-execute-extended-command. ;; icicle-apropos-complete-and-exit, icicle-apropos-complete-1: ;; Use flag icicle-apropos-complete-and-exit-p to suppress minibuffer-message. ;; 2006/01/22 dadams ;; Added: icicle-execute-extended-command*. ;; completing-read, icicle-read-file-name: ;; Corrected nil case for icicle-require-match-flag (bug fix). ;; Hard-code bindings, instead of using \\[...], so the simpler bindings are shown. ;; Changed C-o to C-RET for consistency (C-o still works too). ;; icicle-(bind|restore)-completion-keys: Added C-RET binding. ;; 2006/01/21 dadams ;; icicle-mouse-choose-completion: ;; Don't save selected window if it's *Completions*. ;; Added more Commentary about icicle-retrieve-last-input. ;; 2006/01/20 dadams ;; icicle-sort-and-strip-ignored: Don't ignore names if only ignored extensions match. ;; Added: icicle-apropos-complete-and-exit. Bound it in icicle-rebind-completion-maps. ;; icicle-minibuffer-setup: Don't reset icicle-require-match-flag. ;; icicle-apropos-complete: Return the list of candidates. ;; 2006/01/19 dadams ;; Added: icicle(-buffer)-require-match-flag. Thanks to Mathias Dahl for feedback. ;; Use in completing-read, read-file-name, and icicle-minibuffer-setup. ;; Re-alphabetized defcustoms. ;; 2006/01/07 dadams ;; Added :link. ;; 2005/12/31 dadams ;; Added: icicle-fix-default-directory. ;; icicle-read-file-name: Use icicle-fix-default-directory hack to fix bug. ;; 2005/12/26 dadams ;; Added icicle-sort-case-insensitively. ;; Added more parent groups for icicles group. ;; 2005/12/14 dadams ;; icicle-minibuffer-setup: Only save region background when at top level. ;; Added: icicle-Completions-frame-at-right-flag. Use in icicle-candidate-action. ;; Added: defvars for font-lock-keyword-face, font-lock-function-name-face. ;; 2005/12/09 dadams ;; Fontify icicle-define* in emacs-lisp-mode. ;; 2005/12/02 dadams ;; Added: icicle-customize-apropos*. Use in icicle-(redefine|restore)-standard-commands. ;; 2005/12/01 dadams ;; Added: icicle-repeat-complex-command, icicle-redefine-standard-commands-flag, ;; icicle-(redefine|restore)-standard-commands. ;; 2005/11/30 dadams ;; Added: icicle-apropos-zippy. ;; icicle-apropos-command, icicle-apropos-variable: ;; Corrected completing-read for do-all arg. ;; icicle-apropos-command, *-apropos-option: My version must not respect apropos-do-all. ;; 2005/11/29 dadams ;; Added: icicle-apropos*. ;; icicle-help-on-candidate: Treat plists. Message "No help" is the default. ;; 2005/11/25 dadams ;; Added: icicle-dabbrev-completion. ;; Renamed names with "*Completions*" to use "Completions", for coherence with XEmacs port. ;; 2005/11/24 dadams ;; icicle-mouse-choose-completion: Delete *Completions* window systematically. ;; 2005/11/21 dadams ;; icicle-delete-windows-on: Avoid error Attempt to delete minibuffer or sole ... window. ;; icicle-prefix-complete, icicle-apropos-complete-1, icicle-next-candidate: ;; Use icicle-delete-windows-on, not delete-window. ;; icicle-candidate-set-save: Use map in doc string. ;; icicle-compilation-search: Tidied up doc string. ;; Use #' for clarity. ;; 2005/11/20 dadams ;; icicle-completing-read: Added treatment of completions that are lists of strings. ;; Updated Commentary: new section on completions that are lists. ;; Added: icicle-list-join-string, icicle-doc, icicle-fundoc, icicle-vardoc. ;; 2005/11/15 dadams ;; Temporarily removed defadvice of next-history-element for Emacs 22. Bug reported. ;; icicle-minibuffer-prompt-end: Changed from defsubst to defun. ;; 2005/11/13 dadams ;; icicle-mouse-candidate-action: buffer-substring -> buffer-substring-no-properties. ;; icicle-completing-read: Bind, don't set, minibuffer-completion-table. ;; icicle-buffer*: Use other buffer for DEF, not INIT-VALUE. ;; Added: icicle-preselect-init-value-flag, icicle-(add|remove)-buffer-*, ;; icicle-read-from-minibuf-nil-default, icicle-buffer-list, ;; icicle-select-minibuffer-contents, icicle-completing-p. ;; icicle-minibuffer-setup: ;; Select minibuf contents if icicle-preselect-init-value-flag. ;; Only display *Completions* if icicle-completing-p. ;; Advised next-history-element. ;; 2005/11/11 dadams ;; Added: icicle-show-*Completions*-initially-flag, icicle-display-*Completions*. ;; icicle-minibuffer-setup: If icicle-show-*Completions*-initially-flag, display it. ;; 2005/11/09 dadams ;; Added: icicle-mouse-candidate-action. Bind in icicle-rebind-completion-maps. ;; icicle-buffer(-other-window): Use buffer-name-history as HIST arg to completing-read. ;; 2005/11/08 dadams ;; Add/remove hook icicle-cancel-*Help*-redirection in icicle-mode, not at top level. ;; Removed icicle-reset-icicle-menu-items-alist. ;; Reset icicle-menu-items-alist in icicle-execute-menu-command of icicles-menu.el. ;; 2005/11/06 dadams ;; Include minibuffer-local-filename-completion-map. ;; 2005/11/05 dadams ;; icicle-display-candidates-in-*Completions*: Don't try to highlight root if it is "". ;; icicle-help-on-candidate: ;; Test null, not boundp icicle-menu-items-alist. ;; If menu item's command is a lambda, set cand-symb to nil. ;; icicle-mode: Use icicle-reset-icicle-menu-items-alist on minibuffer-exit-hook. ;; Added: icicle-reset-icicle-menu-items-alist. ;; Added defvar for icicle-menu-items-alist. ;; Added byte-compiler comments and defvars to quiet byte-compile. ;; 2005/11/04 dadams ;; icicle-display-candidates-in-*Completions: ;; Bug fix - use (functionp minibuffer-completion-table), not (icicle-file-name-input-p). ;; 2005/11/03 dadams ;; Added: icicle-filter-wo-input and vars icicle-must-*, icicle-extra*, icicle-buffer-*, ;; icicle-buffer-config*, icicle-buffer-sort*. ;; icicle-unsorted-*: Use icicle-filter-wo-input and icicle-extra-candidates. ;; Added Commentary section Global Filters. ;; icicle-buffer* commands: Added filter bindings. ;; icicle-define(-file)-command: Minor bug fix: Ensure buffer is live before switching back. ;; 2005/11/01 dadams ;; Added: icicle-must(-not)-match-regexp. Use in icicle-unsorted-*-candidates. ;; 2005/10/31 dadams ;; Added: icicle-use-default-as-init-value-flag. Use in completing-read. ;; icicle-find-file*: Minor bug fix - REQUIRE-MATCH should be nil. ;; 2005/10/29 dadams ;; icicle-display-candidates-in-*Completions: Minor bug fix - wrap in save-window-excursion. ;; icicle-minibuffer-contents-from-minibuffer: ;; Minor bug fix - do nothing if file & user erased minibuffer. ;; Menu-bar menus: ;; Enable Icicles menu items only in Icicle mode. Put search ;; stuff on Search menu, if available. Use "[Icy]" prefix for ;; Icicles items in menus other than "Icicles". ;; 2005/10/28 dadams ;; Added: icicle-define-file-command. ;; Use it to define icicle-delete-file, icicle-find-file*. ;; icicle-(next|previous)-(apropos|prefix)-candidate-action: ;; Do action before moving to next|prev. ;; icicle-candidate-action: Raise *Completions* frame, to keep it on top. ;; 2005/10/27 dadams ;; Added: icicle-define-command, icicle-find-file*, select-frame-set-input-focus. ;; Redefined using icicle-define-command: ;; icicle-bookmark, icicle-buffer*, icicle-color-theme, icicle-delete-file, ;; icicle-find-file*, icicle-font, icicle-frame-*, icicle-recent-file*. ;; icicle-all-candidates-action: Report failures, not successes. Use error msg. ;; Added Commentary sections: Special-Character Conflicts, Defining Icicles Commands. ;; Commentary section Act on All Candidates: Added delete-one-or-more-files example. ;; Added icicle-find-file* to menu-bar menus. ;; Inactivated top-level menu items when minibuffer is active. ;; Renamed: icicle-delete-file-1 to icicle-delete-file-or-directory. ;; 2005/10/25 dadams ;; Thx to Lennart Borgman for suggestion about select-frame-set-input-focus. ;; 2005/10/24 dadams ;; icicle-search: ;; 1) Bug fix - need to have mouse-choose-completion set icicle-candidate-nb. ;; 2) Show error message. ;; Default value of icicle-candidate-nb is now nil, not -1. ;; Added: icicle-mouse-choose-completion, icicle-nb-of-candidate-in-*Completions*. ;; icicle-move-to-(next|previous)-completion, icicle-increment-cand-nb+signal-end: ;; Reset candidate number to 0 if nil. ;; icicle-(redefine|restore)-std-completion-fns: Use icicle-mouse-choose-completion. ;; 2005/10/23 dadams ;; Added: icicle-mode-map. ;; icicle-(bind|restore)-completion-keys: Updated menu-bar menu. ;; icicle-compilation-search: Error if not in a compilation buffer. ;; 2005/10/21 dadams ;; icicle-remove-duplicates: redefined. ;; 2005/10/18 dadams ;; icicle-file-name-input-p doc string: ;; Mention why don't use minibuffer-completing-file-name. ;; 2005/10/16 dadams ;; Added: icicle-compilation-search, icicle-search-hook. ;; icicle-search: Run icicle-search-hook. Added optional sit-for-period arg. ;; icicle-mode: Added list of top-level commands to doc string. ;; icicle-scroll-or-update-*Completions*: Added msg arg - only display msg if don't scroll. ;; 2005/10/14 dadams ;; Allow for multisets of candidates. ;; Added: icicle-search, icicle-completion-nospace-flag, icicle-candidate-nb, ;; icicle-filter-alist, icicle-increment-cand-nb+signal-end. ;; Commentary: Updated for icicle-search. ;; icicle-next-candidate: Major rewrite. ;; Uses icicle-candidate-nb, icicle-increment-cand-nb+signal-end, ;; icicle-move-to-next-completion. ;; Use icicle-completion-nospace-flag in calls to all-completions. ;; icicle-previous-(apropos|prefix)-candidate, ;; icicle-(next|previous)-(apropos|prefix)-candidate-action: Added optional arg. ;; icicle-apropos-complete-1, icicle-next-candidate, icicle-recompute-candidates: ;; Added *-action commands to memq test. ;; icicle-move-to-next-completion: Added optional no-minibuffer-follow-p arg. ;; icicle-scroll-or-update-*Completions*: Update display even if handle-switch-frame. ;; 2005/10/12 dadams ;; Added: icicle-redefine-std-completion-fns, ;; icicle-restore-std-completion-fns, ;; icicle-delete-windows-on, icicle-frames-on. ;; icicle-mode: Use icicle-redefine-std-completion-fns, ;; icicle-restore-std-completion-fns. ;; Renamed to use icicle- prefix: choose-completion-string, ;; completing-read, completion-setup-function, exit-minibuffer, ;; minibuffer-complete-and-exit, read-file-name, ;; switch-to-completions. Added these and also old- versions. ;; icicle-history: Treat file names also. ;; remove-windows-on -> icicle-delete-windows-on. ;; 2005/10/11 dadams ;; Added: icicle-history, icicle-scroll-or-update-*Completions*, ;; icicle-undo-std-completion-faces. ;; Minor bug fixes: ;; icicle-remove-dots: Also match against "." and ".." (lack of slash in Emacs 21+). ;; icicle-save-or-*: Don't reset to last input if icicle-last-completion-candidate is "". ;; Update icicle-last-completion-candidate also to use current input. ;; Reset icicle-last-input in icicle-minibuffer-setup, not in ;; completing-read and read-file-name. ;; icicle-display-candidates-in-*Completions*, icicle-next-candidate: ;; Put candidate in consp before applying predicate. ;; icicle-recompute-candidates: Don't recompute unless icicle-last-completion-command. ;; icicle-retrieve-last-input: Use icicle-current-input, not icicle-last-input. ;; icicle-self-insert: Update icicle-current-input and set this-command to ;; icicle-apropos-complete. ;; icicle-apropos-complete: Use error-message-string. ;; icicle-apropos-complete-1: ;; Protect icicle-file-directory-p with ;; icicle-file-name-input-p. Unconditionally update ;; icicle-last-completion-command. ;; Moved undoing of std completion faces to icicle-mode. ;; Use icicle-scroll-or-update-*Completions* in icicle-candidate-set-1. ;; 2005/10/06 dadams ;; icicle-prefix-complete, icicle-apropos-complete-1: ;; Removed vestigial slash cruft - should have been removed in 2005/09/01 fix. ;; Added: icicle-remove-dots. Use in icicle-save-or-restore-input. ;; 2005/10/05 dadams ;; icicle-msg-maybe-in-minibuffer: use format-string arg. ;; 2005/10/04 dadams ;; Replace use of minibuffer-completion-help by ;; icicle-apropos-complete. ;; Added: icicle-recent-file*, icicle-toggle-ignored-extensions, ;; icicle-update-completions, icicle-msg-maybe-in-minibuffer, ;; icicle-saved-ignored-extensions. ;; Bound icicle-toggle-*. ;; icicle-toggle-sorting: Use icicle-update-completions, icicle-msg-maybe-in-minibuffer. ;; icicle-sort-and-strip-ignored: ;; icicle-ignored-extensions-regexp nil => nothing is ignored. ;; Reorder key bindings, so prompt shows S-tab, not S-iso-lefttab. ;; icicle-next-candidate: Fixed code to highlight candidate in *Completions*: restriction. ;; 2005/10/03 dadams ;; Regexps can now use backslash (it is no longer a directory separator on MS Windows). ;; icicle-minibuffer-contents-from-minibuffer, icicle-file-name-directory-w-default: ;; Escape backslash, so not used as directory separator on MS Windows. ;; Added: icicle-apropos-complete-1, icicle-file-name-nondirectory. ;; icicle-apropos-complete: Use icicle-apropos-complete-1. ;; Treat regexp error via message. ;; Use icicle-file-name-nondirectory everywhere, instead of file-name-nondirectory. ;; Can now use "?" for regexps; it no longer shows completion list. ;; Do icicle-update-ignored-extensions-regexp inside icicle-minibuffer-setup. ;; Added and bound: icicle-retrieve-last-input. ;; Updated icicle-completion-help-string with recent bindings. ;; Renamed: icicle-last-command to icicle-last-completion-command. ;; icicle-candidate-set-restore to icicle-candidate-set-retrieve. ;; 2005/10/01 dadams ;; Added: icicle-candidate-set-(define|restore|swap). ;; Changed binding of icicle-candidate-set-save to C->. ;; Bound new commands. ;; 2005/10/01 dadams ;; Major rewrite to add set operations: complement, difference, union, intersection. ;; Added: icicle-completion-candidates, icicle-current-input, icicle-candidate-set-*, ;; icicle-set-*, icicle-save-or-restore-input, icicle-recompute-candidates. ;; Bound icicle-candidate-set*. ;; Added Commentary for Sets of Completion Candidates. ;; icicle-(apropos|prefix)-complete: Update icicle-completion-candidates, only as needed. ;; icicle-next-candidate: ;; Reverse candidates only if switched to opposite-direction command of same type. ;; Likewise, for refresh of *Completions*. ;; Protect put-text-property for root (e.g. no match for complement). ;; icicle-(apropos|prefix)-complete, ;; icicle-prefix-word-complete, icicle-next-candidate: Use icicle-completion-candidates. ;; icicle-all-candidates-action: Use icicle-completion-candidates, not *-apropos-complete. ;; icicle-display-candidates-in-*Completions*: ;; Removed first arg (candidates). Update icicle-completion-candidates. ;; icicle-all-candidates-action: ;; Use icicle-completion-candidates, so act on completions of either kind. ;; 2005/09/30 dadams ;; Commented out resetting of minibuffer-completion-table to nil for icompletion. ;; Thx to Andrey for bug report on M-x M-r problem. ;; 2005/09/27 dadams ;; icicle-(bind|restore)-completion-keys: Bound [S-iso-lefttab] like [S-tab]. ;; 2005/09/26 dadams ;; Bug fix: Changed "\C-!" to [(control ?!)] (others similarly). ;; Bound [S-iso-lefttab] like [S-tab]. ;; 2005/09/16 dadams ;; Added: icicle-all-candidates-action, icicle-delete-file*, ;; icicle-rebind-completion-maps: Bound icicle-all-candidates-action to C-!. ;; icicle-(apropos|prefix)-complete: Return candidates list. ;; icicle-bookmark, icicle-buffer*, icicle-color-theme, ;; icicle-font, icicle-frame*: Return t for success, nil for failure. ;; Commentary: Added section Choose All Completion Candidates. ;; 2005/09/14 dadams ;; icicle-rebind-completion-maps: Bound TAB and S-TAB for navigation. ;; icicle-move-to-(next|previous)-completion, icicle-(next|previous)-line: Wrap around. ;; 2005/09/13 dadams ;; Major rewrite of file treatment, to treat directory candidates similarly to files. ;; Added: icicle-default-directory, icicle-file-directory-p, icicle-sort-function, ;; icicle-toggle-sorting, toggle-icicle-sorting. ;; Use icicle-file-directory-p everywhere, except choose-completion-string. ;; Removed: icicle-nondirectory-*. ;; icicle-next-candidate: If not icicle-cycle-into-subdirs-flag, then use relative ;; file/dir name, not nondirectory part. ;; icicle-(apropos|prefix)-complete: ;; Set icicle-default-directory if sole completion is a subdirectory. ;; icicle-sort-and-strip-ignored: Removed optional arg and treatment of subdirs. ;; icicle-next-(apropos|prefix)-candidate, icicle-(apropos|prefix)-complete: ;; Don't treat icicle-cycle-into-subdirs-flag here. ;; icicle-(apropos|prefix)-complete, icicle-next-candidate: ;; Set icicle-default-directory, if directory candidate. ;; icicle-minibuffer-setup: Set icicle-default-directory. ;; icicle-apropos-complete: Different message if icicle-apropos-icompleting-p. ;; icicle-sort-dirs-last: Treat other kinds of candidates, besides files and dirs. ;; Commentary and doc strings: Updated for icicle-sort-function, icicle-cycle-into-subdirs. ;; Let delete-selection mode work with icicle-self-insert. ;; icicle-display-candidates-in-*Completions*: Make *Completions* read-only. ;; 2005/09/09 dadams ;; choose-completion-string: bug fix for Emacs 21.3.1 - use Emacs 20 version for 21.3.1. ;; 2005/09/08 dadams ;; completion-setup-function: bug fix for Emacs 21.3.1 - use Emacs 20 version for 21.3.1. ;; Added: icicle-remap, icicle-unmap, icicle-(bind|restore)-completion-keys. ;; completing-read: Do not append suffix if not in Icicle mode. ;; icicle-rebind-completion-maps: ;; Clean-up. Use icicle-(bind|restore)-completion-keys. ;; Don't (suppress-keymap completion-list-mode-map). ;; 2005/09/06 dadams ;; Provided apropos icompletion. ;; Added: icicle-self-insert, icicle-incremental-completion-flag, ;; icicle-apropos-icompleting-p. ;; icicle-apropos-complete: Respect icicle-apropos-icompleting-p. ;; Commentary: Updated Icompletion and Customization sections. ;; Added Apropos Icompletion. ;; Changed default value of icicle-word-completion-key to M-SPC. ;; icicle-rebind-completion-maps: ;; Bind icicle-self-insert. Use self-insert for SPC. ;; Updated icicle-completion-help-string. Treat menu-bar menu for the minibuffer. ;; completion-setup-function: Add instruction2 only when icicle-mode. ;; icicle-display-candidates-in-*Completions*: Use save-restriction. ;; icicle-minibuffer-contents-from-minibuffer: ;; Allow for mixing $ of environment vars with $ of regexps. ;; 2005/09/02 dadams ;; Added: icicle-bookmark, icicle-buffer(-other-window), icicle-candidate-action, ;; icicle-candidate-action-fn, icicle-color-theme(s), icicle-font, ;; icicle-frame-(b|f)g. ;; Renamed: icicle-(next|previous)-(apropos|prefix)-*-help to ;; icicle-(next|previous)-(apropos|prefix)-*-action. ;; icicle-(apropos|prefix)-complete: Set icicle-last-completion-candidate. ;; In renamed functions: Use icicle-candidate-action, not icicle-help-on-candidate. ;; icicle-rebind-completion-maps: Bound C-o to icicle-candidate-action. ;; Added Commentary section on actions on candidates. ;; icicle-move-to-next-completion: Test line num, not char position (fix). ;; icicle-previous-line: 3 or 4, not 4 or 5 (fix). ;; 2005/09/01 dadams ;; Fixed major bug: file-name completion did not work at all in non-MS Windows! ;; icicle-file-name-(apropos|prefix)-candidates: ;; Removed code for case where input starts with "/". ;; icicle-nondirectory-file-name-(apropos|prefix)-candidates: ;; Removed code for case where input starts with "/". Bind default-directory. ;; icicle-(apropos|prefix)-complete: Treat case when icicle-cycle-into-subdirs-flag = nil. ;; icicle-next-candidate: Took out code that moved point when line is too long. ;; icicle-minibuffer-setup: Reset icicle-prompt. ;; 2005/08/23 dadams ;; Added: icicle-help-on-candidate, icicle-cancel-*Help*-redirection, ;; icicle-(previous|next)-(prefix|apropos)-candidate-help. Bound them all. ;; icicle-rebind-completion-maps: ;; Bound icicle-help-on-candidate, icicle-(previous|next)-(prefix|apropos)-candidate-help. ;; 2005/08/22 dadams ;; Unconditionally require cl.el when compile (because of case). ;; 2005/08/19 dadams ;; Renamed icicle-cursor-position-in-candidate to icicle-point-position-in-candidate. ;; Added: icicle-mark-position-in-candidate, icicle-minibuffer-prompt-end. ;; icicle-place-cursor: Position both point and mark. ;; icicle-point-position-in-candidate: Change values from bob, eob to input-start/end. ;; Removed: icicle-select-rest-of-completion-flag. ;; Use inequality test on point and mark. ;; 2005/08/16 dadams ;; Minbuffer messages: Differentiate prefix from apropos completion. ;; completing-read, read-file-name: Append icicle-prompt-suffix for Emacs 20 (oversight). ;; 2005/08/15 dadams ;; Bug fix: Only use face-spec-reset-face if target faces defined. ;; read-file-name: bug fix: ;; Use condition-case to get the correct number of args for ;; old-read-file-name. Thx to Mathias Dahl for both bug reports. ;; 2005/08/14 dadams ;; icicle-place-cursor: Narrow region to exclude minibuffer-prompt ;; 2005/08/13 dadams ;; Add regexp support (removed it when introduced highlighting). ;; icicle-next-candidate: Added regexp-p arg. Use in icicle-next-apropos-candidate. ;; icicle-place-cursor: Use regexp search. For root-start, go to match-beginning. ;; icicle-unsorted-file-name-apropos-candidates: Don't use regexp-quote. ;; icicle-switch-to-*Completions*: ;; Search in restriction of mouse-face zone; repeat. ;; Treat file case (use nondirectory part). Bind case-fold-search. ;; Protect (aref 0) against empty string. ;; member -> memq, for symbols. ;; 2005/08/12 dadams ;; Added: icicle-word-completion-key, icy-mode, icicle-insert-a-space. ;; icicle-rebind-completion-maps: Use icicle-word-completion-key and icicle-insert-a-space. ;; completing-read, icicle-rebind-completion-maps: Corrected bindings in doc string. ;; 2005/07/29 dadams ;; Added: icicle-change-region-background-flag, icicle-increment-color-value, ;; icicle-region-background, icicle-saved-region-background, ;; icicle-restore-region-face. ;; Added icicle-restore-region-face to minibuffer-exit-hook. ;; Require hexrgb.el. ;; Removed: icicle-select-rest-of-completion. ;; icicle-minibuffer-setup: ;; Save icicle-saved-region-background and use icicle-region-background. ;; 2005/07/28 dadams ;; Added: icicle-*Completions*-instruction-*. ;; completion-setup-function: ;; Use icicle-*Completions*-instruction-*. ;; Remove ? from instruction2. Put both instr on same line. ;; Use put-text-property, not *-w-face*. ;; ------ ;; Move all completion stuff here, from simple+.el: ;; choose-completion-string, completion-setup-function, switch-to-completions. ;; Wrap *Completions* window deletion in save-selected-window. ;; Added icicle-prefix-word-complete, and bound it to SPC. ;; completion-setup-function: ;; Renamed icicle-completing-read-prompt-suffix to icicle-prompt-suffix. ;; 2005/07/27 dadams ;; Renamed: icicle-completing-read-prompt* to icicle-prompt*. ;; Added: read-file-name, face ;; icicle-completing-read-prompt-suffix, icicle-remove-property, ;; icicle-select-rest-of-completion (simple, for now). ;; completing-read: Apply faces to prompt. ;; icicle-place-cursor: Use icicle-select-rest-of-completion. ;; Added (if icicle-mode (icicle-mode 1)) at end. ;; Reworded Commentary in terms of "input completion", not just completing-read. ;; 2005/07/26 dadams ;; rebind-minibuffer-completion-maps: Minor bug fix. ;; icicle-mode: Added " Icy" to mode line. ;; Wrapped Emacs 21 version of icicle-mode (with define-minor-mode) in (eval (quote...)), ;; so byte-compiling in Emacs 20 will produce a *.elc that works in Emacs 21. ;; 2005/07/25 dadams ;; Added: icicle-mode, icicle-*-hook, icicle-minibuffer-setup, icicle-activate-mark. ;; rebind-minibuffer-completion-maps: ;; Restore bindings when exit Icicle mode. ;; Added argument. Pick up everything bound to help-command. ;; Message only when mode is turned on. ;; 2005/07/24 dadams ;; Now leave region from end of root to end of completion, so you can easily replace it, ;; especially if you use delete-selection mode. (Suggestion by Lennart Borgman.) ;; Added: icicle-select-rest-of-completion-flag. ;; icicle-place-cursor: Create active region if icicle-select-rest-of-completion-flag ;; icicle-completion-help: Removed icicle-abort-minibuffer-input. ;; icicle-abort-minibuffer-input: Removed obsolete code & comment on icomplete-inhibit. ;; 2005/07/22 dadams ;; Major fixup: Treat file and directory names well, respect standard user options, more. ;; Renamed: ;; icicle-(next|previous)?-completion-candidate to icicle-*-prefix-candidate(s), ;; icicle*filename* to icicle*file-name*, ;; icicle-descend-into-subdirs to icicle-cycle-into-subdirs-flag. ;; Added: icicle-file-name-apropos-candidates, icicle-file-name-directory-w-default, ;; icicle-file-name-input-p, icicle-file-name-prefix-candidates, ;; icicle-nondirectory-file-name-apropos-candidates, ;; icicle-nondirectory-file-name-prefix-candidates, ;; icicle-sort-dirs-last, icicle-unsorted-apropos-candidates, ;; icicle-unsorted-file-name-apropos-candidates, ;; icicle-unsorted-file-name-prefix-candidates, icicle-unsorted-prefix-candidates, ;; icicle-last-command. ;; Respect insert-default-directory and completion-auto-help. ;; Use minibuffer-message instead of message. ;; Commentary: Added Customization & Tips section. ;; completing-read: Save icicle-last-input. Reset icicle-nb-of-other-cycle-candidates. ;; icicle-next-*-candidate: Branch to file-specific functions. ;; icicle-*-candidates: Use icicle-unsorted-*-candidates. ;; icicle-next-candidate: ;; Delete *Completions* window if no candidates. ;; Use icicle-file-name-directory, not file-name-directory. ;; icicle-minibuffer-contents-from-minibuffer: Use substitute-in-file-name. ;; icicle-*-complete: ;; Treat slashed file names (e.g. "/foo"). ;; Use icicle-file-name-*-candidates, icicle-file-name-directory-w-default for files. ;; Added messages [No completion], [Sole completion], [Complete, but not unique]. ;; Use icicle-last-command for repetition test. And set it. ;; icicle-rebind-completion-maps: Updated icicle-completion-help-string and message. ;; 2005/07/21 dadams ;; icicle-apropos-candidates: Use, not apropos, but delete-if-not on string-match. ;; Treat files too. ;; Removed icicle-intersection. ;; Added: icicle-descend-into-subdirs. ;; icicle-sort-and-strip-ignored: Use icicle-descend-into-subdirs. Don't use "." and "..". ;; icicle-next-candidate: ;; File names w/o dir. ;; Use regexp-quote on root for underlining file-name root. ;; Insert directory name for file. ;; icicle-place-cursor: Search past dir, then search for file-name w/o dir. ;; icicle-prefix-complete, icicle-apropos-complete, ;; icicle-switch-to-*Completions*: Use icicle-minibuffer-contents-from-minibuffer. ;; icicle-prefix-complete, icicle-apropos-complete: Insert dir when single candidate. ;; icicle-display-candidates-in-*Completions*: Underline file-name w/o dir. ;; 2005/07/20 dadams ;; icicle-next-candidate, *-display-candidates-in-*Completions*: Use set-buffer-modified-p. ;; icicle-next-candidate: Use ding when hit end of cycle. ;; Added: icicle-cursor-position-in-candidate, icicle-place-cursor. ;; Use in icicle-next-candidate to position cursor. ;; Added: defgroup icicles. ;; 2005/07/19 dadams ;; Initialize icicle-ignored-*. ;; Added: icicle-nb-of-other-cycle-candidates, icicle-minibuffer-contents-from-minibuffer. ;; completing-read: Reset icicle-last-completion-candidate to nil. ;; icicle-next-candidate: ;; Use icicle-minibuffer-contents-from-minibuffer. ;; Save icicle-nb-of-other-cycle-candidates for icomplete-completions (icomplete+). ;; Use copy of "next" string since change its text properties. ;; Use regexp-quote for underlined root. ;; Use put-text-property, so works in Emacs 20. ;; Update *Completions*, even if last command is repeated. ;; icicle-*-complete: Complete rewrite. ;; icicle-display-candidates-in-*Completions*: Do even if last command is repeated. ;; 2005/07/18 dadams ;; icicle-display-*: Highlight only first occurrence in each candidate. ;; icicle-next-candidate: Use completion-ignore-case. ;; 2005/07/17 dadams ;; Treat file names also. ;; Added: icicle-delete-if*, and use instead of delete-if-*. Removed require cl.el. ;; Added: icicle-ignored-extensions*, icicle-sort-and-strip-ignored, ;; icicle-filename-input-p, icicle-update-ignored-extensions-regexp, ;; icicle-prefix-complete. Bound icicle-prefix-complete. ;; Use icicle-update-ignored-extensions-regexp as minibuffer-setup-hook. ;; icicle-*-candidates: Use icicle-sort-and-strip-ignored. ;; icicle-next-candidate, icicle-display-candidates-in-*Completions*: ;; Don't use predicate on file-name candidates (icicle-filename-input-p). ;; icicle-next-candidate: ;; Use read-file-name-completion-ignore-case (Emacs 22) and file-name-nondirectory. ;; icicle-apropos-complete: Return t/nil. Treat single candidate as no-op. ;; Reset std completions-* faces, so they don't interfere with apropos highlighting. ;; 2005/07/16 dadams ;; Added: icicle-display-*, icicle-apropos-complete. ;; Use icicle-display-* in icicle-next-candidate and icicle-apropos-complete. ;; Bound icicle-apropos-complete to S-tab in completion maps. ;; icicle-switch-to-*Completions*: ;; Move to start of candidate. Highlight candidate, not regexp. ;; icicle-next-candidate: Underline the root that was completed. ;; Added: faces icicle-root-highlight-*. ;; Removed: faces: icicle-completion-help*. ;; Removed (not used): require of strings.el. ;; Commentary: Added Nutshell View. ;; 2005/07/15 dadams ;; Renamed: icicle-completion-help+ to icicle-completion-help. ;; Replaced: icicle-delete-lines by icicle-erase-minibuffer. ;; icicle-next-candidate: ;; Wrapped display-* and re-search-forward in condition-case. Use icicle-place-overlay. ;; Changed icicle-completion-help bindings to [f1]. ;; Added: icicle-*-line, icicle-switch-to-*, icicle-move-to-*-completion, ;; icicle-current-completion-in-*Completions*, icicle-place-overlay. ;; Added bindings for icicle-*-line, icicle-switch-to-*, icicle-move-to-*. ;; Bound q to icicle-abort-minibuffer-input in completion-list-mode-map. ;; icicle-completing-read-prompt-suffix: Mention both [f1] and ?. ;; Removed: icicle-fit-frame. ;; Commentary: Added How...Improves...(5). Updated Key Bindings. ;; 2005/07/14 dadams ;; icicle-next-candidate: ;; Update *Completions*, if displayed, to reflect current ;; candidates, but don't do it if this-command = last-command. ;; Reverse list as needed, to keep same order. Ensure current ;; *Completions* choice shows in window (recenter as needed). ;; For highlighting: Search with re-search-forward to be sure to get the right one. ;; Took test for presence of predicate out of loop. ;; Commentary: Added Note on pop-up-frames = t. ;; 2005/07/13 dadams ;; Rewrote icicle-apropos-candidates. ;; Added: icicle-intersection. ;; 2005/07/12 dadams ;; Added: icicle-(next|previous)-apropos-candidate, icicle-next-candidate, ;; icicle-apropos-candidates, icicle-completion-candidates. ;; Bound: icicle-(next|previous)-apropos-candidate. ;; Renamed: icicle-completion-help-(title-)face: Removed "-face". ;; icicle-next-completion-candidate: Redefined to use icicle-next-candidate. ;; icicle-rebind-completion-maps: Updated text to mention apropos completion. ;; icicle-completion-help+: Use icicle-abort-minibuffer-input, not abort-recursive-edit. ;; 2005/07/10 dadams ;; First version of icicles.el (previously called elect-mbuf.el). ;; Renamed: minibuffer-completion-help-string to icicle-completion-help-string, ;; completing-read-prompt to icicle-completing-read-prompt, ;; completing-read-prompt-suffix to icicle-completing-read-prompt-suffix, ;; mbuf-completion-help-face to icicle-completion-help-face, ;; mbuf-completion-help-title-face to icicle-completion-help-title-face, ;; minibuffer-last-default to icicle-last-completion-candidate, ;; command-calling-for-completion to icicle-cmd-calling-for-completion, ;; minibuffer-completion-help+ to icicle-completion-help+, ;; abort-minibuffer-input to icicle-abort-minibuffer-input, ;; next-default-input to icicle-next-completion-candidate, ;; previous-default-input to icicle-previous-completion-candidate, ;; rebind-minibuffer-completion-maps to icicle-rebind-completion-maps, ;; Added: minibuffer-complete-and-exit, icicle-fit-frame, icicle-last-input. ;; Moved delete-lines here from and renamed to icicle-delete-lines. ;; Removed: mod+ (unused). ;; icicle-completion-help+: Use *Help*, not *Completions*. Don't show completions. ;; icicle-next-completion-candidate: Use insert, not insert-string. ;; icicle-rebind-completion-maps: Made it interactive. ;; 2005/07/09 dadams ;; Removed: buffer-alist (not used). ;; 2005/05/15 dadams ;; Renamed: flash-ding-minibuffer-frame to 1on1-flash-ding-minibuffer-frame. ;; 2005/05/10 dadams ;; Hacked completing-read to remove *Completions* window at end if require-match is non-nil. ;; (Don't know why/when this became a problem.) ;; 2004/09/21 dadams ;; Updated to work in Emacs 21 (and 20): ;; next-default-input uses delete-minibuffer-contents for 21, but erase-buffer for 20. ;; minibuffer-completion-help+: bind inhibit-read-only to t around erase-buffer. ;; 2001/01/10 dadams ;; Protected remove-windows-on via fboundp. ;; 1999/09/03 dadams ;; Added: mbuf-completion-help-face, mbuf-completion-help-title-face. ;; minibuffer-completion-help+: Use mbuf-*-face's instead of hard-coding. ;; minibuffer-completion-help-string, completing-read-prompt-suffix: defconst -> defvar. ;; 1999/08/26 dadams ;; Protected faces via boundp. ;; 1999/04/13 dadams ;; Bound delete-lines to M-S-DEL and M-S-backspace. ;; 1999/03/17 dadams ;; protect calls with test fboundp. ;; 1996/04/26 dadams ;; Put escaped newlines on long-line strings. ;; 1996/03/26 dadams ;; minibuffer-completion-help+: concat -> concat-w-faces (color). ;; 1995/12/20 dadams ;; exit-minibuffer: Iconify *Completion* frame. ;; 1995/12/15 dadams ;; abort-minibuffer-input: Reset minibuffer-completion-table to avoid icompletion. ;; Defined replacement exit-minibuffer to do the same as #1. ;; 1995/12/01 dadams ;; abort-minibuffer-input: Incorporated delete-selection-mode code ;; rebind-minibuffer-completion-maps: ;; Added C-g bindings for minibuffer-local-map, minibuffer-local-ns-map, ;; minibuffer-local-isearch-map. ;; 1995/10/25 dadams ;; Put defvar of minibuffer-completion-help-string after do ;; rebind-minibuffer-completion-maps, so its doc string gives bindings. ;; 1995/10/24 dadams ;; Mention ESC-TAB completion in completing-read. ;; 1995/10/17 dadams ;; Let minibuffer use ESC-TAB for completion (Lisp symbols etc.) ;; completing-read: Minibuffer adopts current buffer's ESC-TAB binding. ;; Added command-calling-for-completion to memorize current command (done in ;; completion-setup-hook). ;; 1995/09/12 dadams ;; Added abort-minibuffer-input. ;; Define C-g as abort-minibuffer-input in completion-list-mode-map and ;; minibuffer-local-* maps. ;; No self-insertion for completion-list-mode-map. ;; 1995/08/16 dadams ;; next-default-input: Fixed bug - skip repeated alist entries. ;; 1995/08/10 dadams ;; Rewrote minibuffer-completion-help+: Provide help even if no completions. ;; So, added minibuffer-completion-help-string. ;; `?' defined correctly for minibuffer-local-must-match-map. ;; 1995/08/08 dadams ;; next-default-input: error msg: no hard coding of key seq. ;; 1995/08/02 dadams ;; Major rewrite. ;; No reminders in prompts. Added minibuffer-completion-help+ to provide help info for ;; *Completions*. ;; Log for functions that were previously in simple+.el: ;; choose-completion-string, completion-setup-function, switch-to-completions. ;; 2005/07/28 dadams ;; completion-setup-function: ;; Renamed icicle-completing-read-prompt-suffix to icicle-prompt-suffix. ;; 2005/07/15 dadams ;; choose-completion-string, completion-setup-function: Updated for Emacs 21+. ;; 2005/07/10 dadams ;; Renamed: command-calling-for-completion to icicle-cmd-calling-for-completion. ;; 2004/09/21 dadams ;; Only redefine choose-completion-string if prior to Emacs 21. ;; 1999/03/17 dadams ;; choose-completion-string: ;; Added doc string. Updated to correspond to Emacs 34.1. ;; completion-setup-function: diff prompt setups. face1 & face2 tests. ;; Added: switch-to-completions. ;; 1996/04/26 dadams ;; Put escaped newlines on long-line strings. ;;;(@* "CHANGE LOG FOR `icicles-cmd.el'" - Deprecated file) ;; ;; 2009/05/22 dadams ;; Split in two: icicles-cmd1.el, icicles-cmd2.el. File too large to upload to Emacs Wiki. ;; 2009/05/20 dadams ;; Renamed: *-Info-build-node-completions-fix-* to *-Info-build-node-completions-1. ;; icicle-Info-goto-node: Plain C-u now prepends Info file name to candidates. ;; icicle-Info-goto-node-1: swapped arg order in call to Info-goto-node nodename (bug fix). ;; icicle-Info-read-node-name, icicle-Info-build-node-completions(-1): ;; Added optional arg INCLUDE-FILE-P. ;; 2009/05/11 dadams ;; icicle-complete-keys: Use icicle-local-keys-first-p as icicle-sort-function. ;; Bind icicle-hist-cands-no-highlight to (".."). ;; icicle-keys+cmds-w-prefix: Propertize candidate "..". ;; icicle-dabbrev-completion: Use icicle-upcase. ;; 2009/05/10 dadams ;; Added: icicle-search-(defs|lines|paragraphs|sentences|pages). ;; icicle-plist: Pretty-print, unless negative prefix arg (or Emacs 20). ;; icicle-search-regexp-scan: Fix to pick up candidate at eob: removed (not (eobp)) test. ;; 2009/05/05 dadams ;; icicle-find-file-(absolute|in-tags-table)(-other-window), ;; icicle-(recent|locate)-file(-other-window), icicle-describe-option-of-type, ;; icicle-(vardoc|fundoc|doc|plist), icicle-goto-global-marker: ;; Remove quote before face name, for icicle-candidate-properties-alist value. ;; icicle-buffer(-other-window|-list), icicle-kill-buffer, icicle-choose-candidate-of-type: ;; Bind completion-ignore-case, based on read-buffer-completion-ignore-case. ;; 2009/05/01 dadams ;; Added: icicle-shell-command-on-file. ;; Bind both icicle-all-candidates-list-alt-action-fn and icicle-candidate-alt-action-fn ;; to icicle-alt-act-fn-for-type for appropriate type - same commands as for 2009/04/26, ;; except removed these for *recent* (mistaken). ;; Use renaming from icicles-fn.el: *-choose-action-for-type -> *-alt-act-fn-for-type. ;; 2009/04/28 dadams ;; icicle-object-action: ;; At end, just apply the fn returned by icicle-choose-action-for-type to chosen object. ;; Use icicle-type-actions-alist, not icicle-object-named-types. ;; Update to use with icicle-predicate-types-alist (not flat list of preds). ;; icicle-choose-candidate-of-type: Handle color type too. ;; icicle-get-anything-actions-for-type: ;; Highlight Anything actions using face icicle-special-candidate. ;; 2009/04/26 dadams ;; icicle-marker+text, icicle-compilation-search-in-context-fn: ;; Bind inhibit-field-text-motion to t, to ensure real end-of-line. ;; Load icicles-mac (at compile time) using load-library, to ensure latest .elc. ;; Bind icicle-candidate-alt-action-fn, where appropriate, to icicle-choose-action-for-type: ;; *-lisp-complete-symbol, *-customize-face(-other-window), *-execute-extended-command, ;; *-command-abbrev, *-command-abbrev-command, *-execute-named-keyboard-macro, ;; *-set-option-to-t, *-reset-option-to-nil, *-toggle-option, *-select-frame, ;; *-delete-windows, *-kill-buffer, icicle-buffer(-other-window), ;; *-(add|remove)-buffer-candidate, *-(buffer|face|file|directory)-list, ;; *-find-file(-absolute|-in-tags-table)(-other-window), ;; *-(recent|locate)-file(-other-window), *-frame-(bg|fg), *-where-is, ;; *-apropos(-variable|option|function|command), *-apply, *-save-string-to-variable, ;; *--choose-candidate-of-type, *-read-var-value-satisfying, *-read-color. ;; icicle-execute-extended-command-1, icicle-command-abbrev-action: ;; Rebind icicle-candidate-alt-action-fn to nil so we don't override it for invoked cmd. ;; icicle-object-action: Respect icicle-use-anything-candidates-flag. ;; 2009/04/25 dadams ;; icicle-find-file-in-tags-table(-other-window): Fixed copy+paste typo. ;; 2009/04/24 dadams ;; Added: icicle-find-file-in-tags-table(-other-window). ;; 2009/04/19 dadams ;; icicle-customize-apropos-options-of-type, icicle-dabbrev-completion: ;; Don't fset unless standard function is defined. ;; Use when/unless instead of or for fset's. (cosmetic) ;; 2009/04/18 dadams ;; Soft-require hexrgb.el unconditionally, not just when there is a window-system. ;; icicle-read-color: Error if hexrgb is not loaded. ;; 2009/04/11 dadams ;; Added: icicle-region-add-short-help. ;; icicle-font-w-orig-size: Construct short help only if user will see it. ;; icicle-describe-opt-of-type-complete, icicle-marker+text, ;; icicle-(select|search|remove)-region, icicle-search-(regexp|char-property)-scan: ;; Add short help for mode-line and tooltip. ;; icicle-region-help: Corrected start/end order. ;; icicle-region-help, icicle-search-help: Removed unused help: No help. ;; 2009/04/10 dadams ;; icicle-font-w-orig-size: Provide help string. Set font to use orig-pointsize also. ;; icicle-font: Modify frame - don't use menu-bar-mode. Get orig menu-bar info from frame. ;; Save orig-pointsize also. ;; icicle-frame-(bg|fg): ;; Incorporate behavior of icicle-read-color: multi-completion etc. Added short help. ;; (Use icicle-make-color-candidate, icicle-color-completion-setup.) ;; icicle-read-color: ;; Factored out stuff as new function icicle-color-completion-setup. ;; Corrected handling of ARG > 2. ;; Moved to icicles-fn.el: ;; icicle-color-help, icicle-make-color-candidate, icicle-remove-color-duplicates. ;; 2009/04/09 dadams ;; Added: icicle-font-w-orig-size. ;; icicle-font: Use icicle-font-w-orig-size. No menu bar, to avoid Emacs frame-sizing bug. ;; 2009/04/04 dadams ;; icicle-kill-buffer, icicle-buffer(-other-window|-list), icicle-choose-candidate-of-type: ;; Bind icicle-sort-functions-alist for buffer names. ;; 2009/03/29 dadams ;; icicle-make-color-candidate: Use white or black foreground, depending on color value. ;; 2009/03/27 dadams ;; Renamed: icicle-default-buffer-name to icicle-default-buffer-names. ;; icicle-buffer(-other-window): ;; Bind bufflist, to make it available also to icicle-default-buffer-names. ;; icicle-default-buffer-names: Emacs 23: Provide first 4 buffers from bufflist. ;; 2009/03/26 dadams ;; Added: icicle-default-buffer-name. ;; icicle-buffer(-other-window), icicle-add-buffer-candidate: ;; Use icicle-default-buffer-name. ;; 2009/03/16 dadams ;; icicle-buffer(-other-window), icicle-buffer-list, icicle-kill-buffer, ;; icicle-add-buffer-candidate: Treat prefix arg buffers visiting files or frame-local. ;; icicle-recent-file(-other-window): Bind icicle-use-candidates-only-once-alt-p to t. ;; 2009/03/15 dadams ;; Added: icicle-remove-file-from-recentf-list, icicle-remove-from-recentf-candidate-action. ;; icicle-recent-file(-other-window): ;; Bind icicle-candidate-alt-action-fn to icicle-remove-from-recentf-candidate-action. ;; 2009/03/10 dadams ;; Added: icicle-recompute-shell-command-candidates. ;; 2009/02/28 dadams ;; icicle-find-file-absolute(-other-window): ;; Treat directory candidates as special candidates. ;; icicle-apropos: Treat functions as special candidates. ;; icicle-apropos-variable: Treat user options as special candidates. ;; icicle-apropos-function: Treat commands as special candidates. ;; icicle-apropos-command (non-apropos-fn+var version): Treat cmds as special candidates. ;; 2009/02/23 dadams ;; icicle-Info-goto-node-action: ;; Protect dir insertion with icicle-extra-candidates-dir-insert-p. ;; 2009/02/17 dadams ;; icicle-lisp-complete-symbol: ;; Added predicate arg. Updated wrt Emacs 23 (better var completion). ;; 2009/02/01 dadams ;; icicle-(find-file-absolute|(recent|locate)-file)(-other-window): ;; Bind C-backspace to icicle-up-directory. ;; 2009/01/18 dadams ;; icicle-dired-saved-file-candidates(-other-window): ;; If there is no saved set, then use icicle-file-list to let user choose a set. ;; Added: icicle-dired-chosen-files(-other-window), as aliases. ;; 2009/01/14 dadams ;; Same commands as yesterday: icicle-remove-duplicates -> icicle-remove-dups-if-extras. ;; 2009/01/13 dadams ;; icicle-kill-buffer, icicle-buffer(-other-window), icicle-(buffer|file|directory)-list, ;; icicle-find-file(-absolute)(-other-window), icicle-(recent|locate)-file(-other-window), ;; icicle-choose-candidate-of-type: ;; Bind icicle-transform-function to icicle-remove-duplicates. ;; 2009/01/05 dadams ;; Added: icicle-gud-gdb-complete-command. ;; icicle-shell-dynamic-complete(-as)-environment-variable: (require 'shell) ;; icicle-shell-dynamic-complete-as-command: Added candidate help for shell commands. ;; 2009/01/04 dadams ;; Added ESS support: ;; Added: icicle-comint-replace-by-expanded-filename, icicle-ess-complete-filename, ;; icicle-ess(-internal)-complete-object-name, icicle-ess-R-complete-object-name. ;; Thx to Sebastian Luque. ;; Improved some doc strings. ;; 2009/01/02 dadams ;; icicle-comint-dynamic-complete-as-filename, icicle-comint-dynamic-simple-complete: ;; Fixed for comint-completion-autolist, absolute directories. Thx to Sebastian Luque. ;; 2009/01/01 dadams ;; icicle-comint-replace-orig-completion-fns: ;; Use icicle-comint-dynamic-complete-replacements instead of hard-coded list. ;; icicle-comint-dynamic-simple-complete: Fix for Emacs 20: map #'list over completions. ;; 2008/12/30 dadams ;; Removed: shell-hook-fn. ;; Removed fset here for: old-comint-dynamic-*, old-shell-dynamic-*, old-bbdb-complete-name. ;; icicle-comint-dynamic-simple-complete: Map #'list over candidates (for Emacs 20). ;; icicle-comint-hook-fn: ;; Don't bind icicle-comint-command here - do it in icicle-bind-other-keymap-keys. ;; 2008/12/27 dadams ;; Removed: icicle-find-file(-other-window)-w-wildcards. ;; Removed soft require of dired+.el. ;; icicle-find-file(-other-window): ;; Use just find-file* with wildcards arg, not *-w-wildcards, as action fn. ;; Bind icicle-default-value so that it won't insert the default value. ;; icicle-find-file(-other-window), icicle-choose-candidate-of-type: ;; Use nil as 3rd read-file-name arg, if not in Dired on a file name. ;; 2008/12/23 dadams ;; icicle-comint-dynamic-complete-as-filename: Bind use-dialog-box to nil. ;; 2008/12/22 dadams ;; icicle-comint-dynamic-complete-as-filename: Use INIT and PRED in read-file-name call. ;; 2008/12/21 dadams ;; Added: icicle-shell-hook-fn, (icicle|old)-comint-dynamic-complete(-filename), ;; (icicle|old)-shell-dynamic-complete-(command|filename|environment-variable), ;; icicle-comint-replace-orig-completion-fns, icicle-comint-dynamic-simple-complete, ;; icicle-comint-dynamic-complete-as-filename, ;; icicle-shell-dynamic-complete-as-(command|environment-variable). ;; Renamed: icicle-comint-send-input to icicle-comint-search-send-input, ;; icicle-comint-get-final-choice to icicle-comint-search-get-final-choice, ;; icicle-comint-get-minibuffer-input to icicle-comint-search-get-minibuffer-input. ;; Require shell.el at compile time. ;; Use fn, not var, confirm-nonexistent-file-or-buffer. Thx to Daniel Clemente. ;; 2008/12/02 dadams ;; Removed all use of icicle-file-ignore-space-prefix-flag (removed). ;; 2008/11/23 dadams ;; Updated wrt Emacs 23: ;; find-file-confirm-nonexistent-file -> confirm-nonexistent-file-or-buffer. ;; icicle-buffer*, icicle-add-buffer-candidate, icicle-choose-candidate-of-type: ;; Added confirm-nonexistent-file-or-buffer. ;; 2008/11/22 dadams ;; icicle-command-abbrev, icicle-remove-buffer-config-action, icicle-find-file-absolute*, ;; icicle-(recent|locate)-file*, icicle-describe-option-of-type, ;; icicle-(vardoc|fundoc|plist|doc), icicle-complete-keys-1, icicle-read-color: ;; Put icicle-fancy-candidates property on prompt when appropriate. ;; icicle-(find|recent|locate)-file(-absolute)(-other-window): ;; Support find-file-confirm-nonexistent-file (Emacs 23). ;; 2008/11/17 dadams ;; Added: icicle-find-first-tag-action, icicle-find-first-tag-other-window-action. ;; icicle-find(-first)-tag(-other-window), icicle-find-tag-action: Crosshairs highlighting. ;; icicle-find-first-tag(-other-window): Use icicle-find-first-tag(-other-window)-action. ;; Mention crosshairs.el in doc strings of commands that use it. ;; 2008/11/14 dadams ;; icicle-locate-file*: Use face icicle-candidate-part only for negative prefix arg. ;; 2008/11/09 dadams ;; icicle-explore: When only 1 candidate, no completion. Thx to Hannes Janetzek. ;; 2008/11/04 dadams ;; Removed compile-time require of palette.el or eyedropper.el. Thx to Andrey Zhdanov. ;; icicle-read-color: Moved soft require of palette.el or eyedropper.el to beginning. ;; Removed: icicle-generic-S-tab. ;; icicle-add-key+cmd: Removed test for icicle-generic-S-tab. ;; 2008/11/03 dadams ;; icicle-insert-for-yank: push-mark first. Thx to Fabrice Knevez. ;; Renamed: icicle-insert-kill to icicle-completing-yank, ;; icicle-yank-insert to icicle-yank-maybe-completing. ;; icicle-search: Restored binding of icicle-searching-p (somehow, accidentally removed it). ;; 2008/11/02 dadams ;; icicle-(doc|vardoc|fundoc|plist): ;; Prefix arg uses candidates cache. Tighten scope of condition-case. ;; icicle-doc: ;; Show all of fn, var, and face doc that are available. Thx to Fabrice Knevez. ;; Use multi-completion: added symbol name and type. ;; icicle-doc-action: (intern (icicle-transform-multi-completion...)), not assoc. ;; 2008/10/27 dadams ;; icicle-find(-first)-tag*: Bind case-fold-search too. ;; 2008/10/26 dadams ;; icicle-(file|directory)-list, icicle-find-file(-absolute)(-other-window), ;; icicle-(locate|recent)-file(-other-window): Bind to icicle-file-* options. ;; icicle-locate-file*, icicle-recent-file*: ;; Bind icicle-abs-file-candidates, icicle-delete-candidate-object. ;; Move init code into bindings. ;; icicle-find-first-tag*: Move init code into bindings. ;; 2008/10/24 dadams ;; Find-tag fixes. Thx to Per Nordlow. ;; icicle-find-tag: Bind completion-ignore-case also for call to icicle-explore. ;; icicle-find-tag-define-candidates-1: ;; Look for regexp followed by DEL, through eol. Move to bol, then next line. ;; icicle-explore: Call icicle-get-alist-candidate with NO-ERROR-P arg. ;; 2008/10/23 dadams ;; icicle-find-tag: Use nil for REQUIRE-MATCH in call to icicle-explore. ;; 2008/10/21 dadams ;; icicle-search-read-context-regexp: Bound icicle-candidate-(action|help)-fn to nil. ;; icicle-search-define-candidates-1: Added error message - better than generic explore msg. ;; Moved enable-recursive-minibuffers from *-search-region to *-search-region-action. ;; icicle-search-region-action: Added message if no such file. ;; 2008/10/18 dadams ;; Replaced customize-save-variable by funcall icicle-customize-save-variable-function. ;; icicle-bookmark(-other-window): Use icicle-bookmark-cleanup. Removed completion default. ;; Added: icicle-bookmark-cleanup: Select orig-window at end. Thx to Andrey Zhdanov. ;; 2008/10/17 dadams ;; Added: icicle-bookmark-cmd. ;; 2008/10/16 dadams ;; icicle-bookmark-jump-1: Fixed for Emacs 23. Thx to Andrey Zhdanov. ;; 2008/10/12 dadams ;; Added: icicle-search-ibuffer-marked, icicle-search-buff-menu-marked. ;; icicle-search-dired-marked: Removed unused let binding. ;; 2008/10/11 dadams ;; icicle-Info-index-20: Use symbol at point as default index topic. ;; 2008/10/05 dadams ;; icicle-Info-read-node-name: Use lax completion. Thx to Richard Kim. ;; 2008/09/22 dadams ;; icicle-dired-project(-other-window): ;; Map expand-file-name over absolute file names, to expand ~ in fileset entries. ;; 2008/09/20 dadams ;; icicle-find-file-absolute(-other-window): abs-file-list -> icicle-abs-file-list. ;; 2008/09/19 dadams ;; icicle-add-entry-to-saved-completion-set: ;; Use only the fileset name, not the whole fileset, in the (:fileset...) entry. ;; icicle-remove-entry-from-saved-completion-set: Rewrote. ;; Either the entry to remove or the set to remove it from can now be a fileset. ;; icicle-dired-save-marked-persistently: Added FILESETP arg, so you can save in a fileset. ;; icicle-dired-project(-other-window): Include filesets as project candidates. ;; Renamed: icicle-dired-save-marked-to-cache-file to icicle-dired-save-marked-persistently. ;; Moved icicle-kill-a-buffer to icicles-fn.el. ;; 2008/09/15 dadams ;; icicle-(add|remove)-candidate-(to|from)-saved-completion-set: Use :fileset keyword. ;; icicle-search-where-arg, icicle-search-where-arg: ;; Wrap icicle-(file|buffer)-list with save-selected-window. ;; 2008/09/14 dadams ;; Renamed: icicle-(add|remove)-candidate-(to|from)-saved-completion-set to ;; icicle-(add|remove)-entry-(to|from)-saved-completion-set. ;; icicle-add-entry-to-saved-completion-set: Treat fileset entries, not just strings. ;; icicle-(add|remove)-entry-(to|from)-saved-completion-set, ;; icicle-remove-saved-completion-set, icicle-dired-project(-other-window): ;; No default value for completing-read. ;; 2008/09/13 dadams ;; Use renamings from icicles-mcmd.el: ;; icicle-candidate-set-save-to-cache-file to icicle-candidate-set-save-persistently, ;; icicle-candidate-set-retrieve-from-cache-file to *-candidate-set-retrieve-persistent. ;; 2008/09/11 dadams ;; Added: icicle-grep-saved-file-candidates. ;; 2008/09/09 dadams ;; Added: icicle-remove-saved-set-action: No longer set minibuffer-completion-table or call ;; icicle-complete-again-update. ;; icicle-dired-save-marked-(to-(variable|cache-file)|as-project), ;; icicle-dired-project(-other-window). ;; Renamed: icicle-candidate-set-dired-marked-save(-more) to icicle-dired-save-marked(-more) ;; icicle-remove-saved-completion-set: ;; Prompt and delete cache file. Use icicle-remove-saved-set-action as action function. ;; Bind: icicle-whole-candidate-as-text-prop-p, icicle-use-candidates-only-once-flag. ;; Remove *Completions* window at end. ;; 2008/09/08 dadams ;; icicle-dired-saved-file-candidates(-other-window): ;; Don't change to relative file names - use whichever form (abs, rel) is saved. ;; icicle-find-tag-define-candidates-1: Make sure tag is not empty before (aref tag 0). ;; icicle-find-file-absolute(-other-window): ;; Use default-directory as init value and default value. ;; 2008/09/03 dadams ;; icicle-bookmark(-other-window), icicle-goto-marker-1: ;; Use crosshairs-unhighlight, not icicle-unhighlight-crosshairs+cleanup. ;; icicle-goto-marker-1: Bind orig-buff. ;; *-bookmark-jump-1, *-goto-marker-1-action, *-compilation-search-in-context-fn: ;; Use crosshairs-highlight, not icicle-highlight-crosshairs. ;; 2008/09/02 dadams ;; Added: icicle-dabbrev--abbrev-at-point. ;; icicle-dabbrev-completion: Use icicle-dabbrev--abbrev-at-point. Thx to Tomer Levin. ;; 2008/09/01 dadams ;; Added: icicle-bookmark-jump(-other-window), icicle-bookmark-jump-1. ;; Removed: icicle-bookmark-other-window-action. ;; icicle-bookmark(-other-window): Use icicle-bookmark-jump(-other-window) as action fn. ;; Clean up crosshairs highlighting at end. ;; icicle-goto-marker-1: ;; Don't bind minibuffer-exit-hook. Don't require crosshairs.el or hl-line+.el. ;; Use icicle-unhighlight-crosshairs+cleanup for the cleanup. ;; icicle-compilation-search: Don't require hl-line+.el. ;; icicle-compilation-search-in-context-fn: Use icicle-highlight-crosshairs. ;; 2008/08/31 dadams ;; icicle-goto-marker-1-action: ;; Use col-highlight-(un)highlight, not crosshairs-flash. Force redisplay. ;; Add col-highlight-unhighlight to pre-command-hook. ;; Use hl-line-highlight-now, not hl-line-flash. ;; icicle-goto-marker-1: Remove col-highlight-unhighlight from pre-command-hook at end. ;; icicle-customize-face(-other-window, icicle-execute-extended-command-1, ;; icicle-find-tag-action, icicle-insert-thesaurus-entry, icicle-apply(-list)-action, ;; icicle-search-action, icicle-tags-search, icicle-choose-anything-candidate: ;; Select window before call select-frame-set-input-focus. ;; 2008/08/25 dadams ;; icicle-find-file-absolute(-other-window), icicle-(recent|locate)-file(-other-window): ;; Use lax completion and provide WILDCARDS arg to find-file. ;; 2008/08/24 dadams ;; Use renaming from icicles-fn.el: icicle-minibuffer-contents to icicle-minibuf-input. ;; 2008/08/23 dadams ;; icicle-clear-history: Wrap default value, minibuffer-history-variable, with symbol-name. ;; 2008/08/21 dadams ;; Added: icicle-file(-other-*), icicle-find-file-absolute(-other-*). Thx to Glauber M4. ;; Soft-require bbdb-com.el at compile time. Don't require bbdb.el at load time - define ;; old-bbdb-* only if original is already defined. ;; icicle-bbdb-complete-name: Raise error if BBDB not loaded. ;; 2008/08/20 dadams ;; icicle-bbdb-complete-name, icicle-clear-current-history: Replaced ding by icicle-ding. ;; 2008/08/18 dadams ;; icicle-clear-history: ;; Moved icicle-use-candidates-only-once-flag binding to icicle-clear-history-1. ;; icicle-delete-windows: Bind icicle-inhibit-try-switch-buffer. ;; icicle-insert-kill: Bind icicle-sort-function to nil. ;; icicle-recent-file(-other-window): ;; Bind *-candidate-properties-alist and *-list-use-nth-parts to nil if no prefix arg. ;; icicle-goto(-global)-marker: ;; Bind icicle-sort-function(s-alist) differently in each - don't bind in *-goto-marker-1. ;; icicle-remove-region: Use just icicle-delete-region-from-alist as action function. ;; icicle-delete-region-from-alist: ;; Use the propertized region name, not just reg-name in the cons to delete. ;; Moved icicle-cdr-less-p to icicles-fn.el and renamed to icicle-cdr-lessp. ;; Moved icicle-remove-candidate-display-others to icicles-mcmd.el. ;; Use renamings from icicles-fn.el: icicle-complete-again-update, icicle-remove-if-not. ;; icicle-explore, icicle-find-tag, icicle-complete-keys: ;; Renamed local orig-* vars. Use explore's in *-search-(quit-or-error|cleanup|action). ;; 2008/08/14 dadams ;; icicle-apply: Handle multi-completion alist entries. ;; icicle-goto-global-marker: Treat icicle-add-buffer-name-flag: Use multi-completions. ;; icicle-marker+text: Added optional arg. Annotate text with buffer name if appropriate. ;; icicle-goto-marker-1: Pass global-ring-p to icicle-marker+text, so it can annotate. ;; 2008/08/13 dadams ;; icicle-goto-marker-1: Don't add marker to ring markers if global ring. ;; icicle-goto-marker-1-action: select-frame-set-input-focus. ;; icicle-bbdb-complete-name: let -> let* (duh!) for completing-read. ;; 2008/08/12 dadams ;; Added: icicle-goto(-global)-marker-or-(set-mark-command|pop-global-mark), ;; icicle-goto-marker-1-action (factored out from icicle-goto-marker-1). ;; icicle-goto-marker-1: ;; Add mark-marker to list of markers in ring. ;; Use icicle-goto-marker-1-action. ;; Go directly to marker if only one. Message if same as point. ;; Better test for type of ring, for error msg. ;; icicle-apply: Use icicle-explore-final-choice-full in final result (not void var). ;; Added optional arg NOMSG; bind icicle-apply-nomsg. ;; icicle-apply-action: Respect icicle-apply-nomsg. Removed vestigial cruft. ;; icicle-bbdb-complete-name: Bind icicle-bbdb-complete-name to t and use strict completion. ;; 2008/08/11 dadams ;; icicle-search-highlight-context-levels: Increase overlay priority for each context level. ;; icicle-search-highlight-all-input-matches, icicle-search-highlight-input-matches-here: ;; Made of current-input overlay higher than any context-level overlay: 204 -> 220. ;; 2008/08/10 dadams ;; Added: icicle-explore, icicle-find-tag-define-candidates (renamed old to *-1), ;; icicle-search-define-candidates (renamed old to *-1), icicle-search-cleanup, ;; icicle-(find-tag|search)-(final-act|quit-or-error). ;; Renamed: icicle-find-tag-define-candidates to icicle-find-tag-define-candidates-1, ;; icicle-search-define-candidates to icicle-search-define-candidates-1. ;; Redefined to use icicle-explore: icicle-find-tag, icicle-apply, icicle-search. ;; icicle-comint-get-final-choice: Use icicle-explore-final-choice (not icicle-search-*). ;; 2008/08/08 dadams ;; Added: icicle-goto-marker-1 (from icicle-goto-marker): ;; Use unwind-protect and minibuffer-exit-hook to unhighlight crosshairs. ;; Provide S-delete: bind icicle-delete-candidate-object. ;; Require crosshairs.el, hl-line+.el. Use crosshairs-flash. ;; icicle-goto(-global)-marker: Use icicle-goto-marker-1. ;; 2008/08/06 dadams ;; icicle-kmacro(-action): ;; Better prefix arg treatment. ;; kmacro-end-or-call-macro if still defining. ;; No-exit require-match. ;; Default value if only one. ;; Minor bug fix (extra candidate). ;; Name macros just 1, 2..., not macro #1, macro #2... ;; 2008/08/03 dadams ;; Added: icicle-clear(-current)-history(-1|-entry), icicle-apply-list-action. ;; icicle-apply: Bind icicle-all-candidates-list-action-fn to icicle-apply-list-action. ;; Renamed: icicle-all-candidates-action-fn to icicle-all-candidates-list-action-fn, ;; icicle-candidate-alternative-action-fn to icicle-candidate-alt-action-fn. ;; 2008/07/27 dadams ;; icicle-recent-file*, icicle-locate-file*: Added date multi-completion, with prefix arg. ;; Added: icicle-make-file+date-candidate. ;; 2008/07/23 dadams ;; Renamed: icicle-map(-action) to icicle-apply(-action). Added defalias for icicle-map. ;; 2008/07/21 dadams ;; Added: icicle-bbdb-complete-name. Thx to Ian Swainson. require of bbdb.el for compile. ;; 2008/07/19 dadams ;; icicle-Info-menu: Corrected regexp to pick up menu-item default, for Emacs 20. ;; 2008/07/15 dadams ;; eval-when-compile require of: anything, cookie1, etags, eyedropper/palette, yow. ;; icicle-customize-apropos-options-of-type: Typo: help-remove-duplicates -> icicle-*. ;; icicle-send-bug-report: Include emacs-version. ;; 2008/05/16 dadams ;; icicle-find-first-tag*, icicle-find-tag: Use tags-lazy-completion-table for Emacs 23. ;; 2008/04/25 dadams ;; icicle-execute-extended-command-1: ;; Add msg about binding if suggest-key-bindings. Thx to Jonathan Arkell. ;; 2008/04/14 dadams ;; icicle-pp-eval-expression: Treat negative prefix arg. ;; 2008/04/13 dadams ;; icicle-pp-eval-expression: ;; Treat prefix arg (added optional arg). ;; Respect eval-expression-debug-on-error and icicle-pp-eval-*. ;; 2008/04/09 dadams ;; icicle-apropos-(function|command), icicle-imenu-non-interactive-function-p, ;; icicle-complete-keys-help: Use fboundp, not functionp, to also pick up macros. ;; 2008/04/04 dadams ;; icicle-bookmark: Bind completion-ignore-case to bookmark-completion-ignore-case. ;; Added: icicle-bookmark-other-window(-action). ;; 2008/04/01 dadams ;; icicle-describe-option-of-type: Bind icicle-apropos-complete-match-fn to nil. ;; icicle-describe-opt-of-type-complete: ;; Moved icicle-current-completion-mode test out of icicle-delete-if-not (iterates). ;; 2008/03/31 dadams ;; icicle-locate-file(-other-window), icicle-plist, icicle-describe-option-of-type, ;; icicle-(var|fun)doc: icicle-highlight-lighter, before gather candidates. ;; icicle-plist, icicle-describe-option-of-type, icicle-vardoc, icicle-fundoc: ;; Simplified doc string and prompt wrt C-M-j. ;; 2008/03/30 dadams ;; icicle-Info-menu: Treat also pseudo-menu at Top. Thx to William Xu. ;; 2008/03/26 dadams ;; Added: icicle-Info-menu(-cmd). ;; 2008/03/22 dadams ;; icicle-other-window-or-frame: Rewrote to use icicle-select-window for all frames or one. ;; icicle-select-window: ;; Rewrote: Similar to icicle-select-frame (unique window names). All frames or one. ;; Added: icicle-select-window-by-name, icicle-make-window-alist. ;; 2008/03/19 dadams ;; Added: icicle-pp-eval-expression (old version in icicles-mcmd.el was renamed). ;; 2008/03/11 dadams ;; icicle-repeat-complex-command: Rewrote doc string. ;; 2008/03/10 dadams ;; icicle-select-frame: Rewrote to use icicle-select-frame-by-name (unique frame names). ;; icicle-choose-candidate-of-type: Use icicle-make-frame-alist, not make-frame-alist. ;; Added: icicle-select-frame-by-name, icicle-make-frame-alist. ;; 2008/03/09 dadams ;; icicle-dabbrev-completion, icicle-find-tag-define-candidates, ;; icicle-Info-build-node-completions, icicle-search, icicle-read-color: ;; Call icicle-highlight-lighter. ;; 2008/03/05 dadams ;; icicle-map: Don't inhibit sorting. ;; icicle-goto(-global)-marker: Provide sorting choices. Highlight target line. ;; Added: icicle-cdr-less-p. ;; 2008/02/26 dadams ;; Added: icicle-where-is. ;; 2008/02/23 dadams ;; icicle-lisp-complete-symbol: ;; Wrap completing-read in save-excursion, because of icicle-top-level-*-completion-flag. ;; icicle-search: Use NOWARN arg with find-file-noselect. ;; Added: icicle-tags-search. ;; Renamed: icicle-search-tag* to icicle-find-tag*, ;; icicle-find-tag(-other-window) to icicle-find-first-tag(-other-window). ;; 2008/02/21 dadams ;; icicle-Info-goto-node: Added .. node for book order. ;; Use global var icicle-Info-only-rest-of-book-p. Call icicle-Info-goto-node-1. ;; icicle-Info-read-node-name: Remove REST-P arg. ;; icicle-Info-goto-node-action: When rest-of-book-p: ;; Update node completion table and then completions, and set current candidate number. ;; Added: icicle-Info-goto-node-1, icicle-Info-build-node-completions(-fix-*). ;; 2008/02/17 dadams ;; icicle-Info-goto-node: ;; Moved let to interactive spec, and added two args. Use icicle-Info-read-node-name. ;; Negative prefix arg means completions are limited to rest of book. ;; Add icicle-Info-book-order-p to icicle-sort-functions-alist. ;; New doc string, to explain everything. ;; Added: icicle-Info-book-order-p, icicle-Info-read-node-name. ;; 2008/02/16 dadams ;; icicle-(select|remove|search)-region: ;; Removed extraneous (setq icicle-candidates-alist) in let binding. ;; 2008/02/13 dadams ;; Added: icicle-search-tag, icicle-search-tag-define-candidates, icicle-search-tag-action, ;; icicle-search-tag-help, icicle-pop-tag-mark. ;; Updated doc string of icicle-find-tag(-other-window). ;; 2008/02/08 dadams ;; icicle-compilation-search-in-context-fn: ;; Simplified and corrected. Dropped let, with-current-buffer. Narrow to whole line. ;; Different code for Emacs 22+: Set current error; call compilation-next-error-function. ;; Removed: icicle-compilation-search-hl-line. ;; icicle-compilation-search: Soft require hl-line+. ;; Don't bind next-error-hook to icicle-*-search-hl-line. ;; Renamed: icicle-directories-list to icicle-directory-list. ;; 2008/02/07 dadams ;; icicle-search-action: ;; Moved icicle-highlight-candidate-* to after icicle-search-in-context-fn call. ;; icicle-compilation-search-in-context-fn: ;; Use buffer of marker. Removed code using overlay buffer. ;; icicle-compilation-search: Bound icicle-compilation-search-hl-line as next-error-hook. ;; Added: icicle-compilation-search-hl-line. ;; 2008/02/03 dadams ;; icicle-file-list: Rewrote using icicle-define-file-command. ;; icicle-(re)set-option-*: Added boundp before user-variable-p and icicle-binary-option-p. ;; Added: icicle-directories-list. ;; 2008/01/18 dadams ;; Moved icicle-complete-keys-alist to icicles-var.el ;; 2008/01/13 dadams ;; icicle-customize-face(-other-window), icicle-face-list, icicle-read-color: ;; Use icicle-transform-multi-completion. ;; icicle-(vardoc|fundoc): Use icicle-funvardoc-action as action fn and as help fn. ;; icicle-doc: Use icicle-doc-action as action fn and as help fn. ;; Added: icicle-funvardoc-action, icicle-doc-action. ;; icicle-search-replace-search-hit: Simplified bind/restore of Icicles completion vars. ;; 2008/01/11 dadams ;; icicle-search-highlight-and-maybe-replace: ;; Don't call icicle-update-completions or icicle-display-candidates-in-Completions here. ;; icicle-search-in-context-default-fn, icicle-compilation-search-in-context-fn: ;; Call icicle-update-completions (at the end), since not done in i*-and-maybe-replace. ;; 2008/01/08 dadams ;; icicle-describe-opt-of-type-complete: Treat 3rd arg. Treat prefix completion. ;; 2008/01/06 dadams ;; icicle-read-color: Provide color help for C-M-. Added: icicle-color-help. ;; 2008/01/04 dadams ;; icicle-doc, icicle-fundoc, icicle-vardoc: Use history variable icicle-doc-history. ;; 2008/01/02 dadams ;; Added: icicle-search-dired-marked. ;; 2008/01/01 dadams ;; icicle-(buffer|face|file)-list: Reverse list, so C-! keeps order. ;; icicle-dired-saved-file-candidates(-other-window): ;; Convert candidates to relative file names before opening Dired using them. ;; Error if any candidate is not a file in directory. ;; Added: icicle-candidate-set-dired-marked-save(-more). ;; 2007/12/31 dadams ;; Added: icicle-fn-doc-minus-sig. ;; icicle-fundoc, icicle-doc: Use icicle-fn-doc-minus-sig. ;; icicle-doc: Bind icicle-transform-function, not icicle-whole-candidate-as-text-prop-p. ;; 2007/12/27 dadams ;; icicle-describe-option-of-type: ;; Bind icicle-apropos-complete-match-fn to nil to prevent automatic input match. ;; 2007/12/26 dadams ;; icicle-describe-opt-of-type-complete: Pretty-print types. Bind icicle-candidate-help-fn. ;; Added: icicle-describe-opt-action. ;; 2007/12/24 dadams ;; icicle-describe-option-of-type: ;; Rewrote for different kinds of type matching. TYPE can be a regexp or type sexp. ;; Diff prefix args for diff behaviors. Handle type inheritance and value-checking. ;; Added: icicle-describe-opt-of-type-complete. ;; 2007/12/21 dadams ;; icicle-customize-apropos-options-of-type: help-var-is-* -> icicle-var-is-*. ;; 2007/12/20 dadams ;; icicle-dired-saved-file-candidates(-*): ;; Use substitute-command-keys in error msg. Use generate-new-buffer name, not y-or-n-p. ;; 2007/12/15 dadams ;; Added: icicle-customize-apropos-options-of-type. ;; 2007/12/11 dadams ;; icicle-read-color: Don't leave out variable proxies if don't have eyedropper. ;; 2007/12/07 dadams ;; Added: icicle-describe-option-of-type. ;; icicle-doc: ;; Choose kind of doc, instead of showing all (overwriting). ;; Removed binding of icicle-candidate-properties-alist. ;; icicle-read-color: Single-quote proxies, don't wrap with `_'. ;; 2007/12/06 dadams ;; icicle-doc: Forgot to include face doc. ;; 2007/12/03 dadams ;; Renamed icicle-longest-common-match to icicle-expanded-common-match. ;; 2007/12/02 dadams ;; icicle-read-color: Include color-valued variables as proxy candidates. ;; 2007/11/30 dadams ;; icicle-command-abbrev: ;; Use only membership in icicle-proxy-candidates, not icicle-proxy-candidate property. ;; So predicate is just commandp, since proxies are not part of regular candidates. ;; icicle-command-abbrev-action: ;; Bind to save/restore: icicle-add-proxy-candidates-flag, icicle-proxy-candidates. ;; icicle-command-abbrev-command: Bind icicle-add-proxy-candidates-flag to nil, to reset. ;; 2007/11/29 dadams ;; icicle-command-abbrev: Treat icicle-add-proxy-candidates-flag, icicle-proxy-candidates. ;; icicle-read-color: Don't test icicle-add-proxy-candidates-flag. ;; 2007/11/27 dadams ;; icicle-command-abbrev: Remove icicle-proxy-candidate property in unwind-protect. ;; 2007/11/26 dadams ;; icicle-get-anything-candidates: Fixed for try-completion and test-completion cases. ;; icicle-choose-anything-candidate: Bind icicle-candidates-alist to actions (two places). ;; 2007/11/25 dadams ;; Added: icicle-command-abbrev(-action|-command|-matching-commands|-record|regexp). ;; 2007/11/24 dadams ;; icicle-execute-extended-command: Bind use-file-dialog to nil. ;; 2007/11/17 dadams ;; icicle-read-color: ;; Respect icicle-add-proxy-candidates-flag. Convert proxy multi-completions to strings. ;; 2007/11/03 dadams ;; icicle-generic-S-tab: Doc string - mention icicle-generic-S-tab-keys. ;; 2007/10/28 dadams ;; icicle-search: Don't bind icicle-expand-input-to-common-match-flag. Updated doc string. ;; icicle-search-highlight-all-input-matches: ;; Don't set icicle-search-lcm unless icicle-expand-input-to-common-match-flag. ;; icicle-search-highlight-and-maybe-replace: ;; Match the lcm if icicle-search-replace-common-match-flag is non-nil. ;; Save icicle-candidate-nb around icicle-update-completions. ;; Set icicle-candidate-nb to 0 if nil. ;; icicle-search-highlight-input-matches-here: ;; Don't delete icicle-search-refined-overlays if icicle-*-all-current-flag. ;; 2007/10/26 dadams ;; icicle-search-highlight-all-input-matches: Loop through overlays twice, to get the lcm. ;; icicle-search-highlight-input-matches-here: Highlight the lcm, if available. ;; icicle-search: Bind icicle-search-lcm. ;; 2007/10/22 dadams ;; icicle-read-color: Use special-candidate face for pseudo color candidates. ;; icicle-add-key+cmd: Don't include keys bound to undefined. ;; 2007/10/20 dadams ;; icicle-read-color, icicle-remove-color-duplicates: ;; Treat pseudo colors too (e.g. *point foreground*). ;; icicle-make-color-candidate: Added optional HEX-RGB arg. ;; 2007/10/16 dadams ;; icicle-vardoc: Prefix arg means use only user options. ;; 2007/10/14 dadams ;; Updated doc strings to reflect new icicle-act-before-cycle-flag change. ;; 2007/10/13 dadams ;; icicle-get-anything-candidates: ;; If candidates is a fn, return fn that's useful for all-completions. Filter by input. ;; icicle-choose-anything-candidate: ;; Don't sort or transform cands. Respect Anything's require-pattern and delayed ;; settings. Bind icicle-candidates-alist to candidates, if that's a function. ;; icicle-get-anything-candidates-of-type: Don't use mapcar if candidates is a function. ;; Added: icicle-get-anything-req-pat-chars, icicle-get-anything-input-delay. ;; 2007/10/06 dadams ;; icicle-choose-candidate-of-type: Added entry for file type. ;; 2007/09/25 dadams ;; icicle-doc: Bind icicle-whole-candidate-as-text-prop-p to treat full candidates. ;; 2007/09/04 dadams ;; icicle-read-color: Added optional PROMPT arg. ;; 2007/08/31 dadams ;; icicle-buffer-list: Prefix arg means only buffers visiting files are candidates. ;; icicle-search-where-arg, icicle-occur: ;; Prefix arg 99 means only buffers visiting files are candidates. ;; Added: icicle-search-choose-buffers. ;; 2007/08/27 dadams ;; icicle-search-action: Fixed for return value. Display the error message. ;; 2007/08/25 dadams ;; icicle-choose-candidate-of-type: Removed (> emacs-major-version 21) restriction. ;; 2007/08/25 dadams ;; Added: a, any, buffer, file, icicle-get-anything-(types|(default-)actions-for-type| ;; candidates-of-type|(cached-)candidates), icicle-anything(-candidate-value), ;; what-which-how, icicle-choose-anything-candidate. ;; Renamed icicle-clear-option to clear-option. ;; icicle-object-action: Treat Anything stuff. ;; Added optional type arg. Use vars icicle-object-(named|predicate)-types. ;; Move icicle-read-var-value-satisfying call here from icicle-choose-candidate-of-type. ;; icicle-choose-candidate-of-type: Create buffer if needed. ;; Protected alias definitions with icicle-define-alias-commands-flag. ;; icicle-map(-action): ;; Use icicle-whole-candidate-as-text-prop-p and new icicle-get-alist-candidate. ;; icicle-(select|remove|search)-region, icicle-search: ;; Bind/use icicle-whole-candidate-as-text-prop-p. ;; icicle-occur: Require buffer names to match existing buffers. Thx to Hadron Quark. ;; 2007/08/15 dadams ;; Added command toggle as alias for icicle-toggle-option. ;; 2007/08/09 dadams ;; Soft require kmacro. Define icicle-kmacro* if kmacro gets loaded. ;; 2007/07/27 dadams ;; icicle-search: Renamed icicle-act-first-then-navigate-p to icicle-act-before-cycle-flag. ;; 2007/07/22 dadams ;; icicle-customize-face: Added prefix arg to give vanilla completion. ;; Added: icicle-customize-face-other-window. ;; Replace standard customize-face(-other-window) by icicle-customize-face(-other-window). ;; No longer require icicles-mode.el. ;; Require cus-edit.el (not just at compile time). ;; 2007/07/08 dadams ;; Added: icicle-customize-faces. ;; icicle-customize-face: Bind icicle-all-candidates-action-fn to icicle-customize-faces. ;; 2007/06/23 dadams ;; icicle-search-read-context-regexp, icicle-search-read-word, icicle-search-property-args, ;; icicle-add-region, icicle-save-string-to-variable: ;; Use icicle-completing-read-history, not read-from-minibuffer or read-string. ;; icicle-face-list: Bound icicle-list-nth-parts-join-string etc. ;; Moved to icicles-fn.el: icicle-read-from-minibuf-nil-default. ;; 2007/06/22 dadams ;; Added: icicle-group-regexp, icicle-keyword-list, icicle-search-keywords. ;; 2007/06/21 dadams ;; icicle-plist, icicle-(var|fun)doc, icicle-region-add-buffers, icicle-search-regexp-scan, ;; icicle-search-char-property-scan: ;; Use face icicle-candidate-part, not icicle-special-candidate. ;; icicle-add-key+cmd: Highlight key side of the pair (key = binding). ;; 2007/06/18 dadams ;; Added: icicle-customize-face. ;; 2007/06/17 dadams ;; icicle-make-color-candidate: Respect icicle-WYSIWYG-Completions-flag. ;; icicle-search-action: Added priority in call to icicle-place-overlay. ;; 2007/06/12 dadams ;; icicle-execute-extended-command(-1): ;; i-e-e-c-1 prepares the new last command, but i-e-e-c sets it, at end, to this-command. ;; 2007/06/10 dadams ;; Added: icicle-comint-hook-fn, icicle-compilation-hook-fn. ;; Removed unconditional add-hooks for comint-mode-hook and compilation(minor)-mode-hook. ;; 2007/06/09 dadams ;; icicle-set-option-to-t, icicle-reset-option-to-nil, icicle-delete-windows, ;; icicle-add-buffer-candidate, icicle-remove-buffer-candidate, icicle-buffer-list, ;; icicle-remove-buffer-config, icicle-face-list, icicle-file-list, ;; icicle-remove-all-regions-in-buffer, icicle-delete-file: ;; Bind icicle-use-candidates-only-once-flag to t. ;; icicle-set-option-to-t, icicle-clear-option: Candidate vars must have value nil/non-nil. ;; icicle-search-regexp-scan: Added eobp test and empty hit-string test. ;; icicle-select-(frame|window), icicle-delete-windows: ;; Removed extra t arg to icicle-define-command. ;; 2007/06/08 dadams ;; Added icicle-find-tag(-other-window). ;; 2007/06/07 dadams ;; Renamed: icicle-font-history to icicle-font-name-history, ;; icicle-function-history to icicle-function-name-history, ;; icicle-variable-history to icicle-variable-name-history. ;; Use standard history variable if bound, else use Icicles history variable: ;; bookmark-history, color-history, color-theme-history, face-name-history, ;; font-name-history, frame-name-history, function-name-history, variable-name-history ;; 2007/06/05 dadams ;; Don't require hexrgb.el if no window system. ;; icicle-read-color: Use featurep, not require, for hexrgb. ;; icicle-make-color-candidate: Error if hexrgb is not loaded. ;; 2007/05/31 dadams ;; icicle-execute-extended-command-1: Set, don't bind this-command. ;; icicle-execute-extended-command, icicle-execute-named-keyboard-macro: ;; Simpler save and restore of last-command. ;; 2007/05/28 dadams ;; icicle-imenu: Use same prefix-arg behavior as icicle-search (search multiple...). ;; Added: icicle-imenu-(command|non-interactive-function(-p)). ;; icicle-search-highlight-context-levels: ;; Wrapped loop in condition-case. Took max-levels determination out of loop. ;; 2007/05/25 dadams ;; Added: icicle-face-list, icicle-next-single-char-property-change, ;; icicle-search-(where-arg|property-args|char-property(-scan)|overlay-property), ;; icicle-char-properties-in-buffer(s). ;; Removed: icicle-text-properties-in-buffer(s), icicle-search-text-property-scan. ;; icicle-search(-word): Use icicle-search-where-arg. ;; 2007/05/21 dadams ;; Added: icicle-search-(buffer|file|all-regions). ;; icicle-imenu: Fixed treatment of prefix arg. ;; icicle-imenu-command-p: Fix to work also with Emacs 22 and 21. ;; 2007/05/14 dadams ;; icicle-execute-extended-command-1: Error if empty command name. ;; 2007/05/12 dadams ;; icicle-imenu: Added prefix arg for search for commands and non-cmds in Emacs-Lisp mode. ;; Added: icicle-imenu-command-p. ;; 2007/05/11 dadams ;; icicle-search-define-candidates: ;; Move scan-fn-or-regexp to 4th arg from 2nd. Removed &optional. ;; Apply icicle-search-regexp-scan to args also. ;; icicle-search-regexp-scan: Treat predicate. ;; Move regexp to 3rd arg from 2nd, and add predicate arg. Removed &optional. ;; icicle-search-regexp-scan, icicle-search-text-property-scan: ;; Add lengths of temp-list and icicle-candidates-alist. ;; icicle-search-text-property(-scan): Added predicate argument. ;; icicle-search-region-action: Bind icicle-candidate-action-fn to icicle-search-action. ;; icicle-(select|search|remove)-region: Removed temp var bound to (icicle-region-sorted). ;; icicle-search: Mention predicate in no-match message. ;; 2007/05/07 dadams ;; icicle-add-buffer-config: Added history args for icicle-read-from-minibuf-nil-default. ;; 2007/05/06 dadams ;; icicle-search: Bind icicle-must-pass-predicate to icicle-search-context-match-predicate. ;; icicle-search-read-context-regexp: Don't accept an empty regexp. ;; Changed S-C- to C-S- and M-C- to C-M- in doc. ;; 2007/05/04 dadams ;; icicle-(re)set-option-to-(nil|t), icicle-toggle-option: Enable recursive minibuffers. ;; 2007/05/02 dadams ;; icicle-search-read-word: Updated doc string. ;; icicle-search: Respect icicle-search-whole-word-flag and icicle-regexp-quote-flag. ;; Single message for non-existent buffers. ;; icicle-select-region-action: Message for non-existent file. ;; Added empty defvars for Emacs 22 standard vars, to quiet byte compiler. ;; 2007/05/01 dadams ;; icicle-execute-extended-command-1: ;; Don't bind icicle-candidate-action-fn if we have already read command name. ;; icicle-search-*-scan: Fill, reverse temp list, then append to icicle-candidates-alist. ;; Added: icicle-search-word, icicle-search-read-word. ;; 2007/04/29 dadams ;; icicle-search, icicle-search-text-property, icicle-text-properties-in-buffers: ;; Allow search of multiple files. Change prefix arg accordingly. ;; 2007/04/28 dadams ;; Added: icicle-compilation-search-in-context-fn, icicle-search-in-context-default-fn, ;; icicle-search-highlight-and-maybe-replace. ;; icicle-search-action: Move code to the new functions. Use icicle-search-in-context-fn. ;; icicle-compilation-search: Rewrote. ;; No longer use compile-goto-error as icicle-search-hook. ;; Use icicle-compilation-search-in-context-fn. ;; Cannot-replace error msg if not Emacs 22, since no compilation-highlight-overlay. ;; Provide .* regexp and do not highlight - as in icicle-occur. ;; 2007/04/22 dadams ;; icicle-search: Allow for pre-bound icicle-candidate(-alternative)-action-fn. ;; icicle-search-replace-search-hit: ;; Call icicle-candidate-action-fn, not necessarily icicle-search-action. ;; 2007/04/20 dadams ;; Added: icicle-search-highlight-context-levels. Use in icicle-search-action. ;; icicle-search-highlight-cleanup: Delete icicle-search-level-overlays. ;; icicle-search: Set icicle-search-context-regexp nil if scan-fn-or-regexp is not string. ;; icicle-search-replace-fixed-case-p: Return nil if arg is nil. ;; icicle-search-read-context-regexp: Use default with read-number; protect with fboundp. ;; Added soft require of strings.el. ;; 2007/04/18 dadams ;; Added: icicle-search-replace-fixed-case-p. Use in icicle-search-action. ;; icicle-search-action: ;; Set match data to region when icicle-search-replace-whole-candidate-flag is t. ;; Don't search for icicle-search-context-regexp. ;; icicle-search-replace-match: Added fixedcase arg. ;; Use icicle-search-replace-literally-flag. ;; Use replace-match-maybe-edit (Emacs 22), not replace-match, and save and restore stuff. ;; icicle-search-replace-search-hit: ;; Use regexp-history in read-string. Use icicle-search-define-replacement. ;; 2007/04/17 dadams ;; Added: icicle-search-replace-match. Treat Emacs<22 also. Use in icicle-search-action. ;; icicle-search-replace-search-hit: Use regexp-history in read-string. ;; 2007/04/16 dadams ;; icicle-search-action: Use replace-count. ;; icicle-search: Initialize replace-count to 0. ;; 2007/04/15 dadams ;; icicle-search-action: Allow \,... etc. replacement. ;; Use query-replace-compile-replacement and replace-match, with error treatment. ;; Removed unwind-protect. Removed %s from error-msg return. ;; icicle-search: Save search string as icicle-search-context-regexp. ;; Use "%s" for error message in failure error call. ;; Updated doc string for lisp-eval replacement etc. ;; *(-all)-input-matches(-here): save-match-data around input matching. ;; icicle-search-highlight-input-matches-here: Added not eobp to loop test. ;; 2007/04/13 dadams ;; icicle-search-highlight-input-matches-here: Bound free var ov. ;; 2007/04/10 dadams ;; icicle-search-regexp-scan: ;; Use match indicated by icicle-search-context-level as context. ;; Added: icicle-search-read-context-regexp. ;; icicle-search(-region|-regexp-scan): Use icicle-search-read-context-regexp. ;; 2007/04/08 dadams ;; icicle-map-action, icicle-search-action: ;; Return nil for success, error msg for failure (it was reversed). ;; Use icicle-highlight-candidate-in-Completions. ;; icicle-map-action: Moved minibuffer frame selection to unwind-protect final clause. ;; icicle-search: Give focus to original frame, in unwinding clause (C-g). ;; Added: icicle-search-highlight-input-matches-here. ;; icicle-search-highlight-all-input-matches: Highlight all input matches in candidate. ;; icicle-search-replace-search-hit: ;; Use 0 if icicle-candidate-nb is nil. Display completions. ;; Save and restore: icicle-last-completion-command, icicle-last-input. ;; Prevent using same string as candidate for replacement. ;; icicle-search-action: Rewrote. Enable repeated replacment of input matches. ;; Save and restore icicle-candidate-nb. Wrap it around if at end. ;; Warn about empty input for whole-candidate replacement. ;; Update icicle-last-completion-candidate. Display completions. ;; 2007/04/07 dadams ;; icicle-search: Added query-replace functionality. ;; Navigate first, then act (C-next). ;; Give focus to last frame searched. ;; Bind: icicle-candidate-alternative-action-fn, icicle-inhibit-sort-p, ;; icicle-searching-p, icicle-expand-input-to-common-match-flag. ;; Bind icicle-buffer-require-match-flag to partial-match-ok in interactive spec. ;; icicle-search-action: ;; Added optional replace arg: if non-nil, then fn becomes a replace action. ;; Added: icicle-search-replace-search-hit, icicle-search-replace-candidate, ;; icicle-buffer-list: Bind all the stuff that is bound in icicle-buffer. ;; 2007/04/06 dadams ;; icicle-execute-extended-command-1: ;; Bind this-command, but only around call to cmd - don't set it. ;; 2007/04/02 dadams ;; Added: icicle-search-text-property, icicle-search-text-property-scan, ;; icicle-text-properties-in-buffer(s). ;; icicle-search: ;; Added &rest args. Updated doc string. Don't read regexp or reverse alist here. ;; Use icicle-search-define-candidates, not icicle-search-regexp-scan. ;; icicle-search-regexp-scan: Read regexp here. Reverse alist here. ;; Moved to icicles-fn.el: icicle-filter-alist, icicle-first-matching-candidate. ;; Renamed: icicle-search-region-beg-end to icicle-region-or-buffer-limits. ;; 2007/04/01 dadams ;; icicle-repeat-complex-command: ;; Remove duplicates and sort entries, but only for reading command to eval. ;; 2007/03/31 dadams ;; icicle-lisp-complete-symbol: Bind icicle-top-level-when-sole-completion-flag to t. ;; 2007/03/27 dadams ;; icicle-search: Hard-code C-next key in message. ;; icicle-search-regexp-scan: Initialize last-beg for first time. ;; 2007/03/23 dadams ;; icicle-execute-extended-command-1: ;; Don't restore last-command. Run (pre|post)-command-hook. Set, don't bind, ;; this-command. enable-recursive-minibuffers for interactive call of cmd. ;; icicle-execute-extended-command, icicle-execute-named-keyboard-macro: ;; Restore last-command at end. ;; 2007/03/20 dadams ;; icicle-execute-extended-command-1: When wrong-number-of-args, icicle-help-on-candidate. ;; 2007/03/14 dadams ;; icicle-dired-saved-file-candidates, icicle-buffer, icicle-(find|locate|recent)-file: ;; Put 200 as value of property icicle-Completions-window-max-height. ;; Added ;;;###autoload for icicle-define*. ;; 2007/03/09 dadams ;; icicle-search, icicle-map, icicle-(remove|search|select)-region, icicle-imenu, ;; icicle-occur, icicle-compilation-search: ;; Bound icicle-transform-function to nil if interactive-p. ;; icicle-comint-search: Updated doc string to mention false positives in command matching. ;; Removed eval-when-compile from requires of Icicles libraries (except icicle-mac.el). ;; 2007/03/08 dadams ;; icicle-insert-kill: Bound icicle-delete-candidate-object. ;; 2007/03/07 dadams ;; icicle-delete-windows, icicle-map-action, icicle-search-action, ;; icicle-choose-candidate-of-type, icicle-complete-keys-help: ;; Use 0, not t, as frame arg to get-buffer-window. ;; 2007/03/06 dadams ;; icicle-search, icicle-map, icicle-(remove|search|select)-region: ;; Bind icicle-inhibit-sort-p to non-nil to prevent user sorting. ;; Update doc string to mention that you cannot sort candidates. ;; icicle-(remove|search|select)-region: Sort candidates by buffer and then by tag. ;; icicle-search-region: Bound icicle-delete-candidate-object. ;; icicle-search, icicle-map: Don't add or subtract one from candidate # if use action fn. ;; icicle-search: ;; If require-match, set icicle-completion-candidates and marker to reflect final choice. ;; Renamed: icicle-get-current-candidate to icicle-get-alist-candidate. ;; Added: icicle-region-sorted, icicle-region-add-buffers. ;; 2007/03/04 dadams ;; icicle-get-current-candidate: Return nil if icicle-candidates-alist is nil. ;; 2007/03/02 dadams ;; icicle-remove-buffer-config, icicle-remove-buffer-candidate: Removed extraneous quote. ;; icicle-(find|recent)-file(-other-window): Bound icicle-delete-candidate-object. ;; 2007/02/28 dadams ;; icicle-buffer-list, icicle-color-theme: Bound icicle-delete-candidate-object. ;; 2007/02/27 dadams ;; icicle-recent-file(-other-window): Changed INITIAL-INPUT completing-read arg to nil. ;; 2007/02/25 dadams ;; Added: icicle-remove-buffer-candidate-action, icicle-remove-buffer-config-action. ;; icicle-add-buffer-candidate, icicle-bookmark, icicle-buffer-config: ;; Bound icicle-delete-candidate-object. ;; 2007/02/24 dadams ;; Added: icicle-kill-a-buffer-and-update-completions (was kill-a-buffer), ;; icicle-delete-region-from-alist. ;; icicle-delete-window: Use icicle-kill-a-buffer...-completions, not icicle-kill-a-buffer. ;; icicle-buffer(-other-window), icicle-choose-candidate-of-type: ;; Bind icicle-delete-candidate-object to icicle-kill-a-buffer. ;; Bind icicle-sort-function to self if icicle-buffer-sort-function is nil. ;; icicle-select-region: ;; Bind icicle-delete-candidate-object to icicle-delete-region-from-alist. ;; icicle-remove-region: Rewrote. ;; Use icicle-delete-region-from-alist. ;; Use icicle-remove-candidate-display-others, but don't redisplay unless completing. ;; Respect icicle-add-buffer-name-flag (append buffer names). ;; 2007/02/20 dadams ;; Added: icicle-search-region-action. Open file associated with candidate. ;; icicle-search-region: ;; Use icicle-search-region-action. Updated doc string. Bind icicle-list-*. ;; Fix default completing-read value. Respect icicle-add-buffer-name-flag. ;; icicle-select-region-action: Open file associated with candidate. ;; icicle-region-open-all-files: Ignore files that are not readable. ;; icicle-regions: Remove only non-existent buffers that are not associated with files. ;; 2007/02/19 dadams ;; Added: icicle-region-open-all-files. ;; icicle-(search|select)-region, icicle-search: Use icicle-region-open-all-files. ;; icicle-add-region: Add file name to region entry in alist. ;; icicle-select-region-action, icicle-region-help, icicle-search: ;; Updated selectors for point and mark, because of addition of file name. ;; icicle-region-help: Add file name to help message. ;; 2007/02/18 dadams ;; Added: icicle-first-matching-candidate. ;; icicle-get-current-candidate: Use icicle-first-matching-candidate, not assoc. ;; 2007/02/07 dadams ;; icicle-search-action: Make *Completions* window dedicated. Thx to Peter Povinec. ;; 2007/02/07 dadams ;; icicle-search: pop-to-buffer and raise frame. Don't select orig-window. ;; 2007/02/06 dadams ;; icicle-search, icicle-select-region, icicle-search-regexp-scan: ;; Respect icicle-add-buffer-name-flag. ;; icicle-search: Bound icicle-show-Completions-initially-flag to t. ;; Bound icicle-candidate-help-fn to icicle-search-help. ;; icicle-search-regexp-scan: nil BUFFER arg means current buffer now. ;; icicle-search-action, icicle-filter-alist: Treat multi-completion case also. ;; Added: icicle-search-help. ;; icicle-map-action, icicle-search-action: Removed unused local var, curr-cand-string. ;; icicle-select-region, icicle-remove-region, icicle-search-region: ;; Use icicle-candidates-alist, not regions-w-buffers (but bind it locally too). ;; Renamed: icicle-get-current-region-candidate to icicle-get-current-candidate. ;; icicle-region-help: Provide region limits also. ;; Added note to some doc strings that the command is for Icicle mode only. ;; 2007/02/02 dadams ;; icicle-search: Test for buffers, not buffer names, in WHERE. Thx to Peter Povinec. ;; icicle-buffer-list: Return the list of buffers. ;; 2007/01/28 dadams ;; icicle-complete-keys: ;; Bind icicle-sort-functions-alist, using icicle-command-names-alphabetic-p. ;; 2007/01/22 dadams ;; icicle-read-color: ;; Removed free var NTH-PARTS. ;; Bound icicle-list-nth-parts-join-string the same as icicle-list-join-string. ;; Remove duplicates: AliceBlue and alice blue etc.: downcase and remove whitespace. ;; Added: icicle-remove-color-duplicates. ;; Added soft require of hexrgb.el. ;; icicle-*doc, icicle-plist: Bound icicle-candidate-properties-alist. ;; 2007/01/21 dadams ;; Added: icicle-read-color, icicle-make-color-candidate. ;; 2007/01/18 dadams ;; Added: icicle-get-current-region-candidate. ;; Use current cand if cycled or `mouse-2'. Else if single match, use that. Else error. ;; icicle-remove-region, icicle-search-region, icicle-region-help: ;; Use icicle-get-current-region-candidate. ;; icicle-add-region: Added optional TAG arg and prefix arg treatment. ;; icicle-remove-region: Update completions list. Bind regions-w-buffers. ;; icicle-remove-all-regions-in-buffer: Use current buffer name as default. ;; Added: icicle-select-region-action. ;; icicle-select-region: Use icicle-select-region-action. ;; Renamed: option icicle-regions to icicle-region-alist. ;; icicle-regions: Sort entries. ;; 2007/01/17 dadams ;; icicle-filter-alist: Reversed arg order. Return alist arg if filter-keys arg is empty. ;; 2007/01/12 dadams ;; icicle-delete-window: Do icicle-remove-Completions-window if in minibuffer. ;; icicle-yank-insert: Do icicle-yank if in minibuffer. ;; icicle-(fundoc|vardoc|doc|plist): Added condition-case: protect symbols that error. ;; 2007/01/01 dadams ;; Added: icicle-(add|remove)-candidate-(to|from)-saved-completion-set. ;; icicle-add-buffer-config: Use nil, not "nil" as default, if icicle-buffer-sort is nil. ;; Use icicle-define-add-to-alist-command to define it. ;; icicle-remove-buffer-config, icicle-remove-saved-completion-set: ;; Use icicle-assoc-delete-all, not delete of assoc. ;; icicle-remove-saved-completion-set: Update display after removal. ;; Reformatted icicle-define(-file)-command, based on setup.el's lisp-indentation-hack. ;; 2006/12/25 dadams ;; Bug fix: icicle-search-action: Use icicle-filter-alist on icicle-candidates-alist. ;; icicle-(select|search)-region: Use pop-to-buffer and raise-frame, not set-buffer. ;; icicle-select-region: Activate the region. ;; 2006/12/23 dadams ;; Added: icicle-region-help. Use in icicle-*-region. ;; Added: icicle-remove-all-regions-in-buffer, icicle-remove-all-regions-action. ;; icicle-(select|search)-region: Ignore regions in non-existent buffers. ;; icicle-remove-region: Update the persistent value of icicle-regions. ;; 2006/12/22 dadams ;; Added: icicle-exchange-point-and-mark. ;; icicle-customize-icicles-group: icicles -> Icicles (group name). ;; 2006/12/18 dadams ;; icicle-object-action: Remove print arg. icicle-apply-to-* uses current-prefix-arg now. ;; 2006/12/17 dadams ;; Added: icicle-object-action, icicle-choose-candidate-of-type, ;; icicle-read-var-value-satisfying. ;; 2006/12/16 dadams ;; icicle-map-action: Bug fix: Use icicle-candidate-nb, not assoc. ;; Added: icicle-goto(-global)-marker, icicle-marker+text, icicle-markers. ;; 2006/12/10 dadams ;; Moved minibuffer and *Completions* commands to new file, icicles-mcmd.el. ;; Require icicles-opt.el. ;; icicle-buffer-list: Added final message. ;; 2006/11/26 dadams ;; icicle-search-action: Bug fix: Use icicle-candidate-nb, not assoc, to get cand+mrker. ;; icicle-*-complete-1: Bug fix: Don't set icicle-current-input to icicle-last-input if nil. ;; Renamed: icicle-search-region to icicle-search-region-beg-end. ;; Added: icicle-(add|remove|select|search)-region. ;; icicle-search: Use icicle-regions for numeric prefix arg. Updated doc string. ;; Added: icicle-Info-index-20 - thx to Tamas Patrovics. Use it in icicle-Info-index. ;; 2006/11/25 dadams ;; icicle-search: After final selection, select orig-window and give its frame input focus. ;; 2006/11/24 dadams ;; Added: icicle-ensure-overriding-map-is-bound, icicle-universal-argument, ;; icicle-universal-argument-more, icicle-negative-argument, icicle-digit-argument, ;; icicle-universal-argument-other-key, icicle-universal-argument-minus, ;; icicle-kmacro(-action). ;; icicle-dabbrev-completion: Don't stop at common root, and use lax completion. ;; Replaced icicle-select-window-or-frame by icicle-other-window-or-frame (respects C-u 0). ;; 2006/11/23 dadams ;; icicle-prefix-complete-1: Respect icicle-TAB-shows-candidates-flag. ;; icicle-execute-extended-command-1: Treat named keyboard macros too. ;; Added: icicle-execute-named-keyboard-macro. ;; 2006/11/18 dadams ;; icicle-add/update-saved-completion-set, icicle-apropos*, icicle-bookmark, ;; icicle-buffer-config, icicle-candidate-set-retrieve, icicle-candidate-set-save, ;; icicle-color-theme, icicle-comint-command, icicle-complete-thesaurus-entry, ;; icicle-customize-apropos*, icicle-delete-windows, icicle-font, icicle-frame-bg, ;; icicle-frame-fg, icicle-insert-kill, icicle-insert-string-from-variable, ;; icicle-insert-thesaurus-entry, icicle-locate-file*, icicle-map, icicle-narrow-candidates, ;; icicle-remove-buffer-config, icicle-remove-saved-completion-set, ;; icicle-reset-option-to-nil, icicle-save-string-to-variable, icicle-search, ;; icicle-select-window, icicle-set-option-to-t, icicle-toggle-option: ;; Use a specific history variable. ;; 2006/11/17 dadams ;; Added: icicle-select-(frame|window), icicle-select-window-or-frame. ;; 2006/11/10 dadams ;; icicle-mouse-candidate-action: read-event to swallow mouse up event. ;; icicle-map-action: ;; Don't use icicle-filter-alist - find string in icicle-candidates-alist. ;; Unwind-protect to reselect minibuffer frame. Don't bind case-fold-search. ;; icicle-map: enable-recursive-minibuffers. ;; 2006/11/09 dadams ;; icicle-nb-of-candidate-in-Completions: Redefined using binary search, for performance. ;; icicle-toggle-ignored-space-prefix: Update doc string to use icicle-dispatch-C-^. ;; icicle-search: ;; Bind icicle-update-input-hook unconditionally, after icicle-search-regexp-scan. ;; icicle-search-regexp-scan: Highlight up to icicle-search-highlight-threshold. ;; icicle-search-highlight-all-input-matches: ;; Only update input and highlight if icicle-search-highlight-all-current-flag. ;; icicle-search-action: ;; Don't use icicle-filter-alist - find string in icicle-candidates-alist. ;; icicle-search-highlight-cleanup: Bind inhibit-quit to t. ;; 2006/11/07 dadams ;; Added: icicle-toggle-highlight-all-current. ;; 2006/11/06 dadams ;; icicle-search-action: ;; Highlight icicle-current-input, not icicle-current-raw-input (not updated). ;; Renamed icicle-search-highlight-all-flag to icicle-search-highlight-threshold. ;; 2006/11/05 dadams ;; Added: icicle-search-regexp-scan. ;; icicle-search: ;; Added buffers arg. Updated doc string. ;; Use icicle-search-regexp-scan: Scan each buffer in buffers. ;; Add marker, not position, to icicle-candidates-alist. ;; Go to candidate in its buffer. ;; Added progress message. ;; icicle-search-action: Pop to buffer of candidate (marker) and raise frame. ;; icicle-occur: ;; Added buffers arg. Updated doc string. Call icicle-search-highlight-cleanup. ;; icicle-search-highlight-all-input-matches: set-buffer for each ov in dolist (minor opt.). ;; icicle-search-highlight-cleanup: Added progress messages. Minor optimization. ;; 2006/10/22 dadams ;; icicle-complete-keys-action: ;; Set last-nonmenu-event to non-mouse info, to ignore *Completions* click. ;; icicle-complete-keys-1: Don't use a default value for completing-read. ;; 2006/10/21 dadams ;; Added: icicle-insert-char. ;; icicle-add-key+cmd: Respect icicle-complete-keys-self-insert-flag. ;; 2006/10/20 dadams ;; icicle-map, icicle-delete-window: Corrected doc string. ;; 2006/10/16 dadams ;; icicle-add-key+cmd: Protect :enable's eval with condition-case. ;; icicle-complete-keys-1: ;; No longer use icicle-extra-candidates. ;; Use default value of .. for completing-read (except at top level). ;; icicle-complete-keys-action: Correct no-match case: must match whole and part. ;; icicle-keys+cmds-w-prefix: Add .. to icicle-complete-keys-alist unless at top level. ;; 2006/10/15 dadams ;; icicle-complete-keys: ;; Bind icicle-complete-keys-action, not icicle-complete-keys-help, to icicle-*-action-fn. ;; Bind orig-buff, orig-window, and icicle-completing-keys-p, for use elsewhere. ;; Added: icicle-complete-keys-action using code from icicle-complete-keys. ;; icicle-complete-keys-action: ;; Use orig-buff and orig-window; restore to originally selected window. ;; Error if candidate doesn't match template xxx = yyy. ;; icicle-complete-keys-1: ;; Call icicle-complete-keys-action on chosen candidate. ;; icicle-help-on-candidate: Treat key completion also. ;; Added from cus-edit+.el: custom-variable-p. ;; Moved to icicles-mode.el: icicle-select-minibuffer-contents, next-history-element. ;; Moved here from icicles-mode.el: icicle-generic-S-tab. ;; icicle-generic-S-tab (bug fix): Do not set last-command to icicle-apropos-complete. ;; Added: eval-when-compile's. ;; 2006/10/13 dadams ;; icicle-add-key+cmd: ;; Add actual key to icicle-complete-keys-alist. Thx to Stefan Monnier. ;; Don't filter out index (Imenu) keymap. ;; Treat :enable condition. ;; icicle-complete-keys-1: ;; Use actual key recorded in icicle-*-keys-alist. Don't convert to key description. ;; Treat digit-argument and negative-argument. ;; icicle-complete-keys-alist: Updated doc string for new structure. ;; 2006/10/08 dadams ;; Added: icicle-add-key+cmd, icicle-read-single-key-description. ;; Added: icicle-complete-keys-alist. ;; Use in icicle-complete-keys-1, icicle-keys+cmds-w-prefix, icicle-add-key+cmd. ;; icicle-add-key+cmd: Update binding, depending on its type (menu item etc.). ;; Push (cons candidate binding), not just candidate, onto icicle-complete-keys-alist. ;; icicle-complete-keys-1: ;; Use binding, not just command name. Call it and put it in (this|last)-command. ;; Flipped (corrected) use of icicle-key-descriptions-use-<>-flag. ;; Use icicle-read-single-key-description. ;; icicle-prefix-keys-first-p, icicle-complete-keys-1, icicle-complete-keys-help, ;; icicle-keys+cmds-w-prefix: Don't use icicle-list-*-string. ;; 2006/10/05 dadams ;; icicle-complete-keys-1: Remove icicle-special-candidate property from all candidates. ;; icicle-keys+cmds-w-prefix: ;; Intern candidate and, if local binding, put icicle-special-candidate property on it. ;; Use single string for candidate (don't use multi-completion). ;; 2006/10/03 dadams ;; icicle-complete-keys-1: Treat "..". ;; icicle-complete-keys: Updated doc string accordingly. ;; icicle-prefix-keys-first-p: ".." is less than all other strings. Don't hard-code "= ". ;; icicle-keys+cmds-w-prefix: ;; Filtered out shadowed bindings, icicle-generic-S-tab, and icicle-complete-keys. ;; Use only map-keymap & lookup-key, not accessible-keymaps, current-active-maps, ;; map-keymap. ;; 2006/10/01 dadams ;; icicle-complete-keys: Bind sort functions, to put prefix keys first, by default. ;; Set last-command, before recursing. ;; Replaced icicle-alternative-sort with icicle-toggle-alternative-sorting (new). ;; icicle-(apropos|prefix)-complete-1: ;; Ensure icicle-(current|last)-input are strings, before compare. ;; icicle-keys+cmds-w-prefix: Tolerate empty local and global maps. ;; 2006/09/30 dadams ;; Added: icicle-read-kbd-macro, icicle-edmacro-parse-keys, icicle-toggle-angle-brackets. ;; icicle-complete-keys-1, icicle-dabbrev-completion: ;; key-description -> icicle-key-description, with icicle-key-descriptions-use-<>-flag. ;; icicle-complete-keys-1: ;; read-kbd-macro -> icicle-read-kbd-macro, with icicle-key-descriptions-use-<>-flag. ;; Got rid of extra space in prompt before colon, when no prefix. ;; icicle-keys+cmds-w-prefix: Use single-key-description with icicle-*-use-<>-flag. ;; icicle-insert-key-description: ;; Change arg to a toggle, and use icicle-key-descriptions-use-<>-flag. ;; Bind icicle-candidate-set-(retrieve|save) to C-M-<, C-M->, not C-<, C->. ;; icicle-dired-saved-file-candidates*: ;; Changed doc strings and messages to use dynamic binding of icicle-candidate-set-save. ;; 2006/09/24 dadams ;; Added: icicle-complete-keys-help. ;; icicle-complete-keys: ;; Bind icicle-*-action-fn to icicle-complete-keys-help. Mention help keys in docstring. ;; icicle-complete-keys-1: ;; Set last-command to command, so completion doesn't think candidate was last-command. ;; icicle-keys+cmds-w-prefix: Provide placeholder for future use of generic characters. ;; 2006/09/23 dadams ;; icicle-complete-keys-1: ;; Error if there are no keys for the prefix. ;; Error, not self-insert-command, for key read-kbd-macro can't convert. condition-case. ;; Report error if calling cmd fails. ;; Use vconcat for recursive call. ;; Read cmd, don't intern it - it might be a lambda or byte-compiled function. ;; Remove duplicates. ;; Provide KEYS arg to call-interactively, for error reporting. ;; Don't bind icicle-must-not-match-regexp to "^Character set .*= self-insert-command". ;; icicle-keys+cmds-w-prefix: ;; Treat also local keymap and current minor maps. ;; Do nothing if keys+maps is nil. ;; Only map-keymap if the target is a keymap. ;; Use keymapp, not functionp, as the binding test. ;; Only add binding if it is a command or keymap. ;; Only add self-insert-command binding if the key is char-valid-p. ;; Use format %S, not %s for a command binding. ;; icicle-insert-key-description: Added no-angle-brackets-p arg. ;; 2006/09/22 dadams ;; icicle-complete-keys-1: ;; Filter out keys described "Character set ...= self-insert-command". ;; 2006/09/20 dadams ;; icicle-complete-keys-1: Treat self-insert-command specially. ;; 2006/09/17 dadams ;; Added: icicle-complete-keys(-1), icicle-*-keys-prefix, icicle-keys+cmds-w-prefix, ;; icicle-doc: Removed one \n from each candidate. ;; 2006/09/12 dadams ;; Renamed icicle-switch-to-minibuffer to icicle-insert-completion. ;; Added: icicle-switch-to/from-minibuffer. ;; icicle-completion-help: Keep focus in the minibuffer after displaying help. ;; 2006/09/02 dadams ;; icicle-help-on-(next|previous)-(apropos|prefix)-candidate, ;; icicle-(next|previous)-(apropos|prefix)-candidate-action: ;; Use save-selected-window, not save-window-excursion. ;; icicle-find-file*: In Dired, ignore errors picking up current-line's file name. ;; icicle-mouse-choose-completion: Error if minibuffer is not active. ;; 2006/08/27 dadams ;; icicle-abort-minibuffer-input: If minibuffer not active, just kill buffer *Completions*. ;; icicle-execute-extended-command-1, icicle-insert-thesaurus-entry, icicle-search-action: ;; Ensure orig-window is live before using it. ;; 2006/08/23 dadams ;; Added: icicle-delete-window(s). ;; Added soft require of frame-cmds.el. ;; 2006/08/22 dadams ;; icicle-execute-extended-command-1: Bind this-command, don't set it (fixes C-next). ;; icicle-help-on-candidate: If no last candidate, then reset to first matching candidate. ;; icicle-*-candidate-action, icicle-help-on-*-candidate: save-window-excursion. ;; 2006/08/20 dadams ;; icicle-find-file*: Use diredp-find-a-file* in Dired mode (Emacs 22 or later). ;; Bug fix: icicle-candidate-action: Use icicle-*-candidates, not icicle-next-*-candidate. ;; icicle-next-*-candidate(-action): Set icicle-current-completion-mode. ;; 2006/08/18 dadams ;; Added: icicle-Info-goto-node(-(action|cmd)). ;; icicle-candidate-action: If no icicle-last-completion-candidate, use first candidate. ;; 2006/08/15 dadams ;; Added: icicle-help-on-*-*-candidate,icicle-mouse-help-on-candidate. ;; No longer put icicle-candidate-action-command property on symbols (not used). ;; Added: icicle-raise-Completions-frame. ;; icicle*-candidate-action, icicle-help-on-candidate: Use icicle-raise-Completions-frame. ;; icicle-help-on-candidate: Can use it from *Completions* too now. ;; Use icicle-barf-if-outside-Completions-and-minibuffer. ;; 2006/08/13 dadams ;; Added: icicle-Info-index(-(action|cmd)). ;; 2006/08/04 dadams ;; icicle-*-complete-1, icicle-prefix-word-complete, icicle-keep-only-past-inputs: ;; Set icicle-last-completion-command to the explicit command, not this-command. ;; icicle-history: Call icicle-last-completion-command, not icicle-apropos-complete. ;; icicle-apropos-complete-1, icicle-narrow-candidates: ;; Removed binding of icicle-apropos-completing-p (not used). ;; Added: icicle-plist, icicle-remove-Completions-window, icicle-pp-eval-expression. ;; Added soft require of pp+.el. ;; icicle-exit-minibuffer, icicle-minibuffer-complete-and-exit, ;; icicle-mouse-choose-completion, icicle-abort-minibuffer-input, ;; icicle-(apropos|prefix)-complete-1, icicle-keep-only-past-inputs, ;; icicle-insert-thesaurus-entry-cand-fn: Use icicle-remove-Completions-window. ;; icicle-doc: Treat doc of faces also. ;; icicle-non-whitespace-string-p: Added doc string. ;; 2006/08/03 dadams ;; Added: ;; icicle-comint-command, icicle-insert-kill, icicle-insert-for-yank,icicle-yank-insert. ;; Bound icicle-comint-command to C-c TAB in comint-mode. ;; icicle-search, icicle-comint-search: Cleaned up doc string. ;; 2006/08/02 dadams ;; icicle-comint-search: Mention *-prompt-pattern. Thx to Kevin Rodgers. ;; icicle-insert-string-from-variable: Added more variables to the completing-read alist. ;; 2006/07/29 dadams ;; Added: icicle-dispatch-C-., toggle-icicle-search-cleanup, icicle-toggle-search-cleanup. ;; 2006/07/23 dadams ;; Added: icicle-toggle-transforming. ;; icicle-comint-search: Bind icicle-transform-function to icicle-remove-duplicates. ;; 2006/07/22 dadams ;; Added: icicle-comint-search, icicle-comint-send-input, icicle-comint-get-*-input, ;; icicle-comint-get-final-choice, icicle-search-generic. ;; icicle-search: Added require-match arg for non-interactive calls. ;; Run the hooks if no match and no match required, and if we didn't cycle. ;; Return final choice as value (not used yet). ;; icicle-insert-string-from-variable: Use buffer-local value of variable, if there is one. ;; icicle-insert-string-from-variable: ;; Make sure we use the buffer-local value of the variable, if there is one ;; Added comint-prompt-regexp to regexp list. ;; Added mode hooks for icicle-compilation-search and icicle-comint-send-input. ;; 2006/07/20 dadams ;; Renamed icicle-arrows-respect-* to icicle-cycling-respects-completion-mode-flag. ;; 2006/07/19 dadams ;; Applied patch from Damien Elmes : ;; Added: icicle-(next|previous)-context-candidate, icicle-scroll-completions. ;; icicle-switch-to-completions, icicle-switch-to-Completions-buf, ;; icicle-move-to-next-completion, icicle-map-action, icicle-search-action: ;; Use icicle-start-of-completions. ;; icicle-(apropos|prefix)-complete-1: ;; Set icicle-current-completion-type vs use icicle-arrows-respect-*-flag. ;; Use icicle-scroll-completions. ;; icicle-current-completion-in-Completions: Use point-min if no previous prop change. ;; icicle-keep-only-past-inputs: Use icicle-scroll-completions. ;; Renamed icicle-start-of-completions to icicle-start-of-candidates-in-Completions, ;; icicle-current-completion-type to icicle-current-completion-mode, ;; icicle-*-context-candidate to icicle-(next|previous)-candidate-per-mode, ;; icicle-scroll-completions to icicle-scroll-Completions. ;; icicle-(next|previous)-context-candidate: Use icicle-barf-if-outside-minibuffer. ;; icicle-scroll-Completions: Changed with-selected-window to Emacs 20 equivalent. ;; 2006/07/18 dadams ;; icicle-search: Bind completion-ignore-case to case-fold-search. ;; icicle-search-highlight-all-input-matches, icicle-search-action: ;; Put search inside condition-case, for bad regexp. ;; Added: icicle-toggle-case-sensitivity, toggle-icicle-case-sensitivity. ;; 2006/07/10 dadams ;; Added: icicle-search-region. Use in search functions. Thx to Le Wang. ;; 2006/07/08 dadams ;; icicle-search-highlight-all-input-matches: Use *-current-*, not *-current-raw-*. ;; icicle-execute-extended-command-1: ;; First try a string candidate as arg, then read it to convert it to symbol or number. ;; Reset focus back to the minibuffer, in action function. ;; 2006/07/07 dadams ;; Added: icicle-alternative-sort. ;; icicle-imenu: Show *Completions* initially for submenu choice (only). ;; icicle-execute-extended-command: ;; Echo prefix arg in prompt. Thx: *.dhcp.mdsn.wi.charter.com ;; 2006/07/06 dadams ;; Added (eval-when-compile (require 'icicles-mac)). ;; 2006/07/05 dadams ;; Renamed: icicle-current-regexp-input to icicle-current-raw-input. ;; icicle-prefix-complete-1: Don't set icicle-current-raw-input. ;; 2006/07/04 dadams ;; icicle-prefix-complete-1: No longer calculate common prefix and set current input to it. ;; Added plist entries to categorize commands: ;; icicle-(cycling|completing|candidate-action)-command. ;; icicle-(apropos|prefix)-complete-1, icicle-prefix-word-complete, ;; icicle-switch-to-Completions-buf, icicle-keep-only-past-inputs, icicle-history: ;; Use icicle-cycling-command property. ;; icicle-apropos-complete-1: Removed regexp-p arg in call to icicle-save-or-restore-input. ;; 2006/07/03 dadams ;; icicle-(apropos|prefix)-complete-1: deactivate mark after inserting current input. ;; 2006/06/18 dadams ;; icicle-apropos-complete-1, icicle-narrow-candidates: Bind icicle-apropos-completing-p. ;; 2006/06/09 dadams ;; Bug fixes: Picked up matching subdir as default dir, even if there other files match. ;; Thx to Andrey Zhdanov. ;; Empty directory not treated as a match. ;; icicle-(apropos|prefix)-complete-1: ;; If input matches an empty directory, then use that directory as the sole completion. ;; Do not expand file-name input before call icicle-file-name-*-candidates. ;; icicle-retrieve-last-input: Use insert, not icicle-insert-input (no longer used). ;; (Input backslashes reverted to slashes.) ;; 2006/06/08 dadams ;; Bug fix: Could not complete after cycling file names. Thx to Andrey Zhdanov. ;; icicle-insert-input: Use icicle-expand-file-name. ;; icicle-prefix-complete-1: ;; Expand file-name input before call icicle-file-name-prefix-candidates. ;; Expand icicle-last-completion-candidate if it is a directory name. ;; 2006/05/30 dadams ;; icicle-erase-minibuffer-or-history-element: Fix for consecutive deletions. ;; 2006/05/26 dadams ;; Added: icicle-erase-minibuffer-or-history-element. ;; 2006/05/19 dadams ;; Renamed icicle-inhibit-reminder* to icicle-reminder*. ;; icicle-narrow-candidates: Bind icicle-reminder-prompt-flag to nil, not t. ;; 2006/05/16 dadams ;; Added: icicle-kill(-a)-buffer. ;; 2006/05/15 dadams ;; Renamed: icicle-completion-nospace-flag to icicle-ignore-space-prefix-flag. ;; icicle-candidate-set-complement: Put back icicle-ignore-space-prefix-flag. ;; icicle-buffer(-other-window): Bind icicle-buffer-ignore-space-prefix-flag. ;; Added: icicle-toggle-ignored-space-prefix, toggle-icicle-ignored-space-prefix. ;; 2006/05/13 dadams ;; icicle-occur: Make icicle-search-main-regexp-others unnoticeable instead of ;; setting icicle-search-highlight-all-flag to nil. ;; icicle-candidate-set-complement: Use nil, not icicle-completion-nospace-flag. ;; Renamed: icicle-search-imenu to icicle-imenu, ;; icicle-search-imenu-in-buffer-p to icicle-imenu-in-buffer-p. ;; 2006/05/12 dadams ;; icicle-search-imenu: Remove unmatched submenus. Error if no imenu for the buffer. ;; Added: icicle-search-imenu-in-buffer-p. ;; icicle-insert-string-at-point: Use icicle-barf-if-outside-minibuffer. ;; Moved to icicles-fn.el: icicle-barf-if-outside-*. ;; Moved some commands to minibuffer-cmds section from top-level cmds section. ;; 2006/05/09 dadams ;; Added: icicle-customize-icicles-group, icicle-send-bug-report, icicle-customize-button. ;; 2006/04/30 dadams ;; Added: icicle-map, icicle-map-action. ;; icicle-filter-alist: Corrected and simplified. ;; icicle-search: Corrected cand-nb adjustment when cycle with action fns. ;; Renamed: icicle-search-action-fn to icicle-search-action, ;; icicle-search-candidates to icicle-candidates-alist. ;; 2006/04/28 dadams ;; icicle-retrieve-last-input, icicle-(apropos|prefix)-complete-1: ;; Use icicle-highlight-initial-whitespace. ;; 2006/04/25 dadams ;; icicle-completion-help: Emacs 21.3's help-insert-xref-button signature is different. ;; 2006/04/16 dadams ;; Added: icicle-search-imenu. ;; icicle-search: Bug fixes: ;; Treat completion without cycling: error or singleton go-to. ;; Only subtract one from candidate number for C- cycling, not regular cycling. ;; 2006/04/14 dadams ;; icicle-search: ;; Bug fix: Position was off by one. ;; Highlight input match inside each main regexp match (or not). ;; Bind icicle-update-input-hook and icicle-incremental-completion-flag. ;; Extract code to define icicle-search-action-fn. ;; Use icicle-search-candidates instead of local variable search-candidates. ;; Respect icicle-search-cleanup-flag. ;; Added: icicle-search-highlight-*, icicle-search-action-fn, ;; icicle-(insert|save)-text-(from|to)-variable. ;; Renamed icicle-search-refined-regexp to icicle-search-current-input. ;; 2006/04/09 dadams ;; icicle-(apropos|prefix)-complete-1: Deal with icicle-arrows-respect-*-flag. ;; Moved here from icicles-fn.el: icicle-customize-apropos*, icicle-repeat-complex-command. ;; 2006/04/07 dadams ;; icicle-search: Highlight all occurrences at once (like isearch highlight, but not lazy). ;; Error if no match for initial regexp. ;; icicle-occur: Bind icicle-search-highlight-all-flag to nil: don't highlight each line. ;; 2006/04/02 dadms ;; Added: icicle-toggle-regexp-quote, icicle-find-file*-w-wildcards. ;; icicle-find-file*: Use icicle-find-file*-w-wildcards. ;; 2006/03/31 dadams ;; icicle-search: Wrap action function with unwind-protect to select minibuffer frame. ;; Use completion-ignore-case when highlighting search hits. ;; Protect delete-overlay with overlayp. ;; Turn off region highlighting (so can see highlighting done here). ;; Removed sit-for-period argument. ;; icicle-candidate-set-save: Use prin1 instead of pp. ;; 2006/03/27 dadams ;; Added: icicle-occur. ;; icicle-search: Highlight also match of current regexp, inside that of regexp arg. ;; Use new faces icicle-search-*-regexp. ;; icicle-search, icicle-switch-to-Completions-buf, icicle-move-to-next-completion: ;; Use new, generic icicle-place-overlay. ;; Removed icicle-place-search-overlay. ;; 2006/03/26 dadams ;; icicle-search: Use icicle-search-overlay. Ensure don't match twice at same position. ;; Added regexp arg. Use 0 as sit-for default. ;; Added: icicle-place-search-overlay. ;; 2006/03/25 dadams ;; icicle-prefix-complete: Minor bug fix: Don't save try-completion if not a string. ;; icicle-candidate-set-(save|retrieve): Allow use of a variable to save/retrieve. ;; Added: icicle-candidate-set-(retrieve-from|save-to)-variable, icicle-*-no-display, ;; icicle-prefix-complete-1. ;; icicle-apropos-complete-1: Added no-display-p optional arg. ;; Use no-display-p arg in calls to icicle-display-candidates-in-Completions. ;; icicle-candidate-set-(retrieve-from|save-to)-cache-file: Pass a consp, not t. ;; icicle-candidate-set-retrieve: Don't display *Completions*. ;; 2006/03/24 dadams ;; Added icicle-delete-char. ;; 2006/03/23 dadams ;; icicle-candidate-set-define: Rewrote. Can also use at top level. ;; Error if wrong result type. Sort result. Use display-completion-list and ;; icicle-narrow-candidates (unless at top level). ;; icicle-narrow-candidates: Can call from top-level (but not interactively). ;; icicle-candidate-set-complement: Use icicle-maybe-sort-and-strip-candidates. ;; Mention in doc strings of minibuffer and *Completions* functions: where, key. ;; 2006/03/22 dadams ;; icicle-find-file*: Use default-directory as default, so opens directory on empty input. ;; icicle-prefix-complete: ;; Save icicle-current-regexp-input. ;; Set icicle-current-input to common prefix. Use it everywhere here. ;; Calls to icicle-display-candidates-in-Completions: no root arg now. ;; 2006/03/21 dadams ;; icicle-insert-input: Bug fix: Use directory of input, not default-directory. ;; Append a slash if input itself is a directory. ;; 2006/03/20 dadams ;; icicle-retrieve-last-input: Insert icicle-current-regexp-input if repeat C-l. ;; Added: icicle-insert-input. ;; 2006/03/19 dadams ;; icicle-apropos-complete-1: Call icicle-save-or-restore-input with non-nil regexp-p arg. ;; 2006/03/17 dadams ;; Added: icicle-add/update-saved-completion-set, icicle-remove-saved-completion-set, ;; icicle-retrieve-candidates-from-set. ;; Removed: icicle-cache-file. ;; icicle-candidate-set-retrieve: Read candidates set and use its cache file. ;; Enable recursive minibuffers. ;; icicle-candidate-set-save: Read candidates set and cache-file names. ;; Use icicle-add/update-saved-completion-set. ;; icicle-barf-if-outside-minibuffer: Move interactive test to calling functions. ;; icicle-files-within: Moved to icicle-fn.el. ;; 2006/03/16 dadams ;; Added: icicle*-saved-completion-set. ;; 2006/03/14 dadams ;; icicle-narrow-candidates: Handle no-catch error. Don't use icicle-completing-p. ;; icicle-candidate-set-complement: ;; Do what we do in icicle-candidate-set-retrieve: call icicle-narrow-candidates. ;; icicle-candidate-set-(retrieve|complement): Msg when display. ;; icicle-(apropos|prefix)-complete-1: ;; Removed test for last-command = icicle-candidate-set-complement. ;; 2006/03/13 dadams ;; Added: icicle-candidate-set-(retrieve-from|save-to)-cache-file. ;; icicle-candidate-set-(retrieve|save): C-u uses cache file. ;; 2006/03/12 dadams ;; Added: icicle-dired-saved-file-candidates(-other-window), icicle-locate-file*, ;; icicle-files-within. ;; 2006/03/11 dadams ;; icicle-find-file*, icicle-delete-file*: ;; Reverted to simple form (moved directory control to icicles-mac.el). ;; icicle-keep-only-past-inputs: Expand file name relative to directory of last input. ;; 2006/03/10 dadams ;; icicle-find-file*, icicle-delete-file*: Expand file name relative to dir of last input. ;; Renamed icicle-minibuffer-contents to icicle-minibuffer-contents-from-minibuffer. ;; 2006/03/09 dadams ;; icicle-barf-if-outside-*: Removed argument - use this-command instead. ;; 2006/03/08 dadams ;; icicle-bookmark: Use default value, not init value, for completing-read. ;; 2006/03/07 dadams ;; icicle-doc: Save table in minibuffer-completion-table, so can access via C-RET too. ;; icicle-insert-thesaurus-entry, icicle-*doc: ;; Removed binding of icicle-incremental-completion-flag to nil. ;; Added: icicle-barf-if-outside-(minibuffer|Completions). Use in appropriate commands. ;; Added: icicle-non-whitespace-string-p. Use in icicle-*doc. ;; 2006/03/06 dadams ;; Update doc strings of *-thesaurus*. ;; 2006/03/05 dadams ;; Added: icicle-toggle-incremental-completion, toggle-icicle-incremental-completion. ;; 2006/03/03 dadams ;; icicle-*doc: Clarified doc strings. Updated prompts. ;; Added: icicle-help-button. Use in icicle-completion-help. ;; 2006/03/02 dadams ;; icicle-insert-thesaurus-entry, icicle-complete-thesaurus-entry: ;; Use synonyms-ensure-synonyms-read-from-cache. Clarified doc strings. ;; icicle-complete-thesaurus-entry: Error if no word at point. Correct looking-at regexp. ;; 2006/03/01 dadams ;; Added: icicle-insert-thesaurus-entry, icicle-insert-thesaurus-entry-cand-fn, ;; icicle-complete-thesaurus-entry. ;; icicle-(previous|next)-(apropos|prefix)-candidate-action: Wrap in save-excursion. ;; Use icicle-clear-minibuffer instead of icicle-erase-minibuffer non-interactively. ;; icicle-erase-minibuffer: Use icicle-call-then-update-Completions. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;; You need not load this file. It contains only documentation. (provide 'icicles-chg) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-chg.el ends here icicles-2013.04.23.23400/icicles-cmd1.el000066400000000000000000017462331214003072700167630ustar00rootroot00000000000000;;; icicles-cmd1.el --- Top-level commands for Icicles ;; ;; Filename: icicles-cmd1.el ;; Description: Top-level commands for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:25:04 2006 ;; Version: 22.0 ;; Last-Updated: Wed Apr 24 10:13:26 2013 (-0700) ;; By: dradams ;; Update #: 25719 ;; URL: http://www.emacswiki.org/icicles-cmd1.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `apropos', `apropos-fn+var', `avoid', `cl', `cus-edit', ;; `cus-face', `cus-load', `cus-start', `doremi', `easymenu', ;; `el-swank-fuzzy', `ffap', `ffap-', `frame-cmds', `frame-fns', ;; `fuzzy', `fuzzy-match', `hexrgb', `icicles-fn', `icicles-mcmd', ;; `icicles-opt', `icicles-var', `image-dired', `kmacro', ;; `levenshtein', `misc-fns', `mouse3', `mwheel', `naked', ;; `regexp-opt', `ring', `ring+', `second-sel', `strings', ;; `thingatpt', `thingatpt+', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; top-level commands (and a few non-interactive functions used in ;; those commands). Library `icicles-cmd2.el' is a continuation of ;; this file (a single file for all top-level commands would be too ;; large to upload to Emacs Wiki). ;; ;; For commands to be used mainly in the minibuffer or buffer ;; `*Completions*', see `icicles-mcmd.el'. ;; ;; For Icicles documentation, see `icicles-doc1.el' and ;; `icicles-doc2.el'. ;; ;; If you use the byte-compiled version of this library, ;; `icicles-cmd1.elc', in Emacs 23, then it must be byte-compiled ;; using Emacs 23. Otherwise, Icicles key completion (and perhaps ;; other things?) will not work correctly. ;; ;; Widgets defined here: ;; ;; `icicle-file', `icicle-ORIG-file'. ;; ;; Commands defined here - (+) means a multi-command: ;; ;; (+)`clear-option', (+)`icicle-add-buffer-candidate', ;; (+)`icicle-add-buffer-config', ;; `icicle-add-entry-to-saved-completion-set', `icicle-apropos', ;; `icicle-apropos-command', `icicle-apropos-function', ;; `icicle-apropos-option', (+)`icicle-apropos-options-of-type', ;; (+)`icicle-apropos-value', `icicle-apropos-variable', ;; (+)`icicle-apropos-vars-w-val-satisfying', ;; `icicle-apropos-zippy', `icicle-bbdb-complete-mail', ;; `icicle-bbdb-complete-name', (+)`icicle-bookmark', ;; (+)`icicle-bookmark-all-tags', ;; (+)`icicle-bookmark-all-tags-other-window', ;; (+)`icicle-bookmark-all-tags-regexp', ;; (+)`icicle-bookmark-all-tags-regexp-other-window', ;; (+)`icicle-bookmark-autofile', ;; (+)`icicle-bookmark-autofile-all-tags', ;; (+)`icicle-bookmark-autofile-all-tags-other-window', ;; (+)`icicle-bookmark-autofile-all-tags-regexp', ;; (+)`icicle-bookmark-autofile-all-tags-regexp-other-window', ;; `icicle-bookmark-autofile-narrow', ;; (+)`icicle-bookmark-autofile-other-window', ;; (+)`icicle-bookmark-autofile-some-tags', ;; (+)`icicle-bookmark-autofile-some-tags-other-window', ;; (+)`icicle-bookmark-autofile-some-tags-regexp', ;; (+)`icicle-bookmark-autofile-some-tags-regexp-other-window', ;; (+)`icicle-bookmark-autonamed', ;; `icicle-bookmark-autonamed-narrow', ;; (+)`icicle-bookmark-autonamed-other-window', ;; (+)`icicle-bookmark-autonamed-this-buffer', ;; `icicle-bookmark-autonamed-this-buffer-narrow', ;; (+)`icicle-bookmark-autonamed-this-buffer-other-window', ;; (+)`icicle-bookmark-bookmark-file', ;; `icicle-bookmark-bookmark-file-narrow', ;; (+)`icicle-bookmark-bookmark-list', ;; `icicle-bookmark-bookmark-list-narrow', ;; (+)`icicle-bookmark-cmd', (+)`icicle-bookmark-desktop', ;; `icicle-bookmark-desktop-narrow', (+)`icicle-bookmark-dired', ;; `icicle-bookmark-dired-narrow', ;; (+)`icicle-bookmark-dired-other-window', ;; (+)`icicle-bookmarked-buffer-list', ;; (+)`icicle-bookmarked-file-list', (+)`icicle-bookmark-file', ;; (+)`icicle-bookmark-file-all-tags', ;; (+)`icicle-bookmark-file-all-tags-other-window', ;; (+)`icicle-bookmark-file-all-tags-regexp', ;; (+)`icicle-bookmark-file-all-tags-regexp-other-window', ;; (+)`icicle-bookmark-file-other-window', ;; `icicle-bookmark-file-narrow', ;; (+)`icicle-bookmark-file-some-tags', ;; (+)`icicle-bookmark-file-some-tags-other-window', ;; (+)`icicle-bookmark-file-some-tags-regexp', ;; (+)`icicle-bookmark-file-some-tags-regexp-other-window', ;; (+)`icicle-bookmark-file-this-dir', ;; (+)`icicle-bookmark-file-this-dir-other-window', ;; (+)`icicle-bookmark-file-this-dir-all-tags', ;; (+)`icicle-bookmark-file-this-dir-all-tags-other-window', ;; (+)`icicle-bookmark-file-this-dir-all-tags-regexp', ;; (+)`icicle-bookmark-file-this-dir-all-tags-regexp-other-window', ;; `icicle-bookmark-file-this-dir-narrow', ;; (+)`icicle-bookmark-file-this-dir-some-tags', ;; (+)`icicle-bookmark-file-this-dir-some-tags-other-window', ;; (+)`icicle-bookmark-file-this-dir-some-tags-regexp', ;; (+)`icicle-bookmark-file-this-dir-some-tags-regexp-other-window', ;; (+)`icicle-bookmark-gnus', `icicle-bookmark-gnus-narrow', ;; (+)`icicle-bookmark-gnus-other-window', ;; (+)`icicle-bookmark-image', `icicle-bookmark-image-narrow', ;; (+)`icicle-bookmark-image-other-window', ;; (+)`icicle-bookmark-info', `icicle-bookmark-info-narrow', ;; (+)`icicle-bookmark-info-other-window', `icicle-bookmark-jump', ;; `icicle-bookmark-jump-other-window', (+)`icicle-bookmark-list', ;; (+)`icicle-bookmark-local-file', ;; `icicle-bookmark-local-file-narrow', ;; (+)`icicle-bookmark-local-file-other-window', ;; (+)`icicle-bookmark-man', `icicle-bookmark-man-narrow', ;; (+)`icicle-bookmark-man-other-window', ;; (+)`icicle-bookmark-non-file', ;; `icicle-bookmark-non-file-narrow', ;; (+)`icicle-bookmark-non-file-other-window', ;; (+)`icicle-bookmark-other-window', (+)`icicle-bookmark-region', ;; `icicle-bookmark-region-narrow', ;; (+)`icicle-bookmark-region-other-window', ;; (+)`icicle-bookmark-remote-file', ;; `icicle-bookmark-remote-file-narrow', ;; (+)`icicle-bookmark-remote-file-other-window', ;; `icicle-bookmark-save-marked-files', ;; `icicle-bookmark-save-marked-files-as-project', ;; `icicle-bookmark-save-marked-files-more', ;; `icicle-bookmark-save-marked-files-persistently', ;; `icicle-bookmark-save-marked-files-to-variable', ;; `icicle-bookmark-set', (+)`icicle-bookmark-some-tags', ;; (+)`icicle-bookmark-some-tags-other-window', ;; (+)`icicle-bookmark-some-tags-regexp', ;; (+)`icicle-bookmark-some-tags-regexp-other-window', ;; (+)`icicle-bookmark-specific-buffers', ;; `icicle-bookmark-specific-buffers-narrow', ;; (+)`icicle-bookmark-specific-buffers-other-window', ;; (+)`icicle-bookmark-specific-files', ;; `icicle-bookmark-specific-files-narrow', ;; (+)`icicle-bookmark-specific-files-other-window', ;; (+)`icicle-bookmark-temporary', ;; `icicle-bookmark-temporary-narrow', ;; (+)`icicle-bookmark-temporary-other-window', ;; (+)`icicle-bookmark-this-buffer', ;; `icicle-bookmark-this-buffer-narrow', ;; (+)`icicle-bookmark-this-buffer-other-window', ;; (+)`icicle-bookmark-url', `icicle-bookmark-url-narrow', ;; (+)`icicle-bookmark-url-other-window', (+)`icicle-bookmark-w3m', ;; `icicle-bookmark-w3m-narrow', ;; (+)`icicle-bookmark-w3m-other-window', (+)`icicle-buffer', ;; (+)`icicle-buffer-config', (+)`icicle-buffer-list', ;; (+)`icicle-buffer-no-search', ;; (+)`icicle-buffer-no-search-other-window', ;; (+)`icicle-buffer-other-window', `icicle-cd-for-abs-files', ;; `icicle-cd-for-loc-files', (+)`icicle-clear-history', ;; (+)`icicle-clear-current-history', (+)`icicle-color-theme', ;; `icicle-comint-dynamic-complete', ;; `icicle-comint-dynamic-complete-filename', ;; `icicle-comint-replace-by-expanded-filename', ;; (+)`icicle-command-abbrev', (+)`icicle-command-abbrev-command', ;; (+)`icicle-completing-yank', `icicle-customize-apropos', ;; `icicle-customize-apropos-faces', ;; `icicle-customize-apropos-groups', ;; `icicle-customize-apropos-options', ;; (+)`icicle-customize-apropos-options-of-type', ;; (+)`icicle-customize-apropos-opts-w-val-satisfying', ;; (+)`icicle-customize-face', ;; (+)`icicle-customize-face-other-window', ;; `icicle-customize-icicles-group', `icicle-dabbrev-completion', ;; (+)`icicle-delete-file', (+)`icicle-delete-window', ;; (+)`icicle-describe-option-of-type', `icicle-describe-process', ;; (+)`icicle-describe-var-w-val-satisfying', ;; (+)`icicle-delete-windows', (+)`icicle-directory-list', ;; (+)`icicle-dired', `icicle-dired-chosen-files', ;; `icicle-dired-chosen-files-other-window', ;; (+)`icicle-dired-insert-as-subdir', ;; (+)`icicle-dired-other-window', `icicle-dired-project', ;; `icicle-dired-project-other-window', ;; `icicle-dired-saved-file-candidates', ;; `icicle-dired-saved-file-candidates-other-window', ;; `icicle-dired-save-marked', ;; `icicle-dired-save-marked-as-project', ;; `icicle-dired-save-marked-more', ;; `icicle-dired-save-marked-more-recursive', ;; `icicle-dired-save-marked-persistently', ;; `icicle-dired-save-marked-recursive', ;; `icicle-dired-save-marked-to-cache-file-recursive', ;; `icicle-dired-save-marked-to-fileset-recursive', ;; `icicle-dired-save-marked-to-variable', ;; `icicle-dired-save-marked-to-variable-recursive', ;; `icicle-doremi-increment-variable+', ;; (+)`icicle-execute-extended-command', ;; (+)`icicle-execute-named-keyboard-macro', (+)`icicle-face-list', ;; (+)`icicle-file', (+)`icicle-file-list', ;; (+)`icicle-file-other-window', (+)`icicle-find-file', ;; (+)`icicle-find-file-absolute', ;; (+)`icicle-find-file-absolute-other-window', ;; (+)`icicle-find-file-in-tags-table', ;; (+)`icicle-find-file-in-tags-table-other-window', ;; (+)`icicle-find-file-of-content', ;; (+)`icicle-find-file-of-content-other-window', ;; (+)`icicle-find-file-other-window', ;; (+)`icicle-find-file-no-search', ;; (+)`icicle-find-file-no-search-other-window', ;; (+)`icicle-find-file-read-only', ;; (+)`icicle-find-file-read-only-other-window', ;; (+)`icicle-find-first-tag', ;; (+)`icicle-find-first-tag-other-window', (+)`icicle-find-tag', ;; `icicle-grep-saved-file-candidates', ;; `icicle-gud-gdb-complete-command', (+)`icicle-increment-option', ;; (+)`icicle-increment-variable', (+)`icicle-insert-buffer', ;; (+)`icicle-keyword-list', (+)`icicle-kill-buffer', ;; (+)`icicle-kmacro', `icicle-lisp-complete-symbol', ;; (+)`icicle-locate', (+)`icicle-locate-file', ;; (+)`icicle-locate-file-no-symlinks', ;; (+)`icicle-locate-file-no-symlinks-other-window', ;; (+)`icicle-locate-file-other-window', ;; (+)`icicle-locate-other-window', `icicle-ORIG-customize-face', ;; `icicle-ORIG-customize-face-other-window', ;; `icicle-ORIG-dabbrev-completion', ;; `icicle-ORIG-lisp-complete-symbol', ;; `icicle-ORIG-lisp-completion-at-point', ;; `icicle-ORIG-repeat-complex-command', ;; (+)`icicle-other-window-or-frame', `icicle-pop-tag-mark', ;; `icicle-pp-eval-expression', (+)`icicle-recent-file', ;; (+)`icicle-recent-file-other-window', ;; `icicle-recompute-shell-command-candidates', ;; (+)`icicle-regexp-list', (+)`icicle-remove-buffer-candidate', ;; (+)`icicle-remove-buffer-config', ;; `icicle-remove-entry-from-saved-completion-set', ;; (+)`icicle-remove-file-from-recentf-list', ;; (+)`icicle-remove-saved-completion-set', ;; `icicle-repeat-complex-command', ;; (+)`icicle-reset-option-to-nil', ;; (+)`icicle-select-bookmarked-region', (+)`icicle-select-frame', ;; `icicle-select-frame-by-name', (+)`icicle-select-window', ;; `icicle-select-window-by-name', `icicle-send-bug-report', ;; (+)`icicle-send-signal-to-process', (+)`icicle-set-option-to-t', ;; (+)`icicle-sexp-list', `icicle-shell-dynamic-complete-command', ;; `icicle-shell-dynamic-complete-environment-variable', ;; `icicle-shell-dynamic-complete-filename', ;; (+)`icicle-string-list', (+)`icicle-toggle-option', ;; (+)`icicle-visit-marked-file-of-content', ;; (+)`icicle-visit-marked-file-of-content-other-window', ;; `icicle-widget-file-complete', ;; (+)`icicle-yank-maybe-completing', ;; (+)`icicle-yank-pop-commands', `icicle-zap-to-char', ;; (+)`toggle'. ;; ;; Non-interactive functions defined here: ;; ;; `custom-variable-p', `icicle-apropos-opt-action', ;; `icicle-binary-option-p', ;; `icicle-bookmark-bind-narrow-commands', ;; `icicle-bookmark-cleanup', `icicle-bookmark-cleanup-on-quit', ;; `icicle-bookmark-delete-action', `icicle-bookmark-help-string', ;; `icicle-bookmark-jump-1', ;; `icicle-buffer-apropos-complete-match', ;; `icicle-buffer-cand-help', `icicle-buffer-multi-complete', ;; `icicle-buffer-name-prompt', ;; `icicle-cached-files-without-buffers', `icicle-clear-history-1', ;; `icicle-clear-history-entry', ;; `icicle-comint-completion-at-point', ;; `icicle-comint-dynamic-complete-as-filename', ;; `icicle-comint-dynamic-simple-complete', ;; `icicle-comint-replace-orig-completion-fns', ;; `icicle-command-abbrev-action', ;; `icicle-command-abbrev-matching-commands', ;; `icicle-command-abbrev-record', `icicle-command-abbrev-regexp', ;; `icicle-customize-apropos-opt-action', `icicle-customize-faces', ;; `icicle-dabbrev--abbrev-at-point', ;; `icicle-default-buffer-names', ;; `icicle-delete-file-or-directory', `icicle-describe-opt-action', ;; `icicle-describe-opt-of-type-complete', ;; `icicle-execute-extended-command-1', `icicle-explore', ;; `icicle-file-of-content-apropos-complete-match', ;; `icicle-find-first-tag-action', ;; `icicle-find-first-tag-other-window-action', ;; `icicle-find-tag-action', `icicle-find-tag-define-candidates', ;; `icicle-find-tag-define-candidates-1', ;; `icicle-find-tag-final-act', `icicle-find-tag-help', ;; `icicle-find-tag-quit-or-error', `icicle-insert-for-yank', ;; `icicle-kill-a-buffer-and-update-completions', ;; `icicle-kmacro-action', `icicle-lisp-completion-at-point', ;; (+)`icicle-locate-file-1', `icicle-locate-file-action', ;; `icicle-locate-file-other-window-action', ;; `icicle-make-bookmark-candidate', ;; `icicle-make-file+date-candidate', `icicle-make-frame-alist', ;; `icicle-make-window-alist', ;; `icicle-bookmark-propertize-candidate', ;; `icicle-pp-display-expression', ;; `icicle-read-args-w-val-satisfying', ;; `icicle-recent-files-without-buffers.', ;; `icicle-remove-buffer-candidate-action', ;; `icicle-remove-buffer-config-action', ;; `icicle-remove-from-recentf-candidate-action', ;; `icicle-remove-saved-set-action', ;; `icicle-shell-command-on-file', ;; `icicle-shell-dynamic-complete-as-command', ;; `icicle-shell-dynamic-complete-as-environment-variable'. ;; ;; Internal variables defined here: ;; ;; `icicle-locate-file-action-fn', ;; `icicle-locate-file-no-symlinks-p', ;; `icicle-locate-file-use-locate-p'. ;; ;; ;; ***** NOTE: The following functions defined in `dabbrev.el' have ;; been REDEFINED HERE: ;; ;; `dabbrev-completion' - Use Icicles minibuffer completion when there ;; are multiple candidates. ;; ;; ;; ***** NOTE: The following functions defined in `bbdb-com.el' have ;; been REDEFINED HERE: ;; (BBDB is available here: http://bbdb.sourceforge.net/.) ;; ;; `bbdb-complete-name' - Use Icicles minibuffer completion when there ;; are multiple candidates. ;; ;; ;; ***** NOTE: The following functions defined in `lisp.el' have ;; been REDEFINED in Icicles: ;; ;; `lisp-complete-symbol' - Selects `*Completions*' window even if on ;; another frame. ;; ;; ;; ***** NOTE: The following function defined in `simple.el' has ;; been REDEFINED HERE: ;; ;; `repeat-complex-command' - Use `completing-read' to read command. ;; ;; ;; ***** NOTE: The following functions defined in `cus-edit.el' have ;; been REDEFINED HERE: ;; ;; `customize-apropos', `customize-apropos-faces', ;; `customize-apropos-groups', `customize-apropos-options' - ;; Use `completing-read' to read the regexp. ;; `customize-face', `customize-face-other-window' - Multi-commands. ;; ;; ;; Key bindings made by Icicles: See "Key Bindings" in ;; `icicles-doc2.el'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Icicles Top-Level Commands, Part 1") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 3, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (eval-when-compile (require 'cl)) ;; lexical-let[*], pushnew ;; plus, for Emacs < 21: dolist, push (eval-when-compile (when (>= emacs-major-version 21) (require 'recentf))) ;; recentf-mode (require 'apropos-fn+var nil t) ;; (no error if not found): ;; apropos-command, apropos-function, apropos-option, apropos-variable (eval-when-compile (when (< emacs-major-version 24) ; $$$$$$$$ TODO: Update it for Emacs 24+ (require 'dabbrev))) ;; dabbrev-case-fold-search, dabbrev-upcase-means-case-search, dabbrev--last-obarray, ;; dabbrev--last-completion-buffer, dabbrev--last-abbreviation, dabbrev--check-other-buffers, ;; dabbrev-case-replace, dabbrev--reset-global-variables, dabbrev--minibuffer-origin, ;; dabbrev--find-all-expansions, dabbrev--substitute-expansion (eval-when-compile (require 'bookmark)) ;; bookmark-all-names, bookmark-buffer-name, bookmark-current-bookmark (eval-when-compile (require 'comint)) ;; comint-completion-addsuffix, comint-completion-autolist, comint-completion-fignore, ;; comint-completion-recexact, comint-directory, comint-dynamic-complete-filename, ;; comint-dynamic-complete-functions, comint-line-beginning-position, ;; comint-match-partial-filename, comint-quote-filename (eval-when-compile (require 'cookie1 nil t)) ;; (no error if not found): cookie-cache (eval-when-compile (require 'shell)) ;; shell-backward-command, shell-completion-execonly, ;; shell-dynamic-complete-command, shell-dynamic-complete-environment-variable, ;; shell-dynamic-complete-filename, shell-match-partial-variable (eval-when-compile (require 'etags)) ;; file-of-tag, find-tag, find-tag-default, find-tag-default-function, ;; find-tag-marker-ring, find-tag-other-window, goto-tag-location-function, snarf-tag-function, ;; tag-find-file-of-tag-noselect, tags-case-fold-search, ;; tags-lazy-completion-table, tags-table-files, visit-tags-table-buffer (eval-when-compile (require 'yow nil t)) ;; (no error if not found): ;; apropos-zippy, yow-after-load-message, yow-file, yow-load-message ;; Commented out because `synonyms.el' soft-requires Icicles. ;; (eval-when-compile (require 'synonyms nil t)) ;; (no error if not found): ;; synonyms-ensure-synonyms-read-from-cache, synonyms-obarray (eval-when-compile (require 'misc-cmds nil t)) ;; (no error if not found): ;; kill-buffer-and-its-windows (eval-when-compile (require 'bbdb nil t) (require 'bbdb-com nil t)) ;; (no error if not found): ;; bbdb-auto-fill-function, bbdb-complete-name, bbdb-complete-name-allow-cycling, ;; bbdb-complete-name-cleanup, bbdb-complete-name-hooks, bbdb-completion-display-record, ;; bbdb-completion-predicate, bbdb-completion-type, bbdb-display-records-1, ;; bbdb-dwim-net-address, bbdb-expand-mail-aliases, bbdb-extract-address-components-func, ;; bbdb-gag-messages, bbdb-hashtable, bbdb-mapc, bbdb-pop-up-bbdb-buffer, bbdb-record-aka, ;; bbdb-record-name, bbdb-record-net, bbdb-search-intertwingle, bbdb-string-trim (require 'cus-edit) ;; customize-apropos, customize-apropos-faces, customize-apropos-groups, ;; customize-apropos-options, custom-buffer-create, custom-buffer-order-groups, customize-face, ;; customize-face-other-window, custom-sort-items (require 'misc-fns nil t) ;; (no error if not found): another-buffer (require 'frame-cmds nil t) ;; (no error if not found): delete-windows-on (my version) (require 'second-sel nil t) ;; (no error if not found): ;; secondary-selection-yank-commands, secondary-selection-yank-secondary-commands, ;; yank-pop-secondary (eval-when-compile (or (condition-case nil (load-library "icicles-mac") ; Use load-library to ensure latest .elc. (error nil)) (require 'icicles-mac))) ; Require, so can load separately if not on `load-path'. ;; icicle-assoc-delete-all, icicle-(buffer|file)-bindings, icicle-condition-case-no-debug, ;; icicle-define-bookmark(-other-window)-command, icicle-define(-file)-command, ;; icicle-define-add-to-alist-command (require 'icicles-mcmd) ;; icicle-bind-buffer-candidate-keys, icicle-bind-file-candidate-keys, icicle-unbind-buffer-candidate-keys, ;; icicle-unbind-file-candidate-keys, icicle-yank (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.) ;; icicle-add-proxy-candidates-flag, icicle-buffer-configs, icicle-buffer-extras, ;; icicle-buffer-ignore-space-prefix-flag, icicle-buffer-match-regexp, ;; icicle-buffer-no-match-regexp, icicle-buffer-predicate, icicle-buffer-require-match-flag, ;; icicle-buffer-sort, icicle-color-themes, icicle-kbd, icicle-saved-completion-sets, ;; icicle-sort-comparer, icicle-transform-function (require 'icicles-var) ; (This is required anyway by `icicles-fn.el'.) ;; icicle-abs-file-candidates, icicle-all-candidates-list-action-fn, ;; icicle-all-candidates-list-alt-action-fn, icicle-bookmark-history, ;; icicle-bookmark-list-names-only-p, icicle-bookmark-types, icicle-buffer-config-history, ;; icicle-bufflist, icicle-candidate-action-fn, icicle-candidate-alt-action-fn, ;; icicle-candidate-help-fn, icicle-candidate-nb, icicle-candidate-properties-alist, ;; icicle-candidates-alist, icicle-color-theme-history, icicle-command-abbrev-history, ;; icicle-commands-for-abbrev, icicle-comp-base-is-default-dir-p, icicle-completion-candidates, ;; icicle-completion-set-history, icicle-current-input, icicle-delete-candidate-object, ;; icicle-explore-final-choice, icicle-explore-final-choice-full, icicle-extra-candidates, ;; icicle-face-name-history, icicle-frame-alist, icicle-frame-name-history, icicle-full-cand-fn, ;; icicle-function-name-history, icicle-get-alist-candidate-function, icicle-hist-var, ;; icicle-incremental-completion-p, icicle-inhibit-sort-p, icicle-inhibit-try-switch-buffer, ;; icicle-kill-history, icicle-kmacro-alist, icicle-kmacro-history,icicle-list-use-nth-parts, ;; icicle-must-match-regexp, icicle-must-not-match-regexp, icicle-must-pass-after-match-predicate, ;; icicle-new-last-cmd, icicle-orig-buff, icicle-orig-must-pass-after-match-pred, ;; icicle-orig-pt-explore, icicle-orig-window, icicle-orig-win-explore, icicle-pref-arg, ;; icicle-previous-raw-file-name-inputs, icicle-previous-raw-non-file-name-inputs, icicle-prompt, ;; icicle-proxy-candidates, icicle-read-expression-map, icicle-remove-icicles-props-p, ;; icicle-re-no-dot, icicle-saved-completion-candidates, icicle-search-history, ;; icicle-transform-before-sort-p, icicle-use-candidates-only-once-alt-p, ;; icicle-whole-candidate-as-text-prop-p, icicle-variable-name-history (require 'icicles-fn) ; (This is required anyway by `icicles-mcmd.el'.) ;; icicle-delete-dups, icicle-highlight-lighter, icicle-multi-comp-apropos-complete-match, ;; icicle-read-from-minibuf-nil-default, icicle-string-match-p ;; Byte-compiling this file, you will likely get some byte-compiler warning messages. ;; These are probably benign - ignore them. Icicles is designed to work with multiple ;; versions of Emacs, and that fact provokes compiler warnings. If you get byte-compiler ;; errors (not warnings), then please report a bug, using `M-x icicle-send-bug-report'. ;;; Some defvars to quiet byte-compiler a bit: (when (< emacs-major-version 21) (defvar eval-expression-debug-on-error)) (when (< emacs-major-version 22) (defvar history-delete-duplicates) (defvar icicle-kmacro-alist) ; In `icicles-var.el' (defvar kmacro-ring) ; In `kmacro.el' (defvar read-file-name-completion-ignore-case) ; In `minibuffer.el' (defvar recentf-list) ; In `recentf.el' (defvar tags-case-fold-search) ; In `etags.el' (defvar tooltip-mode)) ; In `tooltip.el' (when (< emacs-major-version 23) (defvar read-buffer-completion-ignore-case)) (when (< emacs-major-version 24) (defvar minibuffer-local-filename-syntax)) (defvar apropos-do-all) ; In `apropos.el' (defvar bbdb-complete-mail-allow-cycling) ; In `bbdb-com.el' (defvar bbdb-complete-name-allow-cycling) ; In `bbdb-com.el' (defvar bbdb-completion-list) ; In `bbdb-come.el' (defvar bbdb-extract-address-components-func) ; In `bbdb-com.el' (defvar bbdb-expand-mail-aliases) ; In `bbdb-com.el' (defvar bbdb-complete-name-hooks) ; In `bbdb-com.el' (defvar bbdb-completion-display-record) ; In `bbdb.el' (defvar bbdb-completion-type) ; In `bbdb.el' (defvar bbdb-hashtable) ; In `bbdb.el' (defvar bbdb-version) ; In `bbdb.el' (defvar bmkp-non-file-filename) ; In `bookmark+-1.el' (defvar bmkp-prompt-for-tags-flag) ; In `bookmark+-1.el' (defvar bmkp-sorted-alist) ; In `bookmark+-1.el' (defvar bookmark-current-point) ; In `bookmark.el' for Emacs < (defvar color-theme) ; In `color-theme.el' (defvar color-themes) ; In `color-theme.el' (defvar color-theme-initialized) ; In `color-theme.el' (defvar cookie-cache) (defvar dabbrev--last-obarray) ; In `dabbrev.el' for Emacs < 24 (defvar dabbrev--last-completion-buffer) ; In `dabbrev.el' for Emacs < 24 (defvar ess-current-process-name) ; In `ess-inf.el' (defvar ess-mode-syntax-table) ; In `ess-cust.el' (defvar ess-use-R-completion) ; In `ess-cust.el' (defvar existing-bufs) ; `icicle-visit-marked-file-of-content', `icicle-find-file-of-content' (defvar file-cache-alist) ; In `filecache.el' (defvar filesets-data) ; In `filesets.el' (defvar find-tag-default-function) ; In `etags.el' (defvar find-tag-marker-ring) ; In `etags.el' (defvar goto-tag-location-function) ; In `etags.el' (defvar icicle-buffer-easy-files) ; Here (defvar icicle-clear-history-hist) ; In `icicle-clear-history-1',`icicle-clear-current-history' (defvar icicle--last-toggle-transforming-msg) ; Here (defvar icicle-window-alist) ; In `icicle-select-window' (defvar locate-make-command-line) ; In `locate.el' (defvar proced-signal-list) ; In `proced.el' (Emacs 23+) (defvar shell-completion-execonly) ; In `shell.el' (defvar snarf-tag-function) ; In `etags.el' (defvar translation-table-for-input) ; Built-in, Emacs 21+ (defvar w3m-current-title) ; In `w3m.el' (defvar yow-after-load-message) (defvar yow-file) (defvar yow-load-message) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Icicles Top-Level Commands, Part 1") ;;; Icicles Top-Level Commands, Part 1 . . . . . . . . . ;; REPLACE ORIGINAL `pp-eval-expression' defined in `pp.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; This is essentially the same as `pp-eval-expression' defined in `pp+.el'. ;; ;; 1. Read with completion, using `icicle-read-expression-map'. ;; 2. Progress message added. ;; 3. Added optional arg and insertion behavior. ;; 4. Respect `icicle-pp-eval-expression-print-length', `icicle-pp-eval-expression-print-level', ;; and `eval-expression-debug-on-error'. ;; 5. Adjusted to work in different Emacs releases. ;; (defun icicle-pp-eval-expression (expression ; Bound to `M-:' in Icicle mode. &optional insert-value) "Evaluate Emacs-Lisp sexp EXPRESSION, and pretty-print its value. Add the value to the front of the variable `values'. With a prefix arg, insert the value into the current buffer at point. With a negative prefix arg, if the value is a string, then insert it into the buffer without double-quotes (`\"'). With no prefix arg: If the value fits on one line (frame width) show it in the echo area. Otherwise, show the value in buffer `*Pp Eval Output*'. This command respects user options `icicle-pp-eval-expression-print-length', `icicle-pp-eval-expression-print-level', and `eval-expression-debug-on-error'. Emacs-Lisp mode completion and indentation bindings are in effect. By default, Icicle mode remaps all key sequences that are normally bound to `eval-expression' or `pp-eval-expression' to `icicle-pp-eval-expression'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive (list (read-from-minibuffer "Eval: " nil icicle-read-expression-map t 'read-expression-history) current-prefix-arg)) (message "Evaluating...") (if (or (not (boundp 'eval-expression-debug-on-error)) (null eval-expression-debug-on-error)) (setq values (cons (eval expression) values)) (let ((old-value (make-symbol "t")) new-value) ;; Bind debug-on-error to something unique so that we can ;; detect when evaled code changes it. (let ((debug-on-error old-value)) (setq values (cons (eval expression) values) new-value debug-on-error)) ;; If evaled code has changed the value of debug-on-error, ;; propagate that change to the global binding. (unless (eq old-value new-value) (setq debug-on-error new-value)))) (let ((print-length icicle-pp-eval-expression-print-length) (print-level icicle-pp-eval-expression-print-level) (deactivate-mark nil)) (cond (insert-value (message "Evaluating...done. Value inserted.") (setq insert-value (prefix-numeric-value insert-value)) (if (or (not (stringp (car values))) (wholenump insert-value)) (pp (car values) (current-buffer)) (princ (car values) (current-buffer)))) (t (icicle-pp-display-expression (car values) "*Pp Eval Output*"))))) ;; REPLACE ORIGINAL in `pp.el': ;; ;; 1. Use no `emacs-lisp-mode-hook' or `change-major-mode-hook'. ;; 2. Call `font-lock-fontify-buffer'. ;; ;; Same as `pp-display-expression' definition in `pp+.el'. ;; (defun icicle-pp-display-expression (expression out-buffer-name) "Prettify and show EXPRESSION in a way appropriate to its length. If a temporary buffer is needed for representation, it is named OUT-BUFFER-NAME." (let* ((old-show-function temp-buffer-show-function) ;; Use this function to display the buffer. ;; This function either decides not to display it at all ;; or displays it in the usual way. (temp-buffer-show-function `(lambda (buf) (with-current-buffer buf (goto-char (point-min)) (end-of-line 1) (if (or (< (1+ (point)) (point-max)) (>= (- (point) (point-min)) (frame-width))) (let ((temp-buffer-show-function ',old-show-function) (old-selected (selected-window)) (window (display-buffer buf))) (goto-char (point-min)) ; expected by some hooks ... (make-frame-visible (window-frame window)) (unwind-protect (progn (select-window window) (run-hooks 'temp-buffer-show-hook)) (when (window-live-p old-selected) (select-window old-selected)) (message "Evaluating...done. See buffer `%s'." out-buffer-name))) (message "%s" (buffer-substring (point-min) (point)))))))) (with-output-to-temp-buffer out-buffer-name (pp expression) (with-current-buffer standard-output (setq buffer-read-only nil) ;; Avoid `let'-binding because `change-major-mode-hook' is local. ;; IOW, avoid this runtime message: ;; "Making change-major-mode-hook buffer-local while locally let-bound!" ;; Suggestion from Stefan M.: Can just set these hooks instead of binding, ;; because they are not permanent-local. They'll be emptied and ;; repopulated as needed by the call to emacs-lisp-mode. (set (make-local-variable 'emacs-lisp-mode-hook) nil) (set (make-local-variable 'change-major-mode-hook) nil) (emacs-lisp-mode) (set (make-local-variable 'font-lock-verbose) nil) (font-lock-fontify-buffer))))) (defun icicle-shell-command-on-file (file) "Read a shell command and invoke it, passing FILE as an argument." (dired-run-shell-command (dired-shell-stuff-it (icicle-read-shell-command (format "! on `%s': " file)) (list file) nil))) (defun icicle-recompute-shell-command-candidates (&optional savep) "Update option `icicle-shell-command-candidates-cache'. Recompute the available shell commands using your search path. Return the new option value. With a prefix argument, the updated option is saved persistently. If the value of option `icicle-guess-commands-in-path' is not `load', then turning on Icicle mode (again) resets the cache value to (). If the value of `icicle-guess-commands-in-path' is `first-use', then the cache is updated when you next use it, but it is not saved." (interactive "P") (setq icicle-shell-command-candidates-cache (icicle-compute-shell-command-candidates)) (when savep (funcall icicle-customize-save-variable-function 'icicle-shell-command-candidates-cache icicle-shell-command-candidates-cache)) icicle-shell-command-candidates-cache) ;; REPLACE ORIGINAL `comint-completion-at-point' defined in `comint.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; (when (> emacs-major-version 23) (defalias 'icicle-comint-completion-at-point 'icicle-comint-dynamic-complete)) ;; REPLACE ORIGINAL `comint-dynamic-complete' defined in `comint.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Use Icicles completion when there are multiple candidates. ;; (defun icicle-comint-dynamic-complete () ; Bound to `TAB' in Comint (and Shell) mode. "Dynamically perform completion at point. Calls the functions in `comint-dynamic-complete-functions', but with Icicles functions substituted, to perform completion until a function returns non-nil. Return that value." (interactive) ;; Need a symbol for `run-hook-with-args-until-success', so bind one. (let ((hook (icicle-comint-replace-orig-completion-fns))) (run-hook-with-args-until-success 'hook))) (defun icicle-comint-replace-orig-completion-fns () "Return `comint-dynamic-complete-functions', but with Icicles functions. Get the Icicles functions from option `icicle-comint-dynamic-complete-replacements'. Only one (the first matching) replacement is made for any function." (let ((result ()) (replacements (copy-sequence icicle-comint-dynamic-complete-replacements))) (dolist (fn comint-dynamic-complete-functions) (catch 'c-d-c-f-replacements-loop (dolist (rep replacements) (when (or (eq (car rep) fn) (and (listp (car rep)) (memq fn (car rep)))) (push (eval (cadr rep)) result) (unless (eq (car rep) fn) (push fn result)) (setq replacements (delete rep replacements)) ; For ((a b c) 'NEW), put NEW in front of only one. (throw 'c-d-c-f-replacements-loop nil))) ; Allow only one replacement. (push fn result))) (nreverse result))) (defun icicle-comint-dynamic-complete-filename (&optional replace-to-eol-p) "Dynamically complete the file name before point, using Icicles completion. Similar to `comint-replace-by-expanded-filename', except that this does not change parts of the file name already in the buffer before point. It just appends completion characters at point. Return t if successful, nil otherwise. With a prefix arg, replace the rest of the line after point with the completion choice. Otherwise, replace only the filename-matching text before point. Completion is dependent on the value of `comint-completion-addsuffix', `comint-completion-recexact' and `comint-completion-fignore', and the timing of completions listing is dependent on the value of `comint-completion-autolist'. See also `comint-match-partial-filename' and `icicle-comint-dynamic-complete-as-filename'." (interactive "P") (require 'comint) (when (comint-match-partial-filename) (unless (window-minibuffer-p (selected-window)) (message "Completing file name...")) (icicle-comint-dynamic-complete-as-filename replace-to-eol-p))) (defun icicle-comint-dynamic-complete-as-filename (&optional replace-to-eol-p) "Dynamically complete at point as a filename. Optional arg REPLACE-TO-EOL-P non-nil means replace the rest of the line after point with the completion choice. Return t if successful. See `icicle-comint-dynamic-complete-filename'." (lexical-let* ((completion-ignore-case (if (boundp 'read-file-name-completion-ignore-case) read-file-name-completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin)))) (completion-ignored-extensions comint-completion-fignore) (minibuffer-p (window-minibuffer-p (selected-window))) (success t) (dirsuffix (cond ((not comint-completion-addsuffix) "") ((not (consp comint-completion-addsuffix)) "/") (t (car comint-completion-addsuffix)))) (filesuffix (cond ((not comint-completion-addsuffix) "") ((not (consp comint-completion-addsuffix)) " ") (t (cdr comint-completion-addsuffix)))) (filename (comint-match-partial-filename)) (filename-beg (if filename (match-beginning 0) (point))) (filename-end (if filename (if replace-to-eol-p (line-end-position) (match-end 0)) (point))) (filename (or filename "")) (filedir (file-name-directory filename)) (filenondir (file-name-nondirectory filename)) (directory (if filedir (comint-directory filedir) default-directory)) (completion (file-name-completion filenondir directory))) (cond ((null completion) (if minibuffer-p (minibuffer-message (format " [No completions of `%s']" filename)) (message "No completions of `%s'" filename)) (setq success nil)) ((eq completion t) ; Already completed: "the-file". (insert filesuffix) (unless minibuffer-p (message "Sole completion"))) ((string-equal completion "") ; A directory: "dir/" - complete it. (icicle-condition-case-no-debug nil (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (icicle-top-level-when-sole-completion-flag t) (choice (save-excursion (save-window-excursion (read-file-name "Complete: " directory nil t))))) (when (and choice (not (string= choice directory))) (insert (comint-quote-filename (directory-file-name (file-relative-name choice directory)))) (insert (if (file-directory-p choice) dirsuffix filesuffix)) (when replace-to-eol-p (delete-region (point) (line-end-position))))) (error nil))) (t ; COMPLETION is the common prefix string. (let ((file (concat (file-name-as-directory directory) completion)) (use-dialog-box nil)) ; Inhibit use of open-file dialog box if called from menu. ;; Insert completion. The completion string might have a different case from ;; what's in the prompt, if `read-file-name-completion-ignore-case' is non-nil. (delete-region filename-beg filename-end) (if filedir (insert (comint-quote-filename filedir))) (insert (comint-quote-filename (directory-file-name completion))) (cond ((symbolp (file-name-completion completion directory)) ;; We inserted a unique completion. Add suffix. (insert (if (file-directory-p file) dirsuffix filesuffix)) (unless minibuffer-p (message "Completed"))) ((and comint-completion-recexact comint-completion-addsuffix (string-equal filenondir completion) (or (icicle-file-remote-p file) ; Don't let Tramp try to access it. (file-exists-p file))) ;; It's not unique, but user wants shortest match. (insert (if (file-directory-p file) dirsuffix filesuffix)) (unless minibuffer-p (message "Completed shortest"))) ;; It's not unique. Let user choose a completion. ((or comint-completion-autolist (string-equal filenondir completion)) (icicle-condition-case-no-debug nil (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (icicle-top-level-when-sole-completion-flag t) (choice (save-excursion (save-window-excursion (read-file-name "Complete: " directory completion nil completion (and (> emacs-major-version 21) (lambda (f) (string-match completion f)))))))) ; FREE: COMPLETION. (when choice (delete-backward-char (length completion)) (insert (comint-quote-filename (directory-file-name (file-relative-name choice directory)))) (insert (if (file-directory-p choice) dirsuffix filesuffix)))) (error nil))) (t (unless minibuffer-p (message "Partially completed"))))))) success)) (defun icicle-shell-dynamic-complete-command () "Dynamically complete the command at point. Similar to `icicle-comint-dynamic-complete-filename', but this searches `exec-path' (minus the trailing Emacs library path) for completion candidates. Note that this may not be the same as the shell's idea of the path. Completion is dependent on the value of `shell-completion-execonly', plus those that effect file completion. See `icicle-shell-dynamic-complete-as-command'. Returns t if successful. Uses Icicles completion." (interactive) (let ((filename (comint-match-partial-filename))) (if (and filename (save-match-data (not (string-match "[~/]" filename))) (eq (match-beginning 0) (save-excursion (shell-backward-command 1) (point)))) (prog2 (unless (window-minibuffer-p (selected-window)) (message "Completing command name...")) (icicle-shell-dynamic-complete-as-command))))) (defun icicle-shell-dynamic-complete-as-command () "Dynamically complete text at point as a command. See `icicle-shell-dynamic-complete-filename'. Return t if successful." (let* ((filename (or (comint-match-partial-filename) "")) (filenondir (file-name-nondirectory filename)) (path-dirs (cdr (reverse exec-path))) (cwd (file-name-as-directory (expand-file-name default-directory))) (ignored-extensions (and comint-completion-fignore (mapconcat (lambda (x) (concat (regexp-quote x) "$")) comint-completion-fignore "\\|"))) (dir "") (comps-in-dir ()) (file "") (abs-file-name "") (completions ())) (while path-dirs ; Go thru each dir in the search path, finding completions. (setq dir (file-name-as-directory (comint-directory (or (car path-dirs) "."))) comps-in-dir (and (file-accessible-directory-p dir) (file-name-all-completions filenondir dir))) (while comps-in-dir ; Go thru each completion, to see whether it should be used. (setq file (car comps-in-dir) abs-file-name (concat dir file)) (when (and (not (member file completions)) (not (and ignored-extensions (string-match ignored-extensions file))) (or (string-equal dir cwd) (not (file-directory-p abs-file-name))) (or (null shell-completion-execonly) (file-executable-p abs-file-name))) (setq completions (cons file completions))) (setq comps-in-dir (cdr comps-in-dir))) (setq path-dirs (cdr path-dirs))) (let ((success (let ((comint-completion-addsuffix nil) (icicle-candidate-help-fn (lambda (cand) (with-output-to-temp-buffer "*Help*" (princ (shell-command-to-string (concat "apropos " (shell-quote-argument cand)))))))) (icicle-comint-dynamic-simple-complete filenondir completions)))) (when (and (memq success '(sole shortest)) comint-completion-addsuffix (not (file-directory-p (comint-match-partial-filename)))) (insert " ")) success))) (defun icicle-comint-replace-by-expanded-filename (&optional replace-to-eol-p) "Dynamically complete, expand, and canonicalize the filename at point. With a prefix arg, replace everthing past point on the current line. Otherwise, replace only the filename-matching text before point. Like vanilla `comint-replace-by-expanded-filename', but uses Icicles completion." (interactive "P") (let ((filename (comint-match-partial-filename))) (when filename (replace-match (expand-file-name filename) t t) (icicle-comint-dynamic-complete-filename replace-to-eol-p)))) (defun icicle-comint-dynamic-simple-complete (stub candidates) "Dynamically complete STUB from CANDIDATES list. Inserts completion characters at point by completing STUB from the strings in CANDIDATES. Uses Icicles completion if completion is ambiguous. Returns nil if no completion was inserted. Returns `sole' if completed with the only completion match. Returns `shortest' if completed with the shortest of the completion matches. Returns `partial' if completed as far as possible with the completion matches. Returns `listed' if a completion listing was shown. See also `icicle-comint-dynamic-complete-filename'." (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) (minibuffer-p (window-minibuffer-p (selected-window))) (suffix (cond ((not comint-completion-addsuffix) "") ((not (consp comint-completion-addsuffix)) " ") (t (cdr comint-completion-addsuffix)))) (candidates (mapcar #'list candidates)) (completions (all-completions stub candidates))) (cond ((null completions) (if minibuffer-p (minibuffer-message (format " [No completions of `%s']" stub)) (message "No completions of `%s'" stub)) nil) ((= 1 (length completions)) (let ((completion (car completions))) (if (string-equal completion stub) (unless minibuffer-p (message "Sole completion")) (insert (substring completion (length stub))) (unless minibuffer-p (message "Completed"))) (insert suffix) 'sole)) (t ; There's no unique completion. (let ((completion (try-completion stub candidates))) ;; Insert the longest substring. (insert (substring completion (length stub))) (cond ((and comint-completion-recexact comint-completion-addsuffix (string-equal stub completion) (member completion completions)) (insert suffix) ; User wants shortest match. (unless minibuffer-p (message "Completed shortest")) 'shortest) ((or comint-completion-autolist (string-equal stub completion)) (icicle-condition-case-no-debug nil ; Let user choose a completion. (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (icicle-top-level-when-sole-completion-flag t) (choice (save-excursion (completing-read "Complete: " (mapcar #'list completions) nil t nil nil completion)))) (when choice (delete-backward-char (length completion)) (insert choice suffix))) (error nil)) 'listed) (t (unless minibuffer-p (message "Partially completed")) 'partial))))))) (defun icicle-shell-dynamic-complete-filename () "Dynamically complete the filename at point. Completes only if point is at a suitable position for a filename argument." (interactive) (let ((opoint (point)) (beg (comint-line-beginning-position))) (when (save-excursion (goto-char (if (re-search-backward "[;|&]" beg t) (match-end 0) beg)) (re-search-forward "[^ \t][ \t]" opoint t)) (icicle-comint-dynamic-complete-as-filename)))) (defun icicle-shell-dynamic-complete-environment-variable () "`shell-dynamic-complete-environment-variable' but uses Icicles completion." (interactive) (require 'shell) (let ((variable (shell-match-partial-variable))) (if (and variable (string-match "^\\$" variable)) (prog2 (unless (window-minibuffer-p (selected-window)) (message "Completing variable name...")) (icicle-shell-dynamic-complete-as-environment-variable))))) (defun icicle-shell-dynamic-complete-as-environment-variable () "`shell-dynamic-complete-as-environment-variable' but uses Icicles completion." (require 'shell) (let* ((var (or (shell-match-partial-variable) "")) (variable (substring var (or (string-match "[^$({]\\|$" var) 0))) (variables (mapcar (lambda (x) (substring x 0 (string-match "=" x))) process-environment)) (addsuffix comint-completion-addsuffix) (comint-completion-addsuffix nil) (success (icicle-comint-dynamic-simple-complete variable variables))) (if (memq success '(sole shortest)) (let* ((var (shell-match-partial-variable)) (variable (substring var (string-match "[^$({]" var))) (protection (cond ((string-match "{" var) "}") ((string-match "(" var) ")") (t ""))) (suffix (cond ((null addsuffix) "") ((file-directory-p (comint-directory (getenv variable))) "/") (t " ")))) (insert protection suffix))) success)) ;; Save vanilla `file' widget as `icicle-ORIG-file' widget, for restoring when you quit Icicle mode. (unless (get 'icicle-ORIG-file 'widget-type) (put 'icicle-ORIG-file 'widget-type (get 'file 'widget-type)) (put 'icicle-ORIG-file 'widget-documentation (get 'file 'widget-documentation))) (define-widget 'icicle-file 'string "Icicles version of the `file' widget. Reads a file name from an editable text field, with Icicles completion." ;; `icicle-widget-file-complete' handles both nil and non-nil `icicle-mode'. ;; Use the following instead of: ;; :completions #'completion-file-name-table :complete-function #'icicle-widget-file-complete :prompt-value 'widget-file-prompt-value :format "%{%t%}: %v" ;; Vanilla Emacs comment: This does not work well with terminating newline. ;; :value-face 'widget-single-line-field :tag "File") (defun icicle-widget-file-complete (&optional replace-to-eol-p) "Perform Icicles completion on the file name at point. Like `widget-file-complete' (`widget-complete', for Emacs 24+), but allows Icicles completion. With a prefix arg, replace everthing past point on the current line. Otherwise, replace only the filename-matching text before point." (interactive "P") (if (and (boundp 'icicle-mode) icicle-mode) (let ((comint-completion-addsuffix nil)) ; Do not append a space. (icicle-comint-dynamic-complete-filename replace-to-eol-p)) (cond ((> emacs-major-version 23) ;; Vanilla Emacs 24+ `file' widget just has this: ;; :completions #'completion-file-name-table ;; But we need the equivalent using `:complete-function', not `:completions'. ;; This is it - this is in fact the Emacs 23 `widget-file-complete'. ;; See `widget-default-completions' for the relations between keywords ;; `:completions' and `:complete-function'. (let* ((field (widget-field-find (point))) (start (widget-field-start field)) (end (max (point) (widget-field-text-end field)))) (completion-in-region start end #'completion-file-name-table))) (t (widget-file-complete))))) (defun icicle-gud-gdb-complete-command (&optional command a b) "`gud-gdb-complete-command', but uses Icicles completion. Perform completion on the GDB command preceding point." (interactive) (if command (setq command (concat "p " command)) ; Used by gud-watch in mini-buffer. (let ((end (point))) ; Used in GUD buffer. (setq command (buffer-substring (comint-line-beginning-position) end)))) (let* ((command-word ;; Find the word break. This match will always succeed. (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) (substring command (match-beginning 2)))) (complete-list (gud-gdb-run-command-fetch-lines (concat "complete " command) (current-buffer) ;; From string-match above. (match-beginning 2)))) ;; Protect against old versions of GDB. (and complete-list (string-match "^Undefined command: \"complete\"" (car complete-list)) (icicle-user-error "This version of GDB does not support command `complete'")) ;; Sort the list like readline. (setq complete-list (sort complete-list (function string-lessp))) ;; Remove duplicates. (let ((first complete-list) (second (cdr complete-list))) (while second (if (string-equal (car first) (car second)) (setcdr first (setq second (cdr second))) (setq first second second (cdr second))))) ;; Add a trailing single quote if there is a unique completion ;; and it contains an odd number of unquoted single quotes. (and (= (length complete-list) 1) (let ((str (car complete-list)) (pos 0) (count 0)) (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos) (setq count (1+ count) pos (match-end 0))) (and (= (mod count 2) 1) (setq complete-list (list (concat str "'")))))) ;; Let comint handle the rest. (icicle-comint-dynamic-simple-complete command-word complete-list))) ;; REPLACE ORIGINAL `dabbrev-completion' defined in `dabbrev.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; You can complete from an empty abbrev also. ;; Uses Icicles completion when there are multiple candidates. ;; (when (< emacs-major-version 24) ; $$$$$$$$ TODO: Update this for Emacs 24+. (when (and (fboundp 'dabbrev-completion) (not (fboundp 'icicle-ORIG-dabbrev-completion))) (defalias 'icicle-ORIG-dabbrev-completion (symbol-function 'dabbrev-completion))) (defun icicle-dabbrev-completion (&optional arg) ; Bound to `C-M-/' globally. "Completion on current word. Like \\[dabbrev-expand], but finds all expansions in the current buffer and presents suggestions for completion. With a prefix argument, it searches all buffers accepted by `dabbrev-friend-buffer-function', to find the completions. If the prefix argument is 16 (which comes from `C-u C-u'), then it searches *ALL* buffers. With no prefix argument, it reuses an old completion list if there is a suitable one already." (interactive "*P") (unless (featurep 'dabbrev) (unless (require 'dabbrev nil t) (error "Library `dabbrev' not found")) (icicle-mode 1)) ; Redefine `dabbrev-completion' to Icicles version. (dabbrev--reset-global-variables) (let* ((dabbrev-check-other-buffers (and arg t)) ; Must be t (dabbrev-check-all-buffers (and arg (= (prefix-numeric-value arg) 16))) (abbrev (icicle-dabbrev--abbrev-at-point)) (ignore-case-p (and (if (eq dabbrev-case-fold-search 'case-fold-search) case-fold-search dabbrev-case-fold-search) (or (not dabbrev-upcase-means-case-search) (string= abbrev (downcase abbrev))))) (my-obarray dabbrev--last-obarray) init) ;; If new abbreviation to expand, then expand it. (save-excursion (unless (and (null arg) my-obarray (or (eq dabbrev--last-completion-buffer (current-buffer)) (and (window-minibuffer-p (selected-window)) (eq dabbrev--last-completion-buffer (dabbrev--minibuffer-origin)))) dabbrev--last-abbreviation (>= (length abbrev) (length dabbrev--last-abbreviation)) (string= dabbrev--last-abbreviation (substring abbrev 0 (length dabbrev--last-abbreviation))) (setq init (try-completion abbrev my-obarray))) (setq dabbrev--last-abbreviation abbrev) (let ((completion-list (dabbrev--find-all-expansions abbrev ignore-case-p)) (completion-ignore-case ignore-case-p)) ;; Make an obarray with all expansions (setq my-obarray (make-vector (length completion-list) 0)) (unless (> (length my-obarray) 0) (icicle-user-error "No dynamic expansion for \"%s\" found%s" abbrev (if dabbrev--check-other-buffers "" " in this-buffer"))) (dolist (string completion-list) (cond ((or (not ignore-case-p) (not dabbrev-case-replace)) (intern string my-obarray)) ((string= abbrev (icicle-upcase abbrev)) (intern (icicle-upcase string) my-obarray)) ((string= (substring abbrev 0 1) (icicle-upcase (substring abbrev 0 1))) (intern (capitalize string) my-obarray)) (t (intern (downcase string) my-obarray)))) (setq dabbrev--last-obarray my-obarray dabbrev--last-completion-buffer (current-buffer) ;; Find the expanded common string. init (try-completion abbrev my-obarray))))) ;; Let the user choose between the expansions (unless (stringp init) (setq init abbrev)) (cond ((and (not (string-equal init "")) (not (string-equal (downcase init) (downcase abbrev))) (<= (length (all-completions init my-obarray)) 1)) (message "Completed (no other completions)") (if (< emacs-major-version 21) (dabbrev--substitute-expansion nil abbrev init) (dabbrev--substitute-expansion nil abbrev init nil)) (when (window-minibuffer-p (selected-window)) (message nil))) ;;$$ ;; Complete text only up through the common root. NOT USED. ;; ((and icicle-dabbrev-stop-at-common-root-p ;; (not (string-equal init "")) ;; (not (string-equal (downcase init) (downcase abbrev)))) ;; (message "Use `%s' again to complete further" ;; (icicle-key-description (this-command-keys) nil icicle-key-descriptions-use-<>-flag)) ;; (if (< emacs-major-version 21) ;; (dabbrev--substitute-expansion nil abbrev init) ;; (dabbrev--substitute-expansion nil abbrev init nil)) ;; (when (window-minibuffer-p (selected-window)) (message nil))) ; $$ NEEDED? (t ;; String is a common root already. Use Icicles completion. (icicle-highlight-lighter) (message "Making completion list...") (search-backward abbrev) (replace-match "") (condition-case nil (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (minibuffer-completion-table my-obarray) (choice (completing-read "Complete: " my-obarray nil nil init nil init))) (when choice (insert choice))) (quit (insert abbrev))))))) (defun icicle-dabbrev--abbrev-at-point () "Like `dabbrev--abbrev-at-point', but returns \"\" if there is no match. Vanilla `dabbrev--abbrev-at-point' raises an error if no match." (let ((abv "")) (setq dabbrev--last-abbrev-location (point)) ; Record the end of the abbreviation. (unless (bobp) (save-excursion ; Return abbrev at point ;; If we aren't right after an abbreviation, move point back to just after one. ;; This is so the user can get successive words by typing the punctuation followed by M-/. (save-match-data (when (and (save-excursion (forward-char -1) (not (looking-at (concat "\\(" (or dabbrev-abbrev-char-regexp "\\sw\\|\\s_") "\\)+")))) (re-search-backward (or dabbrev-abbrev-char-regexp "\\sw\\|\\s_") nil t)) (forward-char 1))) (dabbrev--goto-start-of-abbrev) ; Now find the beginning of that one. (setq abv (buffer-substring-no-properties dabbrev--last-abbrev-location (point))))) abv))) ;; REPLACE ORIGINAL `bbdb-complete-mail' defined in `bbdb-com.el', version 3.02 ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; BBDB Version 3.02, the Insidious Big Brother Database, is available here: http://melpa.milkbox.net/. ;; ;; Uses Icicles completion when there are multiple candidates. ;; ;; Free vars here: `bbdb-*' are bound in `bbdb-com.el'. (defun icicle-bbdb-complete-mail (&optional start-pos cycle-completion-buffer) "In a mail buffer, complete the user name or mail address before point. Completes up to the preceding newline, colon or comma, or the value of START-POS. Returns non-nil if there is a valid completion, else return nil. You can control completion behaviour using `bbdb-completion-list' \(`bbdb-completion-type' in older BBDB versions). If what has been typed is unique, insert an entry \"User Name \" - but see `bbdb-mail-allow-redundancy' \(`bbdb-dwim-net-address-allow-redundancy' in older BBDB versions). If it is a valid completion but not unique, you can choose from the list of completions using Icicles completion. If your input is completed and `bbdb-complete-mail-allow-cycling' is true (`bbdb-complete-name-allow-cycling' for older BBDB versions), you can repeat to cycle through the nets for the matching record. When called with a prefix arg, display a list of all mail messages available for cycling. See your version of BBDB for more information." (interactive (list nil current-prefix-arg)) (unless (and (require 'bbdb nil t) (require 'bbdb-com nil t) (fboundp 'bbdb-complete-mail)) (icicle-user-error "`icicle-bbdb-complete-mail' requires a BBDB version such as 3.02")) (bbdb-buffer) ; Make sure database is initialized. (lexical-let* ((end (point)) (beg (or start-pos (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point)))) (orig (buffer-substring beg end)) (typed (downcase orig)) (pattern (bbdb-string-trim typed)) (completion-ignore-case t) (completion (try-completion pattern bbdb-hashtable #'bbdb-completion-predicate)) (all-the-completions ()) dwim-completions one-record done) ;; [:,] match would be interpreted as START-POS (e.g., a comma in LF-NAME). Compensate. (when (and (stringp completion) (string-match "[:,]" completion)) (setq completion (substring completion 0 (match-beginning 0)))) ;; Cannot use `all-completions' to set `all-the-completions' because it converts symbols to strings. (all-completions pattern bbdb-hashtable (lambda (sym) (when (bbdb-completion-predicate sym) (push sym all-the-completions)))) ;; Resolve records matching pattern. Multiple completions could match the same record. (let ((records (icicle-delete-dups (apply #'append (mapcar #'symbol-value all-the-completions))))) (setq one-record (and (not (cdr records)) (car records)))) ; Only one matching record. (icicle-remove-Completions-window) (cond (one-record ;; Only one matching record. ;; Determine mail address of ONE-RECORD to use for ADDRESS. ;; Do we have a preferential order for the following tests? (let ((completion-list (if (eq t bbdb-completion-list) '(fl-name lf-name mail aka organization) bbdb-completion-list)) (mails (bbdb-record-mail one-record)) mail elt) (unless mails (error "Matching record has no `mail' field")) ;; (1) If PATTERN matches name, AKA, or organization of ONE-RECORD, ;; then ADDRESS is the first mail address of ONE-RECORD. (if (try-completion pattern (append (and (memq 'fl-name completion-list) (list (or (bbdb-record-name one-record) ""))) (and (memq 'lf-name completion-list) (list (or (bbdb-record-name-lf one-record) ""))) (and (memq 'aka completion-list) (bbdb-record-field one-record 'aka-all)) (and (memq 'organization completion-list) (bbdb-record-organization one-record)))) (setq mail (car mails))) ;; (2) If PATTERN matches one or multiple mail addresses of ONE-RECORD, ;; then we take the first one matching PATTERN. (unless mail (while (setq elt (pop mails)) (if (try-completion pattern (list elt)) (setq mail elt mails ())))) (unless mail (error "`icicle-bbdb-complete-mail': No match for `%s'" pattern)) ; Indicates a bug! (let ((address (bbdb-dwim-mail one-record mail))) (if (string= address (buffer-substring-no-properties beg end)) (unless (and bbdb-complete-mail-allow-cycling (< 1 (length (bbdb-record-mail one-record)))) (setq done 'UNCHANGED)) (delete-region beg end) ; Replace text with expansion. (insert address) (bbdb-complete-mail-cleanup address) (setq done 'UNIQUE))))) ;; Completed partially. ;; Cannot use trimmed version of pattern here, else recurse infinitely on, e.g., common first names. ((and (stringp completion) (not (string= typed completion))) (delete-region beg end) (insert completion) (setq done 'PARTIAL)) ;; Partial match not allowing further partial completion. (completion (let ((completion-list (if (eq t bbdb-completion-list) '(fl-name lf-name mail aka organization) bbdb-completion-list)) sname records) ;; Collect dwim-addresses for each completion, but only once for each record! ;; Add if mail is part of the completions. (dolist (sym all-the-completions) (setq sname (symbol-name sym)) (dolist (record (symbol-value sym)) (unless (memq record records) (push record records) (let ((mails (bbdb-record-mail record)) accept) (when mails (dolist (field completion-list) (if (case field (fl-name (bbdb-string= sname (bbdb-record-name record))) (lf-name (bbdb-string= sname (bbdb-cache-lf-name (bbdb-record-cache record)))) (aka (member-ignore-case sname (bbdb-record-field record 'aka-all))) (organization (member-ignore-case sname (bbdb-record-organization record))) (primary (bbdb-string= sname (car mails))) (otherwise nil)) (push (car mails) accept) (when (eq field 'mail) (dolist (mail mails) (when (bbdb-string= sname mail) (push mail accept)))))) (when accept ;; If DWIM-COMPLETIONS contains only one element, set DONE to `UNIQUE' (see below) ;; and we want to know ONE-RECORD. (setq one-record record) (dolist (mail (delete-dups accept)) (push (bbdb-dwim-mail record mail) dwim-completions)))))))) (cond ((not dwim-completions) (error "No mail address for \"%s\"" orig)) ;; DWIM-COMPLETIONS might contain only one element, if multiple completions match the ;; same record. In that case proceed with DONE set to `UNIQUE'. ((eq 1 (length dwim-completions)) (delete-region beg end) (insert (car dwim-completions)) (bbdb-complete-mail-cleanup (car dwim-completions)) (setq done 'UNIQUE)) (t (setq done 'CHOOSE)))))) ;; If no completion so far, consider cycling. ;; Completion is controlled by option `bbdb-completion-list'. Cycling assumes that ORIG already holds ;; a valid RFC 822 mail address. So cycling can consider different records than completion. (when (and (not done) bbdb-complete-mail-allow-cycling) ;; Find the record we are working on. (let* ((address (mail-extract-address-components orig)) (record (and (listp address) (car (bbdb-message-search (nth 0 address) (nth 1 address))))) (mails (and record (bbdb-record-mail record)))) (when mails ;; Cycle, even if MAILS has only one address. `bbdb-dwim-mail' can give something different. ;; E.g., header "JOHN SMITH " can be replaced by "John Smith ". (cond ((and (= 1 (length mails)) (string= (bbdb-dwim-mail record (car mails)) (buffer-substring-no-properties beg end))) (setq done 'UNCHANGED)) (cycle-completion-buffer ; Use completion buffer. (setq dwim-completions (mapcar (lambda (n) (bbdb-dwim-mail record n)) mails) done 'CHOOSE)) (t ; Use next mail (let ((mail (or (nth 1 (or (icicle-member-ignore-case (nth 1 address) mails) (icicle-member-ignore-case orig mails))) (nth 0 mails)))) (delete-region beg end) ; Replace with new mail address (insert (bbdb-dwim-mail record mail)) (setq done 'CYCLE))))))) (when (eq done 'CHOOSE) ;; Icicles completion. `completion-in-region' does not work here, as `dwim-completions' is not a ;; collection for completion in the usual sense. It is really a list of replacements. (unless (eq (selected-window) (minibuffer-window)) (message "Making completion list...")) (icicle-condition-case-no-debug nil (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (icicle-top-level-when-sole-completion-flag t) (completion-ignore-case t) (choice (save-excursion (completing-read "Complete: " (mapcar #'list dwim-completions) nil t pattern nil pattern)))) (when choice (delete-region beg end) (insert choice))) (error nil)) (unless (eq (selected-window) (minibuffer-window)) (message "Making completion list...done"))) done)) ;; REPLACE ORIGINAL `bbdb-complete-name' defined in `bbdb-com.el' version 2.35, ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Version 2.35 is an older version of BBDB, the Insidious Big Brother Database, available here: ;; http://bbdb.sourceforge.net/. ;; ;; Uses Icicles completion when there are multiple candidates. ;; ;; Free vars here: `bbdb-*' are bound in `bbdb-com.el'. ;; ;; ;; Avoid a byte-compile error if user has already loaded BBDB version 3+. ;; The error has to do with `bbdb-records' being a defsubst that takes no args. (unless (eval-when-compile (and (featurep 'bbdb) (not (string-lessp bbdb-version "3")))) (defun icicle-bbdb-complete-name (&optional start-pos) "Complete the user full-name or net-address before point. Completes only up to the preceding newline, colon, or comma, or the value of START-POS. If what has been typed is unique, insert an entry of the form \"User Name \" (but see `bbdb-dwim-net-address-allow-redundancy'). If it is a valid completion but not unique, you can choose from the list of completions using Icicles completion. If your input is completed and `bbdb-complete-name-allow-cycling' is true, then you can repeat to cycle through the nets for the matching record. When called with a prefix arg, display a list of all nets. You can control completion behaviour using `bbdb-completion-type'." (interactive) (unless (and (require 'bbdb nil t) (require 'bbdb-com nil t) (fboundp 'bbdb-complete-name)) (icicle-user-error "`icicle-bbdb-complete-name' requires a BBDB version such as 2.35")) (lexical-let* ((end (point)) (beg (or start-pos (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point)))) (orig (buffer-substring beg end)) (typed (downcase orig)) (pattern (bbdb-string-trim typed)) ;; DADAMS - ;; Replaced `(bbdb-hashtable)' by its expansion (bbdb-with-db-buffer ... bbdb-hashtable), ;; to avoid the silly macro altogether and simplify user byte-compiling a little. (ht (bbdb-with-db-buffer (bbdb-records nil t) bbdb-hashtable)) ;; Make a list of possible completion strings (all-the-completions), and a flag to ;; indicate if there's a single matching record or not (only-one-p). (only-one-p t) (all-the-completions ()) (pred (lambda (sym) ; FREE here: ALL-THE-COMPLETIONS, ONLY-ONE-P. (and (bbdb-completion-predicate sym) (progn (when (and only-one-p all-the-completions (or ;; Not sure about this. More than one record attached to the symbol? ;; Does that happen? (> (length (symbol-value sym)) 1) ;; This is the doozy. Multiple syms which all match the same record. (delete t (mapcar (lambda (x) ; FREE here: SYM. (equal (symbol-value x) (symbol-value sym))) all-the-completions)))) (setq only-one-p nil)) (if (memq sym all-the-completions) nil (setq all-the-completions (cons sym all-the-completions))))))) (completion (progn (all-completions pattern ht pred) (try-completion pattern ht))) (exact-match (eq completion t))) (cond ;; No matches found OR you're trying completion on an already-completed record. ;; In the latter case, we might have to cycle through the nets for that record. ((or (null completion) (and bbdb-complete-name-allow-cycling exact-match ; Which is a net of the record (member orig (bbdb-record-net (car (symbol-value (intern-soft pattern ht))))))) (bbdb-complete-name-cleanup) ; Clean up the completion buffer, if it exists (unless (catch 'bbdb-cycling-exit ; Check for cycling ;; Jump straight out if we're not cycling (unless bbdb-complete-name-allow-cycling (throw 'bbdb-cycling-exit nil)) ;; Find the record we're working on. (lexical-let* ((addr (funcall bbdb-extract-address-components-func orig)) (rec (and (listp addr) ;; For now, we ignore the case where this returns more than ;; one record. Ideally, the last expansion would be stored ;; in a buffer-local variable, perhaps. (car (bbdb-search-intertwingle (caar addr) (car (cdar addr))))))) (unless rec (throw 'bbdb-cycling-exit nil)) (if current-prefix-arg ;; Use completion buffer (let ((standard-output (get-buffer-create "*Completions*"))) ;; A previously existing buffer has to be cleaned first (with-current-buffer standard-output (setq buffer-read-only nil) (erase-buffer)) (display-completion-list (mapcar (lambda (n) (bbdb-dwim-net-address rec n)) ; FREE here: REC. (bbdb-record-net rec))) (delete-region beg end) (switch-to-buffer standard-output)) ;; Use next address (let* ((addrs (bbdb-record-net rec)) (this-addr (or (cadr (member (car (cdar addr)) addrs)) (nth 0 addrs)))) (if (= (length addrs) 1) (throw 'bbdb-cycling-exit t) ; No alternatives. don't signal an error. ;; Replace with new mail address (delete-region beg end) (insert (bbdb-dwim-net-address rec this-addr)) (run-hooks 'bbdb-complete-name-hooks) (throw 'bbdb-cycling-exit t)))))) ;; FALL THROUGH. Check mail aliases (when (and (or (not bbdb-expand-mail-aliases) (not (expand-abbrev))) bbdb-complete-name-hooks) (message "No completion for `%s'" pattern) (icicle-ding)))) ; no matches ;; Match for a single record. If cycling is enabled then we don't ;; care too much about the exact-match part. ((and only-one-p (or exact-match bbdb-complete-name-allow-cycling)) (let* ((sym (if exact-match (intern-soft pattern ht) (car all-the-completions))) (recs (symbol-value sym)) the-net match-recs lst primary matched) (while recs (when (bbdb-record-net (car recs)) ;; Did we match on name? (let ((b-r-name (or (bbdb-record-name (car recs)) ""))) (if (string= pattern (substring (downcase b-r-name) 0 (min (length b-r-name) (length pattern)))) (setq match-recs (cons (car recs) match-recs) matched t))) ;; Did we match on aka? (unless matched (setq lst (bbdb-record-aka (car recs))) (while lst (if (string= pattern (substring (downcase (car lst)) 0 (min (length (downcase (car lst))) (length pattern)))) (setq match-recs (append match-recs (list (car recs))) matched t lst ()) (setq lst (cdr lst))))) ;; Name didn't match name so check net matching (unless matched (setq lst (bbdb-record-net (car recs)) primary t) ; primary wins over secondary... (while lst (if (string= pattern (substring (downcase (car lst)) 0 (min (length (downcase (car lst))) (length pattern)))) (setq the-net (car lst) lst () match-recs (if primary (cons (car recs) match-recs) (append match-recs (list (car recs)))))) (setq lst (cdr lst) primary nil)))) (setq recs (cdr recs) ; Next rec for loop. matched nil)) (unless match-recs (error "Only exact matching record has net field")) ;; Replace the text with the expansion (delete-region beg end) (insert (bbdb-dwim-net-address (car match-recs) the-net)) ;; If we're past fill-column, wrap at the previous comma. (when (and (bbdb-auto-fill-function) (>= (current-column) fill-column)) (let ((p (point)) bol) (save-excursion (setq bol (line-beginning-position)) (goto-char p) (when (search-backward "," bol t) (forward-char 1) (insert "\n "))))) ;; Update the *BBDB* buffer if desired. (when bbdb-completion-display-record (let ((bbdb-gag-messages t)) (bbdb-pop-up-bbdb-buffer) (bbdb-display-records-1 match-recs t))) (bbdb-complete-name-cleanup) ;; Call the exact-completion hook (run-hooks 'bbdb-complete-name-hooks))) ;; Partial match. Note: we can't use the trimmed version of the pattern here or ;; we'll recurse infinitely on e.g. common first names. ((and (stringp completion) (not (string= typed completion))) (delete-region beg end) (insert completion) (setq end (point)) (let ((last "") (bbdb-complete-name-allow-cycling nil)) (while (and (stringp completion) (not (string= completion last)) (setq last completion pattern (downcase orig) completion (progn (all-completions pattern ht pred) (try-completion pattern ht)))) (when (stringp completion) (delete-region beg end) (insert completion))) (bbdb-complete-name beg))) ; RECURSE <================ ;; Exact match, but more than one record (t (unless (eq (selected-window) (minibuffer-window)) (message "Making completion list...")) (lexical-let (dwim-completions uniq nets net name akas) ;; Collect all the dwim-addresses for each completion, but only once for each record. ;; Add if the net is part of the completions. (bbdb-mapc (lambda (sym) (bbdb-mapc ;; FREE here: AKAS, ALL-THE-COMPLETIONS, DWIM-COMPLETIONS, HT, ;; NAME, NET, NETS, SYM, UNIQ. (lambda (rec) (unless (member rec uniq) (setq uniq (cons rec uniq) nets (bbdb-record-net rec) name (downcase (or (bbdb-record-name rec) "")) akas (mapcar 'downcase (bbdb-record-aka rec))) (while nets (setq net (car nets)) (when (cond ((and (member bbdb-completion-type ; Primary '(primary primary-or-name)) (member (intern-soft (downcase net) ht) all-the-completions)) (setq nets ()) t) ((and name (member bbdb-completion-type ; Name '(nil name primary-or-name)) (let ((cname (symbol-name sym))) (or (string= cname name) (member cname akas)))) (setq name nil) t) ((and (member bbdb-completion-type '(nil net)) ; Net (member (intern-soft (downcase net) ht) all-the-completions))) ;; (name-or-)primary ((and (member bbdb-completion-type '(name-or-primary)) (let ((cname (symbol-name sym))) (or (string= cname name) (member cname akas)))) (setq nets ()) t)) (setq dwim-completions (cons (bbdb-dwim-net-address rec net) dwim-completions)) (when exact-match (setq nets ()))) (setq nets (cdr nets))))) (symbol-value sym))) all-the-completions) (cond ((and dwim-completions (null (cdr dwim-completions))) ; Insert the unique match. (delete-region beg end) (insert (car dwim-completions)) (message "")) (t ; More than one match. Use Icicles minibuffer completion. (icicle-condition-case-no-debug nil (let* ((icicle-show-Completions-initially-flag t) (icicle-incremental-completion-p 'display) (icicle-top-level-when-sole-completion-flag t) (completion-ignore-case t) (choice (save-excursion (completing-read "Complete: " (mapcar #'list dwim-completions) nil t pattern nil pattern)))) (when choice (delete-region beg end) (insert choice))) (error nil)) (unless (eq (selected-window) (minibuffer-window)) (message "Making completion list...done")))))))))) ;; REPLACE ORIGINAL `lisp-complete-symbol' (< Emacs 23.2), ;; defined in `lisp.el', saving it for restoration when you toggle `icicle-mode'. ;; ;; Select `*Completions*' window even if on another frame. ;; (unless (fboundp 'icicle-ORIG-lisp-complete-symbol) (defalias 'icicle-ORIG-lisp-complete-symbol (symbol-function 'lisp-complete-symbol))) (defun icicle-lisp-complete-symbol (&optional predicate) ; `M-TAB' (`C-M-i', `ESC-TAB'), globally. "Complete the Lisp symbol preceding point against known Lisp symbols. If there is more than one completion, use the minibuffer to complete. When called from a program, optional arg PREDICATE is a predicate determining which symbols are considered, e.g. `commandp'. If PREDICATE is nil, the context determines which symbols are considered. If the symbol starts just after an open-parenthesis, only symbols with function definitions are considered. Otherwise, all symbols with function definitions, values or properties are considered." (interactive) (let* ((end (point)) (buffer-syntax (syntax-table)) (beg (unwind-protect (save-excursion (set-syntax-table emacs-lisp-mode-syntax-table) (backward-sexp 1) (while (= (char-syntax (following-char)) ?\') (forward-char 1)) (point)) (set-syntax-table buffer-syntax))) (pattern (buffer-substring beg end)) (new (try-completion pattern obarray))) (unless (stringp new) (setq new pattern)) (delete-region beg end) (insert new) (setq end (+ beg (length new))) (if (and (not (string= new "")) (not (string= (downcase new) (downcase pattern))) (< (length (all-completions new obarray)) 2)) (message "Completed (no other completions)") ;; Use minibuffer to choose a completion. (let* ((enable-recursive-minibuffers (active-minibuffer-window)) (icicle-top-level-when-sole-completion-flag t) (icicle-orig-window (selected-window)) ; For alt actions. (alt-fn nil) (icicle-show-Completions-initially-flag t) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "symbol")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "symbol"))) (predicate (or predicate (save-excursion (goto-char beg) (if (not (eq (char-before) ?\( )) (lambda (sym) ;why not just nil ? -sm (or (boundp sym) (fboundp sym) (symbol-plist sym))) ;; If first element of parent list is not an open paren, assume that this is a ;; funcall position: use `fboundp'. If not, then maybe this is a variable in ;; a `let' binding, so no predicate: use nil. (and (not (condition-case nil (progn (up-list -2) (forward-char 1) (eq (char-after) ?\( )) (error nil))) 'fboundp)))))) ;; $$$$$ Could bind `icicle-must-pass-after-match-predicate' to a predicate on interned ;; candidate and pass nil as PRED to `completing-read'. Don't bother for now. (setq new (save-excursion (completing-read "Complete Lisp symbol: " obarray predicate t new))))) (delete-region beg end) (insert new))) ;; REPLACE ORIGINAL `lisp-completion-at-point' (>= Emacs 23.2), ;; defined in `lisp.el', saving it for restoration when you toggle `icicle-mode'. ;; ;; Select `*Completions*' window even if on another frame. ;; (when (fboundp 'completion-at-point) ; Emacs 23.2+. (unless (fboundp 'icicle-ORIG-lisp-completion-at-point) (defalias 'icicle-ORIG-lisp-completion-at-point (symbol-function 'lisp-completion-at-point)) ;; Return a function that does all of the completion. (defun icicle-lisp-completion-at-point () #'icicle-lisp-complete-symbol))) (defun icicle-customize-icicles-group () "Customize Icicles options and faces. View their documentation." (interactive) (customize-group-other-window 'Icicles)) (defun icicle-send-bug-report () "Send a bug report about an Icicles problem." (interactive) (browse-url (format (concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ Icicles bug: \ &body=Describe bug below, using a precise recipe that starts with `emacs -Q' or `emacs -q'. \ Each Icicles file has a header `Update #' that you can use to identify it. \ Include at least the `Update #' from file `icicles-chg.el', if you have that file.\ %%0A%%0AEmacs version: %s.") (emacs-version)))) ;; REPLACE ORIGINAL `customize-face-other-window' defined in `cus-edit.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Multi-command version. ;; (unless (fboundp 'icicle-ORIG-customize-face-other-window) (defalias 'icicle-ORIG-customize-face-other-window (symbol-function 'customize-face-other-window))) (defun icicle-customize-face-other-window (face) "Customize face FACE in another window. Same as `icicle-customize-face' except it uses a different window." (interactive (list (let* ((icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-candidate-action-fn (lambda (x) (icicle-ORIG-customize-face-other-window (intern (icicle-transform-multi-completion x))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))) (icicle-all-candidates-list-action-fn 'icicle-customize-faces) (icicle-orig-window (selected-window)) ; For alt actions. (alt-fn nil) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "face")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "face")))) (if (and (> emacs-major-version 21) current-prefix-arg) (read-face-name "Customize face: " "all faces" t) (read-face-name "Customize face: "))))) (icicle-ORIG-customize-face-other-window face)) ;; REPLACE ORIGINAL `customize-face' defined in `cus-edit.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Multi-command version. ;; (unless (fboundp 'icicle-ORIG-customize-face) (defalias 'icicle-ORIG-customize-face (symbol-function 'customize-face))) (defun icicle-customize-face (face &optional other-window) "Customize face FACE. If OTHER-WINDOW is non-nil, use another window. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active\\: `C-mouse-2', `C-RET' - Act on current completion candidate only `C-down' - Move to next completion candidate and act `C-up' - Move to previous completion candidate and act `C-next' - Move to next apropos-completion candidate and act `C-prior' - Move to previous apropos-completion candidate and act `C-end' - Move to next prefix-completion candidate and act `C-home' - Move to previous prefix-completion candidate and act `\\[icicle-all-candidates-list-action]' - Act on *all* candidates (or all that are saved): Customize all in the same buffer. `\\[icicle-all-candidates-action]' - Act on *all* candidates (or all that are saved): Customize each in a separate buffer. When candidate action and cycling are combined (e.g. `C-next'), option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `C-M-return', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. With a prefix argument, you can enter multiple faces at the same time with a single `RET' (in Emacs 22 or later). This gives you more or less the `crm' completion behavior of `customize-face' in vanilla Emacs. Most Icicles completion features are still available, but `TAB' performs `crm' completion, so it does not also cycle among completion candidates. You can, as always, use `down' to do that. A advantage of using a prefix argument is that the default value is the list of all faces under the cursor. A disadvantage is that face candidates are not WYSIWYG in buffer `*Completions*'. This is an Icicles command - see command `icicle-mode'." (interactive (list (let* ((icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-candidate-action-fn (lambda (x) (icicle-ORIG-customize-face (intern (icicle-transform-multi-completion x))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))) (icicle-all-candidates-list-action-fn 'icicle-customize-faces) (icicle-orig-window (selected-window)) ; For alt actions. (alt-fn nil) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "face")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "face")))) (if (and (> emacs-major-version 21) current-prefix-arg) (read-face-name "Customize face: " "all faces" t) (read-face-name "Customize face: "))))) (if other-window (if (> emacs-major-version 23) (icicle-ORIG-customize-face face t) (icicle-ORIG-customize-face-other-window face)) (icicle-ORIG-customize-face face))) (defun icicle-customize-faces (faces) "Open Customize buffer on all faces in list FACES." (let ((icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts '(1))) (custom-buffer-create (custom-sort-items (mapcar (lambda (f) (list (intern (icicle-transform-multi-completion f)) 'custom-face)) faces) t custom-buffer-order-groups) "*Customize Apropos*"))) ;; Icicles replacement for `customize-apropos', defined in `cus-edit.el'. ;; 1. Uses `completing-read' to read the regexp. ;; 2. Fixes Emacs bugs #11132, #11126. ;; (defun icicle-customize-apropos (pattern &optional type msgp) "Customize all loaded user preferences matching PATTERN. When prompted for the PATTERN, you can use completion against preference names - e.g. `S-TAB'. Instead of entering a pattern you can then just hit `RET' to accept the list of matching preferences. This lets you see which preferences will be available in the customize buffer and dynamically change that list. Interactively: With no prefix arg, customize all matching preferences: groups, faces, and options. With a prefix arg, show those plus all matching non-option variables in Customize (but you cannot actually customize the latter). Non-interactively: If TYPE is `options', include only user options. If TYPE is `faces', include only faces. If TYPE is `groups', include only groups. If TYPE is t, include variables that are not user options, as well as faces and groups. PATTERN is a regexp. Starting with Emacs 22, if PATTERN includes no regexp special chars then it can alternatively be a list of \"words\" separated by spaces. Two or more of the words are matched in different orders against each preference name. \"Word\" here really means a string of non-space chars. This handling of \"words\" is for compatibility with vanilla Emacs, and is only approximative. It can include \"matches\" that you do not expect. For better matching use Icicles progressive completion, i.e., separate the words (any strings, in fact, including regexps) using `S-SPC', not just `SPC'." (interactive (let* ((pref-arg current-prefix-arg) (pred `(lambda (s) (unless (symbolp s) (setq s (intern s))) (or (get s 'custom-group) (custom-facep s) (and (boundp s) (or (get s 'saved-value) (custom-variable-p s) (if (null ',pref-arg) (user-variable-p s) (get s 'variable-documentation))))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (completing-read "Customize (pattern): " obarray (and icompletep pred) nil nil 'regexp-history) pref-arg t))) (let ((found ())) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering apropos data for customize `%s'..." pattern)) (mapatoms `(lambda (symbol) ; FREE here: APROPOS-REGEXP. (when (string-match ,(if (> emacs-major-version 21) apropos-regexp pattern) (symbol-name symbol)) (when (and (not (memq ,type '(faces options))) ; groups or t (get symbol 'custom-group)) (push (list symbol 'custom-group) found)) (when (and (not (memq ,type '(options groups))) ; faces or t (custom-facep symbol)) (push (list symbol 'custom-face) found)) (when (and (not (memq ,type '(groups faces))) ; options or t (boundp symbol) (or (get symbol 'saved-value) (custom-variable-p symbol) (if (memq ,type '(nil options)) (user-variable-p symbol) (get symbol 'variable-documentation)))) (push (list symbol 'custom-variable) found))))) (unless found (error "No %s matching %s" (if (eq type t) "items" (format "%s" (if (memq type '(options faces groups)) (symbol-name type) "customizable items"))) pattern)) (custom-buffer-create (custom-sort-items found t custom-buffer-order-groups) "*Customize Apropos*"))) ;; Define this for Emacs 20 and 21 (unless (fboundp 'custom-variable-p) (defun custom-variable-p (variable) "Return non-nil if VARIABLE is a custom variable." (and (symbolp variable) (or (get variable 'standard-value) (get variable 'custom-autoload))))) ;; Icicles replacement for `customize-apropos-faces', defined in `cus-edit.el'. ;; 1. Uses `completing-read' to read the regexp. ;; 2. Fixes Emacs bug #11124. ;; (defun icicle-customize-apropos-faces (pattern &optional msgp) "Customize all loaded faces matching PATTERN. See `icicle-customize-apropos'." (interactive (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (custom-facep s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (completing-read "Customize faces (pattern): " obarray (and icompletep pred) nil nil 'regexp-history) t))) (when msgp (message "Gathering apropos data for customizing faces...")) (customize-apropos pattern 'faces)) ;; Icicles replacement for `customize-apropos-groups', defined in `cus-edit.el'. ;; 1. Uses `completing-read' to read the regexp. ;; 2. Fixes Emacs bug #11124. ;; (defun icicle-customize-apropos-groups (pattern &optional msgp) "Customize all loaded customize groups matching PATTERN. See `icicle-customize-apropos'." (interactive (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (get s 'custom-group))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (completing-read "Customize groups (pattern): " obarray (and icompletep pred) nil nil 'regexp-history) t))) (when msgp (message "Gathering apropos data for customizing groups...")) (customize-apropos pattern 'groups)) ;; Icicles replacement for `customize-apropos-options', defined in `cus-edit.el'. ;; 1. Uses `completing-read' to read the regexp. ;; 2. Fixes Emacs bugs #11124, #11128. ;; (defun icicle-customize-apropos-options (pattern &optional arg msgp) "Customize all loaded user options matching PATTERN. See `icicle-customize-apropos'. With a prefix arg, include variables that are not user options as completion candidates, and include also matching faces and groups in the customize buffer." (interactive (let* ((pref-arg current-prefix-arg) (pred `(lambda (s) (unless (symbolp s) (setq s (intern s))) (and (boundp s) (or (get s 'saved-value) (custom-variable-p s) (user-variable-p s) (and ',pref-arg (get s 'variable-documentation)))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (completing-read "Customize options (pattern): " obarray (and icompletep pred) nil nil 'regexp-history) pref-arg t))) (when msgp (message "Gathering apropos data for customizing options...")) (customize-apropos pattern (or arg 'options))) (icicle-define-command icicle-customize-apropos-options-of-type "Customize all loaded user options of a given type. Enter patterns for the OPTION name and TYPE definition in the minibuffer, separated by `icicle-list-join-string', which is \"^G^J\", by default. (`^G' here means the Control-g character, input using `C-h C-g'. Likewise, for `^J'.) OPTION is a regexp that is matched against option names. See `icicle-describe-option-of-type', which handles input and completion similarly, for a full description of TYPE, matching, and the use of a prefix argument." ; Doc string icicle-customize-apropos-opt-action ; Action function prompt ; `completing-read' args 'icicle-describe-opt-of-type-complete nil nil nil nil nil nil ((prompt "OPTION `C-M-j' TYPE: ") ; Bindings (icicle-multi-completing-p t) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching ;; in `icicle-unsorted-apropos-candidates' etc., because `icicle-describe-opt-of-type-complete' ;; does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-multi-comp-apropos-complete-match) (icicle-candidate-help-fn 'icicle-describe-opt-action) (icicle-pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering user options and their types..."))) (defun icicle-customize-apropos-opt-action (opt+type) "Action function for `icicle-customize-apropos-options-of-type'." (let ((icicle-list-use-nth-parts '(1))) (custom-buffer-create (custom-sort-items (mapcar (lambda (s) (list (intern s) 'custom-variable)) icicle-completion-candidates) t "*Customize Apropos*")))) (defun icicle-apropos (pattern &optional do-all msgp) "Describe Lisp symbols whose names match PATTERN. By default, show symbols only if they are defined as functions, variables, or faces, or if they have nonempty property lists. With a prefix argument, or if `apropos-do-all' is non-nil, describe all matching symbols. Return a list of the symbols and descriptions. Like command `apropos', but you can preview the list of matches using `S-TAB'. Function names are highlighted using face `icicle-special-candidate'. When prompted for the PATTERN, you can use completion against preference names - e.g. `S-TAB'. Instead of entering a pattern you can then just hit `RET' to accept the list of matching preferences. This lets you see which preferences will be available in the customize buffer and dynamically change that list. PATTERN is a regexp. Starting with Emacs 22, if PATTERN includes no regexp special chars then it can alternatively be a list of \"words\" separated by spaces. Two or more of the words are matched in different orders against each preference name. \"Word\" here really means a string of non-space chars. This handling of \"words\" is for compatibility with vanilla Emacs, and is only approximative. It can include \"matches\" that you do not expect. For better matching use Icicles progressive completion, i.e., separate the words (any strings, in fact, including regexps) using `S-SPC', not just `SPC'." (interactive (list (unwind-protect (progn (mapatoms (lambda (symb) (when (fboundp symb) (put symb 'icicle-special-candidate t)))) (let ((icicle-fancy-candidates-p t) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "symbol"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "symbol")))) (completing-read "Apropos symbol (regexp or words): " obarray nil nil nil 'regexp-history))) (mapatoms (lambda (symb) (put symb 'icicle-special-candidate nil)))) current-prefix-arg t)) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering apropos data...")) (apropos pattern do-all)) (cond ;; Use my versions of the `apropos*' commands, defined in `apropos-fn+var.el'. ;; Note that unlike my versions of `apropos-option' and `apropos-command', the `icicle-' ;; versions here do not respect `apropos-do-all': they always work with options and commands. ((fboundp 'apropos-option) (defun icicle-apropos-variable (pattern &optional msgp) "Show variables that match PATTERN. This includes variables that are not user options. User options are highlighted using face `icicle-special-candidate'. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN." (interactive (list (unwind-protect (progn (mapatoms (lambda (symb) (when (user-variable-p symb) (put symb 'icicle-special-candidate t)))) (let* ((icicle-fancy-candidates-p t) (pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (and (boundp s) (get s 'variable-documentation)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "variable"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "variable")))) (completing-read (concat "Apropos variable (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history))) (mapatoms (lambda (symb) (put symb 'icicle-special-candidate nil)))) t)) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering data apropos variables...")) (apropos-variable pattern)) (defun icicle-apropos-option (pattern &optional msgp) "Show user options (variables) that match PATTERN. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN." (interactive (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (user-variable-p s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (completing-read (concat "Apropos user option (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history) t))) (let ((apropos-do-all nil) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "option"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "option")))) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering data apropos user options...")) (apropos-option pattern))) (defun icicle-apropos-function (pattern &optional msgp) "Show functions that match PATTERN. This includes functions that are not commands. Command names are highlighted using face `icicle-special-candidate'. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN." (interactive (list (unwind-protect (progn (mapatoms (lambda (symb) (when (commandp symb) (put symb 'icicle-special-candidate t)))) (let* ((icicle-fancy-candidates-p t) (pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (fboundp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "function"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "function")))) (completing-read (concat "Apropos function (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history))) (mapatoms (lambda (symb) (put symb 'icicle-special-candidate nil)))) t)) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering data apropos functions...")) (apropos-function pattern)) (defun icicle-apropos-command (pattern &optional msgp) "Show commands (interactively callable functions) that match PATTERN. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN." (interactive (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (commandp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "command"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "command")))) (list (completing-read (concat "Apropos command (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history) t))) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message "Gathering data apropos commands...")) (let ((apropos-do-all nil)) (apropos-command pattern)))) ;; My versions are not available. Use the vanilla Emacs versions of the `apropos...' commands. (t (defun icicle-apropos-variable (pattern &optional do-all msgp) "Show variables that match PATTERN. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN. By default, only user options are candidates. With optional prefix DO-ALL, or if `apropos-do-all' is non-nil, all variables are candidates. In that case, the user-option candidates are highlighted using face `icicle-special-candidate'." (interactive (list (unwind-protect (progn (unless (or (boundp 'apropos-do-all) (require 'apropos nil t)) (error "Library `apropos' not found")) (when (or current-prefix-arg apropos-do-all) (mapatoms (lambda (symb) (when (user-variable-p symb) (put symb 'icicle-special-candidate t))))) (let* ((icicle-fancy-candidates-p (or current-prefix-arg apropos-do-all)) (pred (if (or current-prefix-arg apropos-do-all) (lambda (s) (unless (symbolp s) (setq s (intern s))) (and (boundp s) (get s 'variable-documentation))) (lambda (s) (unless (symbolp s) (setq s (intern s))) (user-variable-p s)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type (if icicle-fancy-candidates-p "variable" "option")))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type (if icicle-fancy-candidates-p "variable" "option"))))) (completing-read (concat "Apropos " (if (or current-prefix-arg apropos-do-all) "variable" "user option") " (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history))) (when (or current-prefix-arg apropos-do-all) (mapatoms (lambda (symb) (put symb 'icicle-special-candidate nil))))) current-prefix-arg t)) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message (format "Gathering data apropos %s..." (if do-all "variables" "options")))) (apropos-variable pattern do-all)) (defun icicle-apropos-command (pattern &optional do-all var-predicate msgp) "Show commands (interactively callable functions) that match PATTERN. You can see the list of matches with `S-TAB'. See `icicle-apropos' for a description of PATTERN. With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show noninteractive functions. In that case, the command candidates are highlighted using face `icicle-special-candidate'. If VAR-PREDICATE is non-nil, show only variables, and only those that satisfy the predicate VAR-PREDICATE. Non-interactively, a string PATTERN is used as a regexp, while a list of strings is used as a word list." (interactive (list (unwind-protect (progn (unless (boundp 'apropos-do-all) (unless (require 'apropos nil t) (error "Library `apropos' not found"))) (when (or current-prefix-arg apropos-do-all) (mapatoms (lambda (symb) (when (commandp symb) (put symb 'icicle-special-candidate t))))) (let* ((icicle-fancy-candidates-p (or current-prefix-arg apropos-do-all)) (pred (if current-prefix-arg (lambda (s) (unless (symbolp s) (setq s (intern s))) (fboundp s)) (lambda (s) (unless (symbolp s) (setq s (intern s))) (commandp s)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type (if icicle-fancy-candidates-p "function" "command")))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type (if icicle-fancy-candidates-p "function" "command"))))) (completing-read (concat "Apropos " (if (or current-prefix-arg apropos-do-all) "command or function" "command") " (regexp" (and (>= emacs-major-version 22) " or words") "): ") obarray (and icompletep pred) nil nil 'regexp-history))) (when (or current-prefix-arg apropos-do-all) (mapatoms (lambda (symb) (put symb 'icicle-special-candidate nil))))) current-prefix-arg nil t)) (when (and (> emacs-major-version 21) (require 'apropos nil t) (string= (regexp-quote pattern) pattern) (not (string= "" pattern))) (setq pattern (split-string pattern "[ \t]+" 'OMIT-NULLS))) (when (fboundp 'apropos-parse-pattern) (apropos-parse-pattern pattern)) ; Emacs 22+ (when msgp (message (format "Gathering data apropos %s..." (if do-all "functions" "commands")))) (apropos-command pattern do-all var-predicate)))) (icicle-define-command icicle-apropos-options-of-type "Show user options of a given type. Enter patterns for the OPTION name and TYPE definition in the minibuffer, separated by `icicle-list-join-string', which is \"^G^J\", by default. (`^G' here means the Control-g character, input using `C-h C-g'. Likewise, for `^J'.) OPTION is a regexp that is matched against option names. See also: * `icicle-describe-option-of-type', which handles input and completion similarly, for a full description of TYPE, matching, and the use of a prefix argument * `icicle-apropos-value', using `C-$' to filter to options only" ; Doc string icicle-apropos-opt-action ; Action function prompt ; `completing-read' args 'icicle-describe-opt-of-type-complete nil nil nil nil nil nil ((prompt "OPTION `C-M-j' TYPE: ") ; Bindings (icicle-multi-completing-p t) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching ;; in `icicle-unsorted-apropos-candidates' etc., because `icicle-describe-opt-of-type-complete' ;; does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-multi-comp-apropos-complete-match) (icicle-candidate-help-fn 'icicle-describe-opt-action) (icicle-pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering user options and their types..."))) (defun icicle-apropos-opt-action (opt+type) "Action function for `icicle-apropos-options-of-type'." (let ((icicle-list-use-nth-parts '(1))) (apropos-option (icicle-transform-multi-completion opt+type)))) (defun icicle-apropos-zippy (regexp) "Show all Zippy quotes matching the regular-expression REGEXP. Return the list of matches." (interactive (progn (unless (boundp 'yow-file) (unless (require 'yow nil t) (error "Library `yow' not found"))) (cookie yow-file yow-load-message yow-after-load-message) (let* ((case-fold-search t) (cookie-table-symbol (intern yow-file cookie-cache)) (string-table (symbol-value cookie-table-symbol)) (table (nreverse (mapcar #'list string-table)))) (list (completing-read "Apropos Zippy (regexp): " table nil nil nil 'regexp-history))))) (let ((matches (apropos-zippy icicle-current-input))) (when (interactive-p) (with-output-to-temp-buffer "*Zippy Apropos*" (while matches (princ (car matches)) (setq matches (cdr matches)) (and matches (princ "\n\n"))))) matches)) ; Return matching Zippyisms. (icicle-define-command icicle-apropos-value "Choose a variable, function, or other symbol description. This is similar to vanilla command `apropos-value', but you can match against the variable name and its printed value at the same time. By default, each completion candidate is multi-completion composed of a variable name plus its value. They are separated by `icicle-list-join-string' \(\"^G^J\", by default). With a prefix arg, candidates are different kinds of symbols: < 0: functions and their defs (but byte-compiled defs are skipped) > 0: symbols and their plists = 0: variables and their values, functions and their definitions, and other symbols and their plists plain (`C-u'): use the last-computed (cached) set of candidates You can use `C-$' during completion to toggle filtering the domain of initial candidates according to the prefix argument, as follows: none: only user options (+ values) < 0: only commands (+ definitions) > 0: only faces (+ plists) = 0: only options (+ values), commands (+ defs), faces (+ plists) Remember that you can use \\\ `\\[icicle-cycle-incremental-completion]' to toggle incremental completion. See also: * `icicle-apropos-vars-w-val-satisfying', `icicle-describe-vars-w-val-satisfying' - values satisfy a predicate * `icicle-plist' - similar to this command with positive prefix arg * `icicle-vardoc', `icicle-fundoc', `icicle-doc' - match name & doc * `icicle-apropos-options-of-type', `icicle-describe-option-of-type' - match name & defcustom type" icicle-doc-action ; Action function prompt ; `completing-read' args (let ((cands (and (consp pref-arg) icicle-apropos-value-last-initial-cand-set)) cand) (unless cands ; COLLECTION arg is an alist whose items are ((SYMB INFO)). (mapatoms (lambda (symb) ;; Exclude the local vars bound by this command. They are not what the user wants to see. (setq cand (and (not (memq symb '(cands pref-arg num-arg prompt icicle-toggle-transforming-message icicle-candidate-properties-alist icicle-multi-completing-p icicle-list-use-nth-parts icicle-transform-before-sort-p icicle-transform-function icicle-last-transform-function print-fn make-cand))) (funcall make-cand symb))) (when cand (push cand cands)))) (setq icicle-apropos-value-last-initial-cand-set cands)) cands) nil nil nil nil nil nil ((pref-arg current-prefix-arg) (num-arg (prefix-numeric-value pref-arg)) (prompt (format "SYMBOL `C-M-j' %s: " (if pref-arg "INFO" "VALUE"))) ; Bindings (icicle-toggle-transforming-message (cond ((or (consp pref-arg) (= num-arg 0)) "Filtering to OPTIONS, COMMANDS, & FACES is now %s") ((and pref-arg (> num-arg 0)) "Filtering to FACES (+ plists) is now %s") ((< num-arg 0) "Filtering to COMMANDS (+ defs) is now %s") (t "Filtering to user OPTIONS (+ values) is now %s"))) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-transform-before-sort-p t) (icicle-transform-function nil) ; No transformation: all symbols. (icicle-last-transform-function (lambda (cands) ; `C-$': only user options, commands, or faces. (loop for cc in cands with symb do (setq symb (intern (icicle-transform-multi-completion cc))) if (cond ((or (consp `,pref-arg) (= `,num-arg 0)) (or (user-variable-p symb) (commandp symb) (facep symb))) ((and `,pref-arg (> `,num-arg 0)) (facep symb)) ((< `,num-arg 0) (commandp symb)) (t (user-variable-p symb))) collect cc))) (print-fn (lambda (obj) (let ((print-circle t)) ;;; $$$$$$ (condition-case nil ;;; (prin1-to-string obj) ;;; (error "`icicle-apropos-value' printing error"))))) (prin1-to-string obj)))) (make-cand (cond ((< num-arg 0) ; Function (lambda (symb) (and (fboundp symb) `((,(symbol-name symb) ,(if (byte-code-function-p (symbol-function symb)) "" (funcall print-fn (symbol-function symb)))))))) ((= num-arg 0) ; Do ALL (lambda (symb) ; Favor the var, then the fn, then the plist. (cond ((boundp symb) `((,(symbol-name symb) ,(funcall print-fn (symbol-value symb))))) ((fboundp symb) `((,(symbol-name symb) ,(if (byte-code-function-p (symbol-function symb)) "" (funcall print-fn (symbol-function symb)))))) ((symbol-plist symb) `((,(symbol-name symb) ,(funcall print-fn (symbol-plist symb)))))))) ((and pref-arg (> num-arg 0)) ; Plist (lambda (symb) (and (symbol-plist symb) `((,(symbol-name symb) ,(funcall print-fn (symbol-plist symb))))))) (t ; Variable (lambda (symb) (and (boundp symb) `((,(symbol-name symb) ,(funcall print-fn (symbol-value symb)))))))))) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code. (icicle-highlight-lighter) (message "Gathering %s%s..." (cond ((consp pref-arg) 'SYMBOLS) ((and pref-arg (< num-arg 0)) 'FUNCTIONS) ((and pref-arg (= num-arg 0)) "all SYMBOLS") ((and pref-arg (> num-arg 0)) 'SYMBOLS) (t 'VARIABLES)) (cond ((consp pref-arg) " from last invocation (cached)") ((and pref-arg (< num-arg 0)) " and their definitions") ((and pref-arg (= num-arg 0)) " and their info") ((and pref-arg (> num-arg 0)) " and their plists") (t " and their values"))))) (icicle-define-command icicle-describe-option-of-type ; Bound to `C-h C-o'. Command name "Describe a user option that was defined with a given `defcustom' type. Enter patterns for the OPTION name and TYPE definition in the minibuffer, separated by `icicle-list-join-string', which is \"^G^J\", by default. (`^G' here means the Control-g character, input using `C-h C-g'. Likewise, for `^J'.) Remember that you can insert `icicle-list-join-string' using `C-M-j'. This command binds option `icicle-dot-string' to the value of `icicle-anychar-regexp' for the duration, which means that `.' in your input to this command matches any character, including a newline char. This is for convenience because `defcustom' type sexps are often multiline. This is particularly important for progressive completion, where your input definitely matches as a regexp (apropos completion). If you do not want `.' to match newlines, use `C-M-.' during the command. Example use of progressive completion: 1. C-h C-o ici C-M-j choic S-TAB That shows all options whose names are apropos-matched by `ici' and whose types are matched by `choic'. 2. S-SPC om C-M-j sexp That limits the matches to options whose names also match `om' and whose types also match `sexp'.' OPTION is a regexp that is matched against option names. Depending on the prefix arg, TYPE is interpreted as either of these: - a regexp to match against the option type - a definition acceptable for `defcustom' :type, or its first symbol, for example, (choice (integer) (regexp)) or `choice' In the second case, depending on the prefix arg, TYPE can be matched against the option type, or it can be matched against either the option type or one of its subtypes. In the second case also, depending on the prefix arg, if TYPE does not match some option's type, that option might still be a candidate, if its current value satisfies TYPE. In sum, the prefix arg determines the type-matching behavior, as follows: - None: OPTION is defined with TYPE or a subtype of TYPE. TYPE is a regexp. - `C-u': OPTION is defined with TYPE or a subtype of TYPE, or its current value is compatible with TYPE. TYPE is a type definition or its first symbol. - Negative: OPTION is defined with TYPE (exact match). TYPE is a regexp. - Positive: OPTION is defined with TYPE, or its current value is compatible with TYPE. TYPE is a type definition or its first symbol. - Zero: OPTION is defined with TYPE or a subtype of TYPE. TYPE is a type definition or its first symbol. - `C-u C-u': OPTION is defined with TYPE (exact match). TYPE is a type definition or its first symbol. You can change these prefix-arg key sequences by customizing option `icicle-option-type-prefix-arg-list'. For example, if you tend to use the matching defined here for `C-u', you might want to make that the default behavior (no prefix arg). You can assign any of the six behaviors to any of the prefix-arg keys. If TYPE is nil, then *all* options that match OPTION are candidates. Note that options defined in libraries that have not been loaded can be candidates, but their type will appear as nil, since it is not known before loading the option definition. You can match your input against the option name or the type definition or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example, to match all Icicles options whose type matches `string' \(according to the prefix arg), use `S-TAB' with this input: icicle C-M-j string$ If you instead want all Icicles options whose type definition contains `string', as in (repeat string), then use this: icicle C-M-j string Remember that you can use `\\\ \\[icicle-cycle-incremental-completion] to toggle incremental completion. See also: * `icicle-apropos-options-of-type', to show options of a given type * `icicle-apropos-value', using `C-$' to filter to options only" ; Doc string icicle-describe-opt-action ; Action function prompt ; `completing-read' args 'icicle-describe-opt-of-type-complete nil nil nil nil nil nil ((prompt "OPTION `C-M-j' TYPE: ") ; Bindings (icicle-multi-completing-p t) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-dot-string icicle-anychar-regexp) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching ;; in `icicle-unsorted-apropos-candidates' etc., because `icicle-describe-opt-of-type-complete' ;; does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-multi-comp-apropos-complete-match) (icicle-candidate-help-fn 'icicle-describe-opt-action) ;; $$$ (icicle-highlight-input-completion-failure nil) (icicle-pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering user options and their types..."))) (defun icicle-describe-opt-action (opt+type) "Action function for `icicle-describe-option-of-type'." (let ((icicle-list-use-nth-parts '(1))) (describe-variable (intern (icicle-transform-multi-completion opt+type))))) ;; Free var here: `icicle-pref-arg' - it is bound in `icicle-describe-option-of-type'. (defun icicle-describe-opt-of-type-complete (strg pred completion-mode) "Completion function for `icicle-describe-option-of-type'. This is used as the value of `minibuffer-completion-table'." (setq strg icicle-current-input) ;; Parse strg into its option part and its type part: OPS and TPS. ;; Make raw alist of all options and their types: ((a . ta) (b . tb)...). (lexical-let* ((num-prefix (prefix-numeric-value icicle-pref-arg)) (mode (cond ((not icicle-pref-arg) ; No prefix arg (nth 4 icicle-option-type-prefix-arg-list)) ((and (consp icicle-pref-arg) (= 16 num-prefix)) ; C-u C-u (nth 0 icicle-option-type-prefix-arg-list)) ((consp icicle-pref-arg) (nth 2 icicle-option-type-prefix-arg-list)) ; C-u ((zerop num-prefix) (nth 1 icicle-option-type-prefix-arg-list)) ; C-0 ((wholenump num-prefix) ; C-9 (nth 3 icicle-option-type-prefix-arg-list)) (t (nth 5 icicle-option-type-prefix-arg-list)))) ; C-- (ops (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion strg))) (tps (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion strg))) (tp (and (not (string= "" tps)) ;; Use regexp if no prefix arg or negative; else use sexp. (if (memq mode '(inherit-or-regexp direct-or-regexp)) tps (read tps)))) (result ())) (mapatoms (lambda (symb) ; FREE here: RESULT. (when (if (fboundp 'custom-variable-p) (custom-variable-p symb) (user-variable-p symb)) (condition-case nil (push (list symb (get symb 'custom-type)) result) (error nil))))) ;; Keep only candidates that correspond to input. (setq result (lexical-let ((ops-re (if (memq icicle-current-completion-mode '(nil apropos)) ops (concat "^" ops)))) (icicle-remove-if-not (lambda (opt+typ) ; FREE here: OPS-RE, MODE, TP. (and (string-match ops-re (symbol-name (car opt+typ))) (or (null tp) (condition-case nil (icicle-var-is-of-type-p (car opt+typ) (list tp) (case mode ((inherit inherit-or-regexp) 'inherit) ((direct direct-or-regexp) 'direct) (inherit-or-value 'inherit-or-value) (direct-or-value 'direct-or-value))) (error nil))))) result))) ;; Change alist entries to multi-completions: "op^G^Jtp". Add short help for mode-line, tooltip. (setq result ;; FREE here: ICICLE-HELP-IN-MODE-LINE-DELAY, ICICLE-LIST-JOIN-STRING, TOOLTIP-MODE. (mapcar (lambda (entry) (let* ((opt+typ-string ;; $$$$$$ (concat (mapconcat (lambda (e) (pp-to-string e)) ;; entry icicle-list-join-string) ;; icicle-list-end-string)) ; $$$$$$ (mapconcat (lambda (e) (pp-to-string e)) entry icicle-list-join-string)) (doc ; Don't bother to look up doc, if user won't see it. (and (or (> icicle-help-in-mode-line-delay 0) (and (boundp 'tooltip-mode) tooltip-mode)) (documentation-property (car entry) 'variable-documentation t))) (doc1 (and (stringp doc) (string-match ".+$" doc) (match-string 0 doc)))) (when doc1 (icicle-candidate-short-help doc1 opt+typ-string)) opt+typ-string)) result)) (if completion-mode result ; `all-completions', `test-completion' (try-completion ; `try-completion' strg (mapcar #'list result) (and pred (lambda (ss) (funcall pred ss))))))) (defun icicle-apropos-vars-w-val-satisfying (predicate pattern &optional optionp) "Show variables whose values satisfy PREDICATE and names match PATTERN. You are prompted for a predicate sexp and a pattern matching the variable names. For the latter, before hitting `RET' you must use completion (`S-TAB' or `TAB') to manifest the set of matching variables. Apropos information is shown for those variables when you hit `RET'. The predicate sexp must be a function symbol or a lambda form that accepts the value of the variable as its (first) argument. Typically the predicate is a type predicate, such as `integerp', but it could be anything. Instead of just `integerp', for example, it could be `(lambda (val) (and (integerp val) (> val 5) (< val 15)))'. With a prefix argument, candidates are limited to user options. See also: `icicle-apropos-value', which matches names and values." (interactive (icicle-read-args-w-val-satisfying "Apropos var (hit `S-TAB' or `TAB'): " current-prefix-arg t)) (if optionp (if (fboundp 'icicle-apropos-option) (icicle-apropos-option pattern) (icicle-apropos-variable pattern t)) (icicle-apropos-variable pattern))) (defun icicle-customize-apropos-opts-w-val-satisfying (predicate pattern) "Customize options whose values satisfy PREDICATE and names match PATTERN. You are prompted for a predicate sexp and a pattern matching the option names. For the latter, before hitting `RET' you must use completion (`S-TAB' or `TAB') to manifest the set of matching options. A Customize buffer is opened for those options when you hit `RET'. The predicate sexp must be a function symbol or a lambda form that accepts the value of the variable as its (first) argument. Typically the predicate is a type predicate, such as `integerp', but it could be anything. Instead of just `integerp', for example, it could be `(lambda (val) (and (integerp val) (> val 5) (< val 15)))'." (interactive (let ((xxx (icicle-read-args-w-val-satisfying "Customize vars (hit `S-TAB' or `TAB'): " t t))) (list (car xxx) (cadr xxx)))) (icicle-customize-apropos-options pattern)) (defun icicle-read-args-w-val-satisfying (prompt optionp patternp) "Read args for `icicle-*-w-val-satisfying' commands. Prompt for the variable names using PROMPT. Non-nil OPTIONP means allow only variables that are user options. It is used here during completion of the variable name, and it is returned as the third arg for `icicle-describe-var-w-val-satisfying'. Non-nil PATTERNP means return as the variable whatever input pattern the user entered. Otherwise, assume the pattern names a variable, and return the symbol with that name." (let* ((enable-recursive-minibuffers t) (valpred (let ((string-read nil) (read-result nil)) (condition-case err (prog1 (setq read-result (read (setq string-read (completing-read "Predicate to satify: " icicle-predicate-types-alist nil nil nil (if (boundp 'function-name-history) 'function-name-history 'icicle-function-name-history))))) (unless (functionp read-result) (error ""))) ; Read was OK, but not a function. (error (error "Invalid function: `%s'" string-read))))) ; Read error. (vardflt (or (and (fboundp 'symbol-nearest-point) (symbol-nearest-point)) (and (symbolp (variable-at-point)) (variable-at-point)))) (symbpred (if optionp #'user-variable-p #'boundp)) (varpred `(lambda (sy) (unless (symbolp sy) (setq sy (intern sy))) (and (funcall #',symbpred sy) (funcall #',valpred (symbol-value sy))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) varpred)) (varpat (completing-read prompt obarray (and icompletep varpred) nil nil nil (and vardflt (symbol-name vardflt)) t))) (list valpred (if patternp (if icicle-completion-candidates (regexp-opt icicle-completion-candidates) (message "Predicate %s. You did not complete var names (`S-TAB' or `TAB')" (icicle-propertize "IGNORED" 'face 'icicle-msg-emphasis)) (sit-for 3) varpat) (intern varpat)) optionp))) ;; REPLACE ORIGINAL `repeat-complex-command' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Uses `completing-read' to read the command to repeat, letting you use `S-TAB' and ;; `TAB' to see the history list and `C-,' to toggle sorting that display. ;; (unless (fboundp 'icicle-ORIG-repeat-complex-command) (defalias 'icicle-ORIG-repeat-complex-command (symbol-function 'repeat-complex-command))) (defun icicle-repeat-complex-command (arg) ; Bound to `C-x ESC ESC', `C-x M-:' in Icicle mode. "Edit and re-evaluate the last complex command, or ARGth from last. A complex command is one that used the minibuffer. ARG is the prefix argument numeric value. You can edit the past command you choose before executing it. The Lisp form of the command is used. If the command you enter differs from the previous complex command, then it is added to the front of the command history. Icicles completion is available for choosing a past command. You can still use the vanilla Emacs bindings `\\\\[next-history-element]' and \ `\\[previous-history-element]' to cycle inputs, and `\\[repeat-matching-complex-command]' to match regexp input, but Icicles input cycling (`up', `down', `next', `prior', `home', `end') and apropos completion \(`S-TAB') are superior and more convenient." (interactive "p") (let ((elt (nth (1- arg) command-history)) newcmd) (if elt (progn (setq newcmd (let ((print-level nil) (minibuffer-history-position arg) (minibuffer-history-sexp-flag (1+ (minibuffer-depth)))) (unwind-protect (let ((icicle-transform-function 'icicle-remove-duplicates)) (read (completing-read "Redo: " (mapcar (lambda (entry) (list (prin1-to-string entry))) command-history) nil nil (prin1-to-string elt) (cons 'command-history arg) (prin1-to-string elt)))) ;; If command was added to command-history as a string, get rid of that. ;; We want only evaluable expressions there. (if (stringp (car command-history)) (setq command-history (cdr command-history)))))) ;; If command to be redone does not match front of history, add it to the history. (or (equal newcmd (car command-history)) (setq command-history (cons newcmd command-history))) (eval newcmd)) (if command-history (icicle-user-error "Argument %d is beyond length of command history" arg) (icicle-user-error "There are no previous complex commands to repeat"))))) (defun icicle-add-entry-to-saved-completion-set (set-name entry type) "Add ENTRY to saved completion-candidates set SET-NAME. ENTRY is normally a single candidate (a string). With a prefix arg, however, and if option `icicle-filesets-as-saved-completion-sets-flag' is non-nil, then ENTRY is the name of an Emacs fileset (Emacs 22 or later). TYPE is the type of entry to add: `Fileset' or `Candidate'." (interactive (let ((typ (if (and current-prefix-arg icicle-filesets-as-saved-completion-sets-flag (prog1 (or (require 'filesets nil t) (error "Feature `filesets' not provided")) (filesets-init)) filesets-data) 'Fileset 'Candidate))) (list (save-selected-window (completing-read "Saved completion set: " icicle-saved-completion-sets nil t nil 'icicle-completion-set-history)) (if (eq typ 'Fileset) (list ':fileset ; Just save the fileset name, not the data. (car (assoc (completing-read "Fileset to add: " filesets-data nil t) filesets-data))) (completing-read "Candidate to add: " (mapcar #'list icicle-saved-completion-candidates))) typ))) (let ((file-name (cdr (assoc set-name icicle-saved-completion-sets)))) (unless (icicle-file-readable-p file-name) (error "Cannot read cache file `%s'" file-name)) (let ((list-buf (find-file-noselect file-name 'NOWARN 'RAW)) candidates newcands entry-type) (unwind-protect (condition-case icicle-add-entry-to-saved-completion-set (when (listp (setq newcands (setq candidates (read list-buf)))) (message "Set `%s' read from file `%s'" set-name file-name)) (error (error "Bad cache file. %s" (error-message-string icicle-add-entry-to-saved-completion-set)))) (kill-buffer list-buf)) (unless (consp newcands) (error "Bad data in cache file `%s'" file-name)) (pushnew entry newcands :test #'equal) (setq entry (if (eq type 'Fileset) (caar entry) entry)) (if (= (length candidates) (length newcands)) (message "%s `%s' is already in saved set `%s', file `%s'" type entry set-name file-name) (with-temp-message (format "Writing entry to cache file `%s'..." file-name) (with-temp-file file-name (prin1 newcands (current-buffer)))) (message "%s `%s' added to saved set `%s', file `%s'" type (icicle-propertize entry 'face 'icicle-msg-emphasis) (icicle-propertize set-name 'face 'icicle-msg-emphasis) (icicle-propertize file-name 'face 'icicle-msg-emphasis)))))) (defun icicle-remove-entry-from-saved-completion-set (set-name) "Remove an entry from saved completion-candidates set SET-NAME. SET-NAME can be an Icicles saved completions set (cache file) or the name of an Emacs fileset. The entry to remove can be a single completion candidate (a string) or an Emacs fileset. You can thus remove a file name from a fileset or remove a fileset from an Icicles saved completion set. (You can also remove a file name from a saved completion set.) If a saved set has both a file and a fileset of the same name, then both are removed. To use filesets here, use Emacs 22 or later, load library `filesets', use `(filesets-init)', and ensure that option `icicle-filesets-as-saved-completion-sets-flag' is non-nil." (interactive (list (completing-read "Saved completion set: " (if (and icicle-filesets-as-saved-completion-sets-flag (featurep 'filesets) filesets-data) (append filesets-data icicle-saved-completion-sets) icicle-saved-completion-sets) nil t nil 'icicle-completion-set-history))) (let* ((file-name (cdr (assoc set-name icicle-saved-completion-sets))) (candidates (icicle-get-candidates-from-saved-set set-name 'dont-expand)) (icicle-whole-candidate-as-text-prop-p t) (icicle-remove-icicles-props-p nil) ; Need prop `icicle-whole-candidate' for now. (entry (funcall icicle-get-alist-candidate-function (completing-read "Candidate to remove: " (mapcar (lambda (e) (cond ((icicle-saved-fileset-p e) ; Swap `:fileset' with fileset name `(,(cadr e) ,(car e) ,@(cddr e))) ((consp e) e) (t (list e)))) ; Listify naked string. candidates) nil t)))) (when (and (consp entry) (eq (cadr entry) ':fileset)) ; Swap back again: `:fileset' and name. (setq entry `(,(cadr entry) ,(car entry) ,@(cddr entry)))) (when (and (consp entry) (null (cdr entry))) (setq entry (car entry))) ; Use just the string. ;; Delete any such candidate, then remove text properties used for completion. (setq candidates (mapcar #'icicle-unpropertize-completion (delete entry candidates))) (cond (file-name (with-temp-message ; Remove from cache file. (format "Writing remaining candidates to cache file `%s'..." file-name) (with-temp-file file-name (prin1 candidates (current-buffer))))) ((icicle-saved-fileset-p (list ':fileset set-name)) ; Remove from fileset. (unless (require 'filesets nil t) (error "Feature `filesets' not provided")) (filesets-init) (let ((fst (and filesets-data (assoc set-name filesets-data)))) ; The fileset itself. (unless fst (error "No such fileset: `%s'" set-name)) (let ((fst-files (filesets-entry-get-files fst))) (if (car (filesets-member entry fst-files :test 'filesets-files-equalp)) (if fst-files ; Similar to code in `filesets-remove-buffer'. (let ((new-fst (list (cons ':files (delete entry fst-files))))) (setcdr fst new-fst) (filesets-set-config set-name 'filesets-data filesets-data)) (message "Cannot remove `%s' from fileset `%s'" (icicle-propertize entry 'face 'icicle-msg-emphasis) (icicle-propertize set-name 'face 'icicle-msg-emphasis))) (message "`%s' not in fileset `%s'" (icicle-propertize entry 'face 'icicle-msg-emphasis) (icicle-propertize set-name 'face 'icicle-msg-emphasis))))))) (when entry (icicle-msg-maybe-in-minibuffer "`%s' removed from %s `%s'%s" (icicle-propertize (if (icicle-saved-fileset-p entry) (cadr entry) entry) 'face 'icicle-msg-emphasis) (if (icicle-saved-fileset-p entry) "fileset" "saved set") (icicle-propertize set-name 'face 'icicle-msg-emphasis) (if file-name (format ", file `%s'" (icicle-propertize file-name'face 'icicle-msg-emphasis)) ""))))) (icicle-define-command icicle-remove-saved-completion-set ; Command name "Remove an entry from `icicle-saved-completion-sets'. Save the updated option. You are prompted to also delete the associated cache file. You can add entries to `icicle-saved-completion-sets' using command `icicle-add/update-saved-completion-set'." ; Doc string icicle-remove-saved-set-action "Remove set of completion candidates named: " ; `completing-read' args icicle-saved-completion-sets nil t nil 'icicle-completion-set-history nil nil ((icicle-whole-candidate-as-text-prop-p t) ; Additional bindings (icicle-use-candidates-only-once-flag t)) nil nil (icicle-remove-Completions-window)) ; First code, undo code, last code (defun icicle-remove-saved-set-action (set-name) "Remove saved set SET-NAME from `icicle-saved-completion-sets'." (let ((enable-recursive-minibuffers t) (sets icicle-saved-completion-sets) set cache) (save-selected-window (select-window (minibuffer-window)) (while (setq set (assoc set-name sets) cache (cdr set)) (when (file-exists-p cache) (if (y-or-n-p (format "Delete cache file `%s'? " (icicle-propertize cache 'face 'icicle-msg-emphasis))) (when (condition-case err (progn (delete-file cache) t) (error (progn (message "%s" (error-message-string err)) nil))) (message "%s `%s'" (icicle-propertize "DELETED" 'face 'icicle-msg-emphasis) cache) (sit-for 1)) (message "OK, file NOT deleted") (sit-for 1))) (setq sets (delete set sets))))) (setq icicle-saved-completion-sets (icicle-assoc-delete-all set-name icicle-saved-completion-sets)) (funcall icicle-customize-save-variable-function 'icicle-saved-completion-sets icicle-saved-completion-sets) (message "Candidate set `%s' removed" (icicle-propertize set-name 'face 'icicle-msg-emphasis))) (defun icicle-bookmark-save-marked-files (&optional arg) ; Bound to `C-M->' in *Bookmark List*. "Save file names of marked bookmarks as a set of completion candidates. Saves file names in variable `icicle-saved-completion-candidates', by default. Marked bookmarks that have no associated file are ignored. With a plain prefix arg (`C-u'), save candidates in a cache file. With a non-zero numeric prefix arg (`C-u N'), save candidates in a variable for which you are prompted. With a zero prefix arg (`C-0'), save candidates in a fileset (Emacs 22 or later). Use this only for file-name candidates, obviously. To subsequently use a fileset for candidate retrieval, option `icicle-filesets-as-saved-completion-sets-flag' must be non-nil. You can retrieve the saved set of file-name candidates during completion using `\\\\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a bookmark-list display buffer \(`*Bookmark List*')." (interactive "P") (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this command")) (bmkp-bmenu-barf-if-not-in-menu-list) (icicle-candidate-set-save-1 (bmkp-bmenu-get-marked-files) arg)) (defun icicle-bookmark-save-marked-files-more (&optional arg) ; Bound to `C->' in *Bookmark List*. "Add the file names of the marked bookmarks to the saved candidates set. Marked bookmarks that have no associated file are ignored. Add candidates to `icicle-saved-completion-candidates', by default. A prefix argument acts the same as for `icicle-candidate-set-save'. The existing saved candidates remain saved. The current candidates are added to those already saved. You can retrieve the saved set of candidates with `C-M-<'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a bookmark-list display buffer \(`*Bookmark List*')." (interactive "P") (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this command")) (bmkp-bmenu-barf-if-not-in-menu-list) (icicle-candidate-set-save-1 (bmkp-bmenu-get-marked-files) arg t)) (defun icicle-bookmark-save-marked-files-to-variable () ; Bound to `C-M-}' in *Bookmark List*. "Save the file names of the marked bookmarks to a variable. Marked bookmarks that have no associated file are ignored. You can retrieve the saved set of file-name candidates during completion using `\\\\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a bookmark-list display buffer \(`*Bookmark List*')." (interactive) (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this command")) (bmkp-bmenu-barf-if-not-in-menu-list) (icicle-candidate-set-save-1 (bmkp-bmenu-get-marked-files) 99)) (defalias 'icicle-bookmark-save-marked-files-as-project ; Bound to `C-}' in *Bookmark List*. 'icicle-bookmark-save-marked-files-persistently) (defun icicle-bookmark-save-marked-files-persistently (filesetp) "Save the file names of the marked bookmarks as a persistent set. Marked bookmarks that have no associated file are ignored. With no prefix arg, save in a cache file. With a prefix arg, save in an Emacs fileset (Emacs 22 or later). You can retrieve the saved set of file-name candidates during completion using `\\\\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a bookmark-list display buffer \(`*Bookmark List*')." (interactive "P") (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this command")) (bmkp-bmenu-barf-if-not-in-menu-list) (icicle-candidate-set-save-1 (bmkp-bmenu-get-marked-files) (if filesetp 0 '(1)))) (defun icicle-dired-save-marked (&optional arg) ; Bound to `C-M->' in Dired. "Save the marked file names in Dired as a set of completion candidates. Saves file names in variable `icicle-saved-completion-candidates', by default. With a plain prefix arg (`C-u'), save candidates in a cache file. With a non-zero numeric prefix arg (`C-u N'), save candidates in a variable for which you are prompted. With a zero prefix arg (`C-0'), save candidates in a fileset (Emacs 22 or later). Use this only for file-name candidates, obviously. To subsequently use a fileset for candidate retrieval, option `icicle-filesets-as-saved-completion-sets-flag' must be non-nil. You can retrieve the saved set of file-name candidates during completion using `\\\\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a Dired buffer." (interactive "P") (unless (eq major-mode 'dired-mode) (icicle-user-error "You must be in a Dired buffer to use this command")) (icicle-candidate-set-save-1 (dired-get-marked-files) arg)) (defun icicle-dired-save-marked-more (&optional arg) ; Bound to `C->' in Dired. "Add the marked file names in Dired to the saved candidates set. Like `icicle-dired-save-marked', but add file names to those already saved, if any. A prefix argument has the same effect as for `icicle-dired-save-marked'." (interactive "P") (unless (eq major-mode 'dired-mode) (icicle-user-error "You must be in a Dired buffer to use this command")) (icicle-candidate-set-save-1 (dired-get-marked-files) arg t)) (defun icicle-dired-save-marked-to-variable () ; Bound to `C-M-}' in Dired. "Save the marked file names in Dired to a variable as a candidate set. Same as using `icicle-dired-save-marked' with no prefix argument." (interactive) (unless (eq major-mode 'dired-mode) (icicle-user-error "You must be in a Dired buffer to use this command")) (icicle-candidate-set-save-1 (dired-get-marked-files) 99)) (defalias 'icicle-dired-save-marked-as-project ; Bound to `C-}' in Dired. 'icicle-dired-save-marked-persistently) (defun icicle-dired-save-marked-persistently (filesetp) "Save the marked file names in Dired as a persistent set. With no prefix arg, save in a cache file. With a prefix arg, save in an Emacs fileset (Emacs 22 or later). You can retrieve the saved set of file-name candidates during completion using `\\\\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from a Dired buffer." (interactive "P") (unless (eq major-mode 'dired-mode) (icicle-user-error "You must be in a Dired buffer to use this command")) (icicle-candidate-set-save-1 (dired-get-marked-files) (if filesetp 0 '(1)))) ;;; These commands require library `Dired+'. ;;; (when (fboundp 'diredp-get-files) ; In Dired+. (defun icicle-dired-save-marked-recursive (&optional ignore-marks-p arg) ; Bound to `M-+ C-M->' in Dired. "Save the marked file names in Dired, including those in marked subdirs. Like `icicle-dired-save-marked', but act recursively on subdirs. The files included are those that are marked in the current Dired buffer, or all files in the directory if none are marked. Marked subdirectories are handled recursively in the same way. With a prefix argument, ignore all marks - include all files in this Dired buffer and all subdirs, recursively. You need library `Dired+' for this command." (interactive (progn (unless (fboundp 'diredp-get-confirmation-recursive) (icicle-user-error "You need library `dired+.el' for this command")) (diredp-get-confirmation-recursive) (list current-prefix-arg 1))) (icicle-candidate-set-save-1 (diredp-get-files ignore-marks-p) arg)) (defun icicle-dired-save-marked-more-recursive (&optional ignore-marks-p arg) ; Bound to `M-+ C->' in Dired. "Add marked files, including those in marked subdirs, to saved candidates. Like `icicle-dired-save-marked-more', but act recursively on subdirs. The files included are those that are marked in the current Dired buffer, or all files in the directory if none are marked. Marked subdirectories are handled recursively in the same way. With a prefix argument, ignore all marks - include all files in this Dired buffer and all subdirs, recursively. You need library `Dired+' for this command." (interactive (progn (unless (fboundp 'diredp-get-confirmation-recursive) (icicle-user-error "You need library `dired+.el' for this command")) (diredp-get-confirmation-recursive) (list current-prefix-arg 1))) (icicle-candidate-set-save-1 (diredp-get-files ignore-marks-p) arg t)) (defun icicle-dired-save-marked-to-variable-recursive (&optional ignore-marks-p) ; `M-+ C-M-}' in Dired. "Save marked files, including those in marked subdirs, to a variable. Like `icicle-dired-save-marked-to-variable', but act recursively on subdirs. The files included are those that are marked in the current Dired buffer, or all files in the directory if none are marked. Marked subdirectories are handled recursively in the same way. With a prefix argument, ignore all marks - include all files in this Dired buffer and all subdirs, recursively. You need library `Dired+' for this command." (interactive (progn (unless (fboundp 'diredp-get-confirmation-recursive) (icicle-user-error "You need library `dired+.el' for this command")) (diredp-get-confirmation-recursive) (list current-prefix-arg))) (icicle-candidate-set-save-1 (diredp-get-files ignore-marks-p) 99)) (defun icicle-dired-save-marked-to-cache-file-recursive (&optional ignore-marks-p) ; `M-+ C-}' in Dired. "Save marked files, including in marked subdirs, to an Icicles cache set. Like `icicle-dired-save-marked-persistently' with no prefix arg, but act recursively on subdirs. The files included are those that are marked in the current Dired buffer, or all files in the directory if none are marked. Marked subdirectories are handled recursively in the same way. With a prefix argument, ignore all marks - include all files in this Dired buffer and all subdirs, recursively. You need library `Dired+' for this command." (interactive (progn (unless (fboundp 'diredp-get-confirmation-recursive) (icicle-user-error "You need library `dired+.el' for this command")) (diredp-get-confirmation-recursive) (list current-prefix-arg))) (icicle-candidate-set-save-1 (diredp-get-files ignore-marks-p) '(1))) (defun icicle-dired-save-marked-to-fileset-recursive (&optional ignore-marks-p) ; Not bound by default. "Save marked files, including those in marked subdirs, to an Emacs fileset. Like `icicle-dired-save-marked-persistently' with no prefix arg, but act recursively on subdirs. The files included are those that are marked in the current Dired buffer, or all files in the directory if none are marked. Marked subdirectories are handled recursively in the same way. With a prefix argument, ignore all marks - include all files in this Dired buffer and all subdirs, recursively. You need library `Dired+' for this command." (interactive (progn (unless (fboundp 'diredp-get-confirmation-recursive) (icicle-user-error "You need library `dired+.el' for this command")) (unless (require 'filesets nil t) (error "Cannot save to a fileset - feature `filesets' not provided")) (diredp-get-confirmation-recursive) (list current-prefix-arg))) (icicle-candidate-set-save-1 (diredp-get-files ignore-marks-p) 0))) (when (and (> emacs-major-version 21) ; Emacs 20 has no PREDICATE arg to `read-file-name'. (fboundp 'diredp-insert-as-subdir)) (icicle-define-file-command icicle-dired-insert-as-subdir "Choose a directory. Insert it into a Dired ancestor listing. If the directory you choose has a Dired buffer then its markings and switches are preserved for the subdir listing in the ancestor Dired buffer. You need library `Dired+' for this command." (lambda (dir) (diredp-insert-as-subdir dir ancestor-dir)) ; FREE here: ANCESTOR-DIR. "Insert directory into ancestor Dired: " ; `read-file-name' args default-directory nil t nil `(lambda (ff) (and (file-directory-p (expand-file-name ff)) (dired-in-this-tree (expand-file-name ff) ',ancestor-dir))) ((ancestor-dir ; Bindings (completing-read "Ancestor Dired dir to insert into: " (cons (list default-directory) (mapcar #'list (diredp-ancestor-dirs default-directory)))))))) (put 'icicle-dired-saved-file-candidates 'icicle-Completions-window-max-height 200) (defalias 'icicle-dired-chosen-files 'icicle-dired-saved-file-candidates) (defun icicle-dired-saved-file-candidates (prompt-for-dir-p) "Open Dired on a set of files and directories of your choice. If you have saved a set of file names using \\\ `\\[icicle-candidate-set-save]', then it is used. If not, you are reminded to do so. With a prefix argument, you are prompted for the default directory to use. Otherwise, the current value of `default-directory' is used. Names that do not correspond to existing files are ignored. Existence of files with relative names is checked in the Dired directory (default directory)." (interactive "P") ;; $$$$$$$ Maybe filter sets to get only file-name candidate sets? (let* ((default-directory (if prompt-for-dir-p (read-file-name "Directory: " nil default-directory nil) default-directory)) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (file-names (icicle-remove-if (lambda (fil) (or (null fil) (not (or (icicle-file-remote-p fil) ; Avoid Tramp accessing. (file-exists-p fil))))) (or (and icicle-saved-completion-candidates (mapcar #'icicle-transform-multi-completion icicle-saved-completion-candidates)) (icicle-file-list))))) (unless file-names (error "No files or directories chosen")) (dired (cons (generate-new-buffer-name "Icy File Set") (nreverse file-names))))) (put 'icicle-dired-saved-file-candidates-other-window 'icicle-Completions-window-max-height 200) (defalias 'icicle-dired-chosen-files-other-window 'icicle-dired-saved-file-candidates-other-window) (defun icicle-dired-saved-file-candidates-other-window (prompt-for-dir-p) ; Bound `C-M-<' in Dired. "Open Dired in other window on set of files & directories of your choice. If you have saved a set of file names using \\\ `\\[icicle-candidate-set-save]', then it is used. If not, you are reminded to do so. With a prefix arg, you are prompted for the default directory to use. Otherwise, the current value of `default-directory' is used. Names that do not correspond to existing files are ignored. Existence of files with relative names is checked in the Dired directory (default directory)." (interactive "P") ;; $$$$$$$ Maybe filter sets to get only file-name candidate sets? (let* ((default-directory (if prompt-for-dir-p (read-file-name "Directory: " nil default-directory nil) default-directory)) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (file-names (icicle-remove-if (lambda (fil) (or (null fil) (not (or (icicle-file-remote-p fil) ; Avoid Tramp accessing. (file-exists-p fil))))) (or (and icicle-saved-completion-candidates (mapcar #'icicle-transform-multi-completion icicle-saved-completion-candidates)) (icicle-file-list))))) (unless file-names (error "No files or directories chosen")) (dired-other-window (cons (generate-new-buffer-name "Icy File Set") (nreverse file-names))))) (put 'icicle-dired-project 'icicle-Completions-window-max-height 200) (defun icicle-dired-project (prompt-for-dir-p) "Open Dired on a saved project. A project is either a persistent completion set or an Emacs fileset. With a prefix argument, you are prompted for the directory. Otherwise, the default directory is assumed. Project file names that do not correspond to existing files are ignored. Existence of files with relative names is checked in the directory. You can use `C-x m' during completion to access Dired bookmarks, if you use library `Bookmark+'." (interactive "P") (when (require 'bookmark+ nil t) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") ; `C-x m' 'icicle-bookmark-dired-other-window)) (unwind-protect ;; $$$$$$$ Maybe filter sets to get only file-name candidate sets? (let ((set-name (completing-read "Project (saved file names): " (if (and icicle-filesets-as-saved-completion-sets-flag (featurep 'filesets) filesets-data) (append filesets-data icicle-saved-completion-sets) icicle-saved-completion-sets) nil nil nil 'icicle-completion-set-history))) (icicle-retrieve-candidates-from-set set-name) (let* ((default-directory (if prompt-for-dir-p (read-file-name "Dired directory: " nil default-directory nil) default-directory)) (file-names ())) (dolist (ff icicle-saved-completion-candidates) (when (or (icicle-file-remote-p ff) ; Don't let Tramp try to access it. (file-exists-p ff)) (push ff file-names))) (unless file-names (error "No files in project `%s' actually exist" set-name)) (dired (cons (generate-new-buffer-name set-name) (nreverse (mapcar (lambda (file) (if (file-name-absolute-p file) (expand-file-name file) file)) file-names)))))) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") nil))) (put 'icicle-dired-project-other-window 'icicle-Completions-window-max-height 200) (defun icicle-dired-project-other-window (prompt-for-dir-p) ; Bound to `C-{' in Dired. "Open Dired on a saved project in another window. A project is either a persistent completion set or an Emacs fileset. With a prefix argument, you are prompted for the directory. Otherwise, the default directory is assumed. Project file names that do not correspond to existing files are ignored. Existence of files with relative names is checked in the directory. You can use `C-x m' during completion to access Dired bookmarks, if you use library `Bookmark+'." (interactive "P") (when (require 'bookmark+ nil t) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") ; `C-x m' 'icicle-bookmark-dired-other-window)) (unwind-protect ;; $$$$$$$ Maybe filter sets to get only file-name candidate sets? (let ((set-name (completing-read "Project (saved file names): " (if (and icicle-filesets-as-saved-completion-sets-flag (featurep 'filesets) filesets-data) (append filesets-data icicle-saved-completion-sets) icicle-saved-completion-sets) nil nil nil 'icicle-completion-set-history))) (icicle-retrieve-candidates-from-set set-name) (let* ((default-directory (if prompt-for-dir-p (read-file-name "Dired directory: " nil default-directory nil) default-directory)) (file-names ())) (dolist (ff icicle-saved-completion-candidates) (when (or (icicle-file-remote-p ff) ; Don't let Tramp try to access it. (file-exists-p ff)) (push ff file-names))) (unless file-names (error "No files in project `%s' actually exist" set-name)) (dired-other-window (cons (generate-new-buffer-name set-name) (nreverse (mapcar (lambda (file) (if (file-name-absolute-p file) (expand-file-name file) file)) file-names)))))) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") nil))) (defun icicle-grep-saved-file-candidates (command-args) ; Bound to `M-s M-s g' in Icicle mode. "Run `grep' on the set of completion candidates saved with \\\ `\\[icicle-candidate-set-save]'. Saved names that do not correspond to existing files are ignored. Existence of files with relative names is checked in the default directory." (interactive (list (let ((file-names ())) (unless icicle-saved-completion-candidates (icicle-user-error "%s" (substitute-command-keys "No saved completion candidates. \ Use \\`\\[icicle-candidate-set-save]' to save candidates"))) (unless grep-command (grep-compute-defaults)) (dolist (ff icicle-saved-completion-candidates) (when (or (icicle-file-remote-p ff) ; Don't let Tramp try to access it. (file-exists-p ff)) (push ff file-names))) (let ((default (and (fboundp 'grep-default-command) (grep-default-command)))) (read-from-minibuffer "grep : " (let ((up-to-files (concat grep-command " "))) (cons (concat up-to-files (mapconcat #'identity icicle-saved-completion-candidates " ")) (- (length up-to-files) 2))) nil nil 'grep-history default))))) (grep command-args)) ;; Utility function. Use it to define multi-commands that navigate. (defun icicle-explore (define-candidates-fn final-action-fn quit-fn error-fn cleanup-fn prompt &rest compl-read-args) "Icicle explorer: explore complex completion candidates. Navigate among locations or other entities represented by a set of completion candidates. See `icicle-search' for a typical example. Arguments: DEFINE-CANDIDATES-FN: Function of no args called to fill `icicle-candidates-alist' with the candidates. FINAL-ACTION-FN: Function of no args called after the final choice of candidate (after both `icicle-explore-final-choice' and `icicle-explore-final-choice-full' have been set). Typically uses `icicle-explore-final-choice-full', the full candidate. QUIT-FN: Function of no args called if user uses `C-g'. ERROR-FN: Function of no args called if an error is raised. CLEANUP-FN: Function of no args called after exploring. PROMPT: Prompt string for `completing-read'. COMPL-READ-ARGS: `completing-read' args other than PROMPT and COLLECTION. If there is only one candidate, then FINAL-ACTION-FN is called immediately. The candidate is not available to act on (e.g. using \\`\\[icicle-candidate-alt-action]'). Returns: The result of executing FINAL-ACTION-FN, if that arg is non-nil. Otherwise, `icicle-explore-final-choice-full'. To use `icicle-explore' to define a multi-command, you must also bind `icicle-candidate-action-fn'. Though `icicle-explore' is typically used to define navigation commands, it need not be. It can be useful anytime you need to use `completing-read' and also provide specific behavior for quitting \(`C-g'), completion errors, and final actions." (let ((icicle-incremental-completion 'always) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-act-before-cycle-flag icicle-act-before-cycle-flag) (icicle-orig-pt-explore (point-marker)) (icicle-orig-win-explore (selected-window)) result) (setq icicle-act-before-cycle-flag nil icicle-candidates-alist () icicle-explore-final-choice nil icicle-explore-final-choice-full nil) (icicle-highlight-lighter) (message "Finding candidates...") (when define-candidates-fn (funcall define-candidates-fn)) (unless icicle-candidates-alist (error "No candidates defined")) (when (= (length icicle-candidates-alist) 1) (setq icicle-explore-final-choice (icicle-display-cand-from-full-cand (car icicle-candidates-alist)))) (unwind-protect (icicle-condition-case-no-debug failure (progn (unless icicle-explore-final-choice (setq icicle-explore-final-choice (let ((icicle-remove-icicles-props-p nil)) ; Keep Icicles text properties. (apply #'completing-read prompt icicle-candidates-alist compl-read-args)))) (setq icicle-explore-final-choice-full (funcall icicle-get-alist-candidate-function icicle-explore-final-choice 'no-error-p)) (unless icicle-explore-final-choice-full (error "No such occurrence")) (setq result (if final-action-fn (funcall final-action-fn) icicle-explore-final-choice-full))) (quit (if quit-fn (funcall quit-fn) (keyboard-quit))) (error (when error-fn (funcall error-fn)) (error "%s" (error-message-string failure)))) (setq result (icicle-unpropertize-completion result)) ; Remove any Icicles text properties. (when cleanup-fn (funcall cleanup-fn))) result)) (icicle-define-command icicle-execute-extended-command ; Bound to `M-x' in Icicle mode. "Read command name, then read its arguments and call it. This is `execute-extended-command', turned into a multi-command. You can use `\\\\[icicle-toggle-transforming]' \ to toggle filtering of candidates to those that are bound to keys. You can use `\\[icicle-toggle-annotation]' to toggle showing key bindings as annotations. \(Menu bindings are not shown.) By default, Icicle mode remaps all key sequences that are normally bound to `execute-extended-command' to `icicle-execute-extended-command'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." ; Doc string icicle-execute-extended-command-1 ; Function to perform the action (format "Execute command%s: " ; `completing-read' args (if current-prefix-arg (format " (prefix %d)" (prefix-numeric-value current-prefix-arg)) "")) obarray (and icompletep pred) t nil 'extended-command-history nil nil (;; Bindings (last-command last-command) ; Save and restore the last command. (use-file-dialog nil) ; `mouse-2' in `*Completions*' won't use dialog box. (alt-fn nil) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (lambda (c) (unless (symbolp c) (setq c (intern-soft c))) (commandp c))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "command")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "command"))) (icicle--last-toggle-transforming-msg icicle-toggle-transforming-message) (icicle-toggle-transforming-message "Filtering to commands bound to keys is now %s") (icicle-last-transform-function (lambda (cands) ; Because we bind `icicle-transform-function'. (with-current-buffer icicle-pre-minibuffer-buffer (loop for cand in cands for symb = (intern-soft cand) if (and (symbolp symb) (where-is-internal symb nil 'non-ascii)) collect cand)))) (icicle-transform-function nil) (completion-annotate-function (lambda (cand) (with-current-buffer icicle-pre-minibuffer-buffer (and (setq cand (intern-soft cand)) (symbolp cand) (let ((key (where-is-internal cand nil t))) (and key (format " %s" (icicle-key-description key)))))))) icicle-new-last-cmd) ; Set in `icicle-execute-extended-command-1'. nil nil ; First code, undo code (setq this-command icicle-new-last-cmd)) ; Last code: this will update `last-command' ;; Free vars here: `icicle-orig-buff' and `icicle-orig-window' are bound by `icicle-define-command'. ;; `icicle-new-last-cmd' and `icicle-orig-must-pass-after-match-pred' are bound in ;; `icicle-execute-extended-command'. (defun icicle-execute-extended-command-1 (cmd-name) "Action function to execute command or named keyboard macro CMD-NAME." (when (get-buffer icicle-orig-buff) (set-buffer icicle-orig-buff)) (when (window-live-p icicle-orig-window) (select-window icicle-orig-window)) (when (string= "" cmd-name) (error "No command name")) (let* ((cmd (intern cmd-name)) (fn (and (fboundp cmd) (symbol-function cmd))) (count (prefix-numeric-value current-prefix-arg)) (completion-annotate-function nil) ; Cancel value from `icicle-execute-extended-command'. (icicle-toggle-transforming-message icicle--last-toggle-transforming-msg) ; Restore - FREE HERE ;; Rebind alternative action functions to nil, so we don't override the command we call. (icicle-candidate-alt-action-fn nil) (icicle-all-candidates-list-alt-action-fn nil) ;; Rebind `icicle-candidate-action-fn' to a function that calls the candidate command on a single ;; argument that it reads. This is used only if the command itself reads an input argument with ;; completion. When that is the case, you can use completion on that input, and if you do that, ;; you can use `C-RET' to use the candidate command as a multi-command. In other words, this ;; binding allows for two levels of multi-commands. (icicle-candidate-action-fn (and icicle-candidate-action-fn ; This is nil after the command name is read. `(lambda (arg) (setq arg (icicle-transform-multi-completion arg)) (condition-case nil (funcall ',cmd arg) ; Try to use string candidate `arg'. ;; If that didn't work, use a symbol or number candidate. (wrong-type-argument (funcall ',cmd (car (read-from-string arg)))) (wrong-number-of-arguments (funcall #'icicle-help-on-candidate))) ; Punt - show help. (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))))) (cond ((arrayp fn) (let ((this-command cmd)) (execute-kbd-macro fn count)) (when (> count 1) (message "(%d times)" count))) ((commandp cmd) (run-hooks 'post-command-hook) (run-hooks 'pre-command-hook) (let ((enable-recursive-minibuffers t) ;; Restore this before we invoke command, since it might use completion. (icicle-must-pass-after-match-predicate icicle-orig-must-pass-after-match-pred) ;; Bind, don't set `this-command'. When you use `C-next', `this-command' needs ;; to be `cmd' during the `C-RET' part, but `last-command' must not be `cmd' ;; during the `next' part. (this-command cmd)) (call-interactively cmd 'record-it))) ;; Should not happen, since `icicle-e*-e*-command' calls `completing-read' with non-nil REQUIRE arg. (t (error "Not a command: `%s'" cmd-name))) ;; Message showing what CMD is bound to. This is pretty much the same as in `execute-extended-command', ;; but do not show the message if we are not at the `M-x' top level, i.e., if we are acting on a ;; candidate command using `C-RET' instead of `RET'. (when (and suggest-key-bindings (not executing-kbd-macro) (not (or (icicle-get-safe this-command 'icicle-action-command) ;; This one is used for `*-per-mode-action', which sets `this-command' to the cycler. (icicle-get-safe this-command 'icicle-cycling-command)))) (let* ((binding (if (> emacs-major-version 21) (where-is-internal cmd overriding-local-map t 'NOINDIRECT) (where-is-internal cmd overriding-local-map t))) (curr-msg (current-message)) (wait-time (or (and (numberp suggest-key-bindings) suggest-key-bindings) 2))) (when (and binding (not (and (vectorp binding) (eq (aref binding 0) 'mouse-movement)))) (let ((message-log-max nil) ; Do not log this message. ;; If CMD showed a msg in echo area, wait a bit, before showing the key-reminder msg. (waited (sit-for (if (current-message) wait-time 0)))) (when (and waited (atom unread-command-events)) (unwind-protect (progn (message "You can invoke command `%s' using `%s'" (icicle-propertize (symbol-name cmd) 'face 'icicle-msg-emphasis) (icicle-propertize (key-description binding) 'face 'icicle-msg-emphasis)) (sit-for wait-time)) (message "%s" curr-msg))))))) ;; After `M-x' `last-command' must be the command finally entered with `RET' or, if you end ;; with `C-g', the last command entered with `C-RET'. (setq icicle-new-last-cmd cmd))) ;; Inspired by Emacs partial completion and by library `exec-abbrev-cmd.el' (Tassilo Horn ;; ). The idea of command abbreviation is combined here with normal ;; command invocation, in an Icicles multi-command. ;; (icicle-define-command icicle-command-abbrev ; Bound to `C-x SPC' in Icicle mode. "Read command name or its abbreviation, read command args, call command. Read input, then call `icicle-command-abbrev-action' to act on it. If `icicle-add-proxy-candidates-flag' is non-nil, then command abbreviations, as well as commands, are available as completion candidates. Otherwise, only commands are available. You can toggle `icicle-add-proxy-candidates-flag' using `\\\ \\[icicle-toggle-proxy-candidates]'in the minibuffer. When an abbreviation is available, you can treat it just like a command. The rest of this description covers the behavior of choosing an abbreviation. Completion for an abbreviation is lax. If you enter a new abbreviation then it is added to option `icicle-command-abbrev-alist', which is the list of your known abbreviations. You can also customize this list. If an abbreviation that you enter matches a single command name then that command is invoked. If it matches more than one, then you can use (strict) completion to choose one. Hyphens (`-') in command names divide them into parts. For example, `find-file' has two parts: `find' and `file'. Each character of a command abbreviation corresponds to one part of each of the commands that match the abbreviation. For example, abbreviation `ff' matches commands `find-file' and `focus-frame', and abbreviation `fg' matches `find-grep'. If user option `icicle-command-abbrev-match-all-parts-flag' is nil then an abbreviation need not match all parts of a command name; it need match only a prefix. For example, if nil then abbreviation `ff' also matches `find-file-other-window' and `fg' also matches `find-grep-dired'. You can use `\\\\[icicle-toggle-transforming]' \ to toggle filtering of candidates to those that are bound to keys. You can use `\\[icicle-toggle-annotation]' to toggle showing key bindings as annotations. \(Menu bindings are not shown.)" ; Doc string icicle-command-abbrev-action ; Function to perform the action prompt obarray (and icompletep pred) nil nil ; `completing-read' args 'icicle-command-abbrev-history nil nil ((prompt "Command or abbrev: ") (last-command last-command) ; Save and restore the last command. (icicle-sort-comparer 'icicle-proxy-candidate-first-p) (first-sort-entries '(("proxy candidates first" . icicle-proxy-candidate-first-p) ("by abbrev frequency" . icicle-command-abbrev-used-more-p))) (icicle-sort-orders-alist (append first-sort-entries (delete (car first-sort-entries) (delete (cadr first-sort-entries) (copy-sequence icicle-sort-orders-alist))))) (icicle-allowed-sort-predicate 'icicle-command-abbrev-used-more-p) (icicle-proxy-candidates (let ((ipc ()) abv) (dolist (entry icicle-command-abbrev-alist ipc) (setq abv (symbol-name (cadr entry))) (unless (member abv ipc) (push abv ipc))) ipc)) (use-file-dialog nil) ; `mouse-2' in `*Completions*' won't use dialog box. (alt-fn nil) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (lambda (c) (unless (symbolp c) (setq c (intern-soft c))) (commandp c))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "command")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "command"))) (icicle-toggle-transforming-message "Filtering to commands bound to keys is now %s") (icicle-last-transform-function (lambda (cands) ; Because we bind `icicle-transform-function'. (with-current-buffer icicle-pre-minibuffer-buffer (loop for cand in cands for symb = (intern-soft cand) if (and (symbolp symb) (where-is-internal symb nil 'non-ascii)) collect cand)))) (icicle-transform-function nil) (completion-annotate-function (lambda (cand) (with-current-buffer icicle-pre-minibuffer-buffer (and (setq cand (intern-soft cand)) (symbolp cand) (let ((key (where-is-internal cand nil t))) (and key (format " %s" (icicle-key-description key))))))))) (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt)) ; First code nil (setq icicle-proxy-candidates ())) ; Undo code, last code (defun icicle-command-abbrev-action (abbrev-or-cmd) "Action function for `icicle-command-abbrev'. If ABBREV-OR-CMD is a command, call it. If ABBREV-OR-CMD is an abbreviation for a single command, invoke it. If ABBREV-OR-CMD is an abbreviation for multiple commands, call `icicle-command-abbrev-command', to let user choose commands. If ABBREV-OR-CMD is not an abbreviation or a command, raise an error." (setq abbrev-or-cmd (intern abbrev-or-cmd)) (let* ((completion-annotate-function nil) ; Cancel value from `icicle-command-abbrev'. (icicle-add-proxy-candidates-flag icicle-add-proxy-candidates-flag) (icicle-proxy-candidates icicle-proxy-candidates) ;; Restore this before we invoke command, since it might use completion. ;; Free var `orig-must-pass...' is bound in `icicle-command-abbrev'. (icicle-must-pass-after-match-predicate icicle-orig-must-pass-after-match-pred) ;; Rebind alternative action functions to nil, so we don't override command we call. (icicle-candidate-alt-action-fn nil) (icicle-all-candidates-list-alt-action-fn nil) (not-cmdp (not (commandp abbrev-or-cmd))) (regexp (and (or not-cmdp icicle-command-abbrev-priority-flag) (icicle-command-abbrev-regexp abbrev-or-cmd))) (icicle-commands-for-abbrev (and (or not-cmdp icicle-command-abbrev-priority-flag) (nconc (let ((result ())) (dolist (abrv icicle-command-abbrev-alist) (when (string= (symbol-name (cadr abrv)) (symbol-name abbrev-or-cmd)) (push (list (symbol-name (car abrv))) result))) result) (icicle-command-abbrev-matching-commands regexp))))) (cond ((and not-cmdp (null icicle-commands-for-abbrev)) (error "No such command or abbreviation `%s'" abbrev-or-cmd)) (icicle-commands-for-abbrev (let ((cmd (if (null (cdr icicle-commands-for-abbrev)) (prog1 (intern (caar icicle-commands-for-abbrev)) (push (caar icicle-commands-for-abbrev) extended-command-history) (call-interactively (intern (caar icicle-commands-for-abbrev)) t)) (let ((enable-recursive-minibuffers t) (icicle-current-input abbrev-or-cmd)) (icicle-remove-Completions-window) (icicle-command-abbrev-command))))) (icicle-command-abbrev-record abbrev-or-cmd cmd))) ((not not-cmdp) (call-interactively abbrev-or-cmd))))) (defun icicle-command-abbrev-regexp (abbrev) "Return the command-matching regexp for ABBREV." (let ((char-list (append (symbol-name abbrev) ())) (str "^")) (dolist (c char-list) (setq str (concat str (list c) "[^-]*-"))) (concat (substring str 0 (1- (length str))) (if icicle-command-abbrev-match-all-parts-flag "$" ".*$")))) (defun icicle-command-abbrev-matching-commands (regexp) "Return a completion alist of commands that match REGEXP." (mapcar #'list (icicle-remove-if-not `(lambda (strg) (string-match ',regexp strg)) (lexical-let ((cmds ())) (mapatoms (lambda (symb) (when (commandp symb) (push (symbol-name symb) cmds)))) ; FREE here: CMDS. cmds)))) (icicle-define-command icicle-command-abbrev-command "Read command name, then read its arguments and call command." ; Doc string icicle-execute-extended-command-1 ; Function to perform the action (format "Command abbreviated%s%s: " ; `completing-read' arguments (cond ((and icicle-current-input (not (string= "" icicle-current-input))) (format " `%s'" icicle-current-input)) (icicle-candidate-nb (format " `%s'" (elt icicle-completion-candidates icicle-candidate-nb))) (t "")) (if current-prefix-arg (format " (prefix %d)" (prefix-numeric-value current-prefix-arg)) "")) icicle-commands-for-abbrev nil t nil 'extended-command-history nil nil (;; Bindings (use-file-dialog nil) ; `mouse-2' in `*Completions*' shouldn't use file dialog. (alt-fn nil) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "command")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "command"))) (icicle-add-proxy-candidates-flag nil) ; No abbrevs - just commands here. (last-command last-command) ; Save and restore the last command. icicle-new-last-cmd) ; Set in `icicle-execute-extended-command-1'. nil nil ; First code, undo code (setq this-command icicle-new-last-cmd) ; Last code: this will update `last-command'. 'NON-INTERACTIVE) ; This is not a real command. (defun icicle-command-abbrev-record (abbrev command) "Record ABBREV and COMMAND in `icicle-command-abbrev-alist'." (let ((entry (assq command icicle-command-abbrev-alist))) (when (and abbrev command) (if entry (setq icicle-command-abbrev-alist (cons (list command abbrev (1+ (car (cddr entry)))) (delete entry icicle-command-abbrev-alist))) (push (list command abbrev 1) icicle-command-abbrev-alist))))) (icicle-define-command icicle-execute-named-keyboard-macro ; Bound to `C-x M-e' in Icicle mode. "Read the name of a keyboard macro, then execute it." icicle-execute-extended-command-1 ; Function to perform the action (format "Execute keyboard macro%s: " ; `completing-read' args (if current-prefix-arg (format " (prefix %d)" (prefix-numeric-value current-prefix-arg)) "")) obarray (and icompletep pred) t nil 'icicle-kmacro-history nil nil ((last-command last-command) ; Save and restore the last command. (alt-fn nil) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (lambda (fn) (unless (symbolp fn) (setq fn (intern fn))) (and (commandp fn) (arrayp (symbol-function fn))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "command")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "command"))))) (when (locate-library "kmacro") (icicle-define-command icicle-kmacro ; Bound to `S-f4' in Icicle mode (Emacs 22+). "Execute a keyboard macro according to its position in `kmacro-ring'. Macros in the keyboard macro ring are given names `1', `2', and so on, for use as completion candidates. With prefix argument, repeat macro that many times (but see below). If a macro is still being defined, end it first, then execute it. Since this is a multi-command, you can execute any number of macros any number of times in a single invocation. In particular, you can execute a given macro repeatedly using `C-RET' (be sure you use `TAB' first, to make it the current candidate). If you use a prefix arg for `icicle-kmacro', then each multi-command action (e.g. `C-RET') repeats the macro that number of times. However if you use a prefix arg for an individual action, then the action repeats the macro that number of times. Without its own prefix arg, an action uses the base prefix arg you used for `icicle-kmacro'." icicle-kmacro-action ; Function to perform the action (format "Execute keyboard macro%s: " ; `completing-read' args (if current-prefix-arg (format " (prefix %s)" (prefix-numeric-value current-prefix-arg)) "")) (lexical-let ((count 0)) (setq icicle-kmacro-alist (mapcar (lambda (x) (cons (format "%d" (setq count (1+ count))) x)) ; FREE here: COUNT. (reverse (if nil kmacro-ring (cons (kmacro-ring-head) kmacro-ring)))))) nil 'NO-EXIT-WO-MATCH nil 'icicle-kmacro-history (and (kmacro-ring-head) (null kmacro-ring) "1") nil ((icicle-pref-arg current-prefix-arg)) ; Additional bindings (progn ; First code (unless (require 'kmacro nil t) (icicle-user-error "You need library `kmacro.el' for this command")) (when defining-kbd-macro (kmacro-end-or-call-macro current-prefix-arg) (icicle-user-error "Done")) (unless (or (kmacro-ring-head) kmacro-ring) (icicle-user-error "No keyboard macro defined")))) ;; Free vars here: `icicle-orig-buff' & `icicle-orig-window' are bound by `icicle-define-command'. ;; `icicle-pref-arg' is bound in `icicle-kmacro'. (defun icicle-kmacro-action (cand) "Action function for `icicle-kmacro'." (when (get-buffer icicle-orig-buff) (set-buffer icicle-orig-buff)) (when (window-live-p icicle-orig-window) (select-window icicle-orig-window)) (let* ((count (if current-prefix-arg (prefix-numeric-value current-prefix-arg) icicle-pref-arg)) (macro (cadr (assoc cand icicle-kmacro-alist)))) (unless macro (error "No such macro: `%s'" cand)) (execute-kbd-macro macro count #'kmacro-loop-setup-function) (when (> count 1) (message "(%s times)" (icicle-propertize count 'face 'icicle-msg-emphasis)))))) (icicle-define-command icicle-set-option-to-t ; Command name "Set option to t. This makes sense for binary (toggle) options. By default, completion candidates are limited to user options that have `boolean' custom types. However, there are many \"binary\" options that allow other non-nil values than t. You can use a prefix argument to change the set of completion candidates, as follows: - With a non-negative prefix arg, all user options are candidates. - With a negative prefix arg, all variables are candidates." ; Doc string (lambda (opt) (set (intern opt) t) (message "`%s' is now `t'" opt)) ; Action function "Set option to t: " obarray (and icompletep pred) 'must-confirm nil ; `completing-read' args (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) nil nil ((enable-recursive-minibuffers t) ; Bindings (icicle-use-candidates-only-once-flag t) (alt-fn nil) (pred (cond ((and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg))) (lambda (x) (unless (symbolp x) (setq x (intern x))) (and (boundp x) (user-variable-p x) (eq nil (symbol-value x))))) (current-prefix-arg (lambda (x) (unless (symbolp x) (setq x (intern x))) (and (boundp x) (eq nil (symbol-value x))))) (t (lambda (x) (unless (symbolp x) (setq x (intern x))) (and (boundp x) (icicle-binary-option-p x) (eq nil (symbol-value x))))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "option")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "option"))))) (icicle-define-command icicle-clear-history "Clear a minibuffer history of selected entries. You are prompted for the history to clear, then you are prompted for the entries to delete from it. You can use multi-command completion for both inputs. That is, you can act on multiple histories and delete multiple entries from each. For convenience, you can use \\\ `\\[icicle-delete-candidate-object]' the same way as `C-RET': Each of them deletes the current entry candidate from the history. With a prefix argument, empty the chosen history completely \(you are not prompted to choose history entries to delete). `icicle-act-before-cycle-flag' is bound to t here during completion of history entries, so `C-next' and so on act on the current candidate." icicle-clear-history-1 ; Function to perform the action "History to clear: " icicle-clear-history-hist-vars ; `completing-read' args nil t nil nil (symbol-name minibuffer-history-variable) nil ((icicle-pref-arg current-prefix-arg) ; Bindings (enable-recursive-minibuffers t) (icicle-transform-function 'icicle-remove-duplicates) (icicle-clear-history-hist-vars `((,(symbol-name minibuffer-history-variable)) (,(symbol-name 'icicle-previous-raw-file-name-inputs)) (,(symbol-name 'icicle-previous-raw-non-file-name-inputs)))) (icicle-delete-candidate-object 'icicle-clear-history-entry)) (mapatoms (lambda (x) (when (and (boundp x) (consp (symbol-value x)) ; First code (stringp (car (symbol-value x))) (string-match "-\\(history\\|ring\\)\\'" (symbol-name x))) (push (list (symbol-name x)) ; FREE here: ICICLE-CLEAR-HISTORY-HIST-VARS. icicle-clear-history-hist-vars))))) ;; Free vars here: `icicle-pref-arg' is bound in `icicle-clear-history'. (defun icicle-clear-history-1 (hist) "Action function for `icicle-clear-history' history-variable candidates." (setq hist (intern hist)) (if (not icicle-pref-arg) (let* ((icicle-candidate-action-fn 'icicle-clear-history-entry) (icicle-transform-function 'icicle-remove-duplicates) (icicle-clear-history-hist hist) (icicle-use-candidates-only-once-flag t) (icicle-show-Completions-initially-flag t) (icicle-act-before-cycle-flag t)) (when hist ; Maybe there are no more, due to deletion actions. (funcall icicle-candidate-action-fn (completing-read "Clear input: " (mapcar #'list (symbol-value hist)) nil t)))) (set hist nil)) (unless hist (message "History `%s' is now empty" hist)) nil) ;; Free vars here: `icicle-clear-history-hist' is bound in `icicle-clear-history-1' ;; and in `icicle-clear-current-history'. (defun icicle-clear-history-entry (cand) "Action function for history entry candidates in `icicle-clear-history'." (unless (string= "" cand) (set icicle-clear-history-hist (icicle-remove-if `(lambda (x) (string= (icicle-substring-no-properties ',cand) (icicle-substring-no-properties x))) (symbol-value icicle-clear-history-hist))) ;; We assume here that CAND was in fact present in the history originally. (message "`%s' deleted from history `%s'" cand icicle-clear-history-hist)) nil) (icicle-define-command icicle-clear-current-history ; Bound to `M-i' in minibuffer. "Clear current minibuffer history of selected entries. You are prompted for the history entries to delete. With a prefix argument, however, empty the history completely \(you are not prompted to choose history entries to delete). `icicle-act-before-cycle-flag' is bound to t here during completion of history entries, so `C-next' and so on act on the current candidate." icicle-clear-history-entry ; Action function "Clear input: " (mapcar #'list (symbol-value icicle-clear-history-hist)) ; `completing-read' args nil t nil nil nil nil ((icicle-pref-arg current-prefix-arg) ; Bindings (enable-recursive-minibuffers t) (icicle-transform-function 'icicle-remove-duplicates) (icicle-use-candidates-only-once-flag t) (icicle-show-Completions-initially-flag t) (icicle-clear-history-hist minibuffer-history-variable)) (when icicle-pref-arg ; First code (icicle-ding) ; Use `error' just to exit and make sure message is seen. (if (not (yes-or-no-p (format "Are you sure you want to empty `%s' completely? " minibuffer-history-variable))) (icicle-user-error "") (set minibuffer-history-variable nil) (icicle-user-error "History `%s' is now empty" minibuffer-history-variable)))) (when (and icicle-define-alias-commands-flag (not (fboundp 'clear-option))) (defalias 'clear-option 'icicle-reset-option-to-nil)) (icicle-define-command icicle-reset-option-to-nil ; Command name "Set option to nil. This makes sense for binary and list options. By default, the set of completion candidates is limited to user options. Note: it is *not* limited to binary and list options. With a prefix arg, all variables are candidates." ; Doc string (lambda (opt) (set (intern opt) nil) (message "`%s' is now `nil'" opt)) ; Action function "Clear option (set it to nil): " obarray (and icompletep pred) t nil ; `completing-read' args (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) nil nil ((enable-recursive-minibuffers t) ; Bindings (icicle-use-candidates-only-once-flag t) (alt-fn nil) (pred (if current-prefix-arg (lambda (x) (unless (symbolp x) (setq x (intern x))) (and (boundp x) (symbol-value x))) (lambda (x) (unless (symbolp x) (setq x (intern x))) (and (boundp x) (user-variable-p x) (symbol-value x))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "option")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "option"))))) (when (and icicle-define-alias-commands-flag (not (fboundp 'toggle))) (defalias 'toggle 'icicle-toggle-option)) (icicle-define-command icicle-toggle-option ; Command name "Toggle option's value. This makes sense for binary (toggle) options. By default, completion candidates are limited to user options that have `boolean' custom types. However, there are many \"binary\" options that allow other non-nil values than t. You can use a prefix argument to change the set of completion candidates, as follows: - With a non-negative prefix arg, all user options are candidates. - With a negative prefix arg, all variables are candidates." ; Doc string (lambda (opt) ; Action function (let ((sym (intern opt))) (set sym (not (eval sym))) (message "`%s' is now `%s'" opt (icicle-propertize (eval sym) 'face 'icicle-msg-emphasis)))) "Toggle value of option: " obarray (and icompletep pred) 'must-confirm nil ; `completing-read' args (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) nil nil ((enable-recursive-minibuffers t) ; Bindings (alt-fn nil) (pred (cond ((and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg))) (lambda (c) (unless (symbolp c) (setq c (intern c))) (user-variable-p c))) (current-prefix-arg (lambda (c) (unless (symbolp c) (setq c (intern c))) (boundp c))) (t (lambda (c) (unless (symbolp c) (setq c (intern c))) (icicle-binary-option-p c))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "option")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "option"))))) (defun icicle-binary-option-p (symbol) "Non-nil if SYMBOL is a user option that has custom-type `boolean'." (eq (icicle-get-safe symbol 'custom-type) 'boolean)) (icicle-define-command icicle-increment-option ; Command name "Increment option's value using the arrow keys (`up', `down'). Completion candidates are limited to options that have `integer', `float', and `number' custom types. This command needs library `doremi.el'." ; Doc string (lambda (opt) ; Action function (let ((sym (intern opt)) ;; Restore this before we read number, since that might use completion. (icicle-must-pass-after-match-predicate icicle-orig-must-pass-after-match-pred)) (icicle-doremi-increment-variable+ sym (icicle-read-number "Increment (amount): ") t) (message "`%s' is now `%s'" opt (icicle-propertize (eval sym) 'face 'icicle-msg-emphasis)))) "Increment value of option: " obarray (and icompletep pred) 'must-confirm nil ; `completing-read' args (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) nil nil ((enable-recursive-minibuffers t) ; Bindings (alt-fn nil) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (lambda (symb) (unless (symbolp symb) (setq symb (intern-soft symb))) (memq (get symb 'custom-type) '(number integer float)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "option")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "option")))) (unless (require 'doremi nil t) ; First code (icicle-user-error "You need library `doremi.el' for this command"))) (icicle-define-command icicle-increment-variable ; Command name "Increment variable's value using the arrow keys (`up', `down'). With a prefix arg, only numeric user options are candidates. With no prefix arg, all variables are candidates, even those that are not numeric. This command needs library `doremi.el'." ; Doc string (lambda (var) ; FREE here: PREFIX-ARG. (let ((sym (intern var)) ;; Restore this before we read number, since that might use completion. (icicle-must-pass-after-match-predicate icicle-orig-must-pass-after-match-pred)) (icicle-doremi-increment-variable+ sym (icicle-read-number "Increment (amount): ") prefix-arg) (message "`%s' is now `%s'" var (icicle-propertize (eval sym) 'face 'icicle-msg-emphasis)))) "Increment value of variable: " obarray (and icompletep pred) 'must-confirm nil ; `completing-read' args (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) nil nil ((enable-recursive-minibuffers t) ; Bindings (prefix-arg current-prefix-arg) (alt-fn nil) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (if prefix-arg (lambda (symb) (unless (symbolp symb) (setq symb (intern-soft symb))) (memq (get symb 'custom-type) '(number integer float))) (lambda (symb) (unless (symbolp symb) (setq symb (intern symb))) (boundp symb)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type (if prefix-arg "option" "variable"))))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type (if prefix-arg "option" "variable"))))) (unless (require 'doremi nil t) ; First code (icicle-user-error "You need library `doremi.el' for this command"))) (defun icicle-doremi-increment-variable+ (variable &optional increment optionp) "Increment VARIABLE by INCREMENT (default 1). Use arrow key `up' or `down' or mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-up') to increment in larger steps. Interactively, you can choose VARIABLE using completion. With a prefix arg, only user options are available to choose from. Raises an error if VARIABLE's value is not a number." (interactive (let* ((symb (or (and (fboundp 'symbol-nearest-point) (symbol-nearest-point)) (and (symbolp (variable-at-point)) (variable-at-point)))) (enable-recursive-minibuffers t) (icicle-orig-must-pass-after-match-pred icicle-must-pass-after-match-predicate) (pred (if current-prefix-arg (lambda (s) (unless (symbolp s) (setq s (intern s))) (user-variable-p s)) (lambda (s) (unless (symbolp s) (setq s (intern s))) (boundp s)))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (list (intern (completing-read "Increment variable: " obarray (and icompletep pred) t nil nil (and symb (symbol-name symb)) t)) ;; Restore this before we read number, since that might use completion. (let ((icicle-must-pass-after-match-predicate icicle-orig-must-pass-after-match-pred)) (icicle-read-number "Increment (amount): ")) current-prefix-arg))) (unless (require 'doremi nil t) (icicle-user-error "You need library `doremi.el' for this command")) (unless increment (setq increment 1)) (unless (numberp (symbol-value variable)) (icicle-user-error "Variable's value is not a number: %S" (symbol-value variable))) (doremi (lambda (new-val) ; FREE here: VARIABLE. (set variable new-val) new-val) (symbol-value variable) increment)) (defun icicle-bookmark-cmd (&optional parg) ; Bound to what `bookmark-set' is bound to (`C-x r m'). "Set bookmark or visit bookmark(s). With a negative prefix arg, visit bookmark(s), using `icicle-bookmark-other-window' (see that command for more info). Otherwise, set a bookmark, as follows: * No prefix arg: Prompt for the bookmark name. If feature `bookmark+' is present: . You can use (lax) completion for the bookmark name. The candidates are bookmarks in the current buffer (or all bookmarks if there are none in this buffer). . You can narrow the current completion candidates to bookmarks of a given type. The keys for this are the same as for `icicle-bookmark' and for the bookmark-jumping keys at the top level. . See the `Bookmark+' doc string of redefined command `bookmark-set' for info about the available default values for the bookmark name. If feature `bookmark+' is not present, then completion is not available, and the default bookmark name is the last one used in the current buffer. Note: You can use command `icicle-bookmark-set' with a numeric prefix arg if you want to complete against all bookmark names, instead of those for the current buffer. * Plain prefix arg (`C-u'): Same as no prefix arg, but do not overwrite any existing bookmark that has the same name. * Non-negative numeric prefix arg: Do not prompt for bookmark name. If feature `bookmark+' is present and the region is active and nonempty, then use the buffer name followed by a prefix of the region text as the bookmark name. Otherwise, use the buffer name followed by the text of the current line, starting at point. Use at most `icicle-bookmark-name-length-max' chars, in either case. If the prefix arg is 0, then do not overwrite any existing bookmark that has the same name. By default, Icicle mode remaps all key sequences that are normally bound to `bookmark-set' to `icicle-bookmark-cmd'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'. In particular, you might prefer to remap `bookmark-set' to `icicle-bookmark-set' (see Note, above)." (interactive "P") (if (and parg (< (prefix-numeric-value parg) 0)) (icicle-bookmark-other-window) (if (or (not parg) (consp parg)) (icicle-bookmark-set nil parg 'PSEUDO-INTERACTIVEP) (let* ((regionp (and (featurep 'bookmark+) transient-mark-mode mark-active (not (eq (region-beginning) (region-end))))) (name-beg (if regionp (region-beginning) (point))) (name-end (if regionp (region-end) (line-end-position))) (def-name (concat (buffer-name) ": " (buffer-substring name-beg name-end))) (trim-name (replace-regexp-in-string "\n" " " (substring def-name 0 (min icicle-bookmark-name-length-max (length def-name)))))) (message "Setting bookmark `%s'" trim-name) (sit-for 2) (bookmark-set trim-name (and parg (or (consp parg) (zerop (prefix-numeric-value parg))))))))) (defun icicle-bookmark-set (&optional name parg interactivep) ; `C-x r m' "With `Bookmark+', this is `bookmark-set' with Icicles multi-completions. In particular, you can use (lax) completion for the bookmark name. Without `Bookmark+', this is the same as vanilla Emacs `bookmark-set'. With `Bookmark+': . You can use (lax) completion for the bookmark name. The candidates are bookmarks in the current buffer (or all bookmarks if there are none in this buffer). . You can narrow the current completion candidates to bookmarks of a given type. The keys for this are the same as for `icicle-bookmark' and for the bookmark-jumping keys at the top level. . See the `Bookmark+' doc string of redefined command `bookmark-set' for info about the available default values for the bookmark name. If feature `bookmark+' is not present, then completion is not available, and the default bookmark name is the last one used in the current buffer. Note: You can use command `icicle-bookmark-set' with a numeric prefix arg if you want to complete against all bookmark names, instead of those for the current buffer." (interactive (list nil current-prefix-arg t)) (if (not (featurep 'bookmark+)) (bookmark-set name parg) (unwind-protect (let ((enable-recursive-minibuffers t) ; In case read input, e.g. File changed... (completion-ignore-case bookmark-completion-ignore-case) (prompt "Bookmark: ") (icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) () (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-candidates-alist (if (not (featurep 'bookmark+)) (mapcar (lambda (cand) (list (icicle-candidate-short-help (icicle-bookmark-help-string cand) (icicle-bookmark-propertize-candidate cand)))) (bookmark-all-names)) ; Loads bookmarks file, defining `bookmark-alist'. (bookmark-maybe-load-default-file) ; Loads bookmarks file, defining `bookmark-alist'. (mapcar #'icicle-make-bookmark-candidate (bmkp-sort-omit (and (or (not parg) (consp parg)) ; No numeric PARG: all bookmarks. (or (bmkp-specific-buffers-alist-only) bookmark-alist)))))) (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p)) (and (featurep 'bookmark+) '(("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p) ("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p) ("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by file name" (bmkp-file-alpha-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p) ("by Info location" (bmkp-info-cp) icicle-alpha-p) ("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p) ("by URL" (bmkp-url-cp) icicle-alpha-p) ("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn ;; FREE here: CURRENT-PREFIX-ARG, ICICLE-GET-ALIST-CANDIDATE-FUNCTION, ;; ICICLE-SHOW-MULTI-COMPLETION-FLAG. (lambda (cand) (when (and (featurep 'bookmark+) icicle-show-multi-completion-flag) (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if (featurep 'bookmark+) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand)) (icicle-msg-maybe-in-minibuffer (icicle-bookmark-help-string cand)))))) (require 'bookmark) (when (featurep 'bookmark+) ;; Bind keys to narrow bookmark candidates by type. Lax is for multi-completion case. (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (icicle-bookmark-bind-narrow-commands map))) (setq bookmark-current-point (point) bookmark-current-buffer (current-buffer)) (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) (let* ((record (bookmark-make-record)) (defname (or (and (stringp (car record)) (car record)) (cond ((eq major-mode 'w3m-mode) w3m-current-title) ((eq major-mode 'gnus-summary-mode) (elt (gnus-summary-article-header) 1)) ((memq major-mode '(Man-mode woman-mode)) (buffer-substring (point-min) (save-excursion (goto-char (point-min)) (skip-syntax-forward "^ ") (point)))) (t nil)))) (defname (and defname (bmkp-replace-regexp-in-string "\n" " " defname))) (bname (or name (icicle-transform-multi-completion (bmkp-completing-read-lax "Set bookmark " (bmkp-new-bookmark-default-names defname) icicle-candidates-alist nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history)))))) (when (string-equal bname "") (setq bname defname)) (bookmark-store bname (cdr record) (consp parg)) (when (and interactivep bmkp-prompt-for-tags-flag) (bmkp-add-tags bname (bmkp-read-tags-completing))) ; Don't bother to refresh tags. (?) (case (and (boundp 'bmkp-auto-light-when-set) bmkp-auto-light-when-set) (autonamed-bookmark (when (bmkp-autonamed-bookmark-p bname) (bmkp-light-bookmark bname))) (non-autonamed-bookmark (unless (bmkp-autonamed-bookmark-p bname) (bmkp-light-bookmark bname))) (any-bookmark (bmkp-light-bookmark bname)) (autonamed-in-buffer (bmkp-light-bookmarks (bmkp-remove-if-not #'bmkp-autonamed-bookmark-p (bmkp-this-buffer-alist-only)) nil interactivep)) (non-autonamed-in-buffer (bmkp-light-bookmarks (bmkp-remove-if #'bmkp-autonamed-bookmark-p (bmkp-this-buffer-alist-only)) nil interactivep)) (all-in-buffer (bmkp-light-this-buffer nil interactivep))) ;; Maybe make bookmark temporary. (if bmkp-autotemp-all-when-set-p (bmkp-make-bookmark-temporary bname) (catch 'icicle-bookmark-set (dolist (pred bmkp-autotemp-bookmark-predicates) (when (and (functionp pred) (funcall pred bname)) (bmkp-make-bookmark-temporary bname) (throw 'icicle-bookmark-set t))))) (run-hooks 'bmkp-after-set-hook) (if bookmark-use-annotations (bookmark-edit-annotation bname) (goto-char bookmark-current-point))) (setq bookmark-yank-point nil bookmark-current-buffer nil)) (icicle-bookmark-cleanup)))) (defun icicle-make-bookmark-candidate (bookmark) "Return a propertized full bookmark candidate for BOOKMARK. BOOKMARK is a bookmark name or a bookmark record. The return value is of the form (DISPLAY . RECORD), where: DISPLAY is the display candidate, propertized with `icicle-bookmark-help-string' and `icicle-bookmark-propertize-candidate'. RECORD is the full BOOKMARK record. If option `icicle-show-multi-completion-flag' is non-nil then DISPLAY is a multi-completion with three parts: bookmark name target file for the bookmark tags in the bookmark If the option value is nil then DISPLAY is just the bookmark name." (setq bookmark (bookmark-get-bookmark bookmark)) (icicle-condition-case-no-debug nil ; Ignore errors, e.g. from bad or stale bookmark records. (if icicle-show-multi-completion-flag (let* ((bname (bookmark-name-from-full-record bookmark)) (guts (bookmark-get-bookmark-record bookmark)) (file (bookmark-get-filename bookmark)) (buf (bmkp-get-buffer-name bookmark)) (file/buf (if (and buf (equal file bmkp-non-file-filename)) buf file)) (tags (bmkp-get-tags bookmark))) (cons `(,(icicle-candidate-short-help (icicle-bookmark-help-string bname) (icicle-bookmark-propertize-candidate bname)) ,file/buf ,@(and tags (list (format "%S" tags)))) guts)) (let ((bname (bookmark-name-from-full-record bookmark)) (guts (bookmark-get-bookmark-record bookmark))) (cons (icicle-candidate-short-help (icicle-bookmark-help-string bname) (icicle-bookmark-propertize-candidate bname)) guts))) (error nil))) (icicle-define-command icicle-bookmark ; Bound to `C-x j j', `C-x p b', `C-x r b'. "Jump to a bookmark. With a plain prefix argument (`C-u'), reverse the effect of option `icicle-bookmark-refresh-cache-flag'. See the doc for that option. In particular, if the option value is nil and you try to jump to a bookmark that is not up to date or does not exist, then try using a prefix arg to refresh the cache. During completion, you can use \\\ `\\[icicle-delete-candidate-object]' on a bookmark to delete it. If you also use library `Bookmark+', then: * `C-M-return' shows detailed info about the current bookmark candidate. `C-u C-M-return' shows the complete, internal info for the bookmark. Likewise, for the other candidate help keys: `C-M-down' etc. (And the mode line always shows summary info about the bookmark.) * You can use `C-,' to sort bookmarks in many different ways, according to their properties. * In `*Completions*', the candidate bookmarks are highlighted according to their type. You can customize the highlighting faces: `bmkp-bad-bookmark' - possibly bad bookmark `bmkp-bookmark-list' - bookmark list `bmkp-buffer' - buffer `bmkp-desktop' - desktop `bmkp-function' - function bookmark `bmkp-gnus' - Gnus article `bmkp-info' - Info node `bmkp-local-directory' - local directory `bmkp-local-file-with-region' - local file with a region `bmkp-local-file-without-region' - local file without a region `bmkp-man' - `man' page `bmkp-non-file' - non-file (no current buffer) `bmkp-remote-file' - remote-file `bmkp-sequence' - sequence bookmark `bmkp-url' - URL * In `*Completions*', if option `icicle-show-multi-completion-flag' is non-nil, then each completion candidate is a multi-completion: a. the bookmark name b. the bookmark file or buffer name c. any tags You can match any parts of the multi-completion. You can toggle the option (for the next command) using `M-m' during completion. For example, you can match all bookmarks that have tags by typing: C-M-j . * C-M-j S-TAB (Each `C-M-j' inserts `^G\n', which is `icicle-list-join-string'.) * You can narrow the current completion candidates to bookmarks of a given type. The keys for this are the same as the bookmark-jumping keys at the top level. `C-x j a' - autofile bookmarks `C-x j b' - non-file (buffer) bookmarks `C-x j B' - bookmark-list bookmarks `C-x j d' - Dired bookmarks `C-x j f' - file bookmarks `C-x j . f' - bookmarks to files in the current directory `C-x j g' - Gnus bookmarks `C-x j i' - Info bookmarks `C-x j M-i' - image bookmarks `C-x j K' - desktop bookmarks `C-x j l' - local-file bookmarks `C-x j m' - `man' pages `C-x j n' - remote-file bookmarks `C-x j r' - bookmarks with regions `C-x j u' - URL bookmarks `C-x j w' - W3M (URL) bookmarks `C-x j x' - temporary bookmarks `C-x j y' - bookmark-file bookmarks `C-x j #' - autonamed bookmarks `C-x j , #' - autonamed bookmarks for the current buffer `C-x j , ,' - bookmarks for the current buffer `C-x j = b' - bookmarks for specific buffers `C-x j = f' - bookmarks for specific files See also the individual multi-commands for different bookmark types: `icicle-bookmark-info-other-window' etc. If you also use library `crosshairs.el', then the visited bookmark position is highlighted." ; Doc string (lambda (cand) (icicle-bookmark-jump (icicle-transform-multi-completion cand))) ; Action prompt icicle-candidates-alist nil (not icicle-show-multi-completion-flag) ; `completing-read' args nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) (and (boundp 'bookmark-current-bookmark) bookmark-current-bookmark) nil ((enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on disk... (completion-ignore-case bookmark-completion-ignore-case) (prompt "Bookmark: ") (icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) () (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p)) (and (featurep 'bookmark+) '(("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p) ("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p) ("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by file name" (bmkp-file-alpha-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p) ("by Info location" (bmkp-info-cp) icicle-alpha-p) ("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p) ("by URL" (bmkp-url-cp) icicle-alpha-p) ("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn ;; FREE here: CURRENT-PREFIX-ARG, ICICLE-GET-ALIST-CANDIDATE-FUNCTION, ;; ICICLE-SHOW-MULTI-COMPLETION-FLAG. (lambda (cand) (when (and (featurep 'bookmark+) icicle-show-multi-completion-flag) (setq cand (funcall icicle-get-alist-candidate-function cand) cand (cons (caar cand) (cdr cand)))) (if (featurep 'bookmark+) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand)) (icicle-msg-maybe-in-minibuffer (icicle-bookmark-help-string cand))))) (icicle-candidates-alist (if (not (featurep 'bookmark+)) (mapcar (lambda (cand) (list (icicle-candidate-short-help (icicle-bookmark-help-string cand) (icicle-bookmark-propertize-candidate cand)))) (bookmark-all-names)) ; Loads bookmarks file, defining `bookmark-alist'. (bookmark-maybe-load-default-file) ; Loads bookmarks file, defining `bookmark-alist'. (mapcar #'icicle-make-bookmark-candidate (or (and (or (and (not icicle-bookmark-refresh-cache-flag) (not (consp current-prefix-arg))) (and icicle-bookmark-refresh-cache-flag (consp current-prefix-arg))) bmkp-sorted-alist) (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist))))))) (progn ; First code (require 'bookmark) (when (featurep 'bookmark+) ;; Bind keys to narrow bookmark candidates by type. Lax is for multi-completion case. (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (icicle-bookmark-bind-narrow-commands map)))) (icicle-bookmark-cleanup-on-quit) ; Undo code (icicle-bookmark-cleanup)) ; Last code (icicle-define-command icicle-bookmark-other-window ; Bound to `C-x 4 j j', `C-x p j', `C-x p o', `C-x p q'. "Jump to a bookmark in another window. Same as `icicle-bookmark', but uses another window." ; Doc string (lambda (cand) (icicle-bookmark-jump-other-window (icicle-transform-multi-completion cand))) prompt icicle-candidates-alist nil (not icicle-show-multi-completion-flag) ; `completing-read' args nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) (and (boundp 'bookmark-current-bookmark) bookmark-current-bookmark) nil ((enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on disk... (completion-ignore-case bookmark-completion-ignore-case) (prompt "Bookmark: ") (icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) () (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p)) (and (featurep 'bookmark+) '(("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p) ("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p) ("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by file name" (bmkp-file-alpha-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p) ("by Info location" (bmkp-info-cp) icicle-alpha-p) ("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p) ("by URL" (bmkp-url-cp) icicle-alpha-p) ("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn ;; FREE here: CURRENT-PREFIX-ARG, ICICLE-GET-ALIST-CANDIDATE-FUNCTION, ;; ICICLE-SHOW-MULTI-COMPLETION-FLAG. (lambda (cand) (when (and (featurep 'bookmark+) icicle-show-multi-completion-flag) (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if (featurep 'bookmark+) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand)) (icicle-msg-maybe-in-minibuffer (icicle-bookmark-help-string cand))))) (icicle-candidates-alist (if (not (featurep 'bookmark+)) (mapcar (lambda (cand) (list (icicle-candidate-short-help (icicle-bookmark-help-string cand) (icicle-bookmark-propertize-candidate cand)))) (bookmark-all-names)) ; Loads bookmarks file, defining `bookmark-alist'. (bookmark-maybe-load-default-file) ; Loads bookmarks file, defining `bookmark-alist'. (mapcar #'icicle-make-bookmark-candidate (or (and (or (and (not icicle-bookmark-refresh-cache-flag) (not (consp current-prefix-arg))) (and icicle-bookmark-refresh-cache-flag (consp current-prefix-arg))) bmkp-sorted-alist) (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist))))))) (progn ; First code (require 'bookmark) (when (featurep 'bookmark+) ;; Bind keys to narrow bookmark candidates by type. Lax is for multi-completion case. (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (icicle-bookmark-bind-narrow-commands map)))) (icicle-bookmark-cleanup-on-quit) ; Undo code (icicle-bookmark-cleanup)) ; Last code (defun icicle-bookmark-bind-narrow-commands (map) "Bind keys to narrow bookmark candidates by type." (when (featurep 'bookmark+) ;; Lax completion is for multi-completion case. (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (define-key (symbol-value map) (icicle-kbd "C-x j #") ; `C-x j #' 'icicle-bookmark-autonamed-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j , #") ; `C-x j , #' 'icicle-bookmark-autonamed-this-buffer-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j a") ; `C-x j a' 'icicle-bookmark-autofile-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j b") ; `C-x j b' 'icicle-bookmark-non-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j B") ; `C-x j B' 'icicle-bookmark-bookmark-list-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j d") ; `C-x j d' 'icicle-bookmark-dired-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j f") ; `C-x j f' 'icicle-bookmark-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j . f") ; `C-x j . f' 'icicle-bookmark-file-this-dir-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j g") ; `C-x j g' 'icicle-bookmark-gnus-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j i") ; `C-x j i' 'icicle-bookmark-info-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j M-i") ; `C-x j M-i' 'icicle-bookmark-image-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j K") ; `C-x j K' 'icicle-bookmark-desktop-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j l") ; `C-x j l' 'icicle-bookmark-local-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j m") ; `C-x j m' 'icicle-bookmark-man-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j n") ; `C-x j n' 'icicle-bookmark-remote-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j r") ; `C-x j r' 'icicle-bookmark-region-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j u") ; `C-x j u' 'icicle-bookmark-url-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j w") ; `C-x j w' 'icicle-bookmark-w3m-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j x") ; `C-x j x' 'icicle-bookmark-temporary-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j y") ; `C-x j y' 'icicle-bookmark-bookmark-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j , ,") ; `C-x j , ,' 'icicle-bookmark-this-buffer-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j = b") ; `C-x j = b' 'icicle-bookmark-specific-buffers-narrow) (define-key (symbol-value map) (icicle-kbd "C-x j = f") ; `C-x j = f' 'icicle-bookmark-specific-files-narrow)))) (defun icicle-bookmark-delete-action (cand) "Delete bookmark candidate CAND, then update `bmkp-sorted-alist'." (bookmark-delete (icicle-transform-multi-completion cand)) (when (or (and (not icicle-bookmark-refresh-cache-flag) (not (consp current-prefix-arg))) (and icicle-bookmark-refresh-cache-flag (consp current-prefix-arg))) (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist)))) (defun icicle-bookmark-propertize-candidate (cand) "Return bookmark name CAND, with a face indicating its type." (when (featurep 'bookmark+) (put-text-property 0 (length cand) 'face (cond ((bmkp-sequence-bookmark-p cand) 'bmkp-sequence) ((bmkp-function-bookmark-p cand) 'bmkp-function) ((bmkp-bookmark-list-bookmark-p cand) 'bmkp-bookmark-list) ((bmkp-desktop-bookmark-p cand) 'bmkp-desktop) ((bmkp-info-bookmark-p cand) 'bmkp-info) ((bmkp-man-bookmark-p cand) 'bmkp-man) ((bmkp-gnus-bookmark-p cand) 'bmkp-gnus) ((bmkp-url-bookmark-p cand) 'bmkp-url) ((bmkp-remote-file-bookmark-p cand) 'bmkp-remote-file) ((and (bmkp-file-bookmark-p cand) (file-directory-p (bookmark-get-filename cand))) 'bmkp-local-directory) ((and (bmkp-local-file-bookmark-p cand) (bmkp-region-bookmark-p cand)) 'bmkp-local-file-with-region) ((bmkp-local-file-bookmark-p cand) 'bmkp-local-file-without-region) ((and (bmkp-get-buffer-name cand) (get-buffer (bmkp-get-buffer-name cand)) (equal (bookmark-get-filename cand) bmkp-non-file-filename)) 'bmkp-buffer) ((not (bmkp-file-bookmark-p cand)) 'bmkp-non-file) (t 'bmkp-bad-bookmark)) cand)) cand) (defun icicle-bookmark-jump (bookmark) "Jump to BOOKMARK. If `crosshairs.el' is loaded, then highlight the target position. You probably don't want to use this. Use `icicle-bookmark' instead." (interactive (list (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark))) (icicle-bookmark-jump-1 bookmark)) (defun icicle-bookmark-jump-other-window (bookmark) "Jump to BOOKMARK in another window. If `crosshairs.el' is loaded, then highlight the target position. You probably don't want to use this. Use `icicle-bookmark-other-window' instead." (interactive (list (bookmark-completing-read "Jump to bookmark (other window)" bookmark-current-bookmark))) (icicle-bookmark-jump-1 bookmark 'other-window)) (defun icicle-bookmark-jump-1 (bookmark &optional other-window-p) "Helper function for `icicle-bookmark-jump(-other-window)'." (unless bookmark (error "No bookmark specified")) (bookmark-maybe-historicize-string bookmark) ;; In case the jump renames it (as for an autonamed bookmark). (setq bookmark (bookmark-get-bookmark bookmark 'NOERROR)) (if (fboundp 'bookmark--jump-via) (bookmark--jump-via bookmark (if other-window-p 'pop-to-buffer 'switch-to-buffer)) (let ((cell (bookmark-jump-noselect bookmark))) ; Emacs < 23 and without `Bookmark+'. (when cell (if other-window-p (pop-to-buffer (car cell) 'other-window) (switch-to-buffer (car cell))) (goto-char (cdr cell)) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) (progn (run-hooks 'bookmark-after-jump-hook) t) ;; If there is an annotation for this bookmark, show it in a buffer. (when bookmark-automatically-show-annotations (bookmark-show-annotation bookmark))))) ;; Unless `bmkp-use-region' and bookmark has a region, show position using crosshairs. (unless (and (boundp 'bmkp-use-region) bmkp-use-region (fboundp 'bmkp-get-end-position) (bmkp-get-end-position bookmark) (/= (bookmark-get-position bookmark) (bmkp-get-end-position bookmark))) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight)))) ;; $$$$$$ (select-window (minibuffer-window)) ;; $$$$$$ (select-frame-set-input-focus (selected-frame))) (defun icicle-bookmark-help-string (bookmark-name) "Return a help string for BOOKMARK-NAME." ; `bmkp-*' functions are defined in `Bookmark+'. ;; Use BOOKMARK-NAME, not full bookmark BMK, as arg to vanilla bookmark functions, for Emacs < 23. (let* ((bmk (bookmark-get-bookmark bookmark-name)) (buf (and (fboundp 'bmkp-get-buffer-name) (bmkp-get-buffer-name bmk))) (file (bookmark-get-filename bookmark-name)) (start (bookmark-get-position bookmark-name)) (no-position-p (not start)) (end (and (fboundp 'bmkp-get-end-position) (bmkp-get-end-position bmk))) (annot (bookmark-get-annotation bookmark-name)) (sequence-p (and (fboundp 'bmkp-sequence-bookmark-p) (bmkp-sequence-bookmark-p bmk))) (function-p (and (fboundp 'bmkp-function-bookmark-p) (bmkp-function-bookmark-p bmk))) (blist-p (and (fboundp 'bmkp-bookmark-list-bookmark-p) (bmkp-bookmark-list-bookmark-p bmk))) (desktop-p (and (fboundp 'bmkp-desktop-bookmark-p) (bmkp-desktop-bookmark-p bmk))) (dired-p (and (fboundp 'bmkp-dired-bookmark-p) (bmkp-dired-bookmark-p bmk))) (gnus-p (and (fboundp 'bmkp-gnus-bookmark-p) (bmkp-gnus-bookmark-p bmk))) (info-p (and (fboundp 'bmkp-info-bookmark-p) (bmkp-info-bookmark-p bmk))) (man-p (and (fboundp 'bmkp-man-bookmark-p) (bmkp-man-bookmark-p bmk))) (url-p (and (fboundp 'bmkp-url-bookmark-p) (bmkp-url-bookmark-p bmk))) type-info-p) (when (or sequence-p function-p) (setq no-position-p t)) (concat (setq type-info-p (cond (sequence-p (format "Sequence: %S" (bookmark-prop-get bmk 'sequence))) (function-p (let ((fn (bookmark-prop-get bmk 'function))) (if (symbolp fn) (format "Function: `%s'" fn) "Function"))) (desktop-p "Desktop, ") (dired-p (format "Dired %s, " file)) (gnus-p "Gnus, ") (info-p "Info, ") (man-p (let ((man-args (bookmark-prop-get bmk 'man-args))) (if man-args (format "`man %s', " man-args) ;; WoMan has no variable for the cmd name. (format "%s, " (bookmark-prop-get bmk 'buffer-name))))) (url-p "URL, ") (t nil))) (and (not dired-p) (or (and file (or (not (boundp 'bmkp-non-file-filename)) (not (equal file bmkp-non-file-filename))) (format (if type-info-p "file `%s', " "File `%s', ") file)) (and buf (format (if type-info-p "buffer `%s', " "Buffer `%s', ") buf)))) (and (not no-position-p) (if (and end (> (- end start) 0)) (format "from %d to %d (%d chars)" start end (- end start)) (format "position %d" start))) (and annot (format ", %s" annot))))) ;;; MUST keep this synchronized with any general Icicle-mode `C-M-' bindings in `icicles-mode.el'. ;; That includes things like `icicle-read+insert-file-name-keys'. (defun icicle-bookmark-cleanup () "Cleanup code for `icicle-bookmark'. Remove crosshairs highlighting and unbind filtering keys." (when (fboundp 'crosshairs-unhighlight) (crosshairs-unhighlight 'even-if-frame-switch)) (when (featurep 'bookmark+) (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (define-key (symbol-value map) (icicle-kbd "C-M-b") nil) ; `C-M-b' (define-key (symbol-value map) (icicle-kbd "C-M-B") nil) ; `C-M-B' (define-key (symbol-value map) (icicle-kbd "C-M-d") nil) ; `C-M-d' (define-key (symbol-value map) (icicle-kbd "C-M-f") nil) ; `C-M-f' (define-key (symbol-value map) (icicle-kbd "C-M-F") nil) ; `C-M-F' (dolist (key icicle-read+insert-file-name-keys) ; `C-M-F' - overrides previous. (define-key (symbol-value map) key 'icicle-read+insert-file-name)) (define-key (symbol-value map) (icicle-kbd "C-M-g") nil) ; `C-M-g' (define-key (symbol-value map) (icicle-kbd "C-M-I") nil) ; `C-M-I' (`C-M-i' is `ESC TAB') (define-key (symbol-value map) (icicle-kbd "C-M-K") nil) ; `C-M-K' (define-key (symbol-value map) (icicle-kbd "C-M-m") nil) ; `C-M-m' (define-key (symbol-value map) (icicle-kbd "C-M-r") nil) ; `C-M-r' (define-key (symbol-value map) (icicle-kbd "C-M-w") nil) ; `C-M-w' (define-key (symbol-value map) (icicle-kbd "C-M-@") nil) ; `C-M-@' (define-key (symbol-value map) (icicle-kbd "C-M-.") ; `C-M-.' 'icicle-toggle-dot) ; `icicles-mode.el'. (define-key (symbol-value map) (icicle-kbd "C-M-= b") nil) ; `C-M-= b' (define-key (symbol-value map) (icicle-kbd "C-M-= f") nil)))) ; `C-M-= f' (defun icicle-bookmark-cleanup-on-quit () "Do `icicle-bookmark-cleanup', then return to original window." (icicle-bookmark-cleanup) (when (window-live-p icicle-orig-window) (select-window icicle-orig-window) (select-frame-set-input-focus (selected-frame)))) ;;; These are minibuffer commands, but we define them here instead of in `icicles-mcmd.el'. (defun icicle-bookmark-autofile-narrow () ; Bound to `C-x j a' in minibuffer for completion. "Narrow the bookmark candidates to autofile bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-autofile-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-autonamed-narrow () ; Bound to `C-x j #' in minibuffer for completion. "Narrow the bookmark candidates to autonamed bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-autonamed-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-autonamed-this-buffer-narrow () ; Bound to `C-x j , #' in minibuffer for completion. "Narrow bookmark candidates to autonamed bookmarks in current buffer." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) ; FREE here: ICICLE-ORIG-BUFF. (with-current-buffer icicle-orig-buff (bmkp-autonamed-this-buffer-bookmark-p (icicle-transform-multi-completion (car x)))))))) (defun icicle-bookmark-bookmark-file-narrow () ; Bound to `C-x j y' in minibuffer for completion. "Narrow the bookmark candidates to bookmark-file bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-bookmark-file-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-bookmark-list-narrow () ; Bound to `C-x j B' in minibuffer for completion. "Narrow the bookmark candidates to bookmark-list bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-bookmark-list-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-desktop-narrow () ; Bound to `C-x j K' in minibuffer for bookmark completion. "Narrow the bookmark candidates to desktop bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-desktop-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-dired-narrow () ; Bound to `C-x j d' in minibuffer for bookmark completion. "Narrow the bookmark candidates to Dired bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-dired-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-file-narrow () ; Bound to `C-x j f' in minibuffer for bookmark completion. "Narrow the bookmark candidates to file bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-file-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-file-this-dir-narrow () ; Bound to `C-x j . f' in minibuffer for completion. "Narrow the bookmark candidates to bookmarked files in `default-directory'." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-file-this-dir-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-gnus-narrow () ; Bound to `C-x j g' in minibuffer for bookmark completion. "Narrow the bookmark candidates to Gnus bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-gnus-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-image-narrow () ; Bound to `C-x j M-i' in minibuffer for bookmark completion. "Narrow the bookmark candidates to image bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-image-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-info-narrow () ; Bound to `C-x j i' in minibuffer for bookmark completion. "Narrow the bookmark candidates to Info bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-info-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-local-file-narrow () ; Bound to `C-x j l' for bookmark completion. "Narrow the bookmark candidates to local-file bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-local-file-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-man-narrow () ; Bound to `C-x j m' in minibuffer for bookmark completion. "Narrow the bookmark candidates to `man'-page bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-man-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-non-file-narrow () ; Bound to `C-x j b' in minibuffer for bookmark completion. "Narrow the bookmark candidates to non-file (buffer-only) bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-non-file-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-region-narrow () ; Bound to `C-x j r' in minibuffer for bookmark completion. "Narrow the bookmark candidates to bookmarks with regions." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-region-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-remote-file-narrow () ; Bound to `C-x j n' in minibuf for bookmark completion. "Narrow the bookmark candidates to remote-file bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-remote-file-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-specific-buffers-narrow (buffers) ; `C-x j = b' for bookmark completion. "Narrow the bookmark candidates to bookmarks for specific BUFFERS. You are prompted for the BUFFERS." (interactive (let ((icicle-completion-candidates icicle-completion-candidates)) (list (icicle-bookmarked-buffer-list)))) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate `(lambda (x) (member (bmkp-get-buffer-name (icicle-transform-multi-completion (car x))) ',buffers))))) (defun icicle-bookmark-specific-files-narrow (files) ; `C-x j = f' in minibuf for bookmark completion. "Narrow the bookmark candidates to bookmarks for specific FILES. You are prompted for the FILES." (interactive (list (icicle-bookmarked-file-list))) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate `(lambda (x) (member (bookmark-get-filename (icicle-transform-multi-completion (car x))) ',files))))) (defun icicle-bookmark-temporary-narrow () ; Bound to `C-x j x' in minibuffer for completion. "Narrow the bookmark candidates to temporary bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-temporary-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-this-buffer-narrow () ; `C-x j , ,' in minibuffer for bookmark completion. "Narrow the bookmark candidates to bookmarks for the current buffer." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) ; FREE here: ICICLE-ORIG-BUFF. (with-current-buffer icicle-orig-buff (bmkp-this-buffer-p (icicle-transform-multi-completion (car x)))))))) (defun icicle-bookmark-url-narrow () ; Bound to `C-x j u' in minibuffer for bookmark completion. "Narrow the bookmark candidates to URL bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-url-bookmark-p (icicle-transform-multi-completion (car x))))))) (defun icicle-bookmark-w3m-narrow () ; Bound to `C-x j w' in minibuffer for bookmark completion. "Narrow the bookmark candidates to W3M (URL) bookmarks." (interactive) (when (featurep 'bookmark+) (icicle-narrow-candidates-with-predicate (lambda (x) (bmkp-w3m-bookmark-p (icicle-transform-multi-completion (car x))))))) ;; The following sexps macro-expand to define these commands: ;; `icicle-bookmark-autofile' `icicle-bookmark-autofile-other-window' ;; `icicle-bookmark-autofile-all-tags', `icicle-bookmark-autofile-all-tags-other-window', ;; `icicle-bookmark-autofile-all-tags-regexp', `icicle-bookmark-autofile-all-tags-regexp-other-window', ;; `icicle-bookmark-autofile-some-tags', `icicle-bookmark-autofile-some-tags-other-window', ;; `icicle-bookmark-autofile-some-tags-regexp', `icicle-bookmark-autofile-some-tags-regexp-other-window', ;; `icicle-bookmark-autonamed' `icicle-bookmark-autonamed-other-window' ;; `icicle-bookmark-autonamed-this-buffer' `icicle-bookmark-autonamed-this-buffer-other-window' ;; `icicle-bookmark-bookmark-file', ;; `icicle-bookmark-bookmark-list', ;; `icicle-bookmark-desktop', ;; `icicle-bookmark-dired', `icicle-bookmark-dired-other-window', ;; `icicle-bookmark-file', `icicle-bookmark-file-other-window', ;; `icicle-bookmark-file-all-tags', `icicle-bookmark-file-all-tags-other-window', ;; `icicle-bookmark-file-all-tags-regexp', `icicle-bookmark-file-all-tags-regexp-other-window', ;; `icicle-bookmark-file-some-tags', `icicle-bookmark-file-some-tags-other-window', ;; `icicle-bookmark-file-some-tags-regexp', `icicle-bookmark-file-some-tags-regexp-other-window', ;; `icicle-bookmark-file-this-dir', `icicle-bookmark-file-this-dir-other-window', ;; `icicle-bookmark-file-this-dir-all-tags', ;; `icicle-bookmark-file-this-dir-all-tags-other-window', ;; `icicle-bookmark-file-this-dir-all-tags-regexp', ;; `icicle-bookmark-file-this-dir-all-tags-regexp-other-window', ;; `icicle-bookmark-file-this-dir-some-tags', ;; `icicle-bookmark-file-this-dir-some-tags-other-window', ;; `icicle-bookmark-file-this-dir-some-tags-regexp', ;; `icicle-bookmark-file-this-dir-some-tags-regexp-other-window', ;; `icicle-bookmark-gnus', `icicle-bookmark-gnus-other-window', ;; `icicle-bookmark-image', `icicle-bookmark-image-other-window', ;; `icicle-bookmark-info', `icicle-bookmark-info-other-window', ;; `icicle-bookmark-local-file', `icicle-bookmark-local-file-other-window', ;; `icicle-bookmark-man', `icicle-bookmark-man-other-window', ;; `icicle-bookmark-non-file', `icicle-bookmark-non-file-other-window', ;; `icicle-bookmark-region', `icicle-bookmark-region-other-window', ;; `icicle-bookmark-remote-file', `icicle-bookmark-remote-file-other-window', ;; `icicle-bookmark-specific-buffers', `icicle-bookmark-specific-buffers-other-window' ;; `icicle-bookmark-specific-files', `icicle-bookmark-specific-files-other-window' ;; `icicle-bookmark-all-tags', `icicle-bookmark-all-tags-other-window' ;; `icicle-bookmark-all-tags-regexp', `icicle-bookmark-all-tags-regexp-other-window' ;; `icicle-bookmark-some-tags', `icicle-bookmark-some-tags-other-window' ;; `icicle-bookmark-some-tags-regexp', `icicle-bookmark-some-tags-regexp-other-window' ;; `icicle-bookmark-temporary' `icicle-bookmark-temporary-other-window' ;; `icicle-bookmark-this-buffer', `icicle-bookmark-this-buffer-other-window' ;; `icicle-bookmark-url', `icicle-bookmark-url-other-window' ;; `icicle-bookmark-w3m', `icicle-bookmark-w3m-other-window' (icicle-define-bookmark-command "this-buffer") ; `C-x j , ,' (icicle-define-bookmark-other-window-command "this-buffer") ; `C-x 4 j , ,' (icicle-define-bookmark-command "specific-buffers" nil ; `C-x j = b' (icicle-bookmarked-buffer-list)) (icicle-define-bookmark-other-window-command "specific-buffers" nil ; `C-x 4 j = b' (icicle-bookmarked-buffer-list)) (icicle-define-bookmark-command "specific-files" nil ; `C-x j = f' (icicle-bookmarked-file-list)) (icicle-define-bookmark-other-window-command "specific-files" nil ; `C-x 4 j = f' (icicle-bookmarked-file-list)) (icicle-define-bookmark-command "autofile") ; `C-x j a' (icicle-define-bookmark-other-window-command "autofile") ; `C-x 4 j a' (icicle-define-bookmark-command "autofile-all-tags" nil ; `C-x j t a *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "autofile-all-tags" nil ; `C-x 4 j t a *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "autofile-all-tags-regexp" nil ; `C-x j t a % *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "autofile-all-tags-regexp" nil ; `C-x 4 j t a % *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "autofile-some-tags" nil ; `C-x j t a +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "autofile-some-tags" nil ; `C-x 4 j t a +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "autofile-some-tags-regexp" nil ; `C-x j t a % +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "autofile-some-tags-regexp" nil ; `C-x 4 j t a % +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "autonamed") ; `C-x j #' (icicle-define-bookmark-other-window-command "autonamed") ; `C-x 4 j # #' (icicle-define-bookmark-command "autonamed-this-buffer") ; `C-x j , #' (icicle-define-bookmark-other-window-command "autonamed-this-buffer") ; `C-x 4 j # .' (icicle-define-bookmark-command "non-file") ; `C-x j b' (icicle-define-bookmark-other-window-command "non-file") ; `C-x 4 j b' ;; Other-window means nothing for a bookmark list. (icicle-define-bookmark-command "bookmark-list") ; `C-x j B' (icicle-define-bookmark-command "dired") ; `C-x j d' (icicle-define-bookmark-other-window-command "dired") ; `C-x 4 j d' (icicle-define-bookmark-command "file") ; `C-x j f' (icicle-define-bookmark-other-window-command "file") ; `C-x 4 j f' (icicle-define-bookmark-command "file-this-dir") ; `C-x j . f' (icicle-define-bookmark-other-window-command "file-this-dir") ; `C-x 4 j . f' (icicle-define-bookmark-command "gnus") ; `C-x j g' (icicle-define-bookmark-other-window-command "gnus") ; `C-x 4 j g' (icicle-define-bookmark-command "image") ; `C-x j M-i' (icicle-define-bookmark-other-window-command "image") ; `C-x 4 j M-i' (icicle-define-bookmark-command "info") ; `C-x j i' (icicle-define-bookmark-other-window-command "info") ; `C-x 4 j i' ;; Other-window means nothing for a desktop. (icicle-define-bookmark-command "desktop") ; `C-x j K' (icicle-define-bookmark-command "local-file") ; `C-x j l' (icicle-define-bookmark-other-window-command "local-file") ; `C-x 4 j l' (icicle-define-bookmark-command "man") ; `C-x j m' (icicle-define-bookmark-other-window-command "man") ; `C-x 4 j m' (icicle-define-bookmark-command "remote-file") ; `C-x j n' (icicle-define-bookmark-other-window-command "remote-file") ; `C-x 4 j n' (icicle-define-bookmark-command "region" "Select region: ") ; `C-x j r' (icicle-define-bookmark-other-window-command "region" "Select region: ") ; `C-x 4 j r' (icicle-define-bookmark-command "all-tags" nil ; `C-x j t *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "all-tags" nil ; `C-x 4 j t *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "some-tags" nil ; `C-x j t +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "some-tags" nil ; `C-x 4 j t +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "all-tags-regexp" nil ; `C-x j t % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "all-tags-regexp" nil ; `C-x 4 j t % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "some-tags-regexp" nil ; `C-x j t % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "some-tags-regexp" nil ; `C-x 4 j t % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "file-all-tags" nil ; `C-x j t f *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "file-all-tags" nil ; `C-x 4 j t f *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "file-some-tags" nil ; `C-x j t f +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "file-some-tags" nil ; `C-x 4 j t f +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "file-all-tags-regexp" nil ; `C-x j t f % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "file-all-tags-regexp" nil ; `C-x 4 j t f % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "file-some-tags-regexp" nil ; `C-x j t f % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "file-some-tags-regexp" nil ; `C-x 4 j t f % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "file-this-dir-all-tags" nil ; `C-x j t . f *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "file-this-dir-all-tags" nil ; `C-x 4 j t . f *' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "file-this-dir-some-tags" nil ; `C-x j t . f +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-other-window-command "file-this-dir-some-tags" nil ; `C-x 4 j t . f +' (bmkp-read-tags-completing nil nil current-prefix-arg)) (icicle-define-bookmark-command "file-this-dir-all-tags-regexp" nil ; `C-x j t . f % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "file-this-dir-all-tags-regexp" nil ; `C-x 4 j t . f % *' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "file-this-dir-some-tags-regexp" nil ; `C-x j t . f % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-other-window-command "file-this-dir-some-tags-regexp" nil ; `C-x 4 j t . f % +' (read-string "Regexp for tags: ")) (icicle-define-bookmark-command "url") ; `C-x j u' (icicle-define-bookmark-other-window-command "url") ; `C-x 4 j u' (icicle-define-bookmark-command "w3m") ; `C-x j w' (icicle-define-bookmark-other-window-command "w3m") ; `C-x 4 j w' (icicle-define-bookmark-command "temporary") ; `C-x j x' (icicle-define-bookmark-other-window-command "temporary") ; `C-x 4 j x' ;; Other-window means nothing for a bookmark file. (icicle-define-bookmark-command "bookmark-file") ; `C-x j y' (defalias 'icicle-select-bookmarked-region 'icicle-bookmark-region-other-window) (defun icicle-bookmarked-buffer-list () "`icicle-buffer-list', but only for bookmarked buffers." (interactive) (let ((icicle-buffer-predicate (lambda (buf) (member buf (bmkp-buffer-names)))) (icicle-prompt "Choose bookmarked buffer (`RET' when done): ")) (icicle-buffer-list))) (defun icicle-bookmarked-file-list () "`icicle-file-list', but only for bookmarked files." (interactive) (bookmark-maybe-load-default-file) (let ((use-file-dialog nil) (icicle-file-predicate (lambda (file) (member (expand-file-name file) (bmkp-file-names)))) (icicle-prompt "Choose bookmarked file (`RET' when done): ")) (icicle-file-list))) (icicle-define-command icicle-find-first-tag ; Command name "Find first tag in current tags table whose name matches your input. This is similar to standard command `find-tag', with these differences: * This is a multi-command, so you can visit any number of tags. * Only the first tag of several identical tags is a candidate, so you cannot visit the others. That is, there is no equivalent to using `M-,' (`tags-loop-continue') after `find-tag' to find additional, identical tags. * If `crosshairs.el' is loaded, the target position is highlighted. To browse all tags (including duplicates) in all tags tables, use the more powerful Icicles multi-command `icicle-find-tag'. By default, Icicle mode remaps all key sequences that are normally bound to `find-tag-other-window' to `icicle-find-first-tag'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." ; Doc string icicle-find-first-tag-action ; Action function "Find tag: " ; `completing-read' args (if (fboundp 'tags-lazy-completion-table) (tags-lazy-completion-table) 'tags-complete-tag) nil nil nil nil (funcall (or find-tag-default-function (get major-mode 'find-tag-default-function) 'find-tag-default)) nil ((completion-ignore-case (progn (require 'etags) ; Bindings (if (and (boundp 'tags-case-fold-search) (memq tags-case-fold-search '(t nil))) tags-case-fold-search case-fold-search))) (case-fold-search completion-ignore-case)) nil nil ; First code, undo code (when (fboundp 'crosshairs-unhighlight) (crosshairs-unhighlight 'even-if-frame-switch))) ; Last code (defun icicle-find-first-tag-action (cand) "Action function for `icicle-find-first-tag'." (find-tag cand) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight))) (icicle-define-command icicle-find-first-tag-other-window ; Command name "Find first tag in current tags table whose name matches your input. Same as `icicle-find-first-tag' except it uses a different window." ; Doc string icicle-find-first-tag-other-window-action ; Action function "Find tag other window: " ; `completing-read' args (if (fboundp 'tags-lazy-completion-table) (tags-lazy-completion-table) 'tags-complete-tag) nil nil nil nil (funcall (or find-tag-default-function (get major-mode 'find-tag-default-function) 'find-tag-default)) nil ((completion-ignore-case (progn (require 'etags) (if (and (boundp 'tags-case-fold-search) ; Bindings (memq tags-case-fold-search '(t nil))) tags-case-fold-search case-fold-search))) (case-fold-search completion-ignore-case)) nil nil ; First code, undo code (when (fboundp 'crosshairs-unhighlight) (crosshairs-unhighlight 'even-if-frame-switch))) ; Last code (defun icicle-find-first-tag-other-window-action (cand) "Action function for `icicle-find-first-tag-other-window'." (find-tag-other-window cand) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight))) (defun icicle-find-tag (regexp &optional arg) "Navigate among all tags that match REGEXP. You are prompted for the REGEXP to match. Enter REGEXP with `RET'. You can use completion to choose a tag in the current tags table as REGEXP. You can use `\\[icicle-pop-tag-mark]' to return to your starting point. All matching tags are shown, including duplicate tags from the same or different source files. This means that you do not need `M-,' - you see all tags as candidates to visit. By default: * Tags from all tags files are candidates. * In `*Completions*', the source file name is shown after each tag. A prefix argument changes this default behavior, as follows: * ARG = 0 or ARG > 0: only the current tag table is used * ARG = 0 or ARG < 0: source file names are not shown By default, Icicle mode remaps all key sequences that are normally bound to `find-tag' to `icicle-find-tag'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'. If `crosshairs.el' is loaded, then the target position is highlighted." (interactive (let* ((completion-ignore-case (if (and (boundp 'tags-case-fold-search) (memq tags-case-fold-search '(t nil))) tags-case-fold-search case-fold-search)) (case-fold-search completion-ignore-case)) (require 'etags) (list (completing-read "Find tag matching regexp: " ;; $$$ Or should we just read a regexp against `regexp-history'? (if (fboundp 'tags-lazy-completion-table) (tags-lazy-completion-table) ; Emacs 23+ 'tags-complete-tag) ; Emacs < 23 nil nil nil 'find-tag-history (funcall (or find-tag-default-function (get major-mode 'find-tag-default-function) 'find-tag-default))) current-prefix-arg))) (unwind-protect (let* ((icicle-whole-candidate-as-text-prop-p t) (icicle-sort-comparer nil) (icicle-inhibit-sort-p t) (icicle-candidate-action-fn 'icicle-find-tag-action) (icicle-candidate-help-fn 'icicle-find-tag-help) (completion-ignore-case (if (and (boundp 'tags-case-fold-search) (memq tags-case-fold-search '(t nil))) tags-case-fold-search case-fold-search)) (case-fold-search completion-ignore-case) (orig-pt-find-tag (point-marker))) (ring-insert find-tag-marker-ring orig-pt-find-tag) ; Record starting point. (icicle-explore `(lambda () (icicle-find-tag-define-candidates ',regexp ',arg)) #'icicle-find-tag-final-act #'icicle-find-tag-quit-or-error #'icicle-find-tag-quit-or-error nil "Choose a tag: " nil nil nil 'find-tag-history)) (when (fboundp 'crosshairs-unhighlight) (crosshairs-unhighlight 'even-if-frame-switch)))) (defun icicle-pop-tag-mark () "Like `pop-tag-mark', but uses `pop-to-buffer', not `switch-to-buffer'. By default, Icicle mode remaps all key sequences that are normally bound to `pop-tag-mark' to `icicle-pop-tag-mark'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive) (require 'etags) (when (ring-empty-p find-tag-marker-ring) (error "No previous locations for find-tag invocation")) (let ((marker (ring-remove find-tag-marker-ring 0))) (pop-to-buffer (or (marker-buffer marker) (error "The marked buffer has been deleted"))) (goto-char (marker-position marker)) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) (set-marker marker nil nil))) (defun icicle-find-tag-define-candidates (regexp arg) "Define candidates for `icicle-find-tag'. See `icicle-explore', argument DEFINE-CANDIDATES-FN." (save-excursion (let ((first-time t) (morep t)) (setq icicle-candidates-alist ()) (while (and morep (visit-tags-table-buffer (not first-time))) (when (and arg (wholenump (prefix-numeric-value arg))) (setq morep nil)) (setq first-time nil icicle-candidates-alist (append icicle-candidates-alist (nreverse (icicle-find-tag-define-candidates-1 regexp (> (prefix-numeric-value arg) 0))))))))) (defun icicle-find-tag-define-candidates-1 (regexp show-file-p) "Helper function for `icicle-find-tag-define-candidates'. Returns completion alist of tag information for tags matching REGEXP. Include file name (label) if SHOW-FILE-P is non-nil. If SHOW-FILE-P is nil, then alist items look like this: (TAG TAG-INFO FILE-PATH GOTO-FUNC) If SHOW-FILE-P is non-nil, then alist items look like this: ((TAG FILE-LABEL) TAG-INFO FILE-PATH GOTO-FUNC) or (FILE-LABEL TAG-INFO FILE-PATH GOTO-FUNC) if no matching TAG. TAG-INFO is what `snarf-tag-function' (e.g. `etags-snarf-tag') returns. It is a cons (TEXT LINE . POSITION). TEXT is the initial part of a line containing the tag. LINE is the line number. POSITION is the (one-based) char position of TEXT within the file. If TEXT is t, it means the tag refers to exactly LINE or POSITION, whichever is present, LINE having preference, no searching. Either LINE or POSITION can be nil. POSITION is used if present." (icicle-highlight-lighter) (message "Gathering tags for `%s'..." regexp) (goto-char (point-min)) (let ((temp-list ())) (while (re-search-forward (concat regexp ".*\177*") nil t) ; Look before the DEL character. (beginning-of-line) (let* ((goto-func goto-tag-location-function) ; e.g. `etags-goto-tag-location'. ;; TAG-INFO: If no specific tag, (t nil (point-min)). Else, (TEXT LINE . STARTPOS). ;; e.g. TEXT = "(defun foo ()" or just "foo" (if explicit), ;; LINE = "148", STARTPOS = "1723" (tag-info (save-excursion (funcall snarf-tag-function))) ; e.g. `etags-snarf-tag'. (tag (if (eq t (car tag-info)) nil (car tag-info))) ;; FILE-PATH is absolute. FILE-LABEL is relative to `default-directory'. (file-path (save-excursion (if tag (file-of-tag) (save-excursion (next-line 1) (file-of-tag))))) (file-label (expand-file-name file-path (file-truename default-directory)))) (when (and tag (not (string= "" tag)) (= (aref tag 0) ?\( )) (setq tag (concat tag " ...)"))) (when (file-readable-p file-path) ;; Add item to alist. ;; Item looks like this: ((TAG FILE-LABEL) TAG-INFO FILE-PATH GOTO-FUNC) ;; or like this, if no matching tag: ((FILE-LABEL) TAG-INFO FILE-PATH GOTO-FUNC) (cond (tag (push `(,(if show-file-p (list tag ; Make multi-completion cons: add file name to candidate. (progn (put-text-property 0 (length file-label) 'face 'icicle-candidate-part file-label) file-label)) tag) ,tag-info ,file-path ,goto-func) temp-list)) (show-file-p ; No tag. Use only the FILE-LABEL. (push `((,(progn (put-text-property 0 (length file-label) 'face 'icicle-candidate-part file-label) file-label)) ,tag-info ,file-path ,goto-func) temp-list))))) (forward-line)) temp-list)) ; Return the alist for this TAGS file. (defun icicle-find-tag-action (ignored-string) "Action function for `icicle-find-tag'." ;; Ignore (TAG FILE-LABEL) part. Use only (TAG-INFO FILE-PATH GOTO-FUNC) part. (let* ((cand (cdr (elt (icicle-filter-alist icicle-candidates-alist icicle-completion-candidates) icicle-candidate-nb))) (tag-info (nth 0 cand)) (goto-func (nth 2 cand))) (switch-to-buffer-other-window ; Go to source file at FILE-PATH. (if (fboundp 'tag-find-file-of-tag-noselect) (tag-find-file-of-tag-noselect (nth 1 cand)) (find-file-noselect (nth 1 cand)))) (widen) (icicle-condition-case-no-debug err (funcall goto-func tag-info) ; Go to text at TAG-INFO. (error (message "%s" (error-message-string err)) (sit-for 2) nil))) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight)) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame))) (defun icicle-find-tag-help (cand) "Use as `icicle-candidate-help-fn' for `icicle-find-tag'." (let* ((cand (cdr (elt (icicle-filter-alist icicle-candidates-alist icicle-completion-candidates) icicle-candidate-nb))) (tag-info (nth 0 cand))) (message (if (eq t (car tag-info)) "No tag - file name itself matches" (format "Line: %s, Position: %s, File: %s" (icicle-propertize (cadr tag-info) 'face 'icicle-msg-emphasis) (icicle-propertize (cddr tag-info) 'face 'icicle-msg-emphasis) (icicle-propertize (nth 1 cand) 'face 'icicle-msg-emphasis)))) (sit-for 4))) (defun icicle-find-tag-final-act () "Go to the final tag choice." (let ((cand (cdr icicle-explore-final-choice-full))) (unless cand (error "No such occurrence: %s" cand)) (switch-to-buffer-other-window ; Go to source file at FILE-PATH. (if (fboundp 'tag-find-file-of-tag-noselect) (tag-find-file-of-tag-noselect (nth 1 cand)) (find-file-noselect (nth 1 cand)))) (widen) (funcall (nth 2 cand) (nth 0 cand)))) ; Go to text at TAG-INFO. (defun icicle-find-tag-quit-or-error () "Pop back to the last tag visited." (icicle-pop-tag-mark) (raise-frame)) (defun icicle-other-window-or-frame (arg) ; Bound to `C-x o' in Icicle mode. "Select a window or frame, by name or by order. This command combines Emacs commands `other-window' and `other-frame', together with Icicles multi-commands `icicle-select-window', and `icicle-select-frame'. Use the prefix argument to choose, as follows: With no prefix arg or a non-zero numeric prefix arg: If the selected frame has multiple windows, then this is `other-window'. Otherwise, it is `other-frame'. With a zero prefix arg (e.g. `C-0'): If the selected frame has multiple windows, then this is `icicle-select-window' with windows in the frame as candidates. Otherwise (single-window frame), this is `icicle-select-frame'. With plain `C-u': If the selected frame has multiple windows, then this is `icicle-select-window' with windows from all visible frames as candidates. Otherwise, this is `icicle-select-frame'. If you use library `oneonone.el' with a standalone minibuffer frame, and if option `1on1-remap-other-frame-command-flag' is non-nil, then frame selection can include the standalone minibuffer frame. By default, Icicle mode remaps all key sequences that are normally bound to `other-window' to `icicle-other-window-or-frame'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (let ((numarg (prefix-numeric-value arg))) (cond ((consp arg) (if (one-window-p) (icicle-select-frame) (icicle-select-window))) ((zerop numarg) (if (one-window-p) (icicle-select-frame) (let ((current-prefix-arg nil)) (icicle-select-window)))) (t (if (one-window-p) (if (and (fboundp '1on1-other-frame) 1on1-minibuffer-frame 1on1-remap-other-frame-command-flag) (1on1-other-frame numarg) (other-frame numarg)) (other-window numarg)))))) (icicle-define-command icicle-select-frame ; Bound to `C-x 5 o' in Icicle mode. "Select frame by its name and raise it. A frame name in this context is suffixed as needed by [NUMBER], to make it unique. For example, in a context where frames are named for their buffers and you have two frames showing buffer *Help*, one of the frames will be called `*Help*[2]' for use with this command." ; Doc string icicle-select-frame-by-name ; Action function "Select frame: " ; `completing-read' args icicle-frame-alist nil t nil (if (boundp 'frame-name-history) 'frame-name-history 'icicle-frame-name-history) (cdr (assq 'name (frame-parameters (next-frame (selected-frame))))) nil ((icicle-frame-alist (icicle-make-frame-alist)) ; Bindings (alt-fn nil) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (setq alt-fn (icicle-alt-act-fn-for-type "frame")))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn alt-fn (icicle-alt-act-fn-for-type "frame"))))) (defun icicle-select-frame-by-name (name &optional frame-alist) "Select the frame named NAME, and raise it. Optional argument FRAME-ALIST is an alist of frames to choose from. Each element has the form (FNAME . FRAME), where FNAME names FRAME. See `icicle-make-frame-alist' for more about FNAME." (interactive (let* ((alist (icicle-make-frame-alist)) (default (car (rassoc (selected-frame) alist))) (input (completing-read "Select Frame: " alist nil t nil 'frame-name-history default))) (list (if (= (length input) 0) default input) alist))) (unless frame-alist (setq frame-alist (or (and (boundp 'icicle-frame-alist) icicle-frame-alist) (icicle-make-frame-alist)))) (let ((frame (cdr (assoc name frame-alist)))) (unless frame (icicle-user-error "No such frame: `%s'" name)) (make-frame-visible frame) (select-frame-set-input-focus frame))) (defun icicle-make-frame-alist () "Return an alist of entries (FNAME . FRAME), where FNAME names FRAME. Frame parameter `name' is used as FNAME, unless there is more than one frame with the same name. In that case, FNAME includes a suffix \[NUMBER], to make it a unique name. The NUMBER order among frame names that differ only by their [NUMBER] is arbitrary." (let ((fr-alist ()) (count 2) fname new-name) (dolist (fr (frame-list)) (setq fname (frame-parameter fr 'name)) (if (not (assoc fname fr-alist)) (push (cons fname fr) fr-alist) (setq new-name fname) (while (assoc new-name fr-alist) (setq new-name (format "%s[%d]" fname count) count (1+ count))) (push (cons new-name fr) fr-alist)) (setq count 2)) fr-alist)) (icicle-define-command icicle-select-window ; Command name ;; Free vars here: `icicle-window-alist' is bound in Bindings form. "Select window by its name. With no prefix arg, candidate windows are those of the selected frame. With a prefix arg, windows of all visible frames are candidates. A window name is the name of its displayed buffer, but suffixed as needed by [NUMBER], to make the name unique. For example, if you have two windows showing buffer *Help*, one of the windows will be called `*Help*[2]' for use with this command." ; Doc string icicle-select-window-by-name ; Action function "Select window: " icicle-window-alist nil t nil nil ; `completing-read' args (buffer-name (window-buffer (other-window 1))) nil ((icicle-window-alist (icicle-make-window-alist current-prefix-arg)))) ; Bindings ;; Free vars here: `icicle-window-alist' is bound in `icicle-select-window'. ;; (defun icicle-select-window-by-name (name &optional window-alist) "Select the window named NAME. Optional argument WINDOW-ALIST is an alist of windows to choose from. Interactively: A prefix arg means windows from all visible frames are candidates. No prefix arg means windows from the selected frame are candidates. Each alist element has the form (WNAME . WINDOW), where WNAME names WINDOW. See `icicle-make-window-alist' for more about WNAME. If `crosshairs.el' is loaded, then the target position is highlighted." (interactive (let* ((alist (icicle-make-window-alist current-prefix-arg)) (default (car (rassoc (selected-window) alist))) (input (completing-read "Select Window: " alist nil t nil nil default))) (list (if (= (length input) 0) default input) alist))) (unless window-alist (setq window-alist (or (and (boundp 'icicle-window-alist) icicle-window-alist) (icicle-make-window-alist)))) (let ((window (cdr (assoc name window-alist)))) (unless window (icicle-user-error "No such window: `%s'" name)) (select-window window) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight)) (select-frame-set-input-focus (selected-frame)))) (defun icicle-make-window-alist (&optional all-p) "Return an alist of entries (WNAME . WINDOW), where WNAME names WINDOW. The name of the buffer in a window is used as its name, unless there is more than one window displaying the same buffer. In that case, WNAME includes a suffix [NUMBER], to make it a unique name. The NUMBER order among window names that differ only by their [NUMBER] is arbitrary. Non-nil argument ALL-P means use windows from all visible frames. Otherwise, use only windows from the selected frame." (lexical-let ((win-alist ()) (count 2) wname new-name) (walk-windows (lambda (w) ; FREE here: COUNT, NEW-NAME, WIN-ALIST, WNAME. (setq wname (buffer-name (window-buffer w))) (if (not (assoc wname win-alist)) (push (cons wname w) win-alist) (setq new-name wname) (while (assoc new-name win-alist) (setq new-name (format "%s[%d]" wname count) count (1+ count))) (push (cons new-name w) win-alist)) (setq count 2)) 'no-mini (if all-p 'visible 'this-frame)) win-alist)) (icicle-define-command icicle-delete-windows ; Command name "Delete windows showing a buffer, anywhere." ; Doc string delete-windows-on ; Action function "Delete windows on buffer: " ; `completing-read' args (let ((cand-bufs ())) (dolist (buf (buffer-list)) (when (get-buffer-window buf 0) (push (list (buffer-name buf)) cand-bufs))) cand-bufs) nil t nil 'buffer-name-history (buffer-name (current-buffer)) nil ((icicle-use-candidates-only-once-flag t) ; Bindings (icicle-inhibit-try-switch-buffer t) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))))) (defun icicle-delete-window (bufferp) ; Bound to `C-x 0' in Icicle mode. "`delete-window' or prompt for buffer and delete all its windows. When called from the minibuffer, remove the `*Completions*' window. Otherwise: With no prefix argument, delete the selected window. With a prefix argument, prompt for a buffer and delete all windows, on any frame, that show that buffer. With a prefix argument, this is an Icicles multi-command - see command `icicle-mode'. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active\\: `C-RET' - Act on current completion candidate only `C-down' - Move to next completion candidate and act `C-up' - Move to previous completion candidate and act `C-next' - Move to next apropos-completion candidate and act `C-prior' - Move to previous apropos-completion candidate and act `C-end' - Move to next prefix-completion candidate and act `C-home' - Move to previous prefix-completion candidate and act `\\[icicle-all-candidates-action]' - Act on *all* candidates (or all that are saved), successively (careful!) With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `C-M-return', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. By default, Icicle mode remaps all key sequences that are normally bound to `delete-window' to `icicle-delete-window'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (if (window-minibuffer-p (selected-window)) (icicle-remove-Completions-window) (if bufferp (icicle-delete-windows) (delete-window)))) (icicle-define-command icicle-kill-buffer ; Bound to `C-x k' in Icicle mode. "Kill a buffer. See `icicle-buffer' for more information, including about buffer-name completion candidates, default values, and additional key bindings. By default, Icicle mode remaps all key sequences that are normally bound to `kill-buffer' to `icicle-kill-buffer'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." ; Doc string icicle-kill-a-buffer-and-update-completions ; Action function (icicle-buffer-name-prompt "Kill") ; `completing-read' args (mapcar (lambda (buf) (list (buffer-name buf))) icicle-bufflist) nil ; `icicle-bufflist' is free here. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (if (< emacs-major-version 23) (buffer-name (current-buffer)) (cons (buffer-name (current-buffer)) (icicle-default-buffer-names current-prefix-arg))) nil (icicle-buffer-bindings) ; Bindings ;; Actually, there is no reason to bind `C-x m' to `icicle-bookmark-non-file-other-window' here, ;; but to keep things simple we do it anyway. (icicle-bind-buffer-candidate-keys) ; First code nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (defun icicle-buffer-name-prompt (action &optional other-window-p) "Return prompt for buffer-name completion. ACTION is the command action, a string. It starts the prompt. Non-nil OTHER-WINDOW-P appends \" in other window\" to the prompt." (concat (cond ((null current-prefix-arg) (format "%s buffer" action)) ((and (consp current-prefix-arg) (> (prefix-numeric-value current-prefix-arg) 16)) ; 3 `C-u' (format "%s invisible buffer" action)) ((and (consp current-prefix-arg) (> (prefix-numeric-value current-prefix-arg) 4)) ; `C-u C-u' (format "%s visible buffer" action)) ((and (consp current-prefix-arg) (fboundp 'derived-mode-p)) ; `C-u' (format "%s buffer with same or ancestor mode" action)) ((zerop (prefix-numeric-value current-prefix-arg)) ; `C-0' (format "%s buffer with same mode" action)) ((< (prefix-numeric-value current-prefix-arg) 0) ; `C--' (format "%s buffer for same frame" action)) (t ; `C-1' (format "%s file buffer" action))) (and other-window-p " in other window") ": ")) (defun icicle-kill-a-buffer-and-update-completions (buf) "Kill buffer BUF and update the set of completions." (setq buf (get-buffer buf)) (if buf (icicle-condition-case-no-debug err (if (not (buffer-live-p buf)) (message "Buffer already deleted: `%s'" buf) (if (fboundp 'kill-buffer-and-its-windows) (kill-buffer-and-its-windows buf) ; Defined in `misc-cmds.el'. (kill-buffer buf)) ;; Update the set of completions, then update `*Completions*'. (setq minibuffer-completion-table (mapcar (lambda (buf) (list (buffer-name buf))) (buffer-list))) (icicle-complete-again-update)) (error nil)) (message "No such live buffer: `%s'" buf))) (put 'icicle-buffer 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-buffer ; Bound to `C-x b' in Icicle mode. "Switch to a different buffer, whose content contains a regexp match. By default, Icicle mode remaps all key sequences that are normally bound to `switch-to-buffer' to `icicle-buffer'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'. Completion candidates are two-part multi-completions, with the second part optional. If both parts are present they are separated by `icicle-list-join-string' (\"^G^J\", by default). The first part is matched as a regexp against a buffer name. The second part is matched as a regexp against buffer content. Candidates that do not match are filtered out. When matching buffer content, Icicles just looks for a single match. Visiting the buffer does not move to that match or to any other match. Matching is used only to filter candidate buffers. However, if your input includes a content-matching part and it matches, that part is automatically added to the Isearch regexp history, `regexp-search-ring' whenever you hit `S-TAB' to complete. This means that when you visit the buffer you can immediately search for matches using `C-M-s' or `C-M-r'. Your minibuffer input can match a buffer name or buffer content, or both. Use \\`C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example: To match `foo' against buffer names, use input `foo'. To match `bar' against buffer contents, use input `C-M-j bar'. To match both, use input `foo C-M-j bar'. Only the matching buffer names are shown in `*Completions*', and only the chosen buffer name is returned. The actual content matches are unimportant anyway: content matching is used only to filter candidates. This is a buffer-switching command. If you instead want to navigate to text searched for in buffers then use `icicle-search'. The buffer-name portion of completion candidates is as follows, depending on the prefix arg: * No prefix arg: all buffers * Numeric arg > 0: buffers visiting files or directories (Dired) * Numeric arg < 0: buffers associated with the selected frame * Numeric arg = 0: buffers with the same mode as the current buffer * Plain prefix arg (`C-u'): buffers with the same mode as current, or with a mode that the current mode is derived from * Double plain (`C-u C-u'): visible buffers (possibly iconified) * Triple plain (`C-u C-u C-u'): invisible buffers Those are the default prefix-argument behaviors, but you can change them using option `icicle-buffer-prefix-arg-filtering'. For Emacs 23 and later, the default values (via `M-n') are the \(buffer-name components of the) first four completion candidates \(respecting the prefix argument). You can use these additional keys during completion: * `C-x F' Toggle including cached file names as candidates (option `icicle-buffer-include-cached-files-nflag'). * `C-x R' Toggle including recent file names as candidates (option `icicle-buffer-include-recent-files-nflag'). * `C-x m' Visit a bookmarked buffer (only if you use Bookmark+). * `C-x M -' Remove buffers in a given mode. Repeatable. * `C-x M +' Keep only buffers in a given mode. * `C-x C-m -' Remove candidate buffers whose mode is derived from a given mode. Repeatable. (`C-m' = `RET'.) * `C-x C-m +' Keep only buffers in a mode derived from a given mode. * `C-x v -' Remove buffers that are visible (maybe iconified). * `C-x v +' Keep only buffers that are visible (maybe iconified). * `\\[icicle-delete-candidate-object]' Kill the buffer named by a completion candidate. Those are default key bindings, but you can change them using option `icicle-buffer-candidate-key-bindings'. These options, when non-nil, control candidate matching and filtering: `icicle-buffer-extras' - Extra buffers to display `icicle-buffer-ignore-space-prefix-flag' - Ignore space-prefix names `icicle-buffer-include-cached-files-nflag' - Include cached files `icicle-buffer-include-recent-files-nflag' - Include recent files `icicle-buffer-match-regexp' - Regexp that buffers must match `icicle-buffer-no-match-regexp' - Regexp buffers must not match `icicle-buffer-predicate' - Predicate buffer names satisfy `icicle-buffer-sort' - Sort function for candidates `icicle-buffer-skip-hook' - Exclude from content searching `icicle-find-file-of-content-skip-hook' - Same, cached/recent files For example, to change the default behavior to show only buffers that are associated with files, set `icicle-buffer-predicate' to this: (lambda (buf) (buffer-file-name buf)) Option `icicle-buffer-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-buffers-ido-like' non-nil gives this command a more Ido-like behavior. See also command `icicle-buffer-no-search', which is `icicle-buffer' without the multi-completion behavior that searches buffer content. See also command `icicle-buffer-config', which lets you choose a configuration of user options for commands such as `icicle-buffer'. Note: The prefix arg is tested, even when this is called noninteractively. Lisp code can bind `current-prefix-arg' to control the behavior." ; Doc string (lambda (buf) ; Action function (when (and (not (get-buffer buf)) (member buf icicle-buffer-easy-files)) (setq buf (find-file-noselect buf))) (switch-to-buffer buf)) prompt 'icicle-buffer-multi-complete nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names current-prefix-arg) nil (icicle-buffer-bindings ; Bindings ((prompt (icicle-buffer-name-prompt "Switch to")) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-candidate-help-fn 'icicle-buffer-cand-help) (icicle-buffer-easy-files ())) ((icicle-buffer-complete-fn 'icicle-buffer-multi-complete) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching in ;; `icicle-unsorted-apropos-candidates' etc., because `icicle-buffer-multi-complete' does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-buffer-apropos-complete-match) ;; `icicle-bufflist' is FREE here. (icicle-bufflist (setq icicle-bufflist (delete icicle-orig-buff icicle-bufflist))))) (progn (icicle-bind-buffer-candidate-keys) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Matching buffer contents...")) nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code ;; Free var here: `icicle-bufflist' is bound by `icicle-buffer-bindings'. (defun icicle-default-buffer-names (&optional arg) "Default buffer names (Emacs 23+) or name (< Emacs 23). For Emacs 23+, up to six names are returned. Optional ARG is used only for Emacs 23+. Its meaning is the same as the prefix argument in Icicles buffer commands, except that it determines which kinds of buffers to include as default values, not as completion candidates: * nil : all buffers, and the first default is `other-buffer' * Number > 0: buffers visiting files or directories (Dired) * Number < 0: buffers associated with the selected frame * Number = 0: buffers with the same mode as the current buffer * (4) : buffers with the same mode as current, or with a mode that the current mode is derived from * (16) : visible buffers * (64) : invisible buffers In any case, the current buffer is always excluded." (if (< emacs-major-version 23) (let ((bname (buffer-name (if (fboundp 'another-buffer) ; In `misc-fns.el'. (another-buffer nil t) (other-buffer (current-buffer)))))) (if (and icicle-bufflist (not (member bname icicle-bufflist))) (car icicle-bufflist) bname)) ;; Emacs 23 accepts a list of default values. ; Just keep the first 4. (This could be an option.) (let ((bfnames (mapcar #'buffer-name (delete (current-buffer) (or icicle-bufflist (buffer-list)))))) (when icicle-buffer-ignore-space-prefix-flag (setq bfnames (icicle-remove-if (lambda (bfname) (icicle-string-match-p "^ " bfname)) bfnames))) (let ((six (icicle-first-N 6 bfnames))) (if arg six (let ((other (buffer-name (other-buffer (current-buffer))))) (cons other (delete other six)))))))) (defun icicle-buffer-cand-help (cand) "Help function for multi-completion buffer-name candidate CAND." (setq cand (icicle-transform-multi-completion cand)) (when (and (bufferp (get-buffer cand)) (with-current-buffer cand (if (fboundp 'describe-buffer) (describe-buffer) (describe-mode)) t)))) ; In `help-fns+.el'. (put 'icicle-buffer-other-window 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-buffer-other-window ; Bound to `C-x 4 b' in Icicle mode. "Switch to a buffer whose content matches a regexp, in another window. Same as `icicle-buffer' except it uses a different window." ; Doc string (lambda (buf) ; Action function (when (and (not (get-buffer buf)) (member buf icicle-buffer-easy-files)) (setq buf (find-file-noselect buf))) (switch-to-buffer-other-window buf)) prompt 'icicle-buffer-multi-complete nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names current-prefix-arg) nil (icicle-buffer-bindings ; Bindings ((prompt (icicle-buffer-name-prompt "Switch to" 'OTHER-WIN)) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-candidate-help-fn 'icicle-buffer-cand-help) (icicle-buffer-easy-files ())) ((icicle-buffer-complete-fn 'icicle-buffer-multi-complete) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching in ;; `icicle-unsorted-apropos-candidates' etc., because `icicle-buffer-multi-complete' does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-buffer-apropos-complete-match) ;; `icicle-bufflist' is FREE here. (icicle-bufflist (setq icicle-bufflist (delete icicle-orig-buff icicle-bufflist))))) (progn (icicle-bind-buffer-candidate-keys) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Matching buffer contents...")) nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (defun icicle-buffer-multi-complete (strg pred completion-mode) "Completion function for `icicle-buffer'. Used as the value of `icicle-buffer-complete-fn' and hence as `minibuffer-completion-table'." (setq strg icicle-current-input) (lexical-let* ((name-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion strg))) (name-pat (if (memq icicle-current-completion-mode '(nil apropos)) name-pat (concat "^" name-pat))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion strg))) (bufs (mapcar (lambda (buf) (buffer-name buf)) icicle-bufflist)) (bufs (if icicle-buffer-ignore-space-prefix-flag (icicle-remove-if (lambda (buf) (icicle-string-match-p "^ " buf)) bufs) bufs)) (bufs (icicle-remove-if (lambda (buf) (or (not (icicle-string-match-p name-pat buf)) (run-hook-with-args-until-success 'icicle-buffer-skip-hook buf))) bufs)) (bufs (cond ((equal "" content-pat) (dolist (buf bufs) ;; Free vars here: EXISTING-BUFFERS, NEW-BUFS--TO-KILL. ;; Bound in `icicle-visit-marked-file-of-content(-other-window)'. (when (and (boundp 'existing-bufs) (boundp 'new-bufs--to-kill) (not (memq (setq buf (get-buffer buf)) existing-bufs))) (add-to-list 'new-bufs--to-kill buf))) bufs) (t (icicle-remove-if-not (lambda (buf) (let ((found (with-current-buffer buf (save-excursion (goto-char (point-min)) (re-search-forward content-pat nil t))))) ;; Free vars here: EXISTING-BUFFERS, NEW-BUFS--TO-KILL. ;; Bound in `icicle-visit-marked-file-of-content(-other-window)'. (when (and (boundp 'existing-bufs) (boundp 'new-bufs--to-kill) (not (memq (setq buf (get-buffer buf)) existing-bufs))) (add-to-list 'new-bufs--to-kill buf)) (when (and found ; Don't do it just because incrementally complete. (or (icicle-get-safe this-command 'icicle-apropos-completing-command) (icicle-get-safe this-command 'icicle-cycling-command) (memq this-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) (isearch-update-ring content-pat 'REGEXP)) found)) bufs)))) (filnames (and (> icicle-buffer-include-recent-files-nflag 0) (require 'recentf nil t) (or recentf-list (recentf-load-list)) (icicle-recent-files-without-buffers bufs))) (filnames (append filnames (and (> icicle-buffer-include-cached-files-nflag 0) (icicle-cached-files-without-buffers bufs)))) (filnames (icicle-remove-if (lambda (fil) (or (not (icicle-string-match-p name-pat fil)) (run-hook-with-args-until-success 'icicle-find-file-of-content-skip-hook fil))) filnames)) (filnames (if (equal "" content-pat) filnames (icicle-remove-if-not (lambda (filname) ;; Avoid the error raised by calling `find-file-noselect' on a directory ;; when `find-file-run-dired' is nil. (and (or find-file-run-dired (not (file-directory-p filname))) (let* ((buf (find-file-noselect filname)) (found (with-current-buffer buf (message "Matching buffer contents...") (save-excursion (goto-char (point-min)) (re-search-forward content-pat nil t))))) ;; Free vars here: EXISTING-BUFFERS, NEW-BUFS--TO-KILL (when (and (boundp 'existing-bufs) (boundp 'new-bufs--to-kill) (not (memq buf existing-bufs))) (add-to-list 'new-bufs--to-kill buf)) (when (and found ; Don't do it just because incrementally complete. (or (icicle-get-safe this-command 'icicle-apropos-completing-command) (icicle-get-safe this-command 'icicle-cycling-command) (memq this-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) (isearch-update-ring content-pat 'REGEXP)) found))) filnames)))) ;; `icicle-buffer-easy-files' is FREE here - bound in `icicle-buffer(-other-window)'. (setq bufs (append bufs (setq icicle-buffer-easy-files filnames))) (cond ((and (eq 'metadata completion-mode) (> emacs-major-version 23)) '(metadata (category . buffer))) (completion-mode bufs) ; `all-completions', `test-completion' (t (try-completion ; `try-completion' strg (mapcar #'list bufs) (and pred (lambda (ss) (funcall pred ss)))))))) (defun icicle-buffer-apropos-complete-match (input buffer) "Match function for progressive completion with `icicle-buffer'. Return non-nil if the current multi-completion INPUT matches BUFFER. BUFFER is a buffer name." (lexical-let* ((name-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion input))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion input)))) (and (icicle-string-match-p name-pat buffer) (or (equal "" content-pat) (let ((found (with-current-buffer buffer (save-excursion (goto-char (point-min)) (re-search-forward content-pat nil t))))) (when (and found ; Don't do it just because incrementally complete. (or (icicle-get-safe this-command 'icicle-apropos-completing-command) (icicle-get-safe this-command 'icicle-cycling-command) (memq this-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) (isearch-update-ring content-pat 'REGEXP)) found))))) (defun icicle-cached-files-without-buffers (buffers) "Return absolute file-name list represented by `file-cache-alist'. Do not include any files that are already visited in BUFFERS, which is a list of buffer names. Return only the first `icicle-buffer-include-cached-files-nflag' names." (and (boundp 'file-cache-alist) file-cache-alist (catch 'icicle-cached-files-without-buffers (let ((result ()) (buf-files (mapcar #'buffer-file-name (mapcar #'get-buffer buffers))) file) (dolist (file+dirs file-cache-alist) (setq file (car file+dirs)) (dolist (dir (cdr file+dirs)) (setq file (concat (or dir default-directory) file)) (unless (member file buf-files) (push file result)) (when (>= (length result) icicle-buffer-include-cached-files-nflag) (throw 'icicle-cached-files-without-buffers result)))) result)))) (defun icicle-recent-files-without-buffers (buffers) "Return absolute file-name list represented by `recentf-list'. Do not include any files that are already visited in BUFFERS, which is a list of buffer names. Return only the first `icicle-buffer-include-recent-files-nflag' names." (and (boundp 'recentf-list) recentf-list (catch 'icicle-recent-files-without-buffers (let ((result ()) (buf-files (mapcar #'buffer-file-name (mapcar #'get-buffer buffers))) file) (dolist (file recentf-list) (unless (member file buf-files) (push file result)) (when (>= (length result) icicle-buffer-include-recent-files-nflag) (throw 'icicle-recent-files-without-buffers result))) result)))) (put 'icicle-buffer-no-search 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-buffer-no-search ; Not bound by default "Switch to a different buffer. This is like command `icicle-buffer', but without the possibility of searching buffer contents. That is, completion candidates are just buffer names, not multi-completions - they contain no buffer-content part." ; Doc string switch-to-buffer ; Action function (icicle-buffer-name-prompt "Switch to") ; `completing-read' args (mapcar (lambda (buf) (list (buffer-name buf))) icicle-bufflist) nil ; `icicle-bufflist' is free. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names current-prefix-arg) nil (icicle-buffer-bindings ; Bindings () ((icicle-bufflist (setq icicle-bufflist (delete icicle-orig-buff icicle-bufflist))))) (icicle-bind-buffer-candidate-keys) ; First code nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (put 'icicle-buffer-no-search-other-window 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-buffer-no-search-other-window ; Not bound by default "Switch to a different buffer in another window. Same as `icicle-buffer' except it uses a different window." ; Doc string switch-to-buffer-other-window ; Action function (icicle-buffer-name-prompt "Switch to" 'OTHER-WIN) ; `completing-read' args (mapcar (lambda (buf) (list (buffer-name buf))) icicle-bufflist) nil ; `icicle-bufflist' is free. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names current-prefix-arg) nil (icicle-buffer-bindings ; Bindings () ((icicle-bufflist (setq icicle-bufflist (delete icicle-orig-buff icicle-bufflist))))) (icicle-bind-buffer-candidate-keys) ; First code nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (icicle-define-command icicle-visit-marked-file-of-content ; Command name "Visit a marked file whose content matches a regexp. The marked files are examined, and those whose file names and/or contents match your multi-completion input are available as candidate buffers to visit. This command is like `icicle-buffer' and `icicle-find-file-of-content' - see those commands for more information. You must be in Dired mode to use this command. When this command is finished, any unused buffers that were created for content matching are killed, if option `icicle-kill-visited-buffers-flag' is non-nil. But a prefix argument flips the behavior specified by that option." ; Doc string (lambda (buf) ; Action function. Free var here: NEW-BUFS--TO-KEEP. (push (switch-to-buffer (icicle-transform-multi-completion buf)) new-bufs--to-keep)) ; Add the visited buffer to those we will keep (not kill). prompt 'icicle-buffer-multi-complete nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names) nil (icicle-buffer-bindings ; Bindings ((prompt (icicle-buffer-name-prompt "Visit file")) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (init-pref-arg current-prefix-arg) (existing-bufs (buffer-list)) (new-bufs--to-kill ()) (new-bufs--to-keep ()) (icicle-candidate-help-fn 'icicle-buffer-cand-help)) ((icicle-buffer-complete-fn 'icicle-buffer-multi-complete) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching in ;; `icicle-unsorted-apropos-candidates' etc., because `icicle-buffer-multi-complete' does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-buffer-apropos-complete-match) (icicle-bufflist (save-excursion (let* ((files (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file))))) (bufs ())) (dolist (file files) (push (find-file-noselect file) bufs)) bufs))))) (progn (unless (eq major-mode 'dired-mode) (icicle-user-error "Use this command only in Dired mode")) (icicle-bind-buffer-candidate-keys) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Matching file contents...")) nil ; Undo code (progn (icicle-unbind-buffer-candidate-keys) ; Last code (when (or (and init-pref-arg (not icicle-kill-visited-buffers-flag)) (and (not init-pref-arg) icicle-kill-visited-buffers-flag)) (dolist (buf new-bufs--to-kill) (unless (memq buf new-bufs--to-keep) (kill-buffer buf)))))) (icicle-define-command icicle-visit-marked-file-of-content-other-window ; Command name "Visit a marked file whose content matches a regexp, in another window. Same as `icicle-visit-marked-file-of-content' except it uses a different window. You must be in Dired to use this command." ; Doc string (lambda (buf) ; Action function. Free var here: NEW-BUFS--TO-KEEP. (push (switch-to-buffer-other-window (icicle-transform-multi-completion buf)) new-bufs--to-keep)) ; Add the visited buffer to those we will keep (not kill). prompt 'icicle-buffer-multi-complete nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names) nil (icicle-buffer-bindings ; Bindings ((prompt (icicle-buffer-name-prompt "Visit file" 'OTHER-WIN)) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (init-pref-arg current-prefix-arg) (existing-bufs (buffer-list)) (new-bufs--to-kill ()) (new-bufs--to-keep ()) (icicle-candidate-help-fn 'icicle-buffer-cand-help)) ((icicle-buffer-complete-fn 'icicle-buffer-multi-complete) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching in ;; `icicle-unsorted-apropos-candidates' etc., because `icicle-buffer-multi-complete' does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-buffer-apropos-complete-match) (icicle-bufflist (save-excursion (let* ((files (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file))))) (bufs ())) (dolist (file files) (push (find-file-noselect file) bufs)) bufs))))) (progn (unless (eq major-mode 'dired-mode) (icicle-user-error "Use this command only in Dired mode")) (icicle-bind-buffer-candidate-keys) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Matching file contents...")) nil ; Undo code (progn (icicle-unbind-buffer-candidate-keys) ; Last code (when (or (and init-pref-arg (not icicle-kill-visited-buffers-flag)) (and (not init-pref-arg) icicle-kill-visited-buffers-flag)) (dolist (buf new-bufs--to-kill) (unless (memq buf new-bufs--to-keep) (kill-buffer buf)))))) (icicle-define-command icicle-insert-buffer "Multi-command version of `insert-buffer'. See `icicle-buffer' for more information, including about buffer-name completion candidates, default values, and additional key bindings." ; Doc string insert-buffer ; Action function (icicle-buffer-name-prompt "Insert") ; `completing-read' args (mapcar (lambda (buf) (list (buffer-name buf))) icicle-bufflist) nil ; `icicle-bufflist' is free. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (icicle-default-buffer-names current-prefix-arg) nil (icicle-buffer-bindings) ; Bindings ;; Actually, there is no reason to bind `C-x m' to `icicle-bookmark-non-file-other-window' here, ;; but to keep things simple we do it anyway. (icicle-bind-buffer-candidate-keys) ; First code nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (icicle-define-command icicle-add-buffer-candidate ; Command name "Add buffer as an always-show completion candidate. Add the buffer to `icicle-buffer-extras'. Save the updated option. See `icicle-buffer' for more information, including about buffer-name completion candidates, default values, and additional key bindings." ; Doc string ;; FREE here: ICICLE-BUFFER-EXTRAS, ICICLE-CUSTOMIZE-SAVE-VARIABLE-FUNCTION. (lambda (buf) (add-to-list 'icicle-buffer-extras buf) ; Action function (funcall icicle-customize-save-variable-function 'icicle-buffer-extras icicle-buffer-extras) (message "Buffer `%s' added to always-show buffers" (icicle-propertize buf 'face 'icicle-msg-emphasis))) (icicle-buffer-name-prompt "Show always") ; `completing-read' args (mapcar (lambda (buf) (list (buffer-name buf))) icicle-bufflist) nil ; `icicle-bufflist' is free. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ; Emacs 23. nil 'buffer-name-history (if (< emacs-major-version 23) (buffer-name (current-buffer)) (cons (buffer-name (current-buffer)) (icicle-default-buffer-names current-prefix-arg))) nil (icicle-buffer-bindings ; Bindings ((icicle-delete-candidate-object 'icicle-remove-buffer-candidate-action) ; Override default (kill). (icicle-use-candidates-only-once-flag t))) ;; Actually, there is no reason to bind `C-x m' to `icicle-bookmark-non-file-other-window' here, ;; but to keep things simple we do it anyway. (icicle-bind-buffer-candidate-keys) ; First code nil ; Undo code (icicle-unbind-buffer-candidate-keys)) ; Last code (icicle-define-command icicle-remove-buffer-candidate ; Command name "Remove buffer as an always-show completion candidate. Remove the buffer from `icicle-buffer-extras'. Save the updated option." ; Doc string icicle-remove-buffer-candidate-action ; Action function "Remove buffer from always-show list: " ; `completing-read' args (mapcar #'list icicle-buffer-extras) nil t nil 'buffer-name-history (car icicle-buffer-extras) nil ((icicle-use-candidates-only-once-flag t) ; Bindings (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "buffer")))) (unless icicle-buffer-extras (icicle-user-error "`icicle-extra-buffers' is empty"))) ; First code (defun icicle-remove-buffer-candidate-action (buf) "Action function for command `icicle-remove-buffer-candidate'." (setq icicle-buffer-extras (delete buf icicle-buffer-extras)) (funcall icicle-customize-save-variable-function 'icicle-buffer-extras icicle-buffer-extras) (message "Buffer `%s' removed from always-show buffers" (icicle-propertize buf 'face 'icicle-msg-emphasis))) (icicle-define-command icicle-buffer-config ; Command name "Choose a configuration of user options for `icicle-buffer'. You can use \\\ `\\[icicle-delete-candidate-object]' on any configuration during completion to remove it. See user option `icicle-buffer-configs'. See also commands `icicle-add-buffer-config' and `icicle-remove-buffer-config'." ; Doc string ;; FREE here: ICICLE-BUFFER-CONFIGS, ICICLE-BUFFER-EXTRAS, ICICLE-BUFFER-MATCH-REGEXP, ;; ICICLE-BUFFER-NO-MATCH-REGEXP, ICICLE-BUFFER-PREDICATE, ICICLE-BUFFER-SORT. (lambda (config-name) ; Action function (let ((config (assoc config-name icicle-buffer-configs))) (setq icicle-buffer-match-regexp (elt config 1) icicle-buffer-no-match-regexp (elt config 2) icicle-buffer-predicate (elt config 3) icicle-buffer-extras (elt config 4) icicle-buffer-sort (elt config 5)))) "Configuration: " icicle-buffer-configs nil t nil ; `completing-read' args 'icicle-buffer-config-history nil nil ((icicle-delete-candidate-object 'icicle-remove-buffer-config-action))) ; Bindings (icicle-define-add-to-alist-command icicle-add-buffer-config ; Command name "Add buffer configuration to `icicle-buffer-configs'. You are prompted for the buffer configuration components. For the list of extra buffers to always display, you can choose them using `C-mouse-2', `C-RET', and so on, just as you would make any Icicles multiple choice." ;; FREE here: FUNCTION-NAME-HISTORY, ICICLE-BUFFER-NO-MATCH-REGEXP, ICICLE-BUFFER-PREDICATE, ;; ICICLE-BUFFER-SORT. (lambda () (let ((name (read-from-minibuffer "Add buffer configuration. Name: ")) (match-regexp (icicle-read-from-minibuf-nil-default "Regexp to match: " nil nil nil 'regexp-history icicle-buffer-match-regexp)) (nomatch-regexp (icicle-read-from-minibuf-nil-default "Regexp not to match: " nil nil nil 'regexp-history icicle-buffer-no-match-regexp)) (pred (icicle-read-from-minibuf-nil-default "Predicate to satify: " nil nil nil (if (boundp 'function-name-history) 'function-name-history 'icicle-function-name-history) icicle-buffer-predicate)) (sort-fn (icicle-read-from-minibuf-nil-default "Sort function: " nil nil t (if (boundp 'function-name-history) 'function-name-history 'icicle-function-name-history) (and icicle-buffer-sort (symbol-name icicle-buffer-sort)))) (extras (let ((icicle-prompt "Choose extra buffers to show (`RET' when done): ")) (icicle-buffer-list)))) ; Do last, for convenience. (list name match-regexp nomatch-regexp pred extras sort-fn))) icicle-buffer-configs) (icicle-define-command icicle-remove-buffer-config ; Command name "Remove buffer configuration from `icicle-buffer-configs'. Save the updated option." ; Doc string icicle-remove-buffer-config-action ; Action function "Remove buffer configuration: " ; `completing-read' args (mapcar (lambda (config) (list (car config))) icicle-buffer-configs) nil t nil 'icicle-buffer-config-history (caar icicle-buffer-configs) nil ((icicle-use-candidates-only-once-flag t))) ; Bindings (defun icicle-remove-buffer-config-action (config-name) "Action function for command `icicle-remove-buffer-config'." (setq icicle-buffer-configs (icicle-assoc-delete-all config-name icicle-buffer-configs)) (funcall icicle-customize-save-variable-function 'icicle-buffer-configs icicle-buffer-configs) (message "Buffer configuration `%s' removed" (icicle-propertize config-name 'face 'icicle-msg-emphasis))) (icicle-define-command icicle-color-theme ; Command name "Change color theme. You can use \\\ `\\[icicle-delete-candidate-object]' during completion to remove the current candidate from the list of color themes. If you use `C-g' during this command, the previous color-theme snapshot is used to restore that color theme. Remember too that you can use the pseudo-theme [Reset] to restore the last theme: `M-x color-theme-select [Reset]'. By default, each time you invoke this command, a snapshot is first made of the current color theme (or current colors, if no theme is used). Thus, by default, if you use `C-g', the colors restored are those used before you changed themes using this command. However, if you use a prefix arg, then this command takes no new snapshot, unless no snapshot has ever been taken during this Emacs session. This can be useful when experimenting, to restore not to the state just before this command invocation, but to some previous snapshot. To use this command, you must have loaded library `color-theme.el', available from http://www.emacswiki.org/cgi-bin/wiki.pl?ColorTheme." ; Doc string (lambda (theme) (when (string= "" theme) (icicle-user-error "No theme name entered (empty input)")) (funcall (intern theme))) ; Action function: just call the theme. "Theme: " icicle-color-themes nil t nil ; `completing-read' args (if (boundp 'color-theme-history) 'color-theme-history 'icicle-color-theme-history) nil nil ((icicle-delete-candidate-object 'icicle-color-themes) ; Bindings (prefix-arg current-prefix-arg)) (progn (unless (prog1 (require 'color-theme nil t) ; First code (when (and (fboundp 'color-theme-initialize) (not color-theme-initialized)) ;; NOTE: We need the `icicle-condition-case-no-debug' because of a BUG in ;; `directory-files' for Emacs 20. Bug reported to `color-theme.el' ;; maintainer 2009-11-22. The problem is that the default value of ;; `color-theme-libraries' concats `file-name-directory', which ends in `/', ;; with `/themes', not with `themes'. So the result is `...//themes'. ;; That is tolerated by Emacs 21+ `directory-files', but not for Emacs 20. ;; Until this `color-theme.el' bug is fixed, Emacs 20 users will need to ;; manually load `color-theme-libraries.el'. (icicle-condition-case-no-debug nil (let ((color-theme-load-all-themes t)) (color-theme-initialize) (setq color-theme-initialized t)) (error nil)))) (icicle-user-error "You need library `color-theme.el' for this command")) (unless icicle-color-themes (setq icicle-color-themes (delete '("bury-buffer") (mapcar (lambda (entry) (list (symbol-name (car entry)))) color-themes)))) ; Free here, defined in `color-theme.el'. ;; Create the snapshot, if not available. Do this so users can also undo using ;; pseudo-theme `[Reset]'. (when (or (not prefix-arg) (not (assq 'color-theme-snapshot color-themes)) (not (commandp 'color-theme-snapshot))) (fset 'color-theme-snapshot (color-theme-make-snapshot)) (setq color-themes (delq (assq 'color-theme-snapshot color-themes) color-themes) color-themes (delq (assq 'bury-buffer color-themes) color-themes) color-themes (append '((color-theme-snapshot "[Reset]" "Undo changes, if possible.") (bury-buffer "[Quit]" "Bury this buffer.")) color-themes)))) (color-theme-snapshot)) ; Undo code ;; Make delete-selection mode recognize yanking, so it replaces region text. (put 'icicle-yank-pop-commands 'delete-selection 'yank) (defun icicle-yank-pop-commands (&optional arg) ; Bound to `M-y'. "`yank-pop', `yank-pop-secondary', or `icicle-completing-yank'. Which of these is used depends on the previous command, as follows: * If the previous command was a yank-secondary command, then `yank-pop-secondary'. * Else if the previous command was a yank command (i.e. using the kill ring), then `yank-pop'. * Else `icicle-completing-yank'. In the last case (`icicle-completing-yank'), during completion you can use: * \\`\\[icicle-change-sort-order]' to sort the \ candidates to yank in different ways (repeat) * `\\[icicle-delete-candidate-object]' to remove a candidate entry from the selection ring * `\\[icicle-candidate-alt-action]' to copy a candidate to the other selection ring You need library `second-sel.el' for this command." (interactive "p") (unless (featurep 'second-sel) (icicle-user-error "You need library `second-sel.el' for this command")) ;; Disable `browse-kill-ring's advice, since we handle such things here instead. (when (fboundp 'browse-kill-ring) (condition-case nil (ad-disable-advice 'yank-pop 'around 'kill-ring-browse-maybe) (error nil))) (cond ((memq last-command secondary-selection-yank-secondary-commands) (when buffer-read-only (icicle-user-error "Buffer is read-only: %S" (current-buffer))) (yank-pop-secondary arg)) ((memq last-command secondary-selection-yank-commands) (when buffer-read-only (icicle-user-error "Buffer is read-only: %S" (current-buffer))) (yank-pop arg)) (t (icicle-completing-yank) ;; Need to do this because `icicle-completing-yank' sets it to `yank'. (setq this-command 'icicle-yank-pop-commands)))) ;; Make delete-selection mode recognize yanking, so it replaces region text. (put 'icicle-completing-yank 'delete-selection 'yank) ;; Bound to `C-- C-y' via `icicle-yank-maybe-completing'. (icicle-define-command icicle-completing-yank ; Bound to `M-y' unless previous command was a yank. "Yank an entry from a selection ring, choosing it using completion. By default, the selection ring used is the kill ring. If you also use library `browse-kill-ring+.el' or library `second-sel.el' then an alternative selection ring is used if you provide a prefix argument: `browse-kill-ring-alternative-ring' or `secondary-selection-ring'. This gives you a way to yank chosen items from two different sets of selections. When the kill ring is used, this is similar to `yank', but this does not rotate the ring. The mark is pushed first, so the yanked text becomes the region. During completion, you can use: * \\`\\[icicle-change-sort-order]' to sort the \ candidates to yank in different ways (repeat) * `\\[icicle-delete-candidate-object]' to remove a candidate entry from the selection ring * `\\[icicle-candidate-alt-action]' to copy a candidate to the other selection ring (requires `second-sel.el' or `browse-kill-ring+.el')" ; Doc string icicle-insert-for-yank ; Action function "Insert: " (mapcar #'list kills-in-order) nil t nil 'icicle-kill-history ; `completing-read' args (car kills-in-order) nil ((icicle-transform-function 'icicle-remove-duplicates) ; Bindings (icicle-sort-comparer nil) (selection-ring (if (not current-prefix-arg) 'kill-ring (if (boundp 'browse-kill-ring-alternative-ring) browse-kill-ring-alternative-ring (if (boundp 'secondary-selection-ring) 'secondary-selection-ring) 'kill-ring))) (icicle-candidate-alt-action-fn `(lambda (seln) ; Add selection to the front of the other ring. ;; FREE here: BROWSE-KILL-RING-ALTERNATIVE-PUSH-FUNCTION, ;; BROWSE-KILL-RING-ALTERNATIVE-RING. (let ((other-ring (if (eq 'kill-ring ',selection-ring) (if (fboundp 'browse-kill-ring) browse-kill-ring-alternative-ring (if (boundp 'secondary-selection-ring) 'secondary-selection-ring nil)) 'kill-ring))) (if (eq 'kill-ring ',selection-ring) (if (fboundp 'browse-kill-ring-alternative-push-function) (funcall browse-kill-ring-alternative-push-function seln) (when (boundp 'secondary-selection-ring) (add-secondary-to-ring seln))) (kill-new seln)) (icicle-msg-maybe-in-minibuffer (if (null other-ring) "No other selection ring" (format "Copied to `%s'" other-ring)))))) (icicle-delete-candidate-object selection-ring) (kills-in-order (if (eq selection-ring 'kill-ring) (append kill-ring-yank-pointer kill-ring ()) (copy-sequence (symbol-value selection-ring)))))) (defun icicle-insert-for-yank (string) "`insert-for-yank', if defined; else, `insert' with `read-only' removed. Pushes the mark first, so the inserted text becomes the region." (setq this-command 'yank) (push-mark) (if (fboundp 'insert-for-yank) ; Defined in `subr.el' (not required). (insert-for-yank string) (let ((opoint (point))) (insert string) (let ((inhibit-read-only t)) (remove-text-properties opoint (point) '(read-only nil)))))) ;; Make delete-selection mode recognize yanking, so it replaces region text. (put 'icicle-yank-maybe-completing 'delete-selection 'yank) (defun icicle-yank-maybe-completing (&optional arg) ; Bound to `C-y' (or what `yank' was bound to). "`icicle-completing-yank', `icicle-yank', or `icicle-yank-function'. If called from the minibuffer, call `icicle-yank'. Otherwise: With a negative prefix argument, call `icicle-completing-yank'. Otherwise, call the value of user option `icicle-yank-function' (by default, `yank')." (interactive "*P") (if (window-minibuffer-p (selected-window)) (icicle-yank arg) (if (wholenump (prefix-numeric-value arg)) (funcall icicle-yank-function arg) (let ((current-prefix-arg nil)) (icicle-completing-yank))))) (when (locate-library "proced") ; Emacs 23+. (icicle-define-command icicle-send-signal-to-process "Send a signal to a system process. Each candidate is a multi-completion with parts COMMAND, USER, and PID, separated by `icicle-list-join-string' (\"^G^J\", by default). COMMAND is the system command associated with the process. USER is the user who issued COMMAND. PID is the process identifier. You can match an input regexp against any combination of the parts. You can use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator." (lambda (cand) ; ; FREE here: GET-ATTR, GET-PID, PROCED-SIGNAL-LIST. (let* ((process (funcall get-pid cand)) (process-name (funcall get-attr cand 'comm)) (sigcode (let ((enable-recursive-minibuffers t)) (completing-read (format "Send signal to process %s: " process-name) ;; `proced-signal-list' is free here. proced-signal-list nil nil nil nil "TERM")))) (setq sigcode (and (stringp sigcode) (if (string-match "\\`[0-9]+\\'" sigcode) (string-to-number sigcode) (make-symbol sigcode)))) (when sigcode (signal-process process sigcode)))) prompt (mapcar (lambda (pid) (let ((ats (process-attributes pid))) `((,(cdr (assoc 'comm ats)) ,(cdr (assoc 'user ats)) ,(number-to-string pid))))) (list-system-processes)) nil 'FORCE-MATCH-TO-PREVENT-ACCIDENTS nil nil nil nil ((prompt "COMMAND `C-M-j' USER `C-M-j' PID: ") ; Bindings (completion-ignore-case t) ; For sorting. (icicle-candidate-properties-alist ()) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(3)) (get-pid (lambda (cand) (string-to-number cand))) (get-attr (lambda (cand attr) ; FREE here: GET-PID. (cdr-safe (assoc attr (process-attributes (funcall get-pid cand)))))) (get-user (lambda (cand) ; FREE here: GET-ATTR. (funcall get-attr cand 'user))) (icicle-candidate-help-fn (lambda (cand) ; FREE here: GET-PID. (icicle-describe-process (funcall get-pid cand)))) (icicle-transform-before-sort-p t) (icicle-last-transform-function nil) ; Because we bind `icicle-transform-function'. (icicle-transform-function (lambda (cands) (let ((user-name (user-login-name))) (loop for cand in cands for user = (funcall ; FREE here: GET-USER. get-user (icicle-transform-multi-completion cand)) if (equal user-name user) collect cand)))) (icicle-sort-orders-alist '(("by pid" . (lambda (s1 s2) ; FREE here: GET-PID. (< (funcall get-pid s1) (funcall get-pid s2)))) ("by command name" . (lambda (s1 s2) ; FREE here: GET-ATTR. (string-lessp (upcase (funcall get-attr s1 'comm)) (upcase (funcall get-attr s2 'comm))))) ("by age" . (lambda (s1 s2) ; FREE here: GET-ATTR. (> (float-time (funcall get-attr s1 'start)) (float-time (funcall get-attr s2 'start))))))) (icicle-sort-comparer (cdar icicle-sort-orders-alist))) (progn (unless (require 'proced nil t) ; First code (icicle-user-error "You need library `proced.el' for this command")) (put-text-property 0 1 'icicle-fancy-candidates t prompt) (icicle-highlight-lighter))) (defun icicle-describe-process (pid) "Describe the system process that has process id PID." (interactive "nPID: ") (with-output-to-temp-buffer "*Help*" (let* ((attributes (process-attributes pid)) (comm (cdr-safe (assoc 'comm attributes))) (args (cdr-safe (assoc 'args attributes))) (start (cdr-safe (assoc 'start attributes))) (user (cdr-safe (assoc 'user attributes))) (state (cdr-safe (assoc 'state attributes)))) (princ (format "PID:\t\t%s\n" pid)) (when comm (princ (format "Command name:\t%s\n" comm))) (when args (princ (format "Command line:\t%s\n" args))) (when user (princ (format "User:\t\t%s\n" user))) (when state (princ (format "State:\t%s\n" state))) (when start (princ (format-time-string "Started:\t%a %b %e %T %Y (%z)\n" start))))))) (icicle-define-file-command icicle-delete-file ; Command name "Delete a file or directory. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles)" ; Doc string (lambda (file) ; Function to perform the action (icicle-delete-file-or-directory file) (icicle-remove-candidate-display-others 'ALL)) "Delete file or directory: " default-directory nil t nil nil ; `read-file-name' args (icicle-file-bindings) ; Bindings (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (defun icicle-delete-file-or-directory (file) "Delete file or (empty) directory FILE." (icicle-condition-case-no-debug i-delete-file (if (eq t (car (file-attributes file))) (delete-directory file) (delete-file file)) (error (message "%s" (error-message-string i-delete-file)) (error "%s" (error-message-string i-delete-file))))) (icicle-define-file-command icicle-dired "Multi-command version of `dired'. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles)" ; Doc string (lambda (dir) (dired dir switches)) ; FREE here: SWITCHES. "Dired (directory): " nil default-directory nil nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((switches (and current-prefix-arg (read-string "Dired listing switches: " dired-listing-switches))) (icicle-file-sort (or icicle-file-sort 'icicle-dirs-first-p)) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (icicle-define-file-command icicle-dired-other-window "Same as `icicle-dired', except uses another window." ; Doc string (lambda (dir) (dired-other-window dir switches)) ; FREE here: SWITCHES. "Dired in other window (directory): " nil default-directory nil nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((switches (and current-prefix-arg (read-string "Dired listing switches: " dired-listing-switches))) (icicle-file-sort (or icicle-file-sort 'icicle-dirs-first-p)) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (put 'icicle-file 'icicle-Completions-window-max-height 200) (defun icicle-file (arg) ; Bound to `C-x C-f' in Icicle mode. "Visit a file or directory. With no prefix argument, use relative file names (`icicle-find-file'). With a prefix argument, use absolute file names (`icicle-find-file-absolute'). With a negative prefix arg, you can choose also by date: Completion candidates include the last modification date. Note that when you use a prefix arg, completion matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax if you use a prefix argument. If you use a prefix arg when you act on a completion candidate, then you visit the file or dir in read-only mode. This includes when you act on all candidates using \\\ `\\[icicle-all-candidates-action]': precede the `\\[icicle-all-candidates-action]' with a prefix arg. This does not apply to the final candidate chosen (using `RET' or `mouse-2') - a prefix arg has no effect for that. See `icicle-find-file' and `icicle-find-file-absolute' for more information. Note that for Emacs 23 and later, `icicle-find-file' lets you search file content, as well as file names. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) By default, Icicle mode remaps all key sequences that are normally bound to `find-file' to `icicle-file'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (if arg (let ((current-prefix-arg (not (wholenump (prefix-numeric-value arg))))) (icicle-find-file-absolute)) (icicle-find-file))) (put 'icicle-file-other-window 'icicle-Completions-window-max-height 200) (defun icicle-file-other-window (arg) ; Bound to `C-x 4 f' in Icicle mode. "Same as `icicle-file', except uses another window." (interactive "P") (if arg (let ((current-prefix-arg (not (wholenump (prefix-numeric-value arg))))) (icicle-find-file-absolute-other-window)) (icicle-find-file-other-window))) (put 'icicle-find-file-absolute 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-find-file-absolute ; Bound to `C-u C-x f' in Icicle mode. "Visit a file or directory, given its absolute name. Unlike `icicle-find-file', the completion candidates are absolute, not relative, file names. Also, this is like `icicle-find-file-no-search', and not like `icicle-find-file', in that there is no file-content search: candidates are only file names, not multi-completions with content patterns after `C-M-j'. By default, the completion candidates are files in the current directory, but you can substitute other candidates by retrieving a saved candidate set. Note that completion here matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax. Also, you cannot move up and down the file hierarchy the same way you can for ordinary (non-absolute) file-name completion. To change to a different directory, with its files as candidates, use \\`C-c C-d' from the minibuffer - it prompts you for the new directory. Remember that you can use `C-x .' to hide the common match portion of each candidate. That can be particularly helpful for files that are in a common directory. With a prefix argument, you can choose also by date: Completion candidates include the last modification date. If you use a prefix argument when you act on a completion candidate, then you visit the file or dir in read-only mode. This includes when you act on all candidates using \\\ `\\[icicle-all-candidates-action]': precede the `\\[icicle-all-candidates-action]' with a prefix arg. This does not apply to the final candidate chosen (using `RET' or `mouse-2') - a prefix arg has no effect for that. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c C-d - change the `default-directory' (a la `cd') C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (file) ; FREE here: CURRENT-PREFIX-ARG, THIS-COMMAND. (let ((r-o (and (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) current-prefix-arg)) (fil (icicle-transform-multi-completion file))) (if r-o (find-file-read-only fil 'WILDCARDS) (find-file fil 'WILDCARDS)))) prompt icicle-abs-file-candidates nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history default-directory nil (icicle-file-bindings ; Bindings ((prompt "File or dir (absolute): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-abs-file-candidates (mapcar icicle-full-cand-fn (directory-files default-directory 'FULL nil 'NOSORT))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))) (icicle-special-candidate-regexp (or icicle-special-candidate-regexp ".+/$")) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt) (setq current-prefix-arg nil)) ; Reset so can use it in action function. (icicle-highlight-lighter) (message "Gathering files...") (icicle-bind-file-candidate-keys) (define-key minibuffer-local-completion-map "\C-c\C-d" 'icicle-cd-for-abs-files) (define-key minibuffer-local-must-match-map "\C-c\C-d" 'icicle-cd-for-abs-files)) nil ; Undo code (progn (icicle-unbind-file-candidate-keys) ; Last code (define-key minibuffer-local-completion-map "\C-c\C-d" nil) (define-key minibuffer-local-must-match-map "\C-c\C-d" nil))) (put 'icicle-find-file-absolute-other-window 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-find-file-absolute-other-window ; Bound to `C-u C-x 4 f' "Same as `icicle-find-file-absolute' except uses another window." ; Doc string (lambda (file) ; FREE here: CURRENT-PREFIX-ARG, THIS-COMMAND. (let ((r-o (and (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) current-prefix-arg)) (fil (icicle-transform-multi-completion file))) (if r-o (find-file-read-only-other-window fil 'WILDCARDS) (find-file-other-window fil 'WILDCARDS)))) prompt icicle-abs-file-candidates nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history default-directory nil (icicle-file-bindings ; Bindings ((prompt "File or dir (absolute): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-abs-file-candidates (mapcar icicle-full-cand-fn (directory-files default-directory 'FULL nil 'NOSORT))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))) (icicle-special-candidate-regexp (or icicle-special-candidate-regexp ".+/$")) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt) (setq current-prefix-arg nil)) ; Reset so can use it in action function. (icicle-highlight-lighter) (message "Gathering files...") (icicle-bind-file-candidate-keys) (define-key minibuffer-local-completion-map "\C-c\C-d" 'icicle-cd-for-abs-files) (define-key minibuffer-local-must-match-map "\C-c\C-d" 'icicle-cd-for-abs-files)) nil ; Undo code (progn (icicle-unbind-file-candidate-keys) ; Last code (define-key minibuffer-local-completion-map "\C-c\C-d" nil) (define-key minibuffer-local-must-match-map "\C-c\C-d" nil))) ;; This is a minibuffer command. It is in this file because it is used only here. ;; (defun icicle-cd-for-abs-files (dir) ; Bound to `C-c C-d' in minibuffer for abs file completion. "Change `default-directory' during `icicle-find-file-absolute'." (interactive ;; Should not need to bind `minibuffer-completion-predicate'. Emacs 23.2 bug, per Stefan. (let ((enable-recursive-minibuffers t) (minibuffer-completion-predicate minibuffer-completion-predicate)) (list (funcall (if (fboundp 'read-directory-name) #'read-directory-name #'read-file-name) "Change default directory: " default-directory (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)) (and (member cd-path '(nil ("./"))) (null (getenv "CDPATH"))))))) (cd dir) (let ((icicle-abs-file-candidates (mapcar (lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) (if icicle-multi-completing-p (icicle-make-file+date-candidate file) (list file))) (directory-files default-directory 'full nil 'nosort)))) (setq minibuffer-completion-table (car (icicle-mctize-all icicle-abs-file-candidates minibuffer-completion-predicate))))) (put 'icicle-find-file-no-search 'icicle-Completions-window-max-height 200) (icicle-define-file-command icicle-find-file-no-search "Visit a file or directory. \(Option `find-file-run-dired' determines whether you can actually visit a directory candidate that you choose.) For Emacs 23 and later, this is like command `icicle-find-file-of-content', but without the possibility of searching file contents. That is, completion candidates are just file names, not multi-completions - they contain no file-content part following `C-M-j'. If you use a prefix argument when you act on a completion candidate \(see below for the use of a prefix arg for the command itself.), then you visit the file or dir in read-only mode. This includes when you act on all candidates using \\\ `\\[icicle-all-candidates-action]': precede the `\\[icicle-all-candidates-action]' with a prefix arg. This does not apply to the final candidate chosen (using `RET' or `mouse-2') - a prefix arg has no effect for that. If you use a prefix arg for the command itself, this reverses the effect of using a prefix arg on individual candidates. That is, with a prefix arg for the command, files are visited in read-only mode by default and a prefix arg for an individual file visits it without read-only mode. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra absolute file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (file) ; FREE here: CURRENT-PREFIX-ARG, INIT-PREF-ARG, THIS-COMMAND. (let* ((r-o (if (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) (or (and init-pref-arg (not current-prefix-arg)) (and (not init-pref-arg) current-prefix-arg)) init-pref-arg)) (fn (if r-o 'find-file-read-only 'find-file))) (funcall fn file 'WILDCARDS))) (concat "File or directory" (and init-pref-arg " (read-only)") ": ") ; `read-file-name' args nil (if (and (eq major-mode 'dired-mode) (fboundp 'dired-get-file-for-visit)) ; Emacs 22+. (condition-case nil ; E.g. error because not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error nil)) default-directory) (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil nil (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (put 'icicle-find-file-no-search-other-window 'icicle-Completions-window-max-height 200) (icicle-define-file-command icicle-find-file-no-search-other-window "Same as `icicle-find-file-no-search', except uses another window." ; Doc string (lambda (file) ; FREE here: CURRENT-PREFIX-ARG, INIT-PREF-ARG, THIS-COMMAND. (let* ((r-o (if (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) (or (and init-pref-arg (not current-prefix-arg)) (and (not init-pref-arg) current-prefix-arg)) init-pref-arg)) (fn (if r-o 'find-file-read-only-other-window 'find-file-other-window))) (funcall fn file 'WILDCARDS))) (concat "File or directory" (and init-pref-arg " (read-only)") ": ") ; `read-file-name' args nil (if (and (eq major-mode 'dired-mode) (fboundp 'dired-get-file-for-visit)) ; Emacs 22+. (condition-case nil ; E.g. error because not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error nil)) default-directory) (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil nil (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (put 'icicle-find-file-read-only 'icicle-Completions-window-max-height 200) (defun icicle-find-file-read-only () ; Bound to `C-x C-r' in Icicle mode. "Visit a file or directory in read-only mode. This is `icicle-find-file-no-search' with prefix-arg behavior flipped. If you use a prefix arg when you act on a candidate file name then visit the file without read-only mode. If you use a prefix arg for the command itself, this reverses the effect of using a prefix arg on individual candidates. That is, with a prefix arg for the command, files are not visited in read-only mode by default and a prefix arg for an individual file visits it in read-only mode. During completion (`*' means this requires library `Bookmark+')\\: *You can use `C-x a +' or `C-x a -' to add or remove tags from the current-candidate file. You are prompted for the tags. *You can use `C-x m' to access file bookmarks (not just autofiles). You can use `C-c +' to create a new directory. You can use `\\[icicle-all-candidates-list-alt-action]' to open Dired on currently matching file names. You can use `\\[icicle-delete-candidate-object]' to delete a candidate file or (empty) dir." (interactive) (let ((current-prefix-arg (not current-prefix-arg))) (icicle-find-file-no-search))) (put 'icicle-find-file-read-only-other-window 'icicle-Completions-window-max-height 200) (defun icicle-find-file-read-only-other-window () ; Bound to `C-x 4 r' in Icicle mode. "Same as `icicle-find-file-read-only' except uses another window." (interactive) (let ((current-prefix-arg (not current-prefix-arg))) (icicle-find-file-no-search-other-window))) (when (> emacs-major-version 22) (put 'icicle-find-file-of-content 'icicle-Completions-window-max-height 200) (icicle-define-file-command icicle-find-file-of-content ; Not bound by default. "Visit a file or dir whose name and/or content matches. Candidate files and directories for completion are examined, and those whose names and/or contents match your multi-completion input are available to visit. \(Option `find-file-run-dired' determines whether you can actually visit a directory candidate that you choose.) If you use a prefix argument when you act on a completion candidate \(see below for the use of a prefix arg for the command itself.), then you visit the file or dir in read-only mode. This includes when you act on all candidates using \\\ `\\[icicle-all-candidates-action]': precede the `\\[icicle-all-candidates-action]' with a prefix arg. This does not apply to the final candidate chosen (using `RET' or `mouse-2') - a prefix arg has no effect for that. Completion candidates are two-part multi-completions, with the second part optional. If both parts are present they are separated by `icicle-list-join-string' (\"^G^J\", by default). The first part is matched as a regexp against a file or directory name. The second part is matched as a regexp against the file or directory content. Candidates that do not match are filtered out. When matching file content, Icicles just looks for a single match. Visiting the file does not move to that match or to any other match. Matching is used only to filter candidate files. However, if your input includes a content-matching part and it matches, that part is automatically added to the Isearch regexp history, `regexp-search-ring' whenever you hit `S-TAB' to complete. This means that when you visit the file you can immediately search for matches using `C-M-s' or `C-M-r'. Your minibuffer input can match a name or content, or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example: To match `foo' against file and dir names, use input `foo'. To match `bar' against file and dir contents, use input `C-M-j bar'. To match both names and content, use input `foo C-M-j bar'. Only the matching file and directory names are shown in buffer `*Completions*', and only the chosen name is returned. The actual content matches are unimportant anyway: content matching is used only to filter the candidates. If your input does not include a content-matching part then this command acts similar to `icicle-find-file-no-search' (but with a different use of the prefix argument). If your input includes a content-matching part then all files and directories matching the name part of your input (or all, if no name part) are visited. This creates buffers visiting each matching candidate. For a directory, a Dired buffer is used - that is the content that is searched. (Actually, this is determined by option `find-directory-functions'.) As you would expect, content matching can be costly in time, even though it can be quite helpful. Use name matching to narrow the set of files that must be visited to search their contents. When this command is finished, any unused buffers that were created for content matching are killed, if option `icicle-kill-visited-buffers-flag' is non-nil. But a prefix argument flips the behavior specified by that option. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles)" ; Doc string (lambda (file) ; Action function ;; Free vars here: CURRENT-PREFIX-ARG, INIT-PREF-ARG, THIS-COMMAND, NEW-BUFS--TO-KEEP. (let* ((r-o (and (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) current-prefix-arg)) (fn (if r-o 'find-file-read-only 'find-file))) (setq file (icicle-transform-multi-completion file)) (funcall fn file 'WILDCARDS) (when (and (file-readable-p file) (buffer-file-name)) (normal-mode)) ; Else in fundamental mode. ;; Add the visited buffer to those we will keep (not kill). ;; If FILE uses wildcards then there will be multiple such buffers. ;; For a directory, get the Dired buffer instead of using `get-file-buffer'. (let ((fil2 (if (string= "" (file-name-nondirectory file)) (directory-file-name file) file))) (dolist (fil (file-expand-wildcards fil2)) (when (setq fil (if (file-directory-p fil) (get-buffer (file-name-nondirectory fil)) (get-file-buffer fil))) (push fil new-bufs--to-keep)))))) prompt nil (if (eq major-mode 'dired-mode) ; `read-file-name' args (condition-case nil ; E.g. error because not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error nil)) default-directory) (confirm-nonexistent-file-or-buffer) nil nil (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) (prompt "File or directory: ") (icicle-compute-narrowing-regexp-p t) ; For progressive completion. (icicle-apropos-complete-match-fn 'icicle-file-of-content-apropos-complete-match) (icicle-last-apropos-complete-match-fn 'icicle-file-of-content-apropos-complete-match) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-transform-before-sort-p t) (existing-bufs (buffer-list)) (new-bufs--to-kill ()) (new-bufs--to-keep ()) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (progn (icicle-bind-file-candidate-keys) ; First code (put-text-property 0 1 'icicle-fancy-candidates t prompt) (icicle-highlight-lighter)) nil ; Undo code (progn (icicle-unbind-file-candidate-keys) ; Last code (when (or (and init-pref-arg (not icicle-kill-visited-buffers-flag)) (and (not init-pref-arg) icicle-kill-visited-buffers-flag)) (dolist (buf new-bufs--to-kill) (unless (memq buf new-bufs--to-keep) (with-current-buffer buf (restore-buffer-modified-p nil) ; Just visiting can sometimes modify the buffer (kill-buffer buf))))))) (put 'icicle-find-file-of-content-other-window 'icicle-Completions-window-max-height 200) (icicle-define-file-command icicle-find-file-of-content-other-window ; Not bound by default. "Visit a file or dir whose name and/or content matches, in another window. Same as `icicle-find-file-of-content' except it uses a different window." ; Doc string (lambda (file) ; Action function ;; Free vars here: CURRENT-PREFIX-ARG, INIT-PREF-ARG, THIS-COMMAND, NEW-BUFS--TO-KEEP. (let* ((r-o (and (memq this-command '(icicle-candidate-action icicle-mouse-candidate-action icicle-all-candidates-action)) current-prefix-arg)) (fn (if r-o 'find-file-read-only-other-window 'find-file-other-window))) (setq file (icicle-transform-multi-completion file)) (funcall fn file 'WILDCARDS) (when (and (file-readable-p file) (buffer-file-name)) (normal-mode)) ; Else in fundamental mode. ;; Add the visited buffer to those we will keep (not kill). ;; If FILE uses wildcards then there will be multiple such buffers. ;; For a directory, get the Dired buffer instead of using `get-file-buffer'. (let ((fil2 (if (string= "" (file-name-nondirectory file)) (directory-file-name file) file))) (dolist (fil (file-expand-wildcards fil2)) (when (setq fil (if (file-directory-p fil) (get-buffer (file-name-nondirectory fil)) (get-file-buffer fil))) (push fil new-bufs--to-keep)))))) prompt nil (if (eq major-mode 'dired-mode) ; `read-file-name' args (condition-case nil ; E.g. error because not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error nil)) default-directory) (confirm-nonexistent-file-or-buffer) nil nil (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) (prompt "File or directory: ") (icicle-compute-narrowing-regexp-p t) ; For progressive completion. (icicle-apropos-complete-match-fn 'icicle-file-of-content-apropos-complete-match) (icicle-last-apropos-complete-match-fn 'icicle-file-of-content-apropos-complete-match) (icicle-show-multi-completion-flag t) ; Override user setting. (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-transform-before-sort-p t) (existing-bufs (buffer-list)) (new-bufs--to-kill ()) (new-bufs--to-keep ()) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (progn (icicle-bind-file-candidate-keys) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter)) nil ; Undo code (progn (icicle-unbind-file-candidate-keys) ; Last code (when (or (and init-pref-arg (not icicle-kill-visited-buffers-flag)) (and (not init-pref-arg) icicle-kill-visited-buffers-flag)) (dolist (buf new-bufs--to-kill) (unless (memq buf new-bufs--to-keep) (with-current-buffer buf (restore-buffer-modified-p nil) ; Just visiting can sometimes modify the buffer (kill-buffer buf))))))) ;;; $$$$$$ Not used. ;;; (defun icicle-find-file-of-content-multi-complete (strg predicate completion-mode) ;;; "Completion function for `icicle-find-file-of-content'. ;;; Used as the value of `minibuffer-completion-table'." ;;; (lexical-let* ((file-pat (let ((icicle-list-use-nth-parts '(1))) ;;; (icicle-transform-multi-completion strg))) ;;; (content-pat (let ((icicle-list-use-nth-parts '(2))) ;;; (icicle-transform-multi-completion strg))) ;;; (content-pred (if (equal "" content-pat) ;;; predicate ;;; (lambda (filname) ;;; ;; Avoid the error raised by calling `find-file-noselect' ;;; ;; on a directory when `find-file-run-dired' is nil. ;;; (and (funcall `,predicate filname) ;;; (or find-file-run-dired (not (file-directory-p filname))) ;;; (not (run-hook-with-args-until-success ;;; 'icicle-find-file-of-content-skip-hook filname)) ;;; (let* ((buf (find-file-noselect filname)) ;;; (found (with-current-buffer buf ;;; (message "Matching file contents...") ;;; (save-excursion ;;; (goto-char (point-min)) ;;; (re-search-forward content-pat nil t))))) ;;; ;; Free vars here: EXISTING-BUFFERS, NEW-BUFS--TO-KILL ;;; (when (and (boundp 'existing-bufs) ;;; (boundp 'new-bufs--to-kill) ;;; (not (memq buf existing-bufs))) ;;; (add-to-list 'new-bufs--to-kill buf)) ;;; found)))))) ;;; (funcall (completion-table-in-turn #'icicle-completion--embedded-envvar-table ;;; #'completion-file-name-table) ;;; file-pat content-pred completion-mode))) (defun icicle-file-of-content-apropos-complete-match (input file-name) "Match function for progressive completion with `icicle-find-file-of-content'. Return non-nil if the current multi-completion INPUT matches FILE-NAME." (lexical-let* ((name-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion input))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion input)))) ;; $$$$$$$$ Should we do this? `find-file-noselect' does it. ;; (setq file-name (abbreviate-file-name (expand-file-name file-name))) (and (icicle-string-match-p name-pat file-name) ;; `icicle-narrow-regexp' is FREE here. It is bound in `icicle-narrow-candidates'. ;; Do this to ensure we visit only the `icicle-completion-candidates' already determined so far. (or (not icicle-narrow-regexp) (icicle-string-match-p icicle-narrow-regexp file-name)) (or find-file-run-dired (not (file-directory-p file-name))) (or (equal "" content-pat) (and (not (run-hook-with-args-until-success 'icicle-find-file-of-content-skip-hook file-name)) (let* ((dir-p (file-directory-p file-name)) (exists nil) (buf (if dir-p (find-file-noselect file-name) ;; Avoid letting `create-file-buffer' create multiple bufs for same file, ;; e.g., when using progressive completion: foo.el, foo.el<2>,... (or (setq exists (find-buffer-visiting file-name)) (create-file-buffer file-name)))) (found (with-current-buffer buf (message "Matching file contents...") (unless (or dir-p exists) ; EXISTS prevents inserting it more than once. ;; `mm-insert-file-contents' works too, but apparently is not needed. ;; $$$$$ (require 'mm-util) (mm-insert-file-contents file-name 'VISIT)) (insert-file-contents file-name 'VISIT)) (save-excursion (goto-char (point-min)) (re-search-forward content-pat nil t))))) ;; Free vars here: EXISTING-BUFFERS, NEW-BUFS--TO-KILL. (when (and (boundp 'existing-bufs) (boundp 'new-bufs--to-kill) (not (memq buf existing-bufs))) (add-to-list 'new-bufs--to-kill buf)) (when (and found ; Don't do it just because incrementally complete. (or (icicle-get-safe this-command 'icicle-apropos-completing-command) (icicle-get-safe this-command 'icicle-cycling-command) (memq this-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) (isearch-update-ring content-pat 'REGEXP)) found))))))) (defalias 'icicle-find-file (if (fboundp 'icicle-find-file-of-content) ; Emacs 23+ 'icicle-find-file-of-content 'icicle-find-file-no-search)) (defalias 'icicle-find-file-other-window (if (fboundp 'icicle-find-file-of-content) ; Emacs 23+ 'icicle-find-file-of-content-other-window 'icicle-find-file-no-search-other-window)) (put 'icicle-recent-file 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-recent-file ; Command name "Open a recently used file. With a prefix argument, you can choose also by date: Completion candidates include the last modification date. Note that completion here matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax. Remember that you can use \\`C-x .' to hide the common match portion of each candidate. That can be particularly helpful for files that are in a common directory. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) You can use any of the alternative-action keys, such as `\\[icicle-candidate-alt-action]', to remove a candidate file from the recent files list, `recentf-list'. \(The file itself is not deleted.) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra absolute file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (f) (find-file (icicle-transform-multi-completion f) 'WILDCARDS)) ; Action function prompt icicle-abs-file-candidates nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history (car recentf-list) nil (icicle-file-bindings ; Bindings ((prompt "Recent file (absolute): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-transform-before-sort-p t) (icicle-sort-comparer 'icicle-last-accessed-first-p) (icicle-abs-file-candidates (progn (unless (boundp 'recentf-list) (require 'recentf)) (when (fboundp 'recentf-mode) (recentf-mode 99)) (unless (consp recentf-list) (icicle-user-error "Recent-files list is empty")) (mapcar (lambda (file) ; FREE here: CURRENT-PREFIX-ARG. (if current-prefix-arg (icicle-make-file+date-candidate file) (list file))) recentf-list))) (icicle-candidate-alt-action-fn 'icicle-remove-from-recentf-candidate-action) (icicle-use-candidates-only-once-alt-p t) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") (mapcar #'icicle-transform-multi-completion files)))))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (icicle-highlight-lighter) (message "Gathering files...") (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (put 'icicle-recent-file-other-window 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-recent-file-other-window ; Command name "Same as `icicle-recent-file' except uses another window." ; Doc string (lambda (f) (find-file-other-window (icicle-transform-multi-completion f) 'WILDCARDS)) ; Action prompt icicle-abs-file-candidates nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history (car recentf-list) nil (icicle-file-bindings ; Bindings ((prompt "Recent file (absolute): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-transform-before-sort-p t) (icicle-sort-comparer 'icicle-last-accessed-first-p) (icicle-abs-file-candidates (progn (unless (boundp 'recentf-list) (require 'recentf)) (when (fboundp 'recentf-mode) (recentf-mode 99)) (unless (consp recentf-list) (icicle-user-error "Recent-files list is empty")) (mapcar (lambda (file) ; FREE here: CURRENT-PREFIX-ARG. (if current-prefix-arg (icicle-make-file+date-candidate file) (list file))) recentf-list))) (icicle-candidate-alt-action-fn 'icicle-remove-from-recentf-candidate-action) (icicle-use-candidates-only-once-alt-p t) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") (mapcar #'icicle-transform-multi-completion files)))))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (icicle-highlight-lighter) (message "Gathering files...") (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (icicle-define-command icicle-remove-file-from-recentf-list "Remove file from `recentf-list' - the list of recently used files." icicle-remove-from-recentf-candidate-action "Remove from recent files list, `recentf-list': " (mapcar #'list (progn (unless (boundp 'recentf-list) (require 'recentf)) (when (fboundp 'recentf-mode) (recentf-mode 99)) (unless (consp recentf-list) (icicle-user-error "Recent-files list is empty")) recentf-list)) nil (and (fboundp 'confirm-nonexistent-file-or-buffer) ; Emacs 23. (confirm-nonexistent-file-or-buffer)) nil 'file-name-history (car recentf-list) nil ((icicle-use-candidates-only-once-flag t))) (defun icicle-remove-from-recentf-candidate-action (file) "Action function for command `icicle-remove-file-from-recentf-list'." (setq recentf-list (delete file recentf-list)) (message "`%s' removed from `recentf-list'" (icicle-propertize file 'face 'icicle-msg-emphasis))) (defvar icicle-locate-file-action-fn nil "Action function used in `icicle-locate-file-1'.") (defvar icicle-locate-file-no-symlinks-p nil "Flag bound in `icicle-locate-file* for use by `icicle-files-within'.") (defvar icicle-locate-file-use-locate-p nil "Flag bound to non-nil in `icicle-locate(-other-window)'. Non-nil means `icicle-locate-file-1' uses external command `locate'.") (put 'icicle-locate-file 'icicle-Completions-window-max-height 200) (defun icicle-locate-file () "Visit a file within one or more directories or their subdirectories. A prefix argument determines the behavior, as follows: * None: The default (i.e., current) directory is used. * Plain (`C-u'): You are prompted for the directories, using multi-command `icicle-directory-list'. * Non-negative (>= 0): You are prompted for the directory. * Non-positive (<= 0): You can choose files also by date: A completion candidate includes the last modification date of the file. * Double plain (`C-u C-u'): You are prompted for the directories and candidates include last-modification dates. The absolute names of all files within a directory and all of its subdirectories are targets for completion. Regexp input is matched against all parts of the absolute name, not just the file-name part. Remember that you can use `C-x .' to hide the common match portion of each candidate. That can be particularly helpful for files that are in a common directory. You can use this command to find all files within your file system that match a regexp, but be aware that gathering and matching the file names will take some time. See also command `icicle-locate-file-no-symlinks', which does the same thing but without following symbolic links. If you use Emacs on a platform that has an external program `locate', then consider using `icicle-locate' instead of `icicle-locate-file'. Remember that you can save the set of files matching your input using \\\ `\\[icicle-candidate-set-save]' or \ `\\[icicle-candidate-set-save-persistently]'. You can then retrieve quickly them later using `\\[icicle-candidate-set-retrieve]' or \ `\\[icicle-candidate-set-retrieve-persistent]'. Note that completion here matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax. You cannot move up and down the file hierarchy the same way you can for ordinary (non-absolute) file-name completion. To change to a different directory, with its files as candidates, use \\`C-c C-d' from the minibuffer - it prompts you for the new directory. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c C-d - change the `default-directory' (a la `cd') C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) Directories in `icicle-ignored-directories' are ignored (skipped). In addition, these options control candidate matching and filtering: `icicle-file-extras' - Extra file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-require-match-flag' - See `icicle-require-match-flag' `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000)))" (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-action) (icicle-locate-file-no-symlinks-p nil)) (icicle-locate-file-1))) (put 'icicle-locate-file-other-window 'icicle-Completions-window-max-height 200) (defun icicle-locate-file-other-window () "Same as `icicle-locate-file' except uses another window. See also command `icicle-locate-file-no-symlinks-other-window', which does not follow symbolic links." (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-other-window-action) (icicle-locate-file-no-symlinks-p nil)) (icicle-locate-file-1))) (put 'icicle-locate 'icicle-Completions-window-max-height 200) (defun icicle-locate () "Run the external program `locate', then visit files. Unlike `icicle-locate-file' this is a wrapper for the external program `locate', which searches an index of files in your file system, which is normally created by external program `updatedb'. Because of this indexing, this command can be much faster than `icicle-locate-file'. `icicle-locate' first prompts for a search pattern for program `locate', which it passes to that program. The absolute file names that match this pattern are targets for Icicles completion. `icicle-locate' uses settings from library `locate.el' where appropriate. In particular, you can customize `locate-make-command-line' to use either regexp matching or file-name globbing. Here is an example of a setup to use regexp matching: \(setq locate-make-command-line (lambda (ss) (list locate-command \"--regex\" ss))) Which particular options the external program `locate' accepts, and how matching is performed, depend on your operating system and its implementation of that program. A prefix argument has the same meaning as for vanilla Emacs command `locate': prompt for a shell command to run instead of program `locate'. A prefix arg has the effect of flipping the value of user option `locate-prompt-for-command' for the duration of the command invocation. After you input the search pattern for program `locate', normal Icicles input pattern matching is available for completion. This is absolute file-name completion, so your input can match any parts of the name, including directory components. Remember that you can use \\`C-x .' to hide the common match portion of each candidate. That can be particularly helpful for files that are in a common directory. Remember that you can save the set of files matching your input using \\\ `\\[icicle-candidate-set-save]' or \ `\\[icicle-candidate-set-save-persistently]'. You can then retrieve quickly them later using `\\[icicle-candidate-set-retrieve]' or \ `\\[icicle-candidate-set-retrieve-persistent]'. Note that completion here matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These Icicles options control candidate matching and filtering: `icicle-file-extras' - Extra file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-require-match-flag' - See `icicle-require-match-flag' `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, you could temporarily set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000)))" (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-action) (icicle-locate-file-use-locate-p t)) (icicle-locate-file-1))) (put 'icicle-locate-other-window 'icicle-Completions-window-max-height 200) (defun icicle-locate-other-window () "Same as `icicle-locate' except uses another window." (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-other-window-action) (icicle-locate-file-use-locate-p t)) (icicle-locate-file-1))) (put 'icicle-locate-file-no-symlinks 'icicle-Completions-window-max-height 200) (defun icicle-locate-file-no-symlinks () "Same as `icicle-locate-file', except do not follow symlinks." (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-other-window-action) (icicle-locate-file-no-symlinks-p t)) (icicle-locate-file-1))) (put 'icicle-locate-file-no-symlinks-other-window 'icicle-Completions-window-max-height 200) (defun icicle-locate-file-no-symlinks-other-window () "Same as `icicle-locate-file-no-symlinks', except uses another window." (interactive) (let ((icicle-locate-file-action-fn 'icicle-locate-file-other-window-action) (icicle-locate-file-no-symlinks-p t)) (icicle-locate-file-1))) (defun icicle-locate-file-action (file) "Action function for `icicle-locate-file'." (find-file (icicle-transform-multi-completion file) 'WILDCARDS)) (defun icicle-locate-file-other-window-action (file) "Action function for `icicle-locate-file-other-window'." (find-file-other-window (icicle-transform-multi-completion file) 'WILDCARDS)) (icicle-define-command icicle-locate-file-1 "Helper for `icicle-locate(-file(-no-symlinks))(-other-window)'." ; Doc string ;; `icicle-locate-file-action-fn' and `icicle-locate-file-use-locate-p' are free here. (lambda (f) (funcall icicle-locate-file-action-fn f)) ; FREE here: ICICLE-LOCATE-FILE-ACTION-FN. prompt icicle-abs-file-candidates nil ; `completing-read' args (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history nil nil (icicle-file-bindings ; Bindings ((prompt "File (absolute): ") (dirs (and (not icicle-locate-file-use-locate-p) (cond ((and current-prefix-arg (consp current-prefix-arg)) (icicle-directory-list)) ((and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg))) (read-file-name "Locate under which directory: " nil default-directory nil)) (t default-directory)))) (icicle-multi-completing-p (and (not icicle-locate-file-use-locate-p) ;; FREE here: CURRENT-PREFIX-ARG. (or (<= (prefix-numeric-value current-prefix-arg) 0) (and current-prefix-arg (consp current-prefix-arg) (= (car current-prefix-arg) 16))))) (icicle-full-cand-fn (if icicle-multi-completing-p (lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) (icicle-make-file+date-candidate file)) (lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) (list file)))) (use-dialog-box nil) (icicle-candidate-properties-alist (and icicle-multi-completing-p '((1 (face icicle-candidate-part))))) (icicle-list-use-nth-parts (and icicle-multi-completing-p '(1))) (IGNORED--FOR-SIDE-EFFECT (progn (icicle-highlight-lighter) (if icicle-locate-file-use-locate-p (require 'locate) ; Hard-require: error if not there. (message "Gathering files %s (this could take a while)..." (if (or (symbolp dirs) (consp dirs)) (format "in `%s'" (icicle-propertize dirs 'face 'icicle-msg-emphasis)) (format "within `%s'" (icicle-propertize dirs 'face 'icicle-msg-emphasis))))))) (icicle-abs-file-candidates (mapcar (if icicle-multi-completing-p #'icicle-make-file+date-candidate #'list) (if icicle-locate-file-use-locate-p (let* ((locate-buffer-name " *Icicles Locate*") (temp-locate-buffer (get-buffer-create locate-buffer-name))) (unwind-protect (with-current-buffer temp-locate-buffer (let ((cands ())) (call-interactively #'locate) ; Gets `current-prefix-arg'. (dired-repeat-over-lines (count-lines (point-min) (point-max)) (lambda () (push (dired-get-filename nil t) cands))) ; FREE here: CANDS. (nreverse cands))) (kill-buffer temp-locate-buffer))) (if (not (or (symbolp dirs) (consp dirs))) (icicle-files-within (directory-files dirs 'full icicle-re-no-dot) nil icicle-locate-file-no-symlinks-p) (apply #'append (mapcar (if icicle-locate-file-no-symlinks-p (lambda (dir) (icicle-remove-if #'file-symlink-p (directory-files dir 'full icicle-re-no-dot 'NOSORT))) (lambda (dir) (directory-files dir 'full icicle-re-no-dot 'NOSORT))) dirs)))))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") (mapcar #'icicle-transform-multi-completion files)))))))) (progn ; First code (when icicle-multi-completing-p (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (icicle-bind-file-candidate-keys) (unless icicle-locate-file-use-locate-p (define-key minibuffer-local-completion-map "\C-c\C-d" 'icicle-cd-for-loc-files) (define-key minibuffer-local-must-match-map "\C-c\C-d" 'icicle-cd-for-loc-files))) nil ; Undo code (progn (icicle-unbind-file-candidate-keys) ; Last code (unless icicle-locate-file-use-locate-p (define-key minibuffer-local-completion-map "\C-c\C-d" nil) (define-key minibuffer-local-must-match-map "\C-c\C-d" nil))) 'NON-INTERACTIVE) ; This is not a real command. ;; This is a minibuffer command. It is in this file because it is used only here. ;; (defun icicle-cd-for-loc-files (dir &optional no-symlinks-p) ; Bound to `C-c C-d' in minibuf locate-*. "Change `default-directory' during `icicle-locate-file'. Optional arg NO-SYMLINKS-P non-nil means do not follow symbolic links." (interactive (save-selected-window ;; Should not need to bind `minibuffer-completion-predicate'. Emacs 23.2 bug, per Stefan. (let ((minibuffer-completion-predicate minibuffer-completion-predicate)) (list (funcall (if (fboundp 'read-directory-name) #'read-directory-name #'read-file-name) "Change default directory: " default-directory (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)) (and (member cd-path '(nil ("./"))) (null (getenv "CDPATH")))))))) (cd dir) (let ((icicle-abs-file-candidates (mapcar (lambda (file) ; FREE here: ICICLE-LIST-USE-NTH-PARTS. (if icicle-multi-completing-p (icicle-make-file+date-candidate file) (list file))) (icicle-files-within (directory-files dir 'full icicle-re-no-dot) nil no-symlinks-p)))) (setq minibuffer-completion-table (car (icicle-mctize-all icicle-abs-file-candidates minibuffer-completion-predicate))))) (put 'icicle-find-file-in-tags-table 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-find-file-in-tags-table ; Command name "Visit a file listed in a tags table. By default, the completion candidates are the file names listed in the current tags table, but you can substitute other candidates by retrieving a saved candidate set. The default candidates appear as they did in the `etags' command that created the tags table, which typically means without directory names. Completion here matches candidates as ordinary strings. It knows nothing of file names per se. In particular, you cannot use remote file-name syntax. If a candidate is an absolute file name then you can complete against any and all parts of the name (including directory components). `find-file' is called for the candidate(s) you choose, with the directory of the tags file as `default-directory'. Remember that you can use \\`C-x .' to hide the common match portion of each candidate. That can be particularly helpful for files that are in a common directory. With a prefix argument, you can choose also by date: Completion candidates include the last modification date. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, you could temporarily set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (ff) (visit-tags-table-buffer 'same) ; To pick up `default-directory' of TAGS table. (find-file (icicle-transform-multi-completion ff) 'WILDCARDS)) ; Action function prompt ; `completing-read' args (mapcar (if current-prefix-arg #'icicle-make-file+date-candidate #'list) (save-excursion (let ((enable-recursive-minibuffers t)) (visit-tags-table-buffer)) (tags-table-files))) nil (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history nil nil (icicle-file-bindings ; Bindings ((prompt "File (in tags table): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-special-candidate-regexp (or icicle-special-candidate-regexp ".+/$")) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (unless (require 'etags nil t) (error "`etags.el' is required")) (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (put 'icicle-find-file-in-tags-table-other-window 'icicle-Completions-window-max-height 200) (icicle-define-command icicle-find-file-in-tags-table-other-window ; Command name "Same as `icicle-find-file-in-tags-table', but uses another window." ; Doc string (lambda (ff) (visit-tags-table-buffer 'same) ; To pick up `default-directory' of TAGS table. (find-file (icicle-transform-multi-completion ff) 'WILDCARDS)) ; Action function prompt ; `completing-read' args (mapcar (if current-prefix-arg #'icicle-make-file+date-candidate #'list) (save-excursion (let ((enable-recursive-minibuffers t)) (visit-tags-table-buffer)) (tags-table-files))) nil (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs 23. nil 'file-name-history nil nil (icicle-file-bindings ; Bindings ((prompt "File (in tags table): ") (icicle-full-cand-fn `(lambda (file) (setq file (if (file-directory-p file) (file-name-as-directory file) file)) ,(if current-prefix-arg '(icicle-make-file+date-candidate file) '(list file)))) (icicle-special-candidate-regexp (or icicle-special-candidate-regexp ".+/$")) (icicle-candidate-properties-alist (and current-prefix-arg '((1 (face icicle-candidate-part))))) (icicle-multi-completing-p current-prefix-arg) (icicle-list-use-nth-parts (and current-prefix-arg '(1))) (icicle-all-candidates-list-alt-action-fn ; M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (progn ; First code (when current-prefix-arg (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (unless (require 'etags nil t) (error "`etags.el' is required")) (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (defun icicle-make-file+date-candidate (file) "Return a multi-completion candidate: FILE + last modification date." (list (list file (format-time-string "%Y %m %d %T " (nth 5 (file-attributes file)))))) (icicle-define-command icicle-string-list ; Command name "Choose a list of strings. The list is returned. You can choose from strings used previously or enter new strings. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one. If option `icicle-add-proxy-candidates-flag' is non-nil (toggle using `\\\\[icicle-toggle-proxy-candidates]'), you can also choose the \ name of a string variable - its value is returned. A string variable is a variable whose value or whose custom type is compatible with type `string'." ; Doc string (lambda (string) ; FREE here: ICICLE-PROXY-CANDIDATES, STRINGS. (let (temp) (push (if (setq temp (member string icicle-proxy-candidates)) (setq temp (symbol-value (intern (car temp)))) (setq temp string)) strings) (when (interactive-p) (message "Added string \"%s\"" (icicle-propertize temp 'face 'icicle-msg-emphasis)) (sit-for 1)))) prompt (mapcar #'list (icicle-remove-duplicates comp-strings)) ; `completing-read' args nil nil nil 'regexp-history nil nil ((icicle-proxy-candidates ; Bindings (and icicle-add-proxy-candidates-flag (let ((ipc ())) (mapatoms (lambda (cand) ; FREE here: IPC. (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand '(string color regexp)) (error nil))) (push (symbol-name cand) ipc)))) ipc))) (comp-strings (append regexp-history regexp-search-ring search-ring icicle-search-history kill-ring)) (strings ()) (icicle-use-candidates-only-once-flag t) (prompt (or icicle-prompt "Choose string (`RET' when done): "))) (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt)) ; First code nil ; Undo code (prog1 (setq strings (nreverse (delete "" strings))) ; Last code - return the list of strings. (setq icicle-proxy-candidates ()) (when (interactive-p) (message "Strings: %S" strings)))) (when (fboundp 'read-char-by-name) (defun icicle-zap-to-char (arg char &optional names) "Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. Go backward if ARG is negative. Raise an error if CHAR is not found. This is the same as `zap-to-char', except if you hit a completing key such as `TAB' then you can complete against the char names in NAMES. If you need to zap up to a completing-key char such as `TAB', escape the char with `C-q'. E.g., use `C-q TAB' instead of `TAB'. NAMES has the same form as `ucs-names'. Interactively, NAMES is determined by option `icicle-zap-to-char-candidates'. By default, it is the subset of `ucs-names' that corresponds to the characters that have been read previously (`icicle-read-char-history'), that is, the Unicode names you entered. If you want to complete against all Unicode chars, then customize option `icicle-zap-to-char-candidates'." (interactive (list (prefix-numeric-value current-prefix-arg) (icicle-read-char-maybe-completing "Zap to char: " (and (functionp icicle-zap-to-char-candidates) (funcall icicle-zap-to-char-candidates))))) (unless names (setq names (or (icicle-char-cands-from-charlist) (icicle-ucs-names)))) (with-no-warnings ; Avoid "obsolete" warning for `translation-table-for-input'. (when (char-table-p translation-table-for-input) ; Free var here. (setq char (or (aref translation-table-for-input char) char)))) (kill-region (point) (progn (search-forward (string char) nil nil arg) ;; (goto-char (if (> arg 0) ;; (max (point-min) (1- (point))) ;; (min (point-max) (1+ (point))))) ; (vanilla) (point))))) (icicle-define-command icicle-sexp-list ; Command name "Choose a list of sexps. The list is returned. The list entries are Lisp objects, not strings (unless you use \"...\"). You can choose from sexps entered previously or enter new sexps. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one." ; Doc string (lambda (sexp) ; FREE here: SEXPS. (push sexp sexps) (when (interactive-p) (message "Added sexp `%s'" (icicle-propertize sexp 'face 'icicle-msg-emphasis)) (sit-for 1))) prompt ; `completing-read' args (mapcar #'list (icicle-remove-duplicates (symbol-value history))) nil nil nil history nil nil ((sexps ()) ; Bindings (icicle-use-candidates-only-once-flag t) (prompt (or icicle-prompt "Choose sexp (`RET' when done): ")) (history (or icicle-hist-var 'read-expression-history))) nil nil ; First code, undo code (prog1 (setq sexps (nreverse (delete "" sexps)) ; Last code - return the list of sexps. sexps (mapcar (lambda (sx) (car (read-from-string sx))) sexps)) (when (interactive-p) (message "Sexps: %S" sexps)))) (defalias 'icicle-regexp-list 'icicle-keyword-list) (icicle-define-command icicle-keyword-list ; Command name "Choose a list of keywords. The list of keywords (strings) is returned. Each keyword is a regexp. The regexps are OR'd, and the resulting regexp is usable for `icicle-search'. You can choose from keywords entered previously or enter new keywords. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one." ; Doc string (lambda (name) ; FREE here: KEYWORDS. (push name keywords) (when (interactive-p) (message "Added keyword `%s'" (icicle-propertize name 'face 'icicle-msg-emphasis)) (sit-for 1))) prompt (mapcar #'list (icicle-remove-duplicates regexp-history)) ; `completing-read' args nil nil nil 'regexp-history nil nil ((keywords ()) ; Bindings (icicle-use-candidates-only-once-flag t) (prompt (or icicle-prompt "Choose keyword (regexp) (`RET' when done): "))) nil nil ; First code, undo code (prog1 (setq keywords (nreverse (delete "" keywords))) ; Last code - return the list of keywords. (when (interactive-p) (message "Keywords (regexps): %S" keywords)))) (icicle-define-command icicle-face-list ; Command name "Choose a list of face names. The list of names (strings) is returned. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one." ; Doc string (lambda (name) ; FREE here: FACE-NAMES. (let ((temp (icicle-transform-multi-completion name))) (push temp face-names) (when (interactive-p) (message "Added face `%s'" (icicle-propertize temp 'face 'icicle-msg-emphasis)) (sit-for 1)))) prompt (mapcar #'icicle-make-face-candidate (face-list)) ; `completing-read' args nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) nil nil ((prompt (or icicle-prompt ; Allow override. "Choose face (`RET' when done): ")) ; Bindings (icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-use-candidates-only-once-flag t) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "face"))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "face"))) (face-names ())) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code nil ; Undo code (prog1 (setq face-names (nreverse (delete "" face-names))) ; Last code - return list of faces (when (interactive-p) (message "Faces: %S" face-names)))) (icicle-define-command icicle-buffer-list ; Command name "Choose a list of buffer names. With a positive prefix arg, only buffers visiting files or directories \(Dired) are candidates. With a negative prefix arg, only buffers associated with the selected frame are candidates. Use multi-command action keys (e.g. \\`C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one. You can use `\\[icicle-delete-candidate-object]' during completion to kill a candidate buffer. The list of names (strings) is returned. These options, when non-nil, control candidate matching and filtering: `icicle-buffer-ignore-space-prefix-flag' - Ignore space-prefix names `icicle-buffer-extras' - Extra buffers to display `icicle-buffer-match-regexp' - Regexp that buffers must match `icicle-buffer-no-match-regexp' - Regexp buffers must not match `icicle-buffer-predicate' - Predicate buffer names satisfy `icicle-buffer-sort' - Sort function for candidates Note: The prefix arg is tested, even when this is called noninteractively. Lisp code can bind `current-prefix-arg' to control the behavior." ; Doc string (lambda (name) ; Action function. FREE here: BUF-NAMES. (push name buf-names) (when (interactive-p) (message "Added buffer name `%s'" (icicle-propertize name 'face 'icicle-msg-emphasis)) (sit-for 1))) prompt (mapcar (lambda (buf) (list (buffer-name buf))) ; `completing-read' args (if current-prefix-arg (if (wholenump (prefix-numeric-value current-prefix-arg)) (icicle-remove-if-not (lambda (bf) (or (buffer-file-name bf) (with-current-buffer bf (eq major-mode 'dired-mode)))) (buffer-list)) (cdr (assq 'buffer-list (frame-parameters)))) (buffer-list))) (and icompletep icicle-buffer-predicate (lambda (buf) (funcall icicle-buffer-predicate (car buf)))) ; FREE here: ICICLE-BUFFER-PREDICATE. (and (fboundp 'confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)) ;Emacs23. nil 'buffer-name-history nil nil ((buf-names ()) ; Bindings (prompt (or icicle-prompt ; Allow override. "Choose buffer name (`RET' when done): ")) (completion-ignore-case (or (and (boundp 'read-buffer-completion-ignore-case) read-buffer-completion-ignore-case) completion-ignore-case)) (icicle-must-match-regexp icicle-buffer-match-regexp) (icicle-must-not-match-regexp icicle-buffer-no-match-regexp) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) icicle-buffer-predicate)) (icicle-require-match-flag icicle-buffer-require-match-flag) (icicle-extra-candidates icicle-buffer-extras) (icicle-delete-candidate-object 'icicle-kill-a-buffer) ; `S-delete' kills current buf (icicle-transform-function 'icicle-remove-dups-if-extras) (icicle-sort-comparer (or icicle-buffer-sort icicle-sort-comparer)) (icicle-sort-orders-alist (append (list '("by last access") ; Renamed from "turned OFF'. '("*...* last" . icicle-buffer-sort-*...*-last) '("by buffer size" . icicle-buffer-smaller-p) '("by major mode name" . icicle-major-mode-name-less-p) (and (fboundp 'icicle-mode-line-name-less-p) '("by mode-line mode name" . icicle-mode-line-name-less-p)) '("by file/process name" . icicle-buffer-file/process-name-less-p)) (delete '("turned OFF") icicle-sort-orders-alist))) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-all-candidates-list-alt-action-fn ; M-|' (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-use-candidates-only-once-flag t)) nil nil ; First code, undo code (prog1 (setq buf-names (nreverse (delete "" buf-names))) ; Last code - return the list of buffers (when (interactive-p) (message "Buffer names: %S" buf-names)))) (icicle-define-command icicle-bookmark-list ; Command name "Choose a list of bookmarks. This is an alist whose entries are bookmark entries. The entries have the bookmark names as their key. You can use the return value as a bookmark alist or as a COLLECTION argument for `completing-read'. With a prefix argument, this is a list of the bookmark names, not an alist of the full bookmarks. If `icicle-show-multi-completion-flag' is non-nil, then completion candidates are multi-completions, with the first part being the bookmark name and the second part being the bookmark's file or buffer name. Otherwise, the candidates are just the bookmark names. If you also use library Bookmark+ (`bookmark+.el') then\\: * Candidates displayed in `*Completions*' are color-coded by type. * You can sort the candidates (e.g. `C-,') in many more ways. * When you ask for help on a candidate (e.g. `C-M-return'), detailed information about the bookmark is shown in `*Help*'. If you use a prefix arg for this (e.g. `C-u C-M-return') then the full, internal form of the bookmark is shown. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one. You can use `\\[icicle-delete-candidate-object]' during completion to delete a candidate bookmark. The list of bookmark names (strings) is returned. Non-interactively: * If `icicle-bookmark-list-names-only-p' is non-nil, then return a list of the bookmark names (just as if a prefix arg were used). * If `icicle-bookmark-types' is non-nil, and you use Bookmark+, then only bookmarks of those types are used. You can thus bind this variable around the function call to specialize the behavior to only certain types." ; Doc string (lambda (name) ; FREE here: CHOSEN-BMKS, NAMES-ONLY-P. (let ((temp (icicle-transform-multi-completion name))) (push (if names-only-p (icicle-unpropertize-completion temp) (bookmark-get-bookmark (icicle-unpropertize-completion temp))) chosen-bmks) (when (interactive-p) (message "Added bookmark `%s'" (icicle-propertize temp 'face 'icicle-msg-emphasis)) (sit-for 1)))) prompt icicle-candidates-alist nil (not icicle-show-multi-completion-flag) ; `completing-read' args nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) (and (boundp 'bookmark-current-bookmark) bookmark-current-bookmark) nil ((prompt (or icicle-prompt ; Allow override. "Choose bookmark (`RET' when done): ")) (enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on disk... (completion-ignore-case bookmark-completion-ignore-case) (icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) () (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) (types icicle-bookmark-types) (names-only-p (if (interactive-p) current-prefix-arg icicle-bookmark-list-names-only-p)) (icicle-candidates-alist ()) (chosen-bmks ()) (icicle-unpropertize-completion-result-flag nil) ; Remove only Icicles internal text properties. (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p)) (and (featurep 'bookmark+) (append '(("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p)) (and (icicle-set-intersection types '("info" "region")) '(("by Info location" (bmkp-info-cp) icicle-alpha-p))) (and (icicle-set-intersection types '("gnus" "region")) '(("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p))) (and (icicle-set-intersection types '("url" "region")) '(("by URL" (bmkp-url-cp) icicle-alpha-p))) (and (icicle-set-difference types '("bookmark-list" "desktop" "gnus" "info" "man" "url")) '(("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) (and (icicle-set-difference types '("bookmark-list" "desktop" "dired" "non-file")) '(("by file name" (bmkp-file-alpha-cp) icicle-alpha-p))) (and (icicle-set-intersection types '("local-file" "file" "dired" "region")) '(("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p))) (and (not (equal types '("desktop"))) '(("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p))) (and (get-buffer "*Bookmark List*") '(("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p))))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn ;; FREE here: CURRENT-PREFIX-ARG, ICICLE-GET-ALIST-CANDIDATE-FUNCTION, ICICLE-SHOW-MULTI-COMPLETION-FLAG. (lambda (cand) (when (and (featurep 'bookmark+) icicle-show-multi-completion-flag) (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if (featurep 'bookmark+) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand)) (icicle-msg-maybe-in-minibuffer (icicle-bookmark-help-string cand)))))) (progn ; First code (message "Gathering bookmarks...") (bookmark-maybe-load-default-file) ; Load bookmarks, define `bookmark-alist'. (if (not (featurep 'bookmark+)) (mapcar (lambda (cand) (list (icicle-candidate-short-help (icicle-bookmark-help-string cand) (icicle-bookmark-propertize-candidate cand)))) bookmark-alist) (unless types (setq types '(all))) (dolist (type types) (setq icicle-candidates-alist (nconc icicle-candidates-alist (mapcar #'icicle-make-bookmark-candidate (bmkp-sort-omit (if (eq type 'all) bookmark-alist (funcall (intern (format "bmkp-%s-alist-only" type))))))))))) (icicle-bookmark-cleanup-on-quit) ; Undo code (prog1 (setq chosen-bmks (nreverse (delete "" chosen-bmks))) ; Last code - return the list. (icicle-bookmark-cleanup) (when (interactive-p) (message "Bookmarks: %S" (if names-only-p chosen-bmks (mapcar #'car chosen-bmks)))))) ;; $$$$$ (icicle-define-command icicle-file-list ; Command name ;; "Choose a list of file names. ;; You can use \\\ ;;`\\[icicle-delete-candidate-object]' during completion to delete a candidate file. ;; The list of names (strings) is returned." ; Doc string ;; (lambda (name) (push name file-names)) ; Function to perform the action ;; "Choose file (`RET' when done): " ; `completing-read' args ;; (mapcar #'list (directory-files default-directory nil icicle-re-no-dot)) ;; nil nil nil 'file-name-history nil nil ;; ((file-names ()) ; Additional bindings ;; (icicle-delete-candidate-object 'icicle-delete-file-or-directory) ; `S-delete' deletes file. ;; (icicle-use-candidates-only-once-flag t)) ;; nil nil ; First code, undo code ;; (prog1 (setq file-names (nreverse (delete "" file-names))) ; Last code - return files list ;; (when (interactive-p) (message "Files: %S" file-names)))) (icicle-define-file-command icicle-file-list ; Command name "Choose a list of file and directory names (strings), and return it. Use multi-command action keys (e.g. \\`C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one. You can navigate the directory tree, picking files and directories anywhere in the tree. Remember too that you can use `\\[icicle-all-candidates-action]' to gather all of the file names matching your current input. For example, apropos-completing with input `foo.*bar' and hitting `\\[icicle-all-candidates-action]' adds all file names matching that regexp. You can use either `RET' or `C-g' to finish adding file names to the list. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra file names to display `icicle-file-match-regexp' - Regexp that file names must match `icicle-file-no-match-regexp' - Regexp file names must not match `icicle-file-predicate' - Predicate file names must satisfy `icicle-file-sort' - Sort function for candidates For example, to show only names of files larger than 5000 bytes, set `icicle-file-predicate' to: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (name) ; FREE here: FILE-NAMES. (push name file-names) (when (interactive-p) (message "Added file name `%s'" (icicle-propertize name 'face 'icicle-msg-emphasis)) (sit-for 1))) prompt nil nil t nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((prompt (or icicle-prompt ; Allow override. "Choose file (`RET' when done): ")) (file-names ()) (icicle-comp-base-is-default-dir-p t) ;; $$$$$ (icicle-dir-candidate-can-exit-p (not current-prefix-arg)) )) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (prog1 (setq file-names (nreverse (delete "" file-names))) ; Last code - return list of files (icicle-unbind-file-candidate-keys) (when (interactive-p) (message "Files: %S" file-names)))) (icicle-define-file-command icicle-directory-list ; Command name "Choose a list of directory names (strings), and return it. You must include a slash (`/') at the end of each directory name. Use multi-command action keys (e.g. `C-RET', `C-mouse-2') to choose, and a final-choice key (e.g. `RET', `mouse-2') to choose the last one. You can navigate the directory tree, picking directories anywhere in the tree. If `icicle-add-proxy-candidates-flag' is non-nil, then certain Emacs variables whose values are lists of directories are available as proxy candidates. This includes variables such as `load-path' and `exec-path'. You can toggle `icicle-add-proxy-candidates-flag' using \\\ `\\[icicle-toggle-proxy-candidates]'in the minibuffer. When you choose a proxy candidate all of its directories are added to the result list. Non-directory elements in the variable value are ignored - only string elements are retained. And none of the string elements are checked to see whether they actually correspond to an existing directory. Keep in mind that only those proxy candidates that match your current input are available. In particular, if `insert-default-directory' is non-nil then you will want to use `\\[icicle-erase-minibuffer-or-history-element]' to remove the default directory from the minibuffer when you want to match proxy candidates. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles) These options, when non-nil, control candidate matching and filtering: `icicle-file-extras' - Extra directory names to display `icicle-file-match-regexp' - Regexp directory names must match `icicle-file-no-match-regexp' - Regexp dir names must not match `icicle-file-predicate' - Predicate the dir names must satisfy `icicle-file-sort' - Sort function for candidates Option `icicle-file-require-match-flag' can be used to override option `icicle-require-match-flag'. Option `icicle-files-ido-like' non-nil gives this command a more Ido-like behavior." ; Doc string (lambda (name) ; FREE here: DIR-NAMES. (if (member (file-name-nondirectory name) ; Do this because choosing candidate adds default dir to it. keep-proxy-cands) (setq name (symbol-value (intern (file-name-nondirectory name))) dir-names (append (icicle-remove-if-not #'stringp name) dir-names)) (push name dir-names)) (when (interactive-p) (message "Added directory name `%s'" (icicle-propertize name 'face 'icicle-msg-emphasis)) (sit-for 1))) prompt nil nil t nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((prompt (or icicle-prompt ; Allow override. "Choose directory (`RET' when done): ")) (dir-names ()) (icicle-exclude-default-proxies t) ; Exclude non-dir file-name proxy candidates. (icicle-proxy-candidates ; Remove vars whose vals are not lists or are lists with no strings. (let ((ipc ())) (when icicle-add-proxy-candidates-flag (setq ipc (mapcar #'symbol-name (icicle-remove-if-not (lambda (symb) (and (boundp symb) (consp (symbol-value symb)) (let ((dirs (symbol-value symb))) (catch 'icicle-directory-list (dolist (dir dirs) (when (stringp dir) (throw 'icicle-directory-list t))) nil)))) icicle-path-variables)))) ipc)) (keep-proxy-cands icicle-proxy-candidates) ; Needed after `read-file-name' resets to nil. (user-file-pred icicle-file-predicate) (icicle-file-predicate (if user-file-pred (lambda (f) ; FREE here: USER-FILE-PRED. (and (file-directory-p f) (funcall user-file-pred f))) #'file-directory-p)) (icicle-comp-base-is-default-dir-p t) ;; $$$$$ (icicle-dir-candidate-can-exit-p (not current-prefix-arg)) )) (progn (icicle-bind-file-candidate-keys) ; First code (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt))) nil ; Undo code (prog1 (setq dir-names (nreverse (delete "" dir-names))) ; Last code - return the list of dirs (icicle-unbind-file-candidate-keys) (setq icicle-proxy-candidates ()) (when (interactive-p) (message "Directories: %S" dir-names)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-cmd1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-cmd1.el ends here icicles-2013.04.23.23400/icicles-cmd2.el000066400000000000000000015254671214003072700167700ustar00rootroot00000000000000;;; icicles-cmd2.el --- Top-level commands for Icicles ;; ;; Filename: icicles-cmd2.el ;; Description: Top-level commands for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Thu May 21 13:31:43 2009 (-0700) ;; Version: 22.0 ;; Last-Updated: Fri Apr 19 10:29:01 2013 (-0700) ;; By: dradams ;; Update #: 6424 ;; URL: http://www.emacswiki.org/icicles-cmd2.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `apropos', `apropos-fn+var', `avoid', `cl', `cus-edit', ;; `cus-face', `cus-load', `cus-start', `doremi', `easymenu', ;; `el-swank-fuzzy', `ffap', `ffap-', `frame-cmds', `frame-fns', ;; `fuzzy', `fuzzy-match', `hexrgb', `icicles-cmd1', `icicles-fn', ;; `icicles-mcmd', `icicles-opt', `icicles-var', `image-dired', ;; `kmacro', `levenshtein', `misc-fns', `mouse3', `mwheel', ;; `naked', `regexp-opt', `ring', `ring+', `second-sel', `strings', ;; `thingatpt', `thingatpt+', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; top-level commands (and a few non-interactive functions used in ;; those commands). This is a continuation of library ;; `icicles-cmd1.el' (a single file for all top-level commands would ;; be too large to upload to Emacs Wiki). ;; ;; For commands to be used mainly in the minibuffer or buffer ;; `*Completions*', see `icicles-mcmd.el'. ;; ;; For Icicles documentation, see `icicles-doc1.el' and ;; `icicles-doc2.el'. ;; ;; If you use the byte-compiled version of this library, ;; `icicles-cmd2.elc', in Emacs 23, then it must be byte-compiled ;; using Emacs 23. Otherwise, Icicles key completion (and perhaps ;; other things?) will not work correctly. ;; ;; Macros defined here: ;; ;; `icicle-search-modes', `icicle-with-comments-hidden'. ;; ;; Widgets defined here: ;; ;; `icicle-color', `icicle-ORIG-color'. ;; ;; Commands defined here - (+) means a multi-command: ;; ;; (+)`a', (+)`any', (+)`buffer', (+)`file', (+)`icicle-anything', ;; (+)`icicle-apply', (+)`icicle-bookmark-a-file', ;; (+)`icicle-choose-faces', (+)`icicle-choose-invisible-faces', ;; (+)`icicle-choose-visible-faces', (+)`icicle-comint-command', ;; (+)`icicle-comint-search', (+)`icicle-compilation-search', ;; (+)`icicle-complete-keys', `icicle-complete-thesaurus-entry', ;; (+)`icicle-doc', (+)`icicle-exchange-point-and-mark', ;; (+)`icicle-find-file-all-tags', ;; (+)`icicle-find-file-all-tags-other-window', ;; (+)`icicle-find-file-all-tags-regexp', ;; (+)`icicle-find-file-all-tags-regexp-other-window', ;; (+)`icicle-find-file-handle-bookmark', ;; (+)`icicle-find-file-handle-bookmark-other-window', ;; (+)`icicle-find-file-some-tags', ;; (+)`icicle-find-file-some-tags-other-window', ;; (+)`icicle-find-file-some-tags-regexp', ;; (+)`icicle-find-file-some-tags-regexp-other-window', ;; (+)`icicle-find-file-tagged', ;; (+)`icicle-find-file-tagged-other-window', (+)`icicle-font', ;; (+)`icicle-frame-bg', (+)`icicle-frame-fg', (+)`icicle-fundoc', ;; (+)`icicle-goto-global-marker', ;; (+)`icicle-goto-global-marker-or-pop-global-mark', ;; (+)`icicle-goto-marker', ;; (+)`icicle-goto-marker-or-set-mark-command', ;; (+)`icicle-hide-faces', (+)`icicle-hide-only-faces', ;; `icicle-hide/show-comments', (+)`icicle-imenu', ;; (+)`icicle-imenu-command', (+)`icicle-imenu-command-full', ;; (+)`icicle-imenu-face-full', (+)`icicle-imenu-face-full', ;; (+)`icicle-imenu-full', (+)`icicle-imenu-key-explicit-map', ;; (+)`icicle-imenu-key-explicit-map-full', ;; (+)`icicle-imenu-key-implicit-map', ;; (+)`icicle-imenu-key-implicit-map-full', ;; (+)`icicle-imenu-macro', (+)`icicle-imenu-macro-full', ;; (+)`icicle-imenu-non-interactive-function', ;; (+)`icicle-imenu-non-interactive-function-full', ;; (+)`icicle-imenu-user-option', ;; (+)`icicle-imenu-user-option-full', (+)`icicle-imenu-variable', ;; (+)`icicle-imenu-variable-full', `icicle-ido-like-mode', ;; (+)`icicle-Info-goto-node', ;; (+)`icicle-Info-goto-node-no-search', ;; (+)`icicle-Info-goto-node-of-content', (+)`icicle-Info-index', ;; (+)`icicle-Info-index-20', (+)`icicle-Info-menu', ;; (+)`icicle-Info-menu-cmd', `icicle-Info-virtual-book', ;; (+)`icicle-insert-thesaurus-entry', (+)`icicle-map', ;; `icicle-next-visible-thing', `icicle-non-whitespace-string-p', ;; (+)`icicle-object-action', (+)`icicle-occur', ;; (+)`icicle-pick-color-by-name', (+)`icicle-plist', ;; `icicle-previous-visible-thing', `icicle-read-color', ;; `icicle-read-color-wysiwyg', `icicle-save-string-to-variable', ;; (+)`icicle-search', (+)`icicle-search-all-tags-bookmark', ;; (+)`icicle-search-all-tags-regexp-bookmark', ;; (+)`icicle-search-autofile-bookmark', ;; (+)`icicle-search-autonamed-bookmark', ;; (+)`icicle-search-bookmark', ;; (+)`icicle-search-bookmark-list-bookmark', ;; `icicle-search-bookmark-list-marked', ;; (+)`icicle-search-bookmarks-together', ;; (+)`icicle-search-buffer', (+)`icicle-search-buff-menu-marked', ;; (+)`icicle-search-char-property', (+)`icicle-search-defs', ;; (+)`icicle-search-defs-full', (+)`icicle-search-dired-bookmark', ;; (+)`icicle-search-dired-marked-recursive', ;; (+)`icicle-search-file', (+)`icicle-search-file-bookmark', ;; (+)`icicle-search-generic', (+)`icicle-search-gnus-bookmark', ;; `icicle-search-highlight-cleanup', ;; (+)`icicle-search-ibuffer-marked', ;; (+)`icicle-search-info-bookmark', (+)`icicle-search-keywords', ;; (+)`icicle-search-lines', ;; (+)`icicle-search-local-file-bookmark', ;; (+)`icicle-search-man-bookmark', ;; (+)`icicle-search-non-file-bookmark', ;; (+)`icicle-search-overlay-property', ;; (+)`icicle-search-paragraphs', (+)`icicle-search-pages', ;; (+)`icicle-search-region-bookmark', ;; (+)`icicle-search-remote-file-bookmark', ;; (+)`icicle-search-sentences', ;; (+)`icicle-search-some-tags-bookmark', ;; (+)`icicle-search-some-tags-regexp-bookmark', ;; (+)`icicle-search-specific-buffers-bookmark', ;; (+)`icicle-search-specific-files-bookmark', ;; (+)`icicle-search-temporary-bookmark', ;; (+)`icicle-search-text-property', (+)`icicle-search-thing', ;; (+)`icicle-search-this-buffer-bookmark', ;; (+)`icicle-search-url-bookmark', ;; `icicle-search-w-isearch-string', ;; (+)`icicle-search-w3m-bookmark', (+)`icicle-search-word', ;; (+)`icicle-search-xml-element', ;; (+)`icicle-search-xml-element-text-node', ;; (+)`icicle-select-frame', `icicle-select-frame-by-name', ;; (+)`icicle-select-text-at-point', ;; `icicle-set-S-TAB-methods-for-command', ;; `icicle-set-TAB-methods-for-command', (+)`icicle-show-faces', ;; (+)`icicle-show-only-faces', (+)`icicle-synonyms', ;; (+)`icicle-tag-a-file', (+)`icicle-tags-search', ;; (+)`icicle-untag-a-file', (+)`icicle-vardoc', ;; (+)`icicle-where-is', (+)`synonyms', (+)`what-which-how'. ;; ;; Non-interactive functions defined here: ;; ;; `icicle-add-key+cmd', `icicle-anything-candidate-value', ;; `icicle-apply-action', `icicle-apply-list-action', ;; `icicle-char-properties-in-buffer', ;; `icicle-char-properties-in-buffers', ;; `icicle-choose-anything-candidate', ;; `icicle-choose-candidate-of-type', ;; `icicle-cmd2-after-load-bookmark+', ;; `icicle-cmd2-after-load-hexrgb', ;; `icicle-cmd2-after-load-highlight', ;; `icicle-cmd2-after-load-palette', ;; `icicle-cmd2-after-load-synonyms', ;; `icicle-cmd2-after-load-wid-edit+', `icicle-color-blue-lessp', ;; `icicle-color-completion-setup', ;; `icicle-color-distance-hsv-lessp', ;; `icicle-color-distance-rgb-lessp', `icicle-color-green-lessp', ;; `icicle-color-help', `icicle-color-hsv-lessp', ;; `icicle-color-hue-lessp', `icicle-color-red-lessp', ;; `icicle-color-saturation-lessp', `icicle-color-value-lessp', ;; `icicle-comint-hook-fn', ;; `icicle-comint-search-get-final-choice', ;; `icicle-comint-search-get-minibuffer-input', ;; `icicle-comint-search-send-input', `icicle-compilation-hook-fn', ;; `icicle-compilation-search-in-context-fn', ;; `icicle-complete-keys-1', `icicle-complete-keys-action', ;; `icicle-defined-thing-p', `icicle-doc-action', ;; `icicle-fn-doc-minus-sig', `icicle-font-w-orig-size', ;; `icicle-get-anything-actions-for-type', ;; `icicle-get-anything-cached-candidates', ;; `icicle-get-anything-candidates', ;; `icicle-get-anything-candidates-of-type', ;; `icicle-get-anything-default-actions-for-type', ;; `icicle-get-anything-input-delay', ;; `icicle-get-anything-req-pat-chars', ;; `icicle-get-anything-types', `icicle-goto-marker-1', ;; `icicle-goto-marker-1-action', `icicle-group-regexp', ;; `icicle-imenu-command-p', `icicle-imenu-in-buffer-p', ;; `icicle-imenu-non-interactive-function-p', ;; `icicle-Info-apropos-complete-match', ;; `icicle-Info-build-node-completions', ;; `icicle-Info-build-node-completions-1', ;; `icicle-Info-content-match', `icicle-Info-goto-node-1', ;; `icicle-Info-goto-node-action', `icicle-Info-index-action', ;; `icicle-Info-multi-read-node-name', ;; `icicle-Info-read-node-name', ;; `icicle-Info-read-node-of-content', ;; `icicle-insert-thesaurus-entry-cand-fn', ;; `icicle-invisible-face-p', `icicle-invisible-p', ;; `icicle-keys+cmds-w-prefix', `icicle-make-color-candidate', ;; `icicle-marker+text', `icicle-markers', ;; `icicle-next-single-char-property-change', ;; `icicle-next-visible-thing-1', `icicle-next-visible-thing-2', ;; `icicle-next-visible-thing-and-bounds', ;; `icicle-ORIG-read-color', `icicle-ORIG-widget-color-complete', ;; `icicle-pick-color-by-name-action', ;; `icicle-previous-single-char-property-change', ;; `icicle-read-args-for-set-completion-methods', ;; `icicle-read-var-value-satisfying', ;; `icicle-region-or-buffer-limits', `icicle-search-action', ;; `icicle-search-action-1', `icicle-search-bookmark-action', ;; `icicle-search-char-property-scan', ;; `icicle-search-char-prop-matches-p', ;; `icicle-search-choose-buffers', `icicle-search-cleanup', ;; `icicle-search-define-candidates', ;; `icicle-search-define-candidates-1', ;; `icicle-search-file-found-p', `icicle-search-final-act', ;; `icicle-search-help', ;; `icicle-search-highlight-all-input-matches', ;; `icicle-search-highlight-and-maybe-replace', ;; `icicle-search-highlight-input-matches-here', ;; `icicle-search-in-context-default-fn', ;; `icicle-search-property-args', ;; `icicle-search-property-default-match-fn', ;; `icicle-search-quit-or-error', ;; `icicle-search-read-context-regexp', `icicle-search-read-word', ;; `icicle-search-regexp-scan', ;; `icicle-search-replace-all-search-hits', ;; `icicle-search-replace-cand-in-alist', ;; `icicle-search-replace-cand-in-mct', ;; `icicle-search-replace-fixed-case-p', ;; `icicle-search-replace-match', ;; `icicle-search-replace-search-hit', `icicle-search-thing-args', ;; `icicle-search-thing-scan', `icicle-search-where-arg', ;; `icicle-set-completion-methods-for-command', ;; `icicle-things-alist', `icicle-this-command-keys-prefix', ;; `icicle-widget-color-complete'. ;; ;; Internal variables defined here: ;; ;; `icicle-active-map', `icicle-info-buff', `icicle-info-window', ;; `icicle-key-prefix', `icicle-key-prefix-2', ;; `icicle-last-thing-type', `icicle-named-colors', ;; `icicle-orig-extra-cands', `icicle-orig-font', ;; `icicle-orig-frame', `icicle-orig-menu-bar', ;; `icicle-orig-pixelsize', `icicle-orig-pointsize', ;; `icicle-orig-show-initially-flag', ;; `icicle-orig-sort-orders-alist', `icicle-this-cmd-keys'. ;; ;; ;; Key bindings made by Icicles: See "Key Bindings" in ;; `icicles-doc2.el'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Icicles Commands for Other Packages") ;; (@> "Icicles Top-Level Commands, Part 2") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 3, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (eval-when-compile (require 'cl)) ;; case, loop ;; plus, for Emacs < 21: dolist, push (eval-when-compile (when (>= emacs-major-version 22) (require 'edmacro))) ;; edmacro-subseq (eval-when-compile (require 'comint)) ;; comint-check-proc, comint-copy-old-input, comint-get-old-input, comint-input-ring, ;; comint-prompt-regexp, comint-send-input (eval-when-compile (require 'imenu)) ;; imenu-syntax-alist (eval-when-compile (require 'compile)) ;; compilation-find-buffer (eval-when-compile (require 'info)) ;; Info-goto-node (eval-when-compile (require 'etags)) ;; tags-case-fold-search, tags-table-files, ;; visit-tags-table-buffer (eval-when-compile (when (> emacs-major-version 21) (require 'anything nil t))) ;; (no error if not found): ;; anything-candidate-cache, anything-get-sources, anything-idle-delay, anything-pattern, ;; anything-sources, anything-transform-candidates (require 'strings nil t) ;; (no error if not found): read-number (my version) (eval-when-compile (require 'bookmark+ nil t)) ;; (no error if not found): ;; bmkp-bmenu-barf-if-not-in-menu-list, bmkp-bmenu-get-marked-files, bmkp-bookmark-last-access-cp, ;; bmkp-buffer-last-access-cp, bmkp-describe-bookmark, bmkp-describe-bookmark-internals, ;; bmkp-file-alpha-cp, bmkp-get-buffer-name, bmkp-get-end-position, bmkp-get-tags, bmkp-gnus-cp, ;; bmkp-handler-cp, bmkp-info-cp, bmkp-local-file-accessed-more-recently-cp, ;; bmkp-local-file-size-cp, bmkp-local-file-type-cp, bmkp-local-file-updated-more-recently-cp, ;; bmkp-marked-cp, bmkp-non-file-filename, bmkp-read-tags-completing, bmkp-region-alist-only, ;; bmkp-region-bookmark-p, bmkp-sorted-alist, bmkp-sort-omit, bmkp-url-cp, bmkp-visited-more-cp (eval-when-compile (require 'hexrgb nil t)) ;; (no error if not found): ;; hexrgb-color-name-to-hex, hexrgb-defined-colors, hexrgb-defined-colors-alist, hexrgb-hex-to-hsv, ;; hexrgb-hex-to-rgb, hexrgb-read-color, hexrgb-(red|green|blue|hue|saturation|value), ;; hexrgb-rgb-hex-string-p, hexrgb-rgb-to-hsv, hexrgb-value (eval-when-compile (require 'highlight nil t)) ;; (no error if not found): ;; hlt-act-on-any-face-flag, hlt-hide-default-face, hlt-highlight-faces-in-buffer, ;; hlt-region-or-buffer-limits, hlt-show-default-face (eval-when-compile (or (condition-case nil (load-library "icicles-mac") ; Use load-library to ensure latest .elc. (error nil)) (require 'icicles-mac))) ; Require, so can load separately if not on `load-path'. ;; icicle-bind-file-candidate-keys, icicle-define-command, icicle-define-file-command, ;; icicle-file-bindings, icicle-unbind-file-candidate-keys (require 'icicles-mcmd) ;; icicle-search-define-replacement (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.) ;; icicle-alternative-sort-comparer, icicle-buffer-extras, icicle-buffer-ignore-space-prefix-flag, ;; icicle-buffer-match-regexp, icicle-buffer-no-match-regexp, icicle-buffer-predicate, ;; icicle-buffer-require-match-flag, icicle-buffer-sort, icicle-complete-keys-self-insert-ranges, ;; icicle-key-descriptions-use-<>-flag, icicle-recenter, icicle-require-match-flag, ;; icicle-saved-completion-sets, icicle-search-cleanup-flag, icicle-kbd, ;; icicle-search-highlight-all-current-flag, icicle-search-highlight-threshold, icicle-search-hook, ;; icicle-sort-comparer, icicle-transform-function (require 'icicles-var) ; (This is required anyway by `icicles-fn.el'.) ;; icicle-abs-file-candidates, icicle-acting-on-next/prev, icicle-all-candidates-action, ;; icicle-all-candidates-list-action-fn, icicle-all-candidates-list-alt-action-fn, ;; icicle-apply-nomsg, icicle-bookmark-history, icicle-buffer-sort-first-time-p, ;; icicle-candidate-action-fn, icicle-candidate-alt-action-fn, icicle-candidate-entry-fn, ;; icicle-candidate-help-fn, icicle-candidate-nb, icicle-candidate-properties-alist, ;; icicle-candidates-alist, icicle-char-property-value-history, icicle-complete-keys-alist, ;; icicle-completing-keys-p, icicle-completion-candidates, icicle-current-completion-mode, ;; icicle-current-input, icicle-delete-candidate-object, icicle-doc-last-initial-cand-set, ;; icicle-explore-final-choice, icicle-explore-final-choice-full, icicle-extra-candidates, ;; icicle-extra-candidates-dir-insert-p, icicle-full-cand-fn, icicle-fundoc-last-initial-cand-set, ;; icicle-get-alist-candidate-function, icicle-hist-cands-no-highlight, icicle-hist-var, ;; icicle-Info-only-rest-of-book-p, icicle-key-prefix-description, icicle-last-completion-candidate, ;; icicle-last-completion-command, icicle-last-input, icicle-last-sort-comparer, ;; icicle-last-transform-function, icicle-list-use-nth-parts, icicle-minibuffer-message-ok-p, ;; icicle-must-match-regexp, icicle-must-not-match-regexp, icicle-must-pass-after-match-predicate, ;; icicle-nb-of-other-cycle-candidates, icicle-orig-buff, icicle-orig-pt-explore, icicle-orig-window, ;; icicle-orig-win-explore, icicle-other-window, icicle-plist-last-initial-cand-set, ;; icicle-predicate-types-alist, icicle-prompt, icicle-proxy-candidate-regexp, ;; icicle-proxy-candidates, icicle-require-match-p, icicle-saved-completion-candidate, ;; icicle-saved-completion-candidates, icicle-scan-fn-or-regexp, icicle-search-command, ;; icicle-search-complement-domain-p, icicle-search-context-level, icicle-search-context-regexp, ;; icicle-search-current-overlay, icicle-search-final-choice, icicle-search-in-context-fn, ;; icicle-searching-p, icicle-search-level-overlays, icicle-search-modes, icicle-search-overlays, ;; icicle-search-refined-overlays, icicle-search-replacement, icicle-transform-before-sort-p, ;; icicle-vardoc-last-initial-cand-set, icicle-whole-candidate-as-text-prop-p (require 'icicles-fn) ; (This is required anyway by `icicles-mcmd.el'.) ;; icicle-candidate-short-help, icicle-completing-read-history, icicle-highlight-lighter, ;; icicle-insert-cand-in-minibuffer, icicle-some, icicle-string-match-p (require 'icicles-cmd1) ;; icicle-bookmark-cleanup, icicle-bookmark-cleanup-on-quit, icicle-bookmark-cmd, ;; icicle-bookmark-help-string, icicle-bookmark-propertize-candidate, icicle-buffer-list, ;; icicle-explore, icicle-face-list, icicle-file-list, icicle-keyword-list, icicle-make-bookmark-candidate, ;; icicle-make-frame-alist, icicle-select-bookmarked-region ;;; (require 'icicles-mode) ;;; ;; icicle-ORIG-Info-goto-node, icicle-ORIG-Info-index, icicle-ORIG-Info-menu ;; Byte-compiling this file, you will likely get some byte-compiler warning messages. ;; These are probably benign - ignore them. Icicles is designed to work with multiple ;; versions of Emacs, and that fact provokes compiler warnings. If you get byte-compiler ;; errors (not warnings), then please report a bug, using `M-x icicle-send-bug-report'. ;;; Some defvars to quiet byte-compiler a bit: (defvar anything-sources) ; In `anything.el' (defvar anything-candidate-cache) ; In `anything.el' (defvar anything-idle-delay) ; In `anything.el' (defvar bmkp-non-file-filename) ; In `bookmark+-1.el' (defvar bmkp-sorted-alist) ; In `bookmark+-1.el' (defvar er/try-expand-list) ; In `expand-region.el' (defvar eyedrop-picked-background) ; In `eyedrop.el' or `palette.el' (defvar eyedrop-picked-foreground) ; In `eyedrop.el' or `palette.el' (defvar hlt-act-on-any-face-flag) ; In `highlight.el' (defvar icicle-complete-keys-self-insert-ranges) ; In `icicles-var.el' (Emacs 22+) (defvar icicle-search-ecm) ; In `icicle-search' (defvar icicle-track-pt) ; In `icicle-insert-thesaurus-entry' (defvar replace-count) ; In `replace.el'. ;; (< emacs-major-version 21) (defvar tooltip-mode) ; In `tooltip.el' ;; (< emacs-major-version 22) (defvar compilation-current-error) (defvar Info-complete-menu-buffer) ; In `info.el' (defvar Info-history-list) ; In `info.el' (defvar Info-menu-entry-name-re) ; In `info.el' (defvar Info-read-node-completion-table) ; In `info.el' (defvar list-colors-sort) ; In `facemenu.el' (Emacs 23+) (defvar palette-current-color) ; In `palette.el' (defvar palette-last-color) ; In `palette.el' (defvar palette-mode-map) ; In `palette.el' (defvar palette-popup-map) ; In `palette.el' (defvar read-file-name-completion-ignore-case) ; In `minibuffer.el' (defvar synonyms-append-result-flag) ; IN `synonyms.el' (defvar synonyms-match-more-flag) ; In `synonyms.el' (defvar synonyms-obarray) ; In `synonyms.el' (defvar tags-case-fold-search) ; In `etags.el' ;; (> emacs-major-version 21) (defvar Info-saved-nodes) ; In `info+.el' ;; (< emacs-major-version 23) (defvar read-buffer-completion-ignore-case) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Icicles Commands for Other Packages") ;;; Icicles Commands for Other Packages ------------------------------ ;; Put this first (defun icicle-cmd2-after-load-bookmark+ () "Things to do for `icicles-cmd2.el' after loading `bookmark+.el'." (icicle-define-file-command icicle-bookmark-a-file ; `C-x p c a' "Bookmark a file (create an autofile bookmark). \(You need library `Bookmark+' for this command.) When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file. The autofile bookmark created has the same name as the file. During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c C-d - change the `default-directory' (a la `cd') C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles)" (lambda (file) (bmkp-bookmark-a-file file nil nil nil 'MSG)) "File to bookmark (autofile): " nil nil nil nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((icicle-use-candidates-only-once-flag t) ;; This binding is for `icicle-autofile-action', in `icicle-bind-file-candidate-keys'. (icicle-full-cand-fn #'icicle-make-bookmark-candidate) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (icicle-define-file-command icicle-tag-a-file ; `C-x p t + a' "Tag a file (an autofile bookmark) with one or more tags. You are prompted for the tags, then the file name. Hit `RET' to enter each tag, then hit `RET' again after the last tag. You can use completion to enter each tag. Completion is lax: you are not limited to existing tags. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file. The tags are added to an autofile bookmark for the same file name and directory. If the bookmark does not yet exist it is created. Candidate help shows information about the file's autofile bookmark if it already exists, or the file itself if not." (lambda (file) (bmkp-autofile-add-tags file tags nil nil nil 'MSG)) "File to tag: " nil nil nil nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing)) (icicle-use-candidates-only-once-flag t)))) (icicle-define-file-command icicle-untag-a-file ; `C-x p t - a' "Remove one or more tags from a file (an autofile bookmark). You are prompted for the tags, then the file name. Hit `RET' to enter each tag, then hit `RET' again after the last tag. You can use completion to enter each tag. Completion is lax: you are not limited to existing tags. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file. The tags are removed from an autofile bookmark for the same file name and directory. During file-name completion, only files tagged with all of the given input tags are completion candidates." (lambda (file) (bmkp-autofile-remove-tags file tags nil nil nil 'MSG)) "File to untag: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing)) ; Pre bindings (icicle-use-candidates-only-once-flag t)) ((pred (lambda (ff) ; Post bindings ;; Expand relative file name, using dir from minibuffer. (setq ff (expand-file-name ff (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)))) (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (catch 'icicle-untag-a-file (dolist (tag tags) (unless (member tag btgs) (throw 'icicle-untag-a-file nil))) t))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))))) ;;$$$ Do not bother with autofiles that have a PREFIX. (icicle-define-command icicle-find-file-tagged ; `C-x j t C-f C-f'. "Find one or more files with tags that match your input. By default, only tagged files are candidates. With a prefix argument, all autofiles are candidates. (Autofiles are autofile bookmarks - you need library `Bookmark+' for this command.) Each completion candidate is a multi-completion composed of these fields: an absolute file name plus the file's tags, all separated by `icicle-list-join-string' (\"^G^J\", by default). As always, you can type `C-M-j' to insert this separator into the minibuffer. For this command, by default `.' in your input matches any character, including a newline. As always, you can use `C-M-.' to toggle this (so `.' does not match newline). You can match your input against the file name or tags or both. E.g., type: `red S-TAB' to match all files with the tag `red' `red S-SPC green S-SPC blue' to match all files with tags `red', `green', and `blue' (in any order) That assumes that these tags do not also match any file names. If you need to match against a particular field (e.g. the file name or a specific tag position), then use the field separator. Otherwise, just use progressive completion, as shown above. E.g., to match only tags and not the filename, start with `C-M-j' to get past the file-name field. To match both file name and tags, type something to match the file name before the `C-M-j'. E.g., type: `2011 C-M-j red S-SPC blue' to match all files tagged `red' and `blue' that have `2011' in their names During completion (`*' means this requires library `Bookmark+')\\, you can use the following keys: C-c C-d - change the `default-directory' (a la `cd') C-c + - create a new directory \\[icicle-all-candidates-list-alt-action] - open Dired on the currently matching file names \\[icicle-delete-candidate-object] - delete candidate file or (empty) dir * C-x C-t * - narrow to files with all of the tags you specify * C-x C-t + - narrow to files with some of the tags you specify * C-x C-t % * - narrow to files with all tags matching a regexp * C-x C-t % + - narrow to files with some tags matching a regexp * C-x a + - add tags to current candidate * C-x a - - remove tags from current candidate * C-x m - access file bookmarks (not just autofiles)" ; Doc string (lambda (f) (bmkp-find-file (icicle-transform-multi-completion f) 'WILDCARDS)) ; Action function prompt icicle-abs-file-candidates ; `completing-read' args nil nil nil 'icicle-filetags-history nil nil (icicle-file-bindings ; Bindings ((prompt "FILE `C-M-j' TAGS: ") ;; This binding is for `icicle-autofile-action', in `icicle-bind-file-candidate-keys'. (icicle-full-cand-fn (lambda (file) (list (cons file (bmkp-get-tags (bmkp-get-autofile-bookmark file)))))) (icicle-abs-file-candidates ; An alist whose items are ((FILE TAG...)). (let ((result ())) (dolist (autofile (bmkp-autofile-alist-only)) (let ((tags (bmkp-get-tags autofile))) (when (or tags current-prefix-arg) (push (list (cons (bookmark-get-filename autofile) tags)) result)))) result)) (icicle-dot-string (icicle-anychar-regexp)) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-whole-candidate-as-text-prop-p t))) (progn ; First code (put-text-property 0 1 'icicle-fancy-candidates t prompt) (icicle-highlight-lighter) (message "Gathering tagged files...") (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (icicle-define-command icicle-find-file-tagged-other-window ; `C-x 4 j t C-f C-f' "Same as `icicle-find-file-tagged', except uses another window." ; Doc string (lambda (f) (bmkp-find-file-other-window (icicle-transform-multi-completion f) 'WILDCARDS)) ; Action prompt icicle-abs-file-candidates ; `completing-read' args nil nil nil 'icicle-filetags-history nil nil (icicle-file-bindings ; Bindings ((prompt "FILE `C-M-j' TAGS: ") ;; This binding is for `icicle-autofile-action', in `icicle-bind-file-candidate-keys'. (icicle-full-cand-fn (lambda (file) (list (cons file (bmkp-get-tags (bmkp-get-autofile-bookmark file)))))) (icicle-abs-file-candidates ; An alist whose items are ((FILE TAG...)). (let ((result ())) (dolist (autofile (bmkp-autofile-alist-only)) (let ((tags (bmkp-get-tags autofile))) (when (or tags current-prefix-arg) (push (list (cons (bookmark-get-filename autofile) tags)) result)))) result)) (icicle-dot-string (icicle-anychar-regexp)) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-whole-candidate-as-text-prop-p t))) (progn ; First code (put-text-property 0 1 'icicle-fancy-candidates t prompt) (icicle-highlight-lighter) (message "Gathering tagged files...") (icicle-bind-file-candidate-keys)) nil ; Undo code (icicle-unbind-file-candidate-keys)) ; Last code (icicle-define-file-command icicle-find-file-handle-bookmark ; `C-x j C-f' "Visit a file or directory, respecting any associated autofile handlers. This is similar to `icicle-find-file', But the file is accessed using `bmkp-find-file', which means that if it has an associated handler in `bmkp-default-handlers-for-file-types' then that handler is used to visit the file. If you use a prefix arg when acting on a completion candidate then an autofile bookmark is created for the file, unless it already has one. When prompted for the file name you can use `M-n' to pick up the file name at point, or if none then the visited file." bmkp-find-file "Find file: " nil nil t nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-handle-bookmark-other-window ; `C-x 4 j C-f' "Same as `icicle-find-file-handle-bookmark', except uses another window." bmkp-find-file-other-window "Find file: " nil nil t nil nil ; `read-file-name' args (icicle-file-bindings ; Bindings ((init-pref-arg current-prefix-arg) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files))))))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-all-tags ; `C-x j t C-f *' "Visit a file or directory that has all of the tags you enter. Only tagged autofiles are candidates. This is essentially a multi-command versions of `bmkp-find-file-all-tags'. You are prompted first for the tags. Hit `RET' to enter each tag, then hit `RET' again after the last tag. You can use completion to enter each tag. This completion is lax: you are not limited to existing tags. By default, the tag choices for completion are NOT refreshed, to save time. Use a prefix argument if you want to refresh them. You are then prompted for the file name. This is read using `read-file-name', so you can browse up and down the file hierarchy. \(The completion candidates are file names, not bookmark names.) If you specify no tags, then every file that has some tags is a candidate. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file." (lambda (file) (bmkp-find-file file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing ; Pre bindings nil nil current-prefix-arg)) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred `(lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every `(lambda (tag) (bmkp-has-tag-p ',bmk tag)) ',tags))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-all-tags-other-window ; `C-x 4 j t C-f *' "Same as `icicle-find-file-all-tags', except uses another window." (lambda (file) (bmkp-find-file-other-window file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing ; Pre bindings nil nil current-prefix-arg)) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred `(lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every `(lambda (tag) (bmkp-has-tag-p ',bmk tag)) ',tags))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-all-tags-regexp ; `C-x j t C-f % *' "Visit a file or directory that has each tag matching a regexp you enter. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file." (lambda (file) (bmkp-find-file file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((regexp (read-string "Regexp for tags: ")) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred (lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every `(lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-all-tags-regexp-other-window ; `C-x 4 j t C-f % *' "Same as `icicle-find-file-all-tags-regexp', except uses another window." (lambda (file) (bmkp-find-file-other-window file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((regexp (read-string "Regexp for tags: ")) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred (lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every `(lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-some-tags ; `C-x j t C-f +' "Visit a file or directory that has at least one of the tags you enter. You are prompted for the tags, then the file name. Hit `RET' to enter each tag, then hit `RET' again after the last tag. You can use completion to enter each tag. Completion is lax: you are not limited to existing tags. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file." (lambda (file) (bmkp-find-file file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing ; Pre bindings nil nil current-prefix-arg)) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred `(lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some `(lambda (tag) (bmkp-has-tag-p ',bmk tag)) ',tags))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-some-tags-other-window ; `C-x 4 j t C-f +' "Same as `icicle-find-file-some-tags', except uses another window." (lambda (file) (bmkp-find-file-other-window file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((tags (bmkp-read-tags-completing ; Pre bindings nil nil current-prefix-arg)) (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred `(lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some `(lambda (tag) (bmkp-has-tag-p ',bmk tag)) ',tags))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-some-tags-regexp ; `C-x j t C-f % +' "Visit a file or directory that has a tag matching a regexp you enter. When prompted for the file you can use `M-n' to pick up the file name at point, or if none then the visited file." (lambda (file) (bmkp-find-file-other-window file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((regexp (read-string "Regexp for tags: ")) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred (lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some `(lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. (icicle-define-file-command icicle-find-file-some-tags-regexp-other-window ; `C-x 4 j t C-f % +' "Same as `icicle-find-file-some-tags-regexp', except uses another window." (lambda (file) (bmkp-find-file-other-window file 'MUST-EXIST)) ; Function to perform the action "Find file: " nil nil t nil (and icompletep pred) ; `read-file-name' args (icicle-file-bindings ; Bindings ((regexp (read-string "Regexp for tags: ")) ; Pre bindings (icicle-all-candidates-list-alt-action-fn ; `M-|' (lambda (files) (let ((enable-recursive-minibuffers t)) (dired-other-window (cons (read-string "Dired buffer name: ") files)))))) ((pred (lambda (ff) ; Post bindings (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some `(lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)))) (icicle-bind-file-candidate-keys) ; First code. nil ; Undo code. (icicle-unbind-file-candidate-keys)) ; Last code. ) (defun icicle-cmd2-after-load-hexrgb () "Things to do for `icicles-cmd2.el' after loading `hexrgb.el'." (when (and (fboundp 'read-color) (not (fboundp 'icicle-ORIG-read-color))) ; Exists with Emacs 23+. (fset 'icicle-ORIG-read-color (symbol-function 'read-color))) ; Not used, but save it anyway. ;; See also `hexrgb-read-color' in `hexrgb.el'. (defun icicle-read-color (&optional prompt convert-to-RGB-p allow-empty-name-p msgp) "Read a color name or hex RGB hexadecimal color value #RRRRGGGGBBBB. Return the name or the RGB hex string for the chosen color. By default (see option `icicle-functions-to-redefine'), this is used in place of standard command `read-color' when you are in Icicle mode, so that any existing code that calls that command invokes this one instead. `icicle-read-color' has the advantage of being an Icicles multi-command that provides WYSIWYG completion, color-variable proxy candidates, alternate candidate actions, candidate help, and multiple color-related candidate sort orders. In this it is like command `icicle-read-color-wysiwyg' (which see), but it is less flexible and powerful than that command. `icicle-read-color' always returns the RGB hex string, and your input cannot be an arbitrary string - it must match a color candidate (or be empty if ALLOW-EMPTY-NAME-P is non-nil). In Lisp code that you write, and for interactive use, `icicle-read-color-wysiwyg' is generally a better choice than `icicle-read-color'. Optional argument PROMPT is the prompt to use (default \"Color: \"). Interactively, or if CONVERT-TO-RGB-P is non-nil, return the RGB hex string for the chosen color. If nil, return the color name. Optional arg ALLOW-EMPTY-NAME-P controls what happens if you enter an empty color name (that is, you just hit `RET'). If non-nil, then `icicle-read-color' returns an empty color name, \"\". If nil, then it raises an error. Calling programs must test for \"\" if ALLOW-EMPTY-NAME-P is non-nil. They can then perform an appropriate action in case of empty input. Interactively, or with non-nil MSGP, show chosen color in echo area." (interactive "i\np\ni\np") ; Always convert to RGB interactively. (let* ((icicle-require-match-p (not allow-empty-name-p)) (color (icicle-read-color-wysiwyg (if convert-to-RGB-p 2 1) prompt))) ;; `icicle-read-color-wysiwyg' transforms input to get the 2nd multi-completion component. ;; But if the user did not complete but just entered a color name, then this transformation returns "". ;; In that case, get the color name that was input from the input history, and convert that to RGB. (when (and (not allow-empty-name-p) (string= "" color)) (let ((col (car-safe (symbol-value minibuffer-history-variable)))) (when (or (equal "" col) (not (stringp col))) (icicle-user-error "No such color: %S" color)) (setq color (hexrgb-color-name-to-hex col)))) (let ((icicle-multi-completing-p t) (icicle-list-use-nth-parts (if convert-to-RGB-p '(2) '(1))) (colr (icicle-transform-multi-completion color))) (when msgp (message "Color: `%s'" (icicle-propertize colr 'face 'icicle-msg-emphasis))) colr))) (defun icicle-read-color-wysiwyg (&optional arg prompt initial-input msgp) "Read a color name or hex RGB color value #RRRRGGGGBBBB. Return a string value. Interactively, optional argument ARG is the prefix arg - see below. Optional argument PROMPT is the prompt to use (default \"Color: \"). Optional argument INITIAL-INPUT is a initial input to insert in the minibuffer for completion. It is passed to `completing-read'. Interactively, or with non-nil MSGP, show chosen color in echo area. In addition to standard color names and RGB (red, green, blue) hex values, the following are also available as proxy color candidates, provided `icicle-add-proxy-candidates-flag' is non-nil and library `palette.el' or `eyedropper.el' is used. In each case, the corresponding color is used. * `*copied foreground*' - last copied foreground, if available * `*copied background*' - last copied background, if available * `*mouse-2 foreground*' - foreground where you click `mouse-2' * `*mouse-2 background*' - background where you click `mouse-2' * `*point foreground*' - foreground under the text cursor * `*point background*' - background under the text cursor \(You can copy a color using eyedropper commands such as `eyedrop-pick-foreground-at-mouse'.) In addition, the names of user options (variables) whose custom type is `color' are also proxy candidates, but with `'' as a prefix and suffix. So, for example, option `icicle-region-background' appears as proxy color candidate `'icicle-region-background''. If you choose such a candidate then (only) the variable's value is returned. As always, you can toggle the use of proxy candidates using `\\\ \\[icicle-toggle-proxy-candidates]' in the minibuffer. With plain `C-u', use `hexrgb-read-color', which lets you complete a color name or input any valid RGB hex value (without completion). With no prefix arg, return a string with both the color name and the RGB value, separated by `icicle-list-nth-parts-join-string'. With a numeric prefix arg of 0 or 1, return the color name. With any other numeric prefix arg, return the RGB value. In the plain `C-u' case, your input is checked to ensure that it represents a valid color. In all other cases: - You can complete your input against the color name, the RGB value, or both. - If you enter input without completing or cycling, the input is not checked: whatever is entered is returned as the string value. You can, as usual in Icicles, use \\`\\[icicle-change-sort-order]' \ to cycle among various sort orders. There is a rich variety of orders, including HSV and RGB distance from a color you specify. From Emacs Lisp, ARG controls what is returned. If ARG is nil, `icicle-list-use-nth-parts' can also be used to control the behavior. Note: Duplicate color names are removed by downcasing and removing whitespace. For example, \"AliceBlue\" and \"alice blue\" are both treated as \"aliceblue\". Otherwise, candidates with different names but the same RGB values are not considered duplicates, so, for example, input can match either \"darkred\" or \"red4\", which both have RGB #8b8b00000000. You can toggle duplicate removal at any time using `\\[icicle-toggle-transforming]'. During completion, candidate help (e.g. `\\[icicle-help-on-candidate]') shows you the RGB and HSV (hue, saturation, value) color components. This command is intended only for use in Icicle mode (but it can be used with `C-u', with Icicle mode turned off)." (interactive "P\ni\ni\np") (unless (featurep 'hexrgb) (icicle-user-error "You need library `hexrgb.el' for this command")) (let (color) (if (consp arg) ; Plain `C-u': complete against color name only, and be able to (setq color (hexrgb-read-color nil 'CONVERT-TO-RGB)) ; input any valid RGB string. ;; Complete against name+RGB pairs, but user can enter invalid value without completing. (when arg (setq arg (prefix-numeric-value arg))) ; Convert `-' to -1. (let ((icicle-multi-completing-p t) (icicle-list-use-nth-parts (or (and arg (if (< arg 2) '(1) '(2))) ; 1 or 2, either by program or via `C-1' or `C-2'. icicle-list-use-nth-parts ; Bound externally by program. '(1 2))) ; Both parts, by default. (mouse-pseudo-color-p nil) icicle-candidate-help-fn completion-ignore-case icicle-transform-function icicle-sort-orders-alist icicle-list-nth-parts-join-string icicle-list-join-string ;; $$$$$$ icicle-list-end-string icicle-proxy-candidate-regexp icicle-named-colors icicle-proxy-candidates) ;; Copy the prompt string because `icicle-color-completion-setup' puts a text prop on it. ;; Use `icicle-prompt' from now on, since that's what `icicle-color-completion-setup' ;; sets up. (setq icicle-prompt (copy-sequence (or prompt "Color: "))) (icicle-color-completion-setup) (setq icicle-proxy-candidates (append icicle-proxy-candidates (mapcar ; Convert multi-completions to strings. ;; $$$$$$ (lambda (entry) ;; (concat (mapconcat #'identity (car entry) ;; icicle-list-join-string) ;; icicle-list-end-string)) ; $$$$$$ (lambda (entry) (mapconcat #'identity (car entry) icicle-list-join-string)) '((("*mouse-2 foreground*")) (("*mouse-2 background*"))))) color (let ((icicle-orig-window (selected-window)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "color"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "color")))) (completing-read icicle-prompt icicle-named-colors nil nil initial-input))) (cond ((string-match "\\`'.+': " color) (let ((icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") (icicle-list-use-nth-parts '(2))) (setq color (icicle-transform-multi-completion color)))) ((fboundp 'eyedrop-foreground-at-point) (cond ((string-match "^\*mouse-2 foreground\*" color) (setq color (prog1 (eyedrop-foreground-at-mouse (read-event "Click `mouse-2' anywhere to choose foreground color")) (read-event)) ; Discard mouse up event. mouse-pseudo-color-p t)) ((string-match "^\*mouse-2 background\*" color) (setq color (prog1 (eyedrop-background-at-mouse (read-event "Click `mouse-2' anywhere to choose background color")) (read-event)) ; Discard mouse up event. mouse-pseudo-color-p t))) (if mouse-pseudo-color-p (let ((icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts (or (and arg (if (< arg 2) '(1) '(2))) ; 1 or 2, via program or `C-1' or `C-2'. icicle-list-use-nth-parts ; Bound externally by program. '(1 2)))) ; Both parts, by default. (setq color (icicle-transform-multi-completion (concat color ": " (hexrgb-color-name-to-hex color))))) (setq color (icicle-transform-multi-completion color))))) (when (string= "" color) (let ((col (car-safe (symbol-value minibuffer-history-variable)))) (when (or (equal "" col) (not (stringp col))) (icicle-user-error "No such color: %S" color)) ;; Cannot use `case', since that uses `eql', not `equal'. (setq color (cond ((equal '(1) icicle-list-use-nth-parts) col) ((equal '(2) icicle-list-use-nth-parts) (hexrgb-color-name-to-hex col)) (t (let ((icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ")) (icicle-transform-multi-completion color))))))))) (when msgp (message "Color: `%s'" (icicle-propertize color 'face 'icicle-msg-emphasis))) color)) (icicle-define-command icicle-frame-bg ; Command name "Change background of current frame. Read color name or hex RGB color value #RRRRGGGGBBBB with completion. In addition to standard color names and RGB (red, green, blue) hex values, the following are also available as proxy color candidates, provided `icicle-add-proxy-candidates-flag' is non-nil and library `palette.el' or `eyedropper.el' is used. In each case, the corresponding color is used. * `*copied foreground*' - last copied foreground, if available * `*copied background*' - last copied background, if available * `*point foreground*' - foreground under the text cursor * `*point background*' - background under the text cursor \(You can copy a color using eyedropper commands such as `eyedrop-pick-foreground-at-mouse'.) In addition, the names of user options (variables) whose custom type is `color' are also proxy candidates, but with `'' as a prefix and suffix. So, for example, option `icicle-region-background' appears as proxy color candidate `'icicle-region-background''. As always, you can toggle the use of proxy candidates using `\\\ \\[icicle-toggle-proxy-candidates]' in the minibuffer. You can complete your input against the color name, the RGB value, or both. Note: Duplicate color names are removed by downcasing and removing whitespace. For example, \"AliceBlue\" and \"alice blue\" are both treated as \"aliceblue\". Otherwise, candidates with different names but the same RGB values are not considered duplicates, so, for example, input can match either \"darkred\" or \"red4\", which both have RGB #8b8b00000000. You can toggle duplicate removal at any time using \\`\\[icicle-toggle-transforming]'. During completion, candidate help (e.g. `\\[icicle-help-on-candidate]') shows you the RGB and HSV (hue, saturation, value) color components. This command is intended only for use in Icicle mode." ; Doc string (lambda (color) ; Action function (modify-frame-parameters icicle-orig-frame (list (cons 'background-color (icicle-transform-multi-completion color))))) icicle-prompt icicle-named-colors nil t nil ; `completing-read' args (if (boundp 'color-history) 'color-history 'icicle-color-history) nil nil ((icicle-orig-frame (selected-frame)) ; Bindings (orig-bg (frame-parameter nil 'background-color)) (icicle-prompt "Background color: ") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(2)) ; Use RGB part. (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "color"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "color"))) icicle-candidate-help-fn completion-ignore-case icicle-transform-function icicle-sort-orders-alist icicle-list-nth-parts-join-string icicle-list-join-string ;; $$$$$$ icicle-list-end-string icicle-proxy-candidate-regexp icicle-named-colors icicle-proxy-candidates) (icicle-color-completion-setup) ; First code - needs `hexrgb.el' (modify-frame-parameters icicle-orig-frame (list (cons 'background-color orig-bg))) ; Undo code nil) ; Last code (icicle-define-command icicle-frame-fg ; Command name "Change foreground of current frame. See `icicle-frame-bg' - but this is for foreground, not background." ; Doc string (lambda (color) ; Action function (modify-frame-parameters icicle-orig-frame (list (cons 'foreground-color (icicle-transform-multi-completion color))))) icicle-prompt icicle-named-colors nil t nil ; `completing-read' args (if (boundp 'color-history) 'color-history 'icicle-color-history) nil nil ((icicle-orig-frame (selected-frame)) ; Bindings (orig-bg (frame-parameter nil 'foreground-color)) (icicle-prompt "Foreground color: ") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(2)) ; Use RGB part. (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "color"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "color"))) icicle-candidate-help-fn completion-ignore-case icicle-transform-function icicle-sort-orders-alist icicle-list-nth-parts-join-string icicle-list-join-string ;; $$$$$$ icicle-list-end-string icicle-proxy-candidate-regexp icicle-named-colors icicle-proxy-candidates) (icicle-color-completion-setup) ; First code - needs `hexrgb.el' (modify-frame-parameters icicle-orig-frame (list (cons 'foreground-color orig-bg))) ; Undo code nil) ; Last code ;; Free vars here: ;; `icicle-prompt', `icicle-candidate-help-fn', `completion-ignore-case', ;; `icicle-transform-function', `icicle-sort-orders-alist', `icicle-list-nth-parts-join-string', ;; `icicle-list-join-string', `icicle-proxy-candidate-regexp', `icicle-named-colors', ;; `icicle-proxy-candidates'. (defun icicle-color-completion-setup () "Set up for color-name/RGB-value completion (helper function). Sets these variables, which are assumed to be already `let'-bound: `icicle-prompt' `icicle-candidate-help-fn' `completion-ignore-case' `icicle-transform-function' `icicle-sort-orders-alist' `icicle-list-nth-parts-join-string' `icicle-list-join-string' `icicle-proxy-candidate-regexp' `icicle-named-colors' `icicle-proxy-candidates' Puts property `icicle-fancy-candidates' on string `icicle-prompt'." (if (< emacs-major-version 22) (require 'eyedropper nil t) (or (require 'palette nil t) (require 'eyedropper nil t))) (when (stringp icicle-prompt) ; Sanity check - should be true. (put-text-property 0 1 'icicle-fancy-candidates t icicle-prompt)) (icicle-highlight-lighter) (setq icicle-candidate-help-fn 'icicle-color-help completion-ignore-case t icicle-sort-orders-alist '(("by color name" . icicle-part-1-lessp) ("by color hue" . (lambda (s1 s2) (not (icicle-color-hue-lessp s1 s2)))) ("by color purity (saturation)" . (lambda (s1 s2) (not (icicle-color-saturation-lessp s1 s2)))) ("by color brightness (value)" . (lambda (s1 s2) (not (icicle-color-value-lessp s1 s2)))) ("by color hsv" . (lambda (s1 s2) (not (icicle-color-hsv-lessp s1 s2)))) ("by hsv distance" . (lambda (s1 s2) (icicle-color-distance-hsv-lessp s1 s2))) ("by amount of red" . (lambda (s1 s2) (not (icicle-color-red-lessp s1 s2)))) ("by amount of green" . (lambda (s1 s2) (not (icicle-color-green-lessp s1 s2)))) ("by amount of blue" . (lambda (s1 s2) (not (icicle-color-blue-lessp s1 s2)))) ("by color rgb" . (lambda (s1 s2) (not (icicle-color-rgb-lessp s1 s2)))) ("by rgb distance" . (lambda (s1 s2) (icicle-color-distance-rgb-lessp s1 s2))) ("turned OFF")) ;; Make the two `*-join-string' variables the same, so past inputs are recognized. ;; Do not use " " as the value, because color names such as "white smoke" would be ;; split, and "smoke" would not be recognized as a color name when trying to list ;; candidates in `*Completions*'. icicle-list-nth-parts-join-string ": " icicle-list-join-string ": " ;; $$$$$$ icicle-list-end-string "" icicle-proxy-candidate-regexp "^[*'].+[*']" icicle-named-colors (mapcar #'icicle-make-color-candidate (hexrgb-defined-colors)) icicle-proxy-candidates (mapcar ; Convert multi-completions to strings. (lambda (entry) ;; $$$$$$ (concat (mapconcat #'identity (car entry) icicle-list-join-string) ;; icicle-list-end-string) ; $$$$$$ (mapconcat #'identity (car entry) icicle-list-join-string)) (append (and (fboundp 'eyedrop-foreground-at-point) (append (and eyedrop-picked-foreground ; Multi-completions. `(,(icicle-make-color-candidate "*copied foreground*" (downcase (hexrgb-color-name-to-hex eyedrop-picked-foreground))))) (and eyedrop-picked-background `(,(icicle-make-color-candidate "*copied background*" (downcase (hexrgb-color-name-to-hex eyedrop-picked-background))))) `(,(icicle-make-color-candidate "*point foreground*" (downcase (hexrgb-color-name-to-hex (eyedrop-foreground-at-point)))) ,(icicle-make-color-candidate "*point background*" (downcase (hexrgb-color-name-to-hex (eyedrop-background-at-point))))))) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand '(color)) (error nil)) ;; This should not be necessary, but type `color' isn't ;; enforced - it just means `string' (so far). (x-color-defined-p (symbol-value cand))) (push `,(icicle-make-color-candidate (concat "'" (symbol-name cand) "'") (downcase (hexrgb-color-name-to-hex (symbol-value cand)))) ipc)))) ipc))))) (defun icicle-color-help (color) "Display help on COLOR. COLOR is a color name, an RGB string, or a multi-completion of both. If only a color name, then just say \"No help\"." (if (not (member icicle-list-use-nth-parts '((1 2) (2)))) (icicle-msg-maybe-in-minibuffer "No help") (with-output-to-temp-buffer "*Help*" (princ (format "Color: %s" color)) (terpri) (terpri) (let* ((icicle-list-use-nth-parts '(2)) (colr (icicle-transform-multi-completion color)) (rgb (hexrgb-hex-to-rgb colr)) (hsv (apply #'hexrgb-rgb-to-hsv rgb))) (princ "RGB:") (mapcar (lambda (component) (princ (format " %.18f" component))) rgb) (terpri) (terpri) (princ "HSV:") (mapcar (lambda (component) (princ (format " %.18f" component))) hsv))))) (defun icicle-make-color-candidate (color-name &optional hex-rgb) "Return multi-completion candidate of COLOR-NAME and its hex RGB string. If `icicle-WYSIWYG-Completions-flag' is non-nil, then the hex RGB string has the color as its background text property. Optional arg HEX-RGB is the hex RGB string. If HEX-RGB is nil, then COLOR-NAME is used to determine the hex RGB string." (let* ((rgb-string (or hex-rgb (hexrgb-color-name-to-hex color-name))) (value (hexrgb-value rgb-string))) (when icicle-WYSIWYG-Completions-flag (put-text-property 0 (length rgb-string) 'face (list (cons 'foreground-color (if (< value 0.6) "White" "Black")) (cons 'background-color rgb-string)) rgb-string)) (when (or (> icicle-help-in-mode-line-delay 0) ; Construct help only if user will see it. (and (boundp 'tooltip-mode) tooltip-mode)) (let* ((rgb (hexrgb-hex-to-rgb rgb-string)) (hsv (apply #'hexrgb-rgb-to-hsv rgb)) (help (format "RGB: %.6f, %.6f, %.6f; HSV: %.6f, %.6f, %.6f" (nth 0 rgb) (nth 1 rgb) (nth 2 rgb) (nth 0 hsv) (nth 1 hsv) (nth 2 hsv)))) (icicle-candidate-short-help help color-name) (icicle-candidate-short-help help rgb-string))) (list (list color-name rgb-string)))) ;; This predicate is used for color completion. (defun icicle-color-red-lessp (s1 s2) "Non-nil means the RGB in S1 has less red than in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-red rgb1) (hexrgb-red rgb2))))) ; Just in case strings were not multipart. ;; This predicate is used for color completion. (defun icicle-color-green-lessp (s1 s2) "Non-nil means the RGB in S1 has less green than in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-green rgb1) (hexrgb-green rgb2))))) ; Just in case strings not multipart. ;; This predicate is used for color completion. (defun icicle-color-blue-lessp (s1 s2) "Non-nil means the RGB in S1 has less blue than in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-blue rgb1) (hexrgb-blue rgb2))))) ; Just in case strings were not multipart. ;; This predicate is used for color completion. (defun icicle-color-distance-rgb-lessp (s1 s2) "Return non-nil if color S1 is RGB-closer than S2 to the base color. S1 and S2 are color names (strings). The base color name is the cdr of option `list-colors-sort', whose car must be `rgb-dist'. If the option value is not already a cons with car `rgb-dist' then it is made so: you are prompted for the base color name to use." (let* ((base-color (if (and (boundp 'list-colors-sort) ; Emacs 23+ (consp list-colors-sort) (eq 'rgb-dist (car list-colors-sort))) (cdr list-colors-sort) ; `list-colors-sort' is free here. (cdr (setq list-colors-sort (cons 'rgb-dist (let ((enable-recursive-minibuffers t) (icicle-sort-comparer nil)) (icicle-read-color-wysiwyg ; Use the color name only. 0 "With RGB close to color: "))))))) (base-rgb (hexrgb-hex-to-rgb (hexrgb-color-name-to-hex base-color))) (base-red (nth 0 base-rgb)) (base-green (nth 1 base-rgb)) (base-blue (nth 2 base-rgb)) (s1-rgb (hexrgb-hex-to-rgb (elt (split-string s1 icicle-list-join-string) 1))) (s2-rgb (hexrgb-hex-to-rgb (elt (split-string s2 icicle-list-join-string) 1)))) (< (+ (expt (- (nth 0 s1-rgb) base-red) 2) (expt (- (nth 1 s1-rgb) base-green) 2) (expt (- (nth 2 s1-rgb) base-blue) 2)) (+ (expt (- (nth 0 s2-rgb) base-red) 2) (expt (- (nth 1 s2-rgb) base-green) 2) (expt (- (nth 2 s2-rgb) base-blue) 2))))) ;; This predicate is used for color completion. (defun icicle-color-hue-lessp (s1 s2) "Non-nil means the RGB hue in S1 is less than that in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-hue rgb1) (hexrgb-hue rgb2))))) ; Just in case strings were not multipart. ;; This predicate is used for color completion. (defun icicle-color-saturation-lessp (s1 s2) "Non-nil means the RGB in S1 is less saturated than in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-saturation rgb1) (hexrgb-saturation rgb2))))) ; For non-multipart strings. ;; This predicate is used for color completion. (defun icicle-color-value-lessp (s1 s2) "Non-nil means the RGB value in S1 is darker than that in S2. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The RGB values are assumed to be the second parts of the strings, and they are assumed to start with `#'." (let ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (rgb2 (elt (split-string s2 icicle-list-join-string) 1))) (and rgb1 rgb2 (< (hexrgb-value rgb1) (hexrgb-value rgb2))))) ; Just in case strings not multipart. ;; This predicate is used for color completion. (defun icicle-color-hsv-lessp (s1 s2) "Non-nil means the HSV components of S1 are less than those of S2. Specifically, the hues are compared first, then if hues are equal then saturations are compared, then if those are also equal values are compared. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The second parts of the strings are RGB triplets that start with `#'." (let* ((rgb1 (elt (split-string s1 icicle-list-join-string) 1)) (hsv1 (and rgb1 (hexrgb-hex-to-hsv rgb1))) (rgb2 (elt (split-string s2 icicle-list-join-string) 1)) (hsv2 (and rgb2 (hexrgb-hex-to-hsv rgb2)))) (and hsv1 hsv2 ; Just in case strings were not multipart. (or (< (nth 0 hsv1) (nth 0 hsv2)) (and (= (nth 0 hsv1) (nth 0 hsv2)) (< (nth 1 hsv1) (nth 1 hsv2))) (and (= (nth 0 hsv1) (nth 0 hsv2)) (= (nth 1 hsv1) (nth 1 hsv2)) (< (nth 2 hsv1) (nth 2 hsv2))))))) ;; This predicate is used for color completion. (defun icicle-color-distance-hsv-lessp (s1 s2) "Return non-nil if color S1 is HSV-closer than S2 to the base color. S1 and S2 are color names (strings). The base color name is the cdr of option `list-colors-sort', whose car must be `hsv-dist'. If the option value is not already a cons with car `hsv-dist' then it is made so: you are prompted for the base color name to use." (let* ((base-color (if (and (boundp 'list-colors-sort) ; Emacs 23+ (consp list-colors-sort) (eq 'hsv-dist (car list-colors-sort))) (cdr list-colors-sort) ; `list-colors-sort' is free here. (cdr (setq list-colors-sort (cons 'hsv-dist (let ((enable-recursive-minibuffers t) (icicle-sort-comparer nil)) (icicle-read-color-wysiwyg ; Use the color name only. 0 "With HSV close to color: "))))))) (base-hsv (hexrgb-hex-to-hsv (hexrgb-color-name-to-hex base-color))) (base-hue (nth 0 base-hsv)) (base-sat (nth 1 base-hsv)) (base-val (nth 2 base-hsv)) (s1-hsv (apply #'hexrgb-rgb-to-hsv (hexrgb-hex-to-rgb (elt (split-string s1 icicle-list-join-string) 1)))) (s2-hsv (apply #'hexrgb-rgb-to-hsv (hexrgb-hex-to-rgb (elt (split-string s2 icicle-list-join-string) 1))))) (< (+ (expt (- (nth 0 s1-hsv) base-hue) 2) (expt (- (nth 1 s1-hsv) base-sat) 2) (expt (- (nth 2 s1-hsv) base-val) 2)) (+ (expt (- (nth 0 s2-hsv) base-hue) 2) (expt (- (nth 1 s2-hsv) base-sat) 2) (expt (- (nth 2 s2-hsv) base-val) 2))))) ) (defun icicle-cmd2-after-load-highlight () "Things to do for `icicles-cmd2.el' after loading `highlight.el'." (when (fboundp 'next-single-char-property-change) ; Don't bother, for Emacs 20. (icicle-define-command icicle-choose-faces "Choose a list of face names (strings). Option `hlt-act-on-any-face-flag' determines whether only highlighting faces in the buffer are candidates. The list of names (strings) is returned." (lambda (name) (push name face-names)) ; Action function prompt ; `completing-read' args (mapcar #'icicle-make-face-candidate (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer (point-min) (point-max)))) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) nil nil ((icicle-list-nth-parts-join-string ": ") ; Additional bindings (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (prompt (copy-sequence "Choose face (`RET' when done): ")) (face-names ())) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code. nil ; Undo code. (prog1 (setq face-names (delete "" face-names)) ; Return the list of faces. (when (interactive-p) (message "Faces: %S" face-names)))) (icicle-define-command icicle-choose-invisible-faces "Choose a list of face names (strings) from currently invisible faces. Option `hlt-act-on-any-face-flag' determines whether only highlighting faces in the buffer are candidates. The list of names (strings) is returned." (lambda (name) (push name face-names)) ; Action function prompt ; `completing-read' args (mapcar #'icicle-make-face-candidate (icicle-remove-if-not #'icicle-invisible-face-p (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer (point-min) (point-max))))) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) nil nil ((icicle-list-nth-parts-join-string ": ") ; Additional bindings (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (prompt (copy-sequence "Choose face (`RET' when done): ")) (face-names ())) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code. nil ; Undo code. (prog1 (setq face-names (delete "" face-names)) ; Return the list of faces. (when (interactive-p) (message "Faces: %S" face-names)))) (icicle-define-command icicle-choose-visible-faces "Choose a list of face names (strings) from currently visible faces. Option `hlt-act-on-any-face-flag' determines whether only highlighting faces in the buffer are candidates. The list of names (strings) is returned." (lambda (name) (push name face-names)) ; Action function prompt ; `completing-read' args (mapcar #'icicle-make-face-candidate (icicle-remove-if #'icicle-invisible-face-p (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer (point-min) (point-max))))) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) nil nil ((icicle-list-nth-parts-join-string ": ") ; Additional bindings (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (prompt (copy-sequence "Choose face (`RET' when done): ")) (face-names ())) (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code. nil ; Undo code. (prog1 (setq face-names (delete "" face-names)) ; Return the list of faces. (when (interactive-p) (message "Faces: %S" face-names)))) (defun icicle-show-only-faces (&optional start end faces) "Show only the faces you choose, hiding all others. Non-nil `hlt-act-on-any-face-flag' means choose from among all faces. Nil means choose only from among faces used to highlight. When choosing faces, completion and cycling are available. During cycling, these keys with prefix `C-' act on the current face name\\: `C-mouse-2', `C-RET' - Choose current face candidate only `C-down' - Choose, then move to next prefix-completion candidate `C-up' - Choose, then move to previous prefix-completion candidate `C-next' - Choose, then move to next apropos-completion candidate `C-prior' - Choose, then move to previous apropos-completion candidate `\\[icicle-all-candidates-action]' - Choose *all* matching face names" (interactive `(,@(hlt-region-or-buffer-limits) ,(mapcar #'intern (icicle-choose-faces)))) ; An Icicles multi-command (dolist (face (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer start end))) (if (memq face faces) (hlt-show-default-face face) (hlt-hide-default-face start end face)))) (defun icicle-hide-only-faces (&optional start end faces) "Hide only the faces you choose, showing all others. Non-nil `hlt-act-on-any-face-flag' means choose from among all faces. Nil means choose only from among faces used to highlight. When choosing faces, completion and cycling are available. During cycling, these keys with prefix `C-' act on the current face name\\: `C-mouse-2', `C-RET' - Choose current face candidate only `C-down' - Choose, then move to next prefix-completion candidate `C-up' - Choose, then move to previous prefix-completion candidate `C-next' - Choose, then move to next apropos-completion candidate `C-prior' - Choose, then move to previous apropos-completion candidate `\\[icicle-all-candidates-action]' - Choose *all* matching face names" (interactive `(,@(hlt-region-or-buffer-limits) ,(mapcar #'intern (icicle-choose-faces)))) ; An Icicles multi-command (dolist (face (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer start end))) (if (memq face faces) (hlt-hide-default-face start end face) (hlt-show-default-face face)))) (defun icicle-show-faces (faces) "Show invisible faces that you choose. Do nothing to other faces. Non-nil `hlt-act-on-any-face-flag' means choose from among all invisible faces. Nil means choose only from among invisible faces used to highlight. When choosing faces, completion and cycling are available. During cycling, these keys with prefix `C-' act on the current face name\\: `C-mouse-2', `C-RET' - Choose current face candidate only `C-down' - Choose, then move to next prefix-completion candidate `C-up' - Choose, then move to previous prefix-completion candidate `C-next' - Choose, then move to next apropos-completion candidate `C-prior' - Choose, then move to previous apropos-completion candidate `\\[icicle-all-candidates-action]' - Choose *all* matching face names" (interactive (list (let ((fs (icicle-remove-if-not #'icicle-invisible-face-p (if hlt-act-on-any-face-flag (face-list) (hlt-highlight-faces-in-buffer (point-min) (point-max)))))) (if fs (mapcar #'intern (icicle-choose-invisible-faces)) ; An Icicles multi-command (icicle-user-error "No%s faces are invisible" (if hlt-act-on-any-face-flag "" " highlight")))))) (dolist (face faces) (hlt-show-default-face face))) (defun icicle-hide-faces (&optional start end faces) "Hide visible faces that you choose. Do nothing to other faces. Non-nil `hlt-act-on-any-face-flag' means choose from among all visible faces. Nil means choose only from among visible faces used to highlight. When choosing faces, completion and cycling are available. During cycling, these keys with prefix `C-' act on the current face name\\: `C-mouse-2', `C-RET' - Choose current face candidate only `C-down' - Choose, then move to next prefix-completion candidate `C-up' - Choose, then move to previous prefix-completion candidate `C-next' - Choose, then move to next apropos-completion candidate `C-prior' - Choose, then move to previous apropos-completion candidate `\\[icicle-all-candidates-action]' - Choose *all* matching face names" (interactive `(,@(hlt-region-or-buffer-limits) ,(mapcar #'intern (icicle-choose-faces)))) ; An Icicles multi-command (dolist (face faces) (hlt-hide-default-face start end face))))) (defun icicle-cmd2-after-load-wid-edit+ () "Things to do for `icicles-cmd2.el' after loading `wid-edit+.el'." ;; Save vanilla `color' widget as `icicle-ORIG-color' widget, for restoring when you quit Icicle mode. (unless (get 'icicle-ORIG-color 'widget-type) (put 'icicle-ORIG-color 'widget-type (get 'color 'widget-type)) (put 'icicle-ORIG-color 'widget-documentation (get 'color 'widget-documentation))) (define-widget 'icicle-color 'editable-field "Icicles version of the `color' widget. `M-TAB' completes the color name using Icicles WYSIWYG completion. See `icicle-widget-color-complete'." :format "%{%t%}: %v (%{sample%})\n" :size (1+ (apply #'max (mapcar #'length (x-defined-colors)))) :tag "Color" :match 'widgetp-color-match :validate 'widgetp-color-validate :value "black" :complete 'icicle-widget-color-complete :sample-face-get 'widget-color-sample-face-get :notify 'widget-color-notify :action 'widget-color-action) ;; Emacs < 24 defines `widget-color-complete'. Save that as `icicle-ORIG-*'. Do nothing for Emacs 24+. (unless (or (> emacs-major-version 23) (fboundp 'icicle-ORIG-widget-color-complete)) (require 'wid-edit) (when (fboundp 'widget-color-complete) (fset 'icicle-ORIG-widget-color-complete (symbol-function 'widget-color-complete)))) (defun icicle-widget-color-complete (widget) "Complete the color name in `color' widget WIDGET. If you use Icicles, then you get Icicles completion (apropos, progressive, complementing...). If, in addition, option `icicle-WYSIWYG-Completions-flag' is non-nil: * Completion is WYSIWYG. Each candidate is a color name followed by its RGB value as a color swatch. You can complete against any of this text (name, RGB, or part or all of both). Or you can enter an RGB value that has no color name without completing. * With a prefix arg, when you choose a completion its RGB value is used, not the color name. If, in addition, option `icicle-add-proxy-candidates-flag' is non-nil and library `palette.el' or `eyedropper.el' is available, then the following Icicles proxy candidates are available during completion: * `*copied foreground*' - last copied foreground, if available * `*copied background*' - last copied background, if available * `*mouse-2 foreground*' - foreground where you click `mouse-2' * `*mouse-2 background*' - background where you click `mouse-2' * `*point foreground*' - foreground under the text cursor * `*point background*' - background under the text cursor \(You can copy a color using eyedropper commands such as `eyedrop-pick-foreground-at-mouse'.) In addition, the names of user options (variables) whose custom type is `color' are also proxy candidates, but with `'' as a prefix and suffix. So, for example, option `icicle-region-background' appears as proxy color candidate `'icicle-region-background''. If you choose such a candidate then (only) the variable's value (color name or RGB) is returned. As always in Icicles, you can toggle the use of proxy candidates using `\\\\[icicle-toggle-proxy-candidates]' in the minibuffer. See `icicle-read-color-wysiwyg' for more information." (let* ((prefix (buffer-substring-no-properties (widget-field-start widget) (point))) ;; Free variables here: `eyedrop-picked-foreground', `eyedrop-picked-background'. ;; They are defined in library `palette.el' or library `eyedropper.el'. (colors (if (fboundp 'hexrgb-defined-colors-alist) ; Defined in `hexrgb.el'. (if (fboundp 'eyedrop-foreground-at-point) (append (and eyedrop-picked-foreground '(("*copied foreground*"))) (and eyedrop-picked-background '(("*copied background*"))) '(("*mouse-2 foreground*") ("*mouse-2 background*") ("*point foreground*") ("*point background*")) (hexrgb-defined-colors-alist)) (hexrgb-defined-colors-alist)) (mapcar #'list (x-defined-colors)))) (completion (try-completion prefix colors))) (cond ((null completion) (widgetp-remove-Completions) (error "No completion for \"%s\"" prefix)) ((eq completion t) (widgetp-remove-Completions) (message "Sole completion")) ((and (not (string-equal prefix completion)) (or (not (boundp 'icicle-mode)) (not icicle-mode))) (insert-and-inherit (substring completion (length prefix))) (message "Making completion list...") (widgetp-display-Completions prefix colors) (message "Completed, but not unique")) ((or (not (boundp 'icicle-mode)) (not icicle-mode)) (message "Making completion list...") (widgetp-display-Completions prefix colors)) (t (let* ((enable-recursive-minibuffers (active-minibuffer-window)) (icicle-top-level-when-sole-completion-flag t) (icicle-show-Completions-initially-flag t) (icicle-unpropertize-completion-result-flag t) (completion-ignore-case t) (field (widget-field-find (point))) (beg (widget-field-start field)) (end (max (point) (if (fboundp 'widget-field-text-end) (widget-field-text-end field) (widget-field-end field)))) (color (if (and (fboundp 'icicle-read-color-wysiwyg) icicle-WYSIWYG-Completions-flag) (icicle-read-color-wysiwyg (if current-prefix-arg 99 0) "Color (name or #R+G+B+): " prefix 'MSGP) (completing-read "Color: " colors nil nil prefix)))) (delete-region beg end) (insert-and-inherit color) (message "Completed")))))) ) (defun icicle-cmd2-after-load-palette () "Things to do for `icicles-cmd2.el' after loading `palette.el'." (icicle-define-command icicle-pick-color-by-name ; Bound to `c' in color palette. "Set the current color to a color you name. Instead of a color name, you can use an RGB string #XXXXXXXXXXXX, where each X is a hex digit. The number of Xs must be a multiple of 3, with the same number of Xs for each of red, green, and blue. If you enter an empty color name, then a color is picked randomly. The new current color is returned." ; Doc string icicle-pick-color-by-name-action ; Action function "Color (name or #R+G+B+): " ; `completing-read' arguments (hexrgb-defined-colors-alist) nil nil nil nil nil nil ((completion-ignore-case t))) ; Bindings (defun icicle-pick-color-by-name-action (color) "Action function for `icicle-pick-color-by-name'." (if (string= "" color) (let* ((colors (hexrgb-defined-colors)) (rand (random (length colors)))) ; Random color. (setq color (elt colors rand))) (let ((hex-string (hexrgb-rgb-hex-string-p color t))) (when (and hex-string (not (eq 0 hex-string))) (setq color (concat "#" color))) ; Add #. (unless (or hex-string (if (fboundp 'test-completion) ; Not defined in Emacs 20. (test-completion color (hexrgb-defined-colors-alist)) (try-completion color (hexrgb-defined-colors-alist)))) (icicle-user-error "No such color: %S" color)) (setq color (hexrgb-color-name-to-hex color))) (setq palette-last-color palette-current-color) (save-selected-window (setq color (hexrgb-color-name-to-hex color)) ; Needed if not interactive. (palette-set-current-color color) (palette-where-is-color color) (palette-brightness-scale) (palette-swatch)) palette-current-color)) (define-key palette-mode-map (icicle-kbd "c") 'icicle-pick-color-by-name) (define-key palette-popup-map [pick-color-by-name] ; Use same name as in `palette.el'. `(menu-item "Choose Color By Name" icicle-pick-color-by-name :help "Set the current color to a color you name")) ) (defun icicle-cmd2-after-load-synonyms () "Things to do for `icicles-cmd2.el' after loading `synonyms.el'." (defalias 'synonyms 'icicle-synonyms) (icicle-define-command icicle-synonyms ; Command "Show synonyms that match a regular expression (e.g. a word or phrase). You are prompted for the regexp. By default, it is the text of the region, if it is active and `transient-mark-mode' is enabled, or the nearest word to the cursor, if not. Option `synonyms-match-more-flag' non-nil means additional thesaurus entries can be matched. This can be more time-consuming. It means two things: 1) Input can match parts of synonyms, in addition to whole synonyms. 2) All synonyms are shown, even if input matches a thesaurus entry. Option `synonyms-append-result-flag' non-nil means to append search result to previous results. A prefix argument toggles the meaning of each of those options for the duration of the command: If `C-u' or `C-u C-u', then toggle `synonyms-match-more-flag'. If negative or `C-u C-u', then toggle `synonyms-append-result-flag'. \(`C-u C-u' thus means toggle both options.) When called from Lisp, optional second argument REGEXP is the regexp to match (no prompting)." ; Doc string synonyms-action ; Action function, defined in `synonyms.el'. "Show synonyms for word or phrase (regexp): " ; `completing-read' arguments synonyms-obarray nil nil nil 'synonyms-history (synonyms-default-regexp) nil ((num-arg (prefix-numeric-value current-prefix-arg)) ; Bindings (morep (eq synonyms-match-more-flag (atom current-prefix-arg))) (appendp (eq synonyms-append-result-flag (and (wholenump num-arg) (/= 16 num-arg)))) (icicle-sort-function 'icicle-case-insensitive-string-less-p)) (synonyms-ensure-synonyms-read-from-cache)) ; Fill `synonyms-obarray' initially, for completion. (icicle-define-command icicle-insert-thesaurus-entry ; Command name "Insert an entry from a thesaurus. Library `synonyms.el' is needed for this. If you have never used command `synonyms' before, then the first use of `icicle-insert-thesaurus-entry' will take a while, because it will build a cache file of synonyms that are used for completion. See `synonyms.el'. Remember that you can use `\\\ \\[icicle-cycle-incremental-completion] to toggle incremental completion." ; Doc string icicle-insert-thesaurus-entry-cand-fn ; Action function "Thesaurus entry to match: " synonyms-obarray ; `completing-read' args nil t nil 'icicle-dictionary-history nil nil ((icicle-track-pt (point))) ; Bindings (progn ; First code (unless (or (boundp 'synonyms-obarray) (require 'synonyms nil t)) (icicle-user-error "You must first load library `synonyms.el'")) (synonyms-ensure-synonyms-read-from-cache)) nil ; Undo code (when (window-live-p icicle-orig-window) ; Last code (select-window icicle-orig-window) (select-frame-set-input-focus (selected-frame)) (goto-char icicle-track-pt))) ;; Free vars here: `icicle-orig-buff' is bound in `icicle-insert-thesaurus-entry'. (defun icicle-insert-thesaurus-entry-cand-fn (string) "Action function for `icicle-insert-thesaurus-entry'. Insert STRING, followed by a space, at position TRACK-PT of buffer ORIG-BUFF." (set-buffer icicle-orig-buff) (goto-char icicle-track-pt) (insert string " ") (setq icicle-track-pt (point)) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) (with-current-buffer (window-buffer (minibuffer-window)) (icicle-clear-minibuffer)) (save-selected-window (icicle-remove-Completions-window))) (defun icicle-complete-thesaurus-entry (word) ; Bound to `C-c /' in Icicle mode. "Complete WORD to an entry from a thesaurus. The default value of WORD is the word at the cursor. Library `synonyms.el' is needed for this. If you have never used command `synonyms' before, then the first use of `icicle-insert-thesaurus-entry' will take a while, because it will build a cache file of synonyms that are used for completion. See `synonyms.el'." (interactive (list (word-at-point))) (unless word (icicle-user-error "No word at point to complete")) (unless (or (boundp 'synonyms-obarray) (require 'synonyms nil t)) (icicle-user-error "You must first load library `synonyms.el'")) (synonyms-ensure-synonyms-read-from-cache) (when (and (looking-at "\\b") (not (looking-at "\\s-"))) (forward-word 1)) (delete-region (progn (forward-word -1) (point)) (progn (forward-word 1) (point))) (insert (completing-read "Thesaurus entry to match: " synonyms-obarray nil nil word 'icicle-dictionary-history word)) (unless (looking-at "\\s-") (insert " "))) ) ;;; Library `Bookmark+' - Icicles multi-commands. ;;; (eval-after-load "bookmark+" '(icicle-cmd2-after-load-bookmark+)) ;;; Library `hexrgb.el' - Icicles multi-commands. ;;; (eval-after-load "hexrgb" '(icicle-cmd2-after-load-hexrgb)) ;;; Library `highlight.el' - Icicles multi-commands. Emacs 21+. ;;; (eval-after-load "highlight" '(icicle-cmd2-after-load-highlight)) ;;; Library `palette.el' - Icicles multi-commands. ;;; (eval-after-load "palette" '(icicle-cmd2-after-load-palette)) ;;; Library `synonyms.el' - Icicles multi-commands. ;;; (eval-after-load "synonyms" '(icicle-cmd2-after-load-synonyms)) ;;; Library `wid-edit+.el' - Icicles function and widget. ;;; (eval-after-load "wid-edit+" '(icicle-cmd2-after-load-wid-edit+)) ;;(@* "Icicles Top-Level Commands, Part 2") ;;; Icicles Top-Level Commands, Part 2 ------------------------------- (defvar icicle-orig-font nil "Font of selected frame, before command.") (defvar icicle-orig-frame nil "Selected frame, before command.") (defvar icicle-orig-menu-bar nil "`menu-bar-lines' of selected frame, before command.") (defvar icicle-orig-pixelsize nil "Size of font of selected frame in pixels, before command.") (defvar icicle-orig-pointsize nil "Size of font of selected frame in points, before command.") (icicle-define-command icicle-font ; Command name "Change font of current frame." ; Doc string (lambda (font) (modify-frame-parameters icicle-orig-frame (list (cons 'font font)))) ; Action fn "Font: " ; `completing-read' args (let ((fonts ()) fws) (dolist (ft (x-list-fonts "*") fonts) ; Just avoiding two traversals, one to remove nil elts. (when (setq fws (icicle-font-w-orig-size ft)) (push fws fonts)))) ; Ignore nil entries. nil t nil (if (boundp 'font-name-history) 'font-name-history 'icicle-font-name-history) nil nil ((icicle-orig-frame (selected-frame)) ; Bindings (icicle-orig-font (frame-parameter nil 'font)) (icicle-orig-pixelsize (aref (x-decompose-font-name icicle-orig-font) xlfd-regexp-pixelsize-subnum)) (icicle-orig-pointsize (aref (x-decompose-font-name icicle-orig-font) xlfd-regexp-pointsize-subnum)) (icicle-orig-menu-bar (assq 'menu-bar-lines (frame-parameters icicle-orig-frame)))) ;; First code - remove menu-bar, to avoid Emacs bug that resizes frame. (modify-frame-parameters icicle-orig-frame (list '(menu-bar-lines . 0))) (modify-frame-parameters icicle-orig-frame ; Undo code. (list (cons 'font icicle-orig-font) icicle-orig-menu-bar)) (modify-frame-parameters icicle-orig-frame (list icicle-orig-menu-bar))) ; Last code. ;; Free var here: `icicle-orig-pixelsize' is bound in `icicle-font'. (defun icicle-font-w-orig-size (font) "Return a font like FONT, but with pixel size `icicle-orig-pixelsize'. Return nil if `x-decompose-font-name' returns nil for FONT. `icicle-orig-pixelsize' is the original pixel size for `icicle-font'." (let ((xlfd-fields (x-decompose-font-name font))) (if (not xlfd-fields) ; Can't handle such font names - return nil. nil (aset xlfd-fields xlfd-regexp-pixelsize-subnum icicle-orig-pixelsize) (aset xlfd-fields xlfd-regexp-pointsize-subnum icicle-orig-pointsize) (let* ((sized-font (x-compose-font-name xlfd-fields)) (font-info (and (or (> icicle-help-in-mode-line-delay 0) ; Only if user will see it. (and (boundp 'tooltip-mode) tooltip-mode)) (font-info sized-font))) (iii (if (< emacs-major-version 21) 3 2)) (help-string (if font-info (format "width: %s, height: %s, offset: %s, compose: %s" (aref font-info iii) (aref font-info (+ iii 1)) (aref font-info (+ iii 2)) (aref font-info (+ iii 3))) "Font is not yet loaded (used)"))) (icicle-candidate-short-help help-string sized-font) (list sized-font))))) (defvar icicle-named-colors () "Named colors.") (defvar icicle-info-buff nil "Info buffer before command was invoked.") (defvar icicle-info-window nil "Info window before command was invoked.") (defun icicle-Info-index (&optional topic) "Like vanilla `Info-index', but you can use multi-command keys `C-RET', `C-up' etc. Also, for Emacs 22 and later, completion candidates (index topics) for nodes already visited are highlighted with face `icicle-historical-candidate-other' if there are fewer matching candidates than `icicle-Info-visited-max-candidates'" ;; We allow an arg only for non-interactive use. E.g., `Info-virtual-index' calls (Info-index TOPIC). (interactive) (unless (and (featurep 'info) (eq major-mode 'Info-mode)) (icicle-user-error "You must be in Info mode to use this command")) (when (and (boundp 'Info-current-file) (equal Info-current-file "dir")) (icicle-user-error "The Info directory node has no index; use `m' to select a manual")) (let ((icicle-info-buff (current-buffer)) (icicle-info-window (selected-window)) (icicle-candidate-action-fn 'icicle-Info-index-action) (C-x-m (lookup-key minibuffer-local-completion-map "\C-xm")) ;; These next 3 are used as FREE vars ;; in `icicle-Info-node-is-indexed-by-topic' and `icicle-display-candidates-in-Completions' (icicle-Info-index-nodes (and (fboundp 'Info-index-nodes) (Info-index-nodes))) ; Emacs 22+ (icicle-Info-manual Info-current-file) (icicle-Info-hist-list (and (boundp 'Info-history-list) Info-history-list)) ; Emacs 22+ (icicle-transform-function 'icicle-remove-duplicates)) ; See Emacs bug #12705. (when (and (require 'bookmark+ nil t) (fboundp 'icicle-bookmark-info-other-window)) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") 'icicle-bookmark-info-other-window)) (unwind-protect (if topic (icicle-ORIG-Info-index topic) (call-interactively (if (> emacs-major-version 21) 'icicle-ORIG-Info-index 'icicle-Info-index-20))) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") C-x-m)))) ;; Thx to Tamas Patrovics for this Emacs 20 version. ;; (defun icicle-Info-index-20 () "Like `Info-index', but you can use completion for the index topic." (interactive) (let* ((symb (or (and (fboundp 'symbol-nearest-point) ; `icicles-opt.el' soft-requires `thingatpt+.el'. (symbol-nearest-point)) (symbol-at-point))) (topic (and symb (symbol-name symb)))) (icicle-ORIG-Info-index "") (let ((pattern "\\* +\\([^:]*\\):.") (candidates ())) (goto-char (point-min)) (while (re-search-forward pattern nil t) (push (list (match-string 1)) candidates)) (icicle-ORIG-Info-index (completing-read "Index topic: " candidates nil t nil nil topic))))) ;; Free vars here: `icicle-info-buff' and `icicle-info-window' are bound in `icicle-Info-index'. (defun icicle-Info-index-action (topic) "Completion action function for `icicle-Info-index'." (let ((minibuf-win (selected-window))) (set-buffer icicle-info-buff) (select-window icicle-info-window) (icicle-ORIG-Info-index topic) (select-window minibuf-win))) (defun icicle-Info-menu (&optional menu-item fork) "Go to a menu node. See `icicle-ORIG-Info-menu'." (interactive) (if menu-item (if (< emacs-major-version 21) (icicle-ORIG-Info-menu menu-item) (icicle-ORIG-Info-menu menu-item fork)) (call-interactively #'icicle-Info-menu-cmd))) ;; Free vars here: `Info-menu-entry-name-re' is bound in `info.el'. (icicle-define-command icicle-Info-menu-cmd "Go to an Info menu node." ; Doc string (lambda (m) (icicle-Info-goto-node-no-search (cdr (funcall icicle-get-alist-candidate-function m)))) ; Action "Menu item: " icicle-candidates-alist ; `completing-read' args nil t nil nil (save-excursion (goto-char (point-min)) (unless (search-forward "\n* menu:" nil t) (icicle-user-error "No menu in this node")) (setq menu-eol (point)) (and (< menu-eol opoint) (save-excursion (goto-char opoint) (end-of-line) (and (re-search-backward (concat "\n\\* +\\(" (if (boundp 'Info-menu-entry-name-re) Info-menu-entry-name-re "[^:\t\n]*") "\\):") menu-eol t) (match-string-no-properties 1))))) nil ((opoint (point)) ; Bindings (completion-ignore-case t) (case-fold-search t) (icicle-sort-comparer nil) (icicle-whole-candidate-as-text-prop-p t) (Info-complete-menu-buffer (current-buffer)) (icicle-candidates-alist (mapcar (lambda (m) (cons m (Info-extract-menu-item m))) (reverse (all-completions "" 'Info-complete-menu-item)))) menu-eol)) (defun icicle-Info-goto-node-no-search (nodename &optional arg) "Go to Info node named NODENAME. Completion is available for node names in the current Info file. With a prefix argument: * Plain `C-u' means prepend the current Info file name (manual name) to each node name. For example: `(emacs)Paragraphs' instead of just `Paragraphs'. * A negative numeric prefix arg (e.g. `C--') means present candidate nodes in book order, and limit them to the current node and the nodes in the rest of the book following it. In this case, the first candidate is `..', which means go up. * A non-negative numeric prefix arg (e.g. `C-1') means show the target node in a new Info buffer (not available prior to Emacs 21). With no prefix argument, or with a non-negative prefix arg, you can use `C-,' to choose how to sort completion candidates. By default, they are sorted alphabetically. If you use library `Bookmark+' then you can use `C-x m' during completion to jump to Info bookmarks. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active: `C-mouse-2', `C-RET' - Go to current completion candidate (node) `C-down' - Go to next completion candidate `C-up' - Go to previous completion candidate `C-next' - Go to next apropos-completion candidate `C-prior' - Go to previous apropos-completion candidate `C-end' - Go to next prefix-completion candidate `C-home' - Go to previous prefix-completion candidate Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'. From Lisp code: Argument NODENAME has the form NODE or (FILE)NODE-IN-FILE, where: NODE names a node in the current Info file or one of its subfiles. FILE names an Info file containing node NODE-IN-FILE. If optional argument ARG is a string, then show the node in a new Info buffer named `*info-ARG*'." (interactive (let* ((icicle-info-buff (current-buffer)) (icicle-info-window (selected-window)) (icicle-candidate-action-fn 'icicle-Info-goto-node-action) (icicle-pref-arg current-prefix-arg) (icicle-Info-only-rest-of-book-p (< (prefix-numeric-value current-prefix-arg) 0)) (icicle-sort-orders-alist (cons '("in book order") icicle-sort-orders-alist)) (icicle-sort-comparer (and (not icicle-Info-only-rest-of-book-p) icicle-sort-comparer))) (list (icicle-Info-read-node-name "Go to node: " (consp current-prefix-arg)) current-prefix-arg))) (icicle-Info-goto-node-1 nodename arg)) (defun icicle-Info-goto-node-1 (nodename &optional arg) "Same as vanilla `Info-goto-node', but go up for `..' pseudo-node." (if (and (string= nodename "..") (Info-check-pointer "up")) (Info-up) (if (> emacs-major-version 20) (icicle-ORIG-Info-goto-node nodename (natnump arg)) (icicle-ORIG-Info-goto-node nodename)))) (defun icicle-Info-read-node-name (prompt &optional include-file-p) "Read an Info node name, prompting with PROMPT. Non-nil optional arg INCLUDE-FILE-P means include current Info file in the name." (let ((C-x-m (lookup-key minibuffer-local-completion-map "\C-xm"))) (when (and (require 'bookmark+ nil t) (fboundp 'icicle-bookmark-info-other-window)) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") 'icicle-bookmark-info-other-window)) (unwind-protect (let* ((completion-ignore-case t) (Info-read-node-completion-table (icicle-Info-build-node-completions include-file-p)) (nodename (completing-read prompt 'Info-read-node-name-1 nil nil))) (if (equal nodename "") (icicle-Info-read-node-name prompt include-file-p) ; Empty input - read again. nodename)) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") C-x-m)))) (defun icicle-Info-build-node-completions (&optional include-file-p) "Build completions list for Info nodes. This takes `icicle-Info-only-rest-of-book-p' into account. Non-nil INCLUDE-FILE-P means include current Info file in the name." (icicle-highlight-lighter) (if (or (not icicle-Info-only-rest-of-book-p) (string= Info-current-node "Top")) (icicle-Info-build-node-completions-1 include-file-p) (cons '("..") (member (list Info-current-node) (icicle-Info-build-node-completions-1 include-file-p))))) (defun icicle-Info-build-node-completions-1 (&optional include-file-p) "Helper function for `icicle-Info-build-node-completions'. Use `Info-build-node-completions' to build node list for completion. Non-nil INCLUDE-FILE-P means include current Info file in the name. Remove pseudo-node `*'. (This just fixes a bug in Emacs 21 and 22.1.)" (let ((comps (Info-build-node-completions))) ;; Emacs 24 after 2012-12-18: `Info-build-node-completions' no longer reverses the node order. (when (or (< emacs-major-version 24) (and (= emacs-major-version 24) (< emacs-minor-version 3))) (setq comps (reverse comps))) (when (equal (car comps) '("*")) (setq comps (cdr comps))) (if include-file-p (let ((file (concat "(" (cond ((stringp Info-current-file) (replace-regexp-in-string "%" "%%" (file-name-nondirectory Info-current-file))) (Info-current-file (format "*%S*" Info-current-file)) (t "")) ")"))) (mapcar (lambda (node) (cons (concat file (car node)) (cdr node))) comps)) comps))) ;; Free vars here: ;; `icicle-info-buff' and `icicle-info-window' are bound in `icicle-Info-goto-node(-no-search|of-content)'. ;; `Info-read-node-completion-table' is bound in `info.el'. (defun icicle-Info-goto-node-action (node) "Completion action function for `icicle-Info-goto-node'." (set-buffer icicle-info-buff) (select-window icicle-info-window) (icicle-Info-goto-node-1 node icicle-pref-arg) (when icicle-Info-only-rest-of-book-p (setq Info-read-node-completion-table (icicle-Info-build-node-completions) icicle-current-input "") (icicle-complete-again-update) (if (and (string= Info-current-node "Top") Info-history) (let* ((hist Info-history) (last (cadr (car hist)))) (while (string= "Top" (cadr (car hist))) (pop hist)) (setq icicle-candidate-nb (1- (length (member (list (cadr (car hist))) (icicle-Info-build-node-completions-1)))))) (setq icicle-candidate-nb 1)) ; Skip `..'. ;; $$$$$$ Maybe factor this out. Same thing in several places. However, here we don't do ;; `icicle-maybe-sort-and-strip-candidates' at beginning of first clause. (cond ((and icicle-completion-candidates (cdr icicle-completion-candidates)) ; > 1 left. (message "Displaying completion candidates...") (save-selected-window (icicle-display-candidates-in-Completions)) (with-current-buffer "*Completions*" (goto-char (icicle-start-of-candidates-in-Completions)) (icicle-move-to-next-completion (mod icicle-candidate-nb (length icicle-completion-candidates))) (set-window-point (get-buffer-window "*Completions*" 0) (point)) (setq icicle-last-completion-candidate (icicle-current-completion-in-Completions)) (set-buffer-modified-p nil))) (icicle-completion-candidates ; Single candidate left (save-selected-window (icicle-remove-Completions-window)) (let ((completion (icicle-transform-multi-completion (car icicle-completion-candidates)))) (select-window (active-minibuffer-window)) (with-current-buffer (window-buffer) ; Need if `*Completions*' redirected to minibuffer. (goto-char (icicle-minibuffer-prompt-end)) (icicle-clear-minibuffer) (insert (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member completion icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-file-name-directory-w-default icicle-current-input) "") completion)))) (t ; No candidates left (select-window (active-minibuffer-window)) (with-current-buffer (window-buffer) ; Needed if `*Completions*' redirected to minibuffer. (goto-char (icicle-minibuffer-prompt-end)) (icicle-clear-minibuffer))))) (select-window (active-minibuffer-window)) (select-frame-set-input-focus (selected-frame))) (when (fboundp 'clone-buffer) ; Emacs 22+ (defun icicle-Info-goto-node-of-content (nodename &optional arg) "Go to Info node whose node name or content matches your input. Candidate node names are those in the current Info file. With a prefix argument: * Plain `C-u' means prepend the current Info file name (manual name) to each node name. For example: `(emacs)Paragraphs' instead of just `Paragraphs'. * A negative numeric prefix arg (e.g. `C--') means present candidate nodes in book order, and limit them to the current node and the nodes in the rest of the book following it. In this case, the first candidate is `..', which means go up. * A non-negative numeric prefix arg (e.g. `C-1') means show the target node in a new Info buffer. With no prefix argument, or with a non-negative prefix arg, you can use `C-,' to choose how to sort completion candidates (node names). By default, they are sorted alphabetically. Completion candidates are two-part multi-completions, with the second part optional. If both parts are present they are separated by `icicle-list-join-string' (\"^G^J\", by default). The first part is matched as a regexp against a node name. The second part is matched as a regexp against the node content. Candidates that do not match are filtered out. When matching node content, Icicles just looks for a single match. Visiting the node does not move to that match or to any other match. Matching is used only to filter candidate files. However, if your input includes a content-matching part and it matches, that part is automatically added to the Isearch regexp history, `regexp-search-ring' whenever you hit `S-TAB' to complete. This means that when you visit the node you can immediately search for matches using `C-M-s' or `C-M-r'. Your minibuffer input can match a node name or content, or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example: To match `foo' against node names, use input `foo'. To match `bar' against node contents, use input `C-M-j bar'. To match both names and content, use input `foo C-M-j bar'. Only the matching node names are shown in buffer `*Completions*', and only the chosen name is returned. The actual content matches are unimportant anyway: content matching is used only to filter the candidates. If your input does not include a content-matching part then this command acts similar to `icicle-Info-goto-node-no-search'. If your input includes a content-matching part then all nodes matching the name part of your input (or all, if no name part) are searched. As you would expect, content matching can be costly in time, even though it can be quite helpful. Use name matching to narrow the set of nodes that must be visited to search their contents. If you use library `Bookmark+' then you can use `C-x m' during completion to jump to Info bookmarks. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active: `C-mouse-2', `C-RET' - Go to current completion candidate (node) `C-down' - Go to next completion candidate `C-up' - Go to previous completion candidate `C-next' - Go to next apropos-completion candidate `C-prior' - Go to previous apropos-completion candidate `C-end' - Go to next prefix-completion candidate `C-home' - Go to previous prefix-completion candidate Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'. From Lisp code: Argument NODENAME has the form NODE or (FILE)NODE-IN-FILE, where: NODE names a node in the current Info file or one of its subfiles. FILE names an Info file containing node NODE-IN-FILE. If optional argument ARG is a string, then show the node in a new Info buffer named `*info-ARG*'." (interactive (let* ((icicle-info-buff (current-buffer)) (icicle-info-window (selected-window)) (icicle-candidate-action-fn 'icicle-Info-goto-node-action) (icicle-pref-arg current-prefix-arg) ; For `icicle-Info-*-action'. (icicle-Info-only-rest-of-book-p (< (prefix-numeric-value current-prefix-arg) 0)) (icicle-sort-orders-alist (cons '("in book order") icicle-sort-orders-alist)) (icicle-sort-comparer (and (not icicle-Info-only-rest-of-book-p) icicle-sort-comparer)) (icicle-multi-completing-p t) ;; Bind `icicle-apropos-complete-match-fn' to nil to prevent automatic input matching ;; in `icicle-unsorted-apropos-candidates' etc., because `icicle-Info-multi-read-node-name' ;; does everything. (icicle-apropos-complete-match-fn nil) (icicle-last-apropos-complete-match-fn 'icicle-Info-apropos-complete-match)) (list (icicle-Info-read-node-of-content "Go to node: " (consp current-prefix-arg)) current-prefix-arg))) (icicle-Info-goto-node-1 nodename arg)) (defun icicle-Info-apropos-complete-match (input node) "Match fn for progressive completion with `icicle-Info-goto-node-of-content'. Return non-nil if the current multi-completion INPUT matches NODE. NODE is an Info node name. If INPUT contains a content-matching part then it too must match." (lexical-let* ((node-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion input))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion input)))) (and (icicle-string-match-p node-pat node) (or (equal "" content-pat) (icicle-Info-content-match content-pat node))))) (defun icicle-Info-content-match (content-pat node) "Return non-nil if CONTENT-PAT matches content of NODE. CONTENT-PAT is a regexp. NODE is an Info node name." ;; Gross hack. If `C-u' was used then NODE has form `(FILE)NODE', ;; and we need to remove the `(FILE)', for arg to `Info-find-node'. (when (and (consp icicle-pref-arg) (string-match "^([^)]+)\\(.+\\)$" node)) (setq node (match-string 1 node))) (let* ((Info-history ()) ; Do not record the node searched. (Info-history-list ()) (found (with-current-buffer Info-complete-menu-buffer (when (and (string= node "..") (Info-check-pointer "up")) (setq node (Info-extract-pointer "up"))) ;; `icicle-Info-tag-table-posn' FREE HERE, defined in `icicle-Info-read-node-of-content'. (set-marker Info-tag-table-marker icicle-Info-tag-table-posn) (if (and (featurep 'info+) (> emacs-major-version 21)) (Info-find-node Info-current-file node 'NO-BACK 'NOMSG) (Info-find-node Info-current-file node 'NO-BACK)) (goto-char (point-min)) (re-search-forward content-pat nil t)))) (when (and found ; Do not do it just because incrementally complete. (or (get this-command 'icicle-apropos-completing-command) (memq this-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) (isearch-update-ring content-pat 'REGEXP)) found)) (defun icicle-Info-read-node-of-content (prompt &optional include-file-p) "Read node name and content search string, prompting with PROMPT. See `icicle-Info-goto-node-of-content' for a description of the input. Non-nil optional arg INCLUDE-FILE-P means include current Info file in the name." (let ((C-x-m (lookup-key minibuffer-local-completion-map "\C-xm")) (Info-complete-menu-buffer (clone-buffer)) ;; Save the position for the current file (manual), so we can then set the (local) marker ;; to it when we visit the cloned buffer for the same file. (icicle-Info-tag-table-posn (marker-position Info-tag-table-marker))) (when (and (require 'bookmark+ nil t) (fboundp 'icicle-bookmark-info-other-window)) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") 'icicle-bookmark-info-other-window)) (unwind-protect (let* ((completion-ignore-case t) (Info-read-node-completion-table (icicle-Info-build-node-completions include-file-p)) (icicle-list-use-nth-parts '(1)) (nodename (icicle-transform-multi-completion (completing-read prompt 'icicle-Info-multi-read-node-name)))) (if (equal nodename "") (icicle-Info-read-node-of-content prompt include-file-p) ; Empty input - read again. nodename)) (kill-buffer Info-complete-menu-buffer) (define-key minibuffer-local-completion-map (icicle-kbd "C-x m") C-x-m)))) ;;;; $$$$$$$$ ;;;; This version is in effect what we'll use at first (it is equivalent to those below, which have ;;;; commented-out sections). It does not let users switch manuals by completing against the manual name. ;;;; It just uses the current manual. ;;;; ;;;; (defun icicle-Info-multi-read-node-name (strg pred completion-mode) ;;;; "Completion function for `icicle-Info-read-node-of-content'. ;;;; This is used as the value of `minibuffer-completion-table'." ;;;; (setq strg icicle-current-input) ;;;; (lexical-let* ((node-pat (let ((icicle-list-use-nth-parts '(1))) ;;;; (icicle-transform-multi-completion strg))) ;;;; (node-pat (if (memq icicle-current-completion-mode '(nil apropos)) ;;;; node-pat ;;;; (concat "^" node-pat))) ;;;; (content-pat (let ((icicle-list-use-nth-parts '(2))) ;;;; (icicle-transform-multi-completion strg))) ;;;; (nodes (mapcar #'car Info-read-node-completion-table)) ;;;; (nodes (icicle-remove-if-not (lambda (nod) ;;;; (icicle-string-match-p node-pat nod)) ;;;; nodes)) ;;;; (nodes (if (equal "" content-pat) ;;;; nodes ;;;; (icicle-remove-if-not ;;;; `(lambda (node) ;;;; (icicle-Info-content-match ',content-pat node)) ;;;; nodes)))) ;;;; (cond ((and (eq 'metadata completion-mode) (> emacs-major-version 23)) ;;;; '(metadata (category . info-node))) ;;;; (completion-mode nodes) ; `all-completions', `test-completion' ;;;; (t ;;;; (try-completion ; `try-completion' ;;;; strg (mapcar #'list nodes) (and pred (lambda (ss) (funcall pred ss)))))))) ) (when (fboundp 'completion-table-with-context) ; Emacs 23+. (defun icicle-Info-multi-read-node-name (strg pred completion-mode) "Completion function for `icicle-Info-read-node-of-content'. This is used as the value of `minibuffer-completion-table'." (unless strg (setq strg icicle-current-input)) (if (eq 'metadata completion-mode) '(metadata (category . info-node)) ; $$$$$$ Not used currently. (cond ;;; $$$$$$ Fix and add back later. This is the vanilla Emacs approach, which loses parens. ;;; ((string-match "\\`([^)]*\\'" strg) ; Incomplete file name: `(...' - complete it. ;;; (completion-table-with-context "(" ;;; (apply-partially ;;; 'completion-table-with-terminator ")" ;;; (apply-partially 'Info-read-node-name-2 ;;; Info-directory-list ;;; (mapcar 'car Info-suffix-list))) ;;; (substring strg 1) pred completion-mode)) ;;; ((string-match "\\`(\\([^)]+\\))" strg) ; A complete file name. Complete nodes in file. ;;; (let ((file0 (match-string 0 strg)) ;;; (file1 (match-string 1 strg)) ;;; (nodename (substring strg (match-end 0)))) ;;; (if (and (equal nodename "") (eq completion-mode 'lambda)) ;;; t ; Empty node name means "Top". ;;; (completion-table-with-context file0 ;;; (apply-partially (lambda (string pred action) ;;; (complete-with-action ;;; action ;;; (Info-build-node-completions ;;; (Info-find-file file1)) ;;; string pred))) ;;; nodename pred completion-mode)))) (t (lexical-let* ((node-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion strg))) (node-pat (if (memq icicle-current-completion-mode '(nil apropos)) node-pat (concat "^" node-pat))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion strg))) (nodes (mapcar #'car Info-read-node-completion-table)) (nodes (icicle-remove-if-not `(lambda (nod) (icicle-string-match-p ',node-pat nod)) nodes)) (nodes (if (equal "" content-pat) nodes (icicle-remove-if-not `(lambda (nod) (icicle-Info-content-match ',content-pat nod)) nodes)))) (if completion-mode ; `all-completions', `test-completion' nodes (try-completion ; `try-completion' strg (mapcar #'list nodes) (and pred (lambda (ss) (funcall pred ss)))))))))) ) (when (= emacs-major-version 22) ; Emacs 22. (defun icicle-Info-multi-read-node-name (strg pred completion-mode) "Completion function for `icicle-Info-read-node-of-content'. This is used as the value of `minibuffer-completion-table'." (setq strg icicle-current-input) (cond ;;; $$$$$$ Fix and add back later. This is the vanilla Emacs approach, which loses parens (so broken). ;;; ((string-match "\\`([^)]*\\'" strg) ; Incomplete file name: `(...' - complete it. ;;; (let ((file (substring strg 1))) ;;; (cond ((eq completion-mode nil) ;;; (let ((comp (try-completion ;;; file 'Info-read-node-name-2 (cons Info-directory-list ;;; (mapcar 'car Info-suffix-list))))) ;;; (cond ((eq comp t) (concat strg ")")) ;;; (comp (concat "(" comp))))) ;;; ((eq completion-mode t) ;;; (all-completions file 'Info-read-node-name-2 (cons Info-directory-list ;;; (mapcar 'car Info-suffix-list)))) ;;; (t nil)))) ;;; ((string-match "\\`(" strg) ; A complete file name. Any node is fair game. ;;; (cond ((eq completion-mode nil) strg) ;;; ((eq completion-mode t) nil) ;;; (t t))) (t (lexical-let* ((node-pat (let ((icicle-list-use-nth-parts '(1))) (icicle-transform-multi-completion strg))) (node-pat (if (memq icicle-current-completion-mode '(nil apropos)) node-pat (concat "^" node-pat))) (content-pat (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion strg))) (nodes (mapcar #'car Info-read-node-completion-table)) (nodes (icicle-remove-if-not `(lambda (nod) (icicle-string-match-p ',node-pat nod)) nodes)) (nodes (if (equal "" content-pat) nodes (icicle-remove-if-not `(lambda (nod) (icicle-Info-content-match ',content-pat nod)) nodes)))) (if completion-mode ; `all-completions', `test-completion' nodes (try-completion ; `try-completion' strg (mapcar #'list nodes) (and pred (lambda (ss) (funcall pred ss))))))))) ) (defalias 'icicle-Info-goto-node (if (fboundp 'icicle-Info-goto-node-of-content) ; Emacs 22+ 'icicle-Info-goto-node-of-content 'icicle-Info-goto-node-no-search)) (when (> emacs-major-version 21) (defun icicle-Info-virtual-book (nodeset) "Open Info on a virtual book of saved Info nodes. You need library `info+.el' to use this command. With a prefix arg, you are prompted to choose a persistent saved completion set from `icicle-saved-completion-sets'. The set you choose should be a set of saved Info node names. With no prefix arg, use `icicle-saved-completion-candidates', which should be a set of Info node names. If that is empty, then use `Info-saved-nodes'. Non-interactively, argument NODESET is a list of Info node names." (interactive (progn (unless (and (require 'info+ nil t) (fboundp 'Info-virtual-book)) (icicle-user-error "You need library `info+.el' for this command")) (list (if (not current-prefix-arg) "Virtual Book" (save-selected-window (completing-read "Saved Info node set: " icicle-saved-completion-sets nil t nil 'icicle-completion-set-history)))))) (let ((nodes (and (consp nodeset) nodeset))) ; (), if interactive - NODESET is a string then. (when (interactive-p) (if (not current-prefix-arg) (setq nodes icicle-saved-completion-candidates) (let ((file-name (cdr (assoc nodeset icicle-saved-completion-sets)))) (unless (icicle-file-readable-p file-name) (error "Cannot read cache file `%s'" file-name)) (let ((list-buf (find-file-noselect file-name 'nowarn 'raw))) (unwind-protect (condition-case icicle-Info-virtual-book (when (listp (setq nodes (read list-buf))) (message "Set `%s' read from file `%s'" nodeset file-name)) (error (error "Bad cache file. %s" (error-message-string icicle-Info-virtual-book)))) (kill-buffer list-buf)) (unless (consp nodes) (error "Bad data in cache file `%s'" file-name)))))) (unless nodes (setq nodes Info-saved-nodes)) ; In `info+.el'. (unless (and nodes (stringp (car nodes))) (error "No saved Info nodes")) ; Minimal check. (unless (stringp nodeset) (setq nodeset "Virtual Book")) ; Non-interactive - NODESET is a list. (Info-virtual-book nodeset nodes)))) (icicle-define-command icicle-where-is ; Command name "Show keyboard/menu/mouse sequences that invoke specified command. This is a multi-command version of `where-is'. With no prefix argument, only commands actually bound to keys are completion candidates. With a prefix argument, all commands are candidates. NOTE: This is a significant difference from vanilla `where-is', which shows all commands as candidates, even those that are not bound. With a plain (non-numeric) prefix argument, `C-u', insert the message in the current buffer. (This is the same for vanilla `where-is'.) By default, Icicle mode remaps all key sequences that are normally bound to `where-is' to `icicle-where-is'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." ; Doc string (lambda (x) (let ((symb (intern-soft x))) ; Action function (where-is symb (and pref-arg (consp pref-arg))))) (if pref-arg "Where is command: " "Where is bound command: ") obarray (and icompletep pred) t nil nil ; `completing-read' args (let ((fn (or (and (fboundp 'tap-symbol-nearest-point) ; Defined in `thingatpt+.el'. (tap-symbol-nearest-point)) (function-called-at-point)))) (and fn (symbol-name fn))) t ((pref-arg current-prefix-arg) ; Bindings (pred (if pref-arg (lambda (cand) (unless (symbolp cand) (setq cand (intern cand))) (commandp cand)) (lambda (cand) (unless (symbolp cand) (setq cand (intern cand))) (with-current-buffer icicle-orig-buff (and (commandp cand) (where-is-internal cand overriding-local-map 'non-ascii)))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-help-fn (lambda (cand) (with-current-buffer icicle-orig-buff (let* ((keys (where-is-internal (intern-soft cand) overriding-local-map)) (keys1 (mapconcat #'icicle-key-description keys "', `"))) (message (if (string= "" keys1) (format "`%s' is not on any key" cand) (format "`%s' is on `%s'" cand (icicle-propertize keys1 'face 'icicle-msg-emphasis)))) (sit-for 3))))) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "command"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "command"))))) (icicle-define-command icicle-vardoc ; Command name "Choose a variable description. Each candidate for completion is a variable name plus its documentation. They are separated by `icicle-list-join-string' \(\"^G^J\", by default). You can match an input regexp against the variable name or the documentation or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example, use input \"dired.*^G \[^^G]*list\" with `S-TAB' to match all variables whose names contain \"dired\" and whose documentation contains \"list\". Here, `[^^G]' matches any character except ^G, which includes newline. If you use `.*' here, instead, then only the first lines of doc strings are searched. With a prefix argument, use the same documentation that was gathered the last time `icicle-vardoc' was called. Use a prefix arg to save the time that would be needed to gather the documentation. You can use `C-$' during completion to toggle limiting the domain of initial candidates to functions that are commands (interactive). Remember that you can use `\\\ \\[icicle-cycle-incremental-completion] to toggle incremental completion. See also: `icicle-apropos-value'." ; Doc string icicle-doc-action ; Action function prompt ; `completing-read' args (let ((result (and pref-arg icicle-vardoc-last-initial-cand-set))) (unless result ; COLLECTION arg is an alist whose items are ((SYMB DOC)). (mapatoms (lambda (symb) ; Each completion candidate is a list of strings. (when (and (boundp symb) (or (wholenump (prefix-numeric-value pref-arg)) (user-variable-p symb))) (let ((doc (documentation-property symb 'variable-documentation))) (when (icicle-non-whitespace-string-p doc) (push (list (list (symbol-name symb) doc)) result)))))) (setq icicle-vardoc-last-initial-cand-set result)) result) nil nil nil 'icicle-doc-history nil nil ((prompt "VAR `C-M-j' DOC: ") ; Bindings (icicle-toggle-transforming-message "Filtering to user options is now %s") (icicle-transform-function nil) ; No transformation: all symbols. (icicle-last-transform-function (lambda (cands) ; `C-$': only options. (loop for cc in cands with symb do (setq symb (intern (icicle-transform-multi-completion cc))) if (user-variable-p symb) collect cc))) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering variable descriptions..."))) ;;; $$$$$$ (defun icicle-funvardoc-action (entry) ;;; "Action function for `icicle-vardoc', `icicle-fundoc', `icicle-plist'." ;;; (with-output-to-temp-buffer "*Help*" (princ entry))) (icicle-define-command icicle-fundoc ; Command name "Choose a function description. Each candidate for completion is a function name plus its documentation. They are separated by `icicle-list-join-string' \(\"^G^J\", by default). You can match an input regexp against the function name or the documentation or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. For example, use input \"dired.*^G \[^^G]*file\" with `S-TAB' to match all functions whose names contain \"dired\" and whose documentation contains \"file\". Here, `[^^G]' matches any character except ^G, which includes newline. If you use `.*' here, instead, then only the first lines of doc strings are searched. With a prefix argument, use the same documentation that was gathered the last time `icicle-fundoc' was called. Use a prefix arg to save the time that would be needed to gather the documentation. You can use `C-$' during completion to toggle limiting the domain of initial candidates to functions that are commands (interactive). Remember that you can use `\\\ \\[icicle-cycle-incremental-completion] to toggle incremental completion. See also: `icicle-apropos-value', using a negative prefix arg." ; Doc string icicle-doc-action ; Action function prompt ; `completing-read' args (let ((result (and pref-arg icicle-fundoc-last-initial-cand-set))) (unless result ; COLLECTION arg is an alist whose items are ((symb doc)). (mapatoms (lambda (symb) ; Each completion candidate is a list of strings. (when (fboundp symb) ;; Ignore symbols that produce errors. Example: In Emacs 20, `any', which is defalias'd ;; to `icicle-anything', raises this error: "Symbol's function definition is void: any". ;; This is caused by the `after' advice `ad-advised-docstring' that is defined by Emacs ;; itself for function `documentation'. It is not a problem for Emacs 22+. (let ((doc (condition-case nil (documentation symb) (error nil)))) (when (and doc (icicle-non-whitespace-string-p (icicle-fn-doc-minus-sig doc))) (push (list (list (symbol-name symb) doc)) result)))))) (setq icicle-fundoc-last-initial-cand-set result)) result) nil nil nil 'icicle-doc-history nil nil ((prompt "FUNC `C-M-j' DOC: ") ; Bindings (icicle-toggle-transforming-message "Filtering to commands is now %s") (icicle-transform-function nil) ; No transformation: all symbols. (icicle-last-transform-function (lambda (cands) ; `C-$': only commands. (loop for cc in cands with symb do (setq symb (intern (icicle-transform-multi-completion cc))) if (commandp symb) collect cc))) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering function descriptions..."))) (defun icicle-fn-doc-minus-sig (docstring) "Return DOCSTRING minus the function signature (usage info)." (let ((sig-p (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring))) (if sig-p (substring docstring 0 (match-beginning 0)) docstring))) (icicle-define-command icicle-plist ; Command name "Choose a symbol and its property list. Each candidate for completion is a symbol name plus its property list \(as a string). They are separated by `icicle-list-join-string' \(^G^J, by default). You can match an input regexp against the symbol name or the property list or both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. With a positive prefix argument, use the same initial set of candidates that were gathered the last time `icicle-plist' was called. Use a positive prefix arg to save the time that would be needed to gather the plists. With a negative prefix arg, do not pretty-print each property list, in buffers `*Help* and `*Completions*'. Generation of the complete set of candidates is about twice as fast when not pretty-printed, but the time to match your input and display candidates is the same, and the match-and-display time for empty input is much longer than the generation time. The time to repeat (positive prefix arg) is the same, whether or not candidates were pretty-printed the first time. Note: Plists are never pretty-printed for Emacs 20, because that seems to cause an Emacs crash. You can use `C-$' during completion to toggle limiting the domain of initial candidates to functions that are commands (interactive). Remember that you can use `\\\ \\[icicle-cycle-incremental-completion] to toggle incremental completion. See also: `icicle-apropos-value', using a positive prefix arg." ; Doc string icicle-doc-action ; Action function prompt ; `completing-read' args (let ((result (and pref-arg (wholenump (prefix-numeric-value pref-arg)) icicle-plist-last-initial-cand-set))) (unless result ; COLLECTION arg: an alist with items ((symb plist-string)) (mapatoms (lambda (symb) ; Each completion candidate is a list of strings. (condition-case nil ; Ignore symbols that produce errors. (let ((plist (symbol-plist symb))) (when plist (push (list (list (symbol-name symb) (if (or (< (prefix-numeric-value pref-arg) 0) (< emacs-major-version 21)) ; Emacs 20 crash if pprint. (format "%s" plist) (pp-to-string plist)))) result))) (error nil)))) (setq icicle-plist-last-initial-cand-set result)) result) nil nil nil nil nil nil ((prompt "SYMB `C-M-j' PLIST: ") ; Bindings (icicle-toggle-transforming-message "Filtering to faces is now %s") (icicle-transform-function nil) ; No transformation: all symbols. (icicle-last-transform-function (lambda (cands) ; `C-$': only faces. (loop for cc in cands with symb do (setq symb (intern (icicle-transform-multi-completion cc))) if (facep symb) collect cc))) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering property lists..."))) (icicle-define-command icicle-doc ; Command name "Choose documentation for a symbol. Each candidate for completion is the description of a function, variable, or face. Displays the documentation and returns the symbol. Each candidate for completion is a symbol name plus its type \(FUNCTION, VARIABLE, or FACE) and its documentation. These candidate components are separated by `icicle-list-join-string' (\"^G^J\", by default). You can match an input regexp against the symbol name, type, or the documentation or any combination of the three. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the default separator. With a prefix argument, use the same documentation that was gathered the last time `icicle-doc' was called. Use a prefix arg to save the time that would be needed to gather the documentation. You can use `C-$' during completion to toggle filtering the domain of initial candidates between all functions, variables, and faces and only commands, user options and faces. Remember that you can use \\\ `\\[icicle-cycle-incremental-completion]' to toggle incremental completion. See also: `icicle-apropos-value'." ; Doc string icicle-doc-action ; Action function: display the doc. prompt ; `completing-read' args (let ((result (and pref-arg icicle-doc-last-initial-cand-set)) doc) ; Each completion candidate is a list of strings. (unless result ; COLLECTION arg is an alist with items (doc . symb). (mapatoms (lambda (symb) (progn (when (and (functionp symb) ; Function's doc. ;; Ignore symbols that produce errors. See comment for `icicle-fundoc'. (setq doc (condition-case nil (documentation symb) (error nil))) (setq doc (icicle-fn-doc-minus-sig doc)) ; Need separate `setq', for `and'. (icicle-non-whitespace-string-p doc) (setq doc (concat doc "\n\n"))) (push (cons (list (concat (symbol-name symb) icicle-list-join-string "FUNCTION") doc) symb) result)) (when (and (boundp symb) ; Variable's doc (and keymap var's bindings if remove nil) (setq doc (documentation-property symb 'variable-documentation)) (icicle-non-whitespace-string-p doc)) (when (and nil ; $$$ Remove nil to get keymaps, but it slows things down. (fboundp 'describe-keymap) (keymapp (symbol-value symb))) (setq doc (concat (symbol-name symb) ":\n" doc "\n\n" ; Keymap variable's doc. (substitute-command-keys (concat "\\{" (symbol-name symb) "}")) "\n\n"))) (setq doc (concat doc "\n\n")) (push (cons (list (concat (symbol-name symb) icicle-list-join-string "VARIABLE") doc) symb) result)) (when (and (facep symb) (setq doc (documentation-property symb 'face-documentation))) (push (cons (list (concat (symbol-name symb) icicle-list-join-string "FACE") doc) symb) result))))) (setq icicle-doc-last-initial-cand-set result)) result) nil nil nil 'icicle-doc-history nil nil ((prompt "Find doc using regexp: ") ; Bindings ;; $$$$$$ (icicle-transform-function 'icicle-remove-duplicates) ; Duplicates are due to `fset's. (icicle-toggle-transforming-message "Filtering to OPTIONS, COMMANDS, & FACES is now %s") (icicle-transform-function nil) ; No transformation: all symbols. (icicle-last-transform-function (lambda (cands) ; `C-$': only user options, commands, or faces. (loop for cc in cands with symb do (setq symb (intern (icicle-transform-multi-completion cc))) if (or (user-variable-p symb) (commandp symb) (facep symb)) collect cc))) (icicle-candidate-properties-alist '((1 (face icicle-candidate-part)))) (icicle-multi-completing-p t) (icicle-list-use-nth-parts '(1)) (icicle-candidate-help-fn 'icicle-doc-action) (pref-arg current-prefix-arg)) (progn (put-text-property 0 1 'icicle-fancy-candidates t prompt) ; First code (icicle-highlight-lighter) (message "Gathering documentation..."))) (defun icicle-doc-action (entry) "Completion action function for `icicle-doc': Display the doc." (let ((symb (intern (icicle-transform-multi-completion entry)))) (cond ((fboundp symb) (describe-function symb)) ;; $$$ This works fine, but it slows things down: ;; ((and (fboundp 'describe-keymap) (boundp symb) (keymapp (symbol-value symb))) ;; (describe-keymap symb)) ((and symb (boundp symb)) (describe-variable symb)) ((facep symb) (describe-face symb))) symb)) (defun icicle-non-whitespace-string-p (string) "Return non-nil if STRING is a string and contains a non-whitespace char. The `standard-syntax-table' definition of whitespace is used." (interactive "s") (let ((orig-syntable (syntax-table))) (unwind-protect (progn (set-syntax-table (standard-syntax-table)) (and (stringp string) (> (length string) 0) (string-match "\\S-" string))) (set-syntax-table orig-syntable)))) (defalias 'icicle-map 'icicle-apply) (defun icicle-apply (alist fn &optional nomsg predicate initial-input hist def inherit-input-method) "Selectively apply a function to elements in an alist. Argument ALIST is an alist such as can be used as the COLLECTION argument for Icicles `completing-read'. Its elements can represent multi-completions, for example. Interactively, COLLECTION is a variable (a symbol) whose value is an alist. Argument FN is a function. Optional argument NOMSG non-nil means do not display an informative message each time FN is applied. If nil, then a message shows the key of the alist element that FN is applied to and the result of the application. The remaining arguments are optional. They are the arguments PREDICATE, INITIAL-INPUT, HIST, DEF, and INHERIT-INPUT-METHOD for `completing-read' (that is, all of the `completing-read' args other than PROMPT, COLLECTION, and REQUIRE-MATCH). During `icicle-apply' completion, a match is required (REQUIRE-MATCH is t). Interactively, you are prompted for both arguments. Completion is available for each. The completion list for ALIST candidates is the set of variables whose value is a cons. With no prefix argument, the names of these variables must end with \"alist\". With a prefix argument, the first car of each variable value must itself be a cons. After choosing the ALIST and FN, you are prompted to choose one or more keys of the alist elements, and FN is applied to each element that has a key that you choose. Multi-command completion is available for choosing these candidates: you can apply FN to any number of elements, any number of times. Examples: If ALIST is `auto-mode-alist' and FN is `cdr', then the completion candidates are the keys of the alist, and the result of applying FN to an alist element is simply the value of that key. If you choose, for example, candidate \"\\.el\\'\", then the result is `cdr' applied to the alist element (\"\\.el\\'\" . emacs-lisp-mode), which is the symbol `emacs-lisp-mode'. In this case, the function performs simple lookup. If FN were instead (lambda (x) (describe-function (cdr x))), then the result of choosing candidate \"\\.el\\'\" would be to display the help for function `emacs-lisp-mode'. NOTE: `icicle-apply' does not, by itself, impose any particular sort order. Neither does it inhibit sorting. If you call this function from Lisp code and you want it to use a certain sort order or you want no sorting, then bind `icicle-sort-comparer' accordingly. During completion you can use multi-command keys. Each displays the value of applying FN to an alist element whose key is a completion candidate.\\ `C-RET' - Act on current completion candidate only `C-down' - Move to next completion candidate and act `C-up' - Move to previous completion candidate and act `C-next' - Move to next apropos-completion candidate and act `C-prior' - Move to previous apropos-completion candidate and act `C-end' - Move to next prefix-completion candidate and act `C-home' - Move to previous prefix-completion candidate and act `\\[icicle-all-candidates-action]' - Act on *each* candidate (or each that is saved), in turn. `\\[icicle-all-candidates-list-action]' - Act on the list of *all* candidates (or all saved). Note that `\\[icicle-all-candidates-list-action]' applies FN to the *list* of chosen alist elements, whereas `\\[icicle-all-candidates-action]' applies FN to each chosen element, in turn. For example, if FN is `length' and your input is `\.el', then `\\[icicle-all-candidates-list-action]' displays the result of applying `length' to the list of chosen elements: ((\"\\.el\\'\" . emacs-lisp-mode) (\"\\.elc'\" . emacs-lisp-mode)) which is 2. When candidate action and cycling are combined (e.g. `C-next'), option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `\\[icicle-help-on-candidate]', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'. `icicle-apply' overrides `icicle-buffer-ignore-space-prefix-flag', binding it to nil so that candidates with initial spaces can be matched." (interactive (list (symbol-value (intern (let* ((pred `(lambda (s) (unless (symbolp s) (setq s (intern s))) (and (boundp s) (consp (symbol-value s)) ,(if current-prefix-arg '(consp (car (symbol-value s))) '(string-match "alist$" (symbol-name s)))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "variable"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "variable")))) (completing-read "Alist (variable): " obarray (and icompletep pred) t nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history))))) (read (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (functionp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "function"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "function")))) (completing-read "Function: " obarray (and icompletep pred) nil nil (if (boundp 'function-name-history) 'function-name-history 'icicle-function-name-history)))))) (setq icicle-candidate-entry-fn fn) ; Save in global variable - used by `icicle-apply-action'. (let ((icicle-candidate-action-fn 'icicle-apply-action) (icicle-all-candidates-list-action-fn 'icicle-apply-list-action) (icicle-buffer-ignore-space-prefix-flag nil) (icicle-apply-nomsg nomsg) (enable-recursive-minibuffers t)) (icicle-explore (lambda () (setq icicle-candidates-alist ; Ensure that keys of ALIST are strings or conses. (mapcar (lambda (key+val) (if (consp (car key+val)) key+val ; Multi-completion candidate: (("aaa" "bbb") . ccc) (cons (format "%s" (car key+val)) (cdr key+val)))) alist))) (lambda () (let ((result (funcall icicle-candidate-entry-fn icicle-explore-final-choice-full))) (unless nomsg (message "Key: %s, Result: %s" (icicle-propertize (car icicle-explore-final-choice-full) 'face 'icicle-msg-emphasis) (icicle-propertize result 'face 'icicle-msg-emphasis))) result)) ; Return result. nil nil nil "Choose an occurrence: " predicate t initial-input hist def inherit-input-method))) (defun icicle-apply-action (string) "Completion action function for `icicle-apply'." (unwind-protect (icicle-condition-case-no-debug icicle-apply-action (progn (icicle-highlight-candidate-in-Completions) ;; Apply function to candidate element and display it. (let* ((key+value (funcall icicle-get-alist-candidate-function string)) (result (funcall icicle-candidate-entry-fn key+value))) (unless icicle-apply-nomsg (icicle-msg-maybe-in-minibuffer "Key: %s, Result: %s" (icicle-propertize (car key+value) 'face 'icicle-msg-emphasis) (icicle-propertize result 'face 'icicle-msg-emphasis)))) nil) ; Return nil for success. (error "%s" (error-message-string icicle-apply-action))) ; Return error msg. (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))) (defun icicle-apply-list-action (strings) "Completion action list function for `icicle-apply'." (unwind-protect (icicle-condition-case-no-debug icicle-apply-list-action (progn ; Apply function to candidate element and display it. (icicle-msg-maybe-in-minibuffer "Result: %s" (icicle-propertize (funcall icicle-candidate-entry-fn (mapcar icicle-get-alist-candidate-function strings)) 'face 'icicle-msg-emphasis)) nil) ; Return nil for success. (error "%s" (error-message-string icicle-apply-list-action))) ; Return error msg. (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))) (defun icicle-goto-marker-or-set-mark-command (arg) ; Bound to `C-@', `C-SPC'. "With prefix arg < 0, `icicle-goto-marker'; else `set-mark-command'. By default, Icicle mode remaps all key sequences that are normally bound to `set-mark-command' to `icicle-goto-marker-or-set-mark-command'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (if (not (wholenump (prefix-numeric-value arg))) (icicle-goto-marker) (setq this-command 'set-mark-command) ; Let `C-SPC C-SPC' activate if not `transient-mark-mode'. (set-mark-command arg))) (defun icicle-goto-global-marker-or-pop-global-mark (arg) ; Bound to `C-x C-@', `C-x C-SPC'. "With prefix arg < 0, `icicle-goto-global-marker'; else `pop-global-mark'. By default, Icicle mode remaps all key sequences that are normally bound to `pop-global-mark' to `icicle-goto-global-marker-or-pop-global-mark'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (if (wholenump (prefix-numeric-value arg)) (pop-global-mark) (icicle-goto-global-marker))) (defun icicle-goto-marker () ; Bound to `C-- C-@', `C-- C-SPC'. "Go to a marker in this buffer, choosing it by the line that includes it. If `crosshairs.el' is loaded, then the target position is highlighted. By default, candidates are sorted in marker order, that is, with respect to their buffer positions. Use `C-M-,' or `C-,' to change the sort order. During completion you can use these keys\\: `C-RET' - Goto marker named by current completion candidate `C-down' - Goto marker named by next completion candidate `C-up' - Goto marker named by previous completion candidate `C-next' - Goto marker named by next apropos-completion candidate `C-prior' - Goto marker named by previous apropos-completion candidate `C-end' - Goto marker named by next prefix-completion candidate `C-home' - Goto marker named by previous prefix-completion candidate `\\[icicle-delete-candidate-object]' - Delete marker named by current completion candidate When candidate action and cycling are combined (e.g. `C-next'), option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `\\[icicle-help-on-candidate]', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to choose a candidate as the final destination, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'." (interactive) (let ((icicle-sort-orders-alist (cons '("by position" . icicle-cdr-lessp) icicle-sort-orders-alist)) (icicle-sort-comparer 'icicle-cdr-lessp)) (icicle-goto-marker-1 mark-ring))) (defun icicle-goto-global-marker () ; Bound to `C-- C-x C-@', `C-- C-x C-SPC'. "Like `icicle-goto-marker', but visits global, not local, markers. If user option `icicle-show-multi-completion-flag' is non-nil, then each completion candidate is annotated (prefixed) with the name of the marker's buffer, to facilitate orientation." (interactive) (let ((icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-nth-parts-join-string "\t") (icicle-list-join-string "\t") ;; $$$$$$ (icicle-list-end-string "") (icicle-sort-orders-alist (cons '("by buffer, then by position" . icicle-part-1-cdr-lessp) icicle-sort-orders-alist)) (icicle-sort-comparer 'icicle-part-1-cdr-lessp) (icicle-candidate-properties-alist (and icicle-show-multi-completion-flag '((1 (face icicle-candidate-part)))))) (icicle-goto-marker-1 global-mark-ring))) (defun icicle-goto-marker-1 (ring) "Helper function for `icicle-goto-marker', `icicle-goto-global-marker'. RING is the marker ring to use." (unwind-protect (let* ((global-ring-p (memq this-command '(icicle-goto-global-marker icicle-goto-global-marker-or-pop-global-mark))) (markers (if (and (not global-ring-p) (marker-buffer (mark-marker))) (cons (mark-marker) (icicle-markers ring)) (icicle-markers ring))) (icicle-delete-candidate-object (lambda (cand) (let ((mrkr+txt (funcall icicle-get-alist-candidate-function cand))) (move-marker (cdr mrkr+txt) nil)))) (icicle-alternative-sort-comparer nil) (icicle-last-sort-comparer nil) (icicle-orig-buff (current-buffer))) (unless (consp markers) (icicle-user-error (if global-ring-p "No global markers" "No markers in this buffer"))) (cond ((cdr markers) (icicle-apply (mapcar (lambda (mrkr) (icicle-marker+text mrkr global-ring-p)) markers) #'icicle-goto-marker-1-action 'nomsg (lambda (cand) (marker-buffer (cdr cand))))) ((= (point) (car markers)) (message "Already at marker: %d" (point))) (t (icicle-goto-marker-1-action (icicle-marker+text (car markers) global-ring-p))))) (when (fboundp 'crosshairs-unhighlight) (crosshairs-unhighlight 'even-if-frame-switch)))) (defun icicle-goto-marker-1-action (cand) "Action function for `icicle-goto-marker-1'." (pop-to-buffer (marker-buffer (cdr cand))) (select-frame-set-input-focus (selected-frame)) (goto-char (cdr cand)) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight))) (defun icicle-marker+text (marker &optional globalp) "Cons of text line that includes MARKER with MARKER itself. If the marker is on an empty line, then text \"\" is used. If both optional argument GLOBALP and option `icicle-show-multi-completion-flag' are non-nil, then the text is prefixed by MARKER's buffer name." (with-current-buffer (marker-buffer marker) (save-excursion (goto-char marker) (let ((line (let ((inhibit-field-text-motion t)) ; Just to be sure, for `line-end-position'. (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) (buff (and globalp icicle-show-multi-completion-flag (buffer-name))) (help (and (or (> icicle-help-in-mode-line-delay 0) ; Get it only if user will see it. (and (boundp 'tooltip-mode) tooltip-mode)) (format "Line: %d, Char: %d" (line-number-at-pos) (point))))) (when (string= "" line) (setq line "")) (when help (icicle-candidate-short-help help line) (when (and globalp icicle-show-multi-completion-flag) (icicle-candidate-short-help help buff))) (if (and globalp icicle-show-multi-completion-flag) (cons (list buff line) marker) (cons line marker)))))) (defun icicle-markers (ring) "Marks in mark RING that are in live buffers other than a minibuffer." (let ((markers ())) (dolist (mkr ring) (when (and (buffer-live-p (marker-buffer mkr)) (not (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name (marker-buffer mkr))))) (push mkr markers))) markers)) (defun icicle-exchange-point-and-mark (&optional arg) ; Bound to `C-x C-x'. "`exchange-point-and-mark' or save a region or select a saved region. With no prefix arg, invoke `exchange-point-and-mark'. If you use library `Bookmark+', then you can use a prefix arg. * Plain `C-u': Emacs 22+: what vanilla Emacs does - temporary Transient Mark mode. Emacs 20/21: same as `C-u C-u'. * Plain `C-u C-u': select (activate) one or more bookmarked regions. * Numeric prefix arg: bookmark (save) the active region using `icicle-bookmark-cmd'. Arg < 0: Prompt for the bookmark name. Arg > 0: Do not prompt for the bookmark name. Use the buffer name plus a prefix of the region text as the bookmark name. Arg = 0: Same as > 0, except do not overwrite any existing bookmark with the same name. By default, Icicle mode remaps all key sequences that are normally bound to `exchange-point-and-mark' to `icicle-exchange-point-and-mark'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive "P") (cond ((not arg) (exchange-point-and-mark)) ((and (consp arg) (< (prefix-numeric-value arg) 16) (> emacs-major-version 21)) (exchange-point-and-mark arg)) ((not (featurep 'bookmark+)) (icicle-user-error "You must load library `Bookmark+' to use a prefix arg")) ((atom arg) (unless (and transient-mark-mode mark-active (not (eq (mark) (point)))) (icicle-user-error "Cannot bookmark inactive region: you must activate it first")) (icicle-bookmark-cmd (and (natnump (prefix-numeric-value arg)) 9))) (t (bookmark-maybe-load-default-file) (unless (consp (bmkp-region-alist-only)) (icicle-user-error "No bookmarked regions")) (call-interactively #'icicle-select-bookmarked-region)))) (defun icicle-search-generic () ; Bound to `C-c `'. "Run `icicle-search-command'. By default, this is `icicle-search'. In Compilation and Grep modes, this is `icicle-compilation-search'. In Comint, Shell, GUD, and Inferior Lisp modes, this is `icicle-comint-search'." (interactive) (call-interactively icicle-search-command)) (defun icicle-search (beg end scan-fn-or-regexp require-match ; Bound to `M-s M-s M-s', `C-c `'. &optional where &rest args) "Search for matches, with completion, cycling, and hit replacement. Search a set of contexts, which are defined interactively by specifying a regexp (followed by `RET'). After specifying the regexp that defines the search contexts, type input (e.g. regexp or other pattern) to match within the contexts. The contexts that match your input are available as completion candidates. You can use `\\\ \\[icicle-apropos-complete-and-narrow]' to further narrow the candidates, typing additional patterns to match. By default, candidates are in order of buffer occurrence, but you can sort them in various ways using `\\[icicle-change-sort-order]'. You can replace individual matches with another string, as in `query-replace' or `query-replace-regexp'. See the Icicles Search doc for more info. Non-interactively, search can be for regexp matches or any other kind of matches. Argument SCAN-FN-OR-REGEXP is the regexp to match, or it is a function that defines an alist of buffer zones to search. You can navigate among the matching buffer zones (defined either as regexp matches or via function), called search \"contexts\", and you can match another regexp against the text in a search context. See the end of this description for information about the other arguments. If the search-context regexp contains regexp subgroups, that is, subexpressions of the form `\(...\)', then you are prompted for the subgroup to use to define the search contexts. Subgroup 0 means the context is whatever matches the whole regexp. Subgroup 1 means the context is whatever matches the first subgroup, and so on. The subgroup number is the number of occurrences of `\(', starting at the beginning of the regexp. Search respects `icicle-regexp-quote-flag' and `icicle-search-whole-word-flag'. You can toggle these during search, by using `\\[icicle-toggle-regexp-quote]' and `\\[icicle-dispatch-M-q]', respectively. \ If `icicle-regexp-quote-flag' is non-nil, then regexp special characters are quoted, so that they become non-special. If `icicle-search-whole-word-flag' is non-nil, then whole-word searching is done. (You can also use `M-s M-s w' to perform word search.) For each of the predefined Icicles search commands, including for `icicle-search' itself, you can alternatively choose to search, not the search contexts as you define them, but the non-contexts, that is, the buffer text that is outside (in between) the search contexts as defined. For example, if you use `icicle-search-thing' and you define sexps as the search contexts, then this feature lets you search the zones of text that are not within a sexp. To do this, use `\\[icicle-toggle-search-complementing-domain]' (`icicle-toggle-search-complementing-domain') during completion to turn on `icicle-search-complement-domain-p'. \(This is a toggle, and it affects only future search commands, not the current one.) Optional Behaviors: Prefix Argument ----------------------------------- By default, search only the current buffer. Search the active region, or, if there is none, then search the entire buffer. With a prefix argument, you can search multiple buffers, files, or bookmarks, as follows: - With a plain prefix arg (`C-u'), search bookmarks. This is the same as command `icicle-search-bookmarks-together'. (To search bookmarks one at a time instead of together, use multi-command `icicle-search-bookmark'.) - With a positive numeric prefix arg, search multiple buffers completely. You are prompted for the buffers to search - all of each buffer is searched. Any existing buffers can be chosen. If the prefix arg is 99, then only buffers visiting files are candidates. This is the same as command `icicle-search-buffer'. - With a negative numeric prefix arg, search multiple files completely. You are prompted for the files to search - all of each file is searched. Any existing files in the current directory can be chosen. This is the same as command `icicle-search-file'. - With a zero (0) prefix arg, search contexts that are determined in a context-dependent way. For example: . in Dired, search the marked files . in a `buffer-menu' or `ibuffer' buffer, search the marked buffers . in a bookmark list buffer, search the marked bookmarks Navigation and Help ------------------- The use of completion for this command is special. It is not unusual in this context to have multiple completion candidates that are identical - only the positions of their occurrences in the search buffer(s) differ. In that case, you cannot choose one simply by completing it in the minibuffer, because the destination would be ambiguous. That is, simply completing your input and entering the completion with `RET' will not take you to its occurrence in the search buffer, unless it is unique. Instead, choose search hits to visit using any of the candidate-action keys: `C-RET', `C-mouse-2', `C-down', `C-up', `C-next', `C-prior', `C-end', and `C-home'. All but the first two of these cycle among the search hits. The current candidate in `*Completions*' corresponds to the current location visited (it is not off by one, as is usually the case in Icicles). As always, the `C-M-' keys provide help on individual candidates: `\\[icicle-help-on-candidate]', `C-M-mouse-2', `C-M-down', `C-M-up', `C-M-next', `C-M-prior', `C-M-end', and `C-M-home'. For `icicle-search', they indicate the buffer and position of the search hit. You can cycle among candidates without moving to their occurrences in the search buffer, using `down', `up', `next', `prior', `end', or `home' (no `C-' modifier). Highlighting ------------ In the search buffer (that is, where the hits are), `icicle-search' does the following: - Highlights the current match (buffer zone) for the initial (context) regexp, using face `icicle-search-main-regexp-current'. - Highlights the first `icicle-search-highlight-threshold' context matches (or all, if the option value is `t'), using face `icicle-search-main-regexp-others'. - Highlights 1-8 context levels, within each search context. This happens only if your initial (context) regexp has \\(...\\) groups and option `icicle-search-highlight-context-levels-flag' is non-nil. - Highlights the match for your current input, using face `icicle-search-current-input'. Highlights all such matches if option `icicle-search-highlight-all-current-flag' is non-nil; otherwise, highlights just the currently visited match. You can toggle this option using `\\[icicle-dispatch-C-^]'. If user option `icicle-search-cleanup-flag' is non-nil (the default), then all search highlighting is removed from the search buffer when you are finished searching. If it is nil, then you can remove this highlighting later using command `icicle-search-highlight-cleanup'. You can toggle `icicle-search-cleanup-flag' during Icicles search using `\\[icicle-dispatch-C-.]' in the minibuffer. `*Completions*' Display ----------------------- In buffer `*Completions*', in addition to eliding the common match \(option `icicle-hide-common-match-in-Completions-flag', toggled anytime using `\\[icicle-dispatch-C-x.]' - no prefix arg), you can elide all lines of a multi-line candidate that do not match your current minibuffer input. This hiding is governed by option `icicle-hide-non-matching-lines-flag', which you can toggle anytime during completion using `C-u \\[icicle-dispatch-C-x.]' (this is not specfic to Icicles search). This can be useful when candidates are very long, as can be the case for instance for the `icicle-imenu-*-full' commands. Search and Replace ------------------ You can replace the current search match by using any of the alternative action keys: `\\[icicle-candidate-alt-action]', `C-S-mouse-2' (in `*Completions*'), `\\[icicle-next-candidate-per-mode-alt-action]', \ `\\[icicle-previous-candidate-per-mode-alt-action]', `\\[icicle-next-apropos-candidate-alt-action]', \ `\\[icicle-help-on-previous-apropos-candidate]', `\\[icicle-next-prefix-candidate-alt-action]', and `\\[icicle-previous-prefix-candidate-alt-action]'. \ You can use `\\[icicle-all-candidates-list-alt-action]' to replace all matches at once. (And remember that you can activate the region to limit the search-and-replace space.) At the first use of any of these, you are prompted for the replacement string; it is used thereafter, or until you use `\\[icicle-dispatch-M-comma]' \(`icicle-search-define-replacement') to change it (anytime). Unlike `query-replace', you need not visit search matches successively or exhaustively. You can visit and replace selected matches in any order. What is meant here by a \"search match\"? It can be either an entire search context or just a part of the context that your current minibuffer input matches. `\\[icicle-dispatch-M-_]' toggles option `icicle-search-replace-whole-candidate-flag'. By default, the entire current search context is replaced, that is, whatever matches the context regexp that you entered initially using `RET'. However, you can use `\\[icicle-dispatch-M-_]' anytime during searching to toggle between this default behavior and replacement of whatever your current minibuffer input matches. Remember this: - If `icicle-search-replace-whole-candidate-flag' is non-nil, then the granularity of replacement is a complete search context. In this case, replacement behaves similarly to `query-replace-regexp'. You can still use minibuffer input to filter the set of search contexts, but replacement is on a whole-context basis. - If `icicle-search-replace-whole-candidate-flag' is nil, then you can replace multiple input matches separately within a search context (using `\\[icicle-candidate-alt-action]'). This behavior is unique to Icicles. You cannot, however skip over one input match and replace the next one in the same context - `\\[icicle-candidate-alt-action]' always replaces the first available match. If `icicle-search-replace-whole-candidate-flag' is non-nil, then you can use the navigational alternative action keys, `\\[icicle-next-candidate-per-mode-alt-action]', `\\[icicle-previous-candidate-per-mode-alt-action]', `\\[icicle-help-on-next-apropos-candidate]', \ `\\[icicle-previous-apropos-candidate-alt-action]', `\\[icicle-next-prefix-candidate-alt-action]', and \ `\\[icicle-previous-prefix-candidate-alt-action]', repeatedly to replace successive search contexts. At the buffer limits, these commands wraps around to the other buffer limit (last search context to first, and vice versa). Search traversal using these go-to-next-context-and-replace keys is always by search context, not by individual input match. This means that you cannot use these keys to replace input matches within a search context (except for the first such match, if `icicle-search-replace-whole-candidate-flag' is nil). If your input matches multiple parts of a search context, and you want to replace these in order, then use `\\[icicle-candidate-alt-action]' repeatedly. You can traverse all matches of your input in the order they appear in the buffer by repeating `\\[icicle-candidate-alt-action]' (provided the replacement text does not also match your input - see below). At the buffer limits, repeating `\\[icicle-candidate-alt-action]' wraps around too. `\\[icicle-candidate-alt-action]' always replaces the first input match in the current search context or, if there are no matches, then the first input match in the next context. This behavior has these important consequences: * If you repeat `\\[icicle-candidate-alt-action]' and the previous replacement no longer matches your input, then `\\[icicle-candidate-alt-action]' moves on to the next input match (which is now the first one) and replaces that. This is why you can usually just repeat `\\[icicle-candidate-alt-action]' to successively replaces matches of your input, including from one context to the next. * If, on the other hand, after replacement the text still matches your input, then repeating `\\[icicle-candidate-alt-action]' will just replace that match. For example, if you replace the input match `ab' by `abcd', then repeating `\\[icicle-candidate-alt-action]' produces `abcd', then `abcdcd', then `abcdcd'... * You cannot replace an input match, skip the next match, and then replace the following one, all in the same context. You can, however, replace some matches and then skip (e.g. `C-next') to the next context. What your input matches, hence what gets replaced if `icicle-search-replace-whole-candidate-flag' is nil, depends on a few Icicles options: - `icicle-regexp-quote-flag' determines whether to use regexp matching or literal matching. - `icicle-expand-input-to-common-match', `icicle-search-highlight-all-current-flag', and `icicle-search-replace-common-match-flag' together determine whether to replace exactly what your input matches in the current search hit or the expanded common match (ECM) of your input among all search hits. If the first of these does not call for automatic input expansion, or if either of the other two is nil, then your exact input match is replaced. Otherwise, the ECM is replaced. Finally, the replacement string can be nearly anything that is allowed as a replacement by `query-replace-regexp'. In Emacs 22 or later, this includes Lisp sexp evaluation via `\,' and constructs such as `\#' and `\N' (back references). You can also use `\?', but it is not very useful - you might as well use `M-,' instead, to change the replacement text. Using Regexps ------------- At any time, you can use `\\[icicle-insert-string-from-variable]' (command `icicle-insert-string-from-variable') to insert text (e.g. a regexp) from a variable into the minibuffer. For example, you can search for ends of sentences by using `C-u \\[icicle-insert-string-from-variable]' and choosing variable `sentence-end' as the variable. And you can use `\\[icicle-save-string-to-variable]' to save a string to a variable for later use by `\\[icicle-insert-string-from-variable]'. When employed with useful regexps, `\\\ \\[icicle-insert-string-from-variable]' can turn `icicle-search' into a general navigator or browser of code, mail messages, and many other types of buffer. Imenu regexps work fine, for example - command `icicle-imenu' simply uses `icicle-search' this way. See `icicle-insert-string-from-variable' for more tips on inserting regexps from variables. Additional Information ---------------------- If user option `icicle-show-multi-completion-flag' is non-nil, then each candidate is annotated with the name of the buffer where the search hit occurs, to facilitate orientation. Note that even when the value is nil, you can use `C-M-mouse-2' and so on to see the buffer name, as well as the position of the hit in the buffer. Completion is lax if `icicle-show-multi-completion-flag' is non-nil; otherwise, it is strict. After you visit a completion candidate, the hooks in variable `icicle-search-hook' are run. `icicle-search' sets `icicle-search-final-choice' to the final user choice, which might not be one of the search candidates if REQUIRE-MATCH is nil. Non-Interactive Use ------------------- Function `icicle-search' is not only a powerful command, it is also a building block for creating your own Icicles search-and-replace commands. When called non-interactively, these are the `icicle-search' arguments: BEG is the beginning of the region to search; END is the end. SCAN-FN-OR-REGEXP: Regexp or function that determines the set of initial candidates (match zones). If a function, it is passed, as arguments, the buffer to search, the beginning and end of the search region in that buffer, and ARGS. REQUIRE-MATCH is passed to `completing-read'. Optional arg WHERE is a list of bookmarks, buffers, or files to be searched. If nil, then search only the current buffer or region. (To search bookmarks you must also use library `Bookmark+'). ARGS are arguments that are passed to function SCAN-FN-OR-REGEXP. Note that if SCAN-FN-OR-REGEXP is a regexp string, then function `icicle-search-regexp-scan' is used to determine the set of match zones. You can limit hits to regexp matches that also satisfy a predicate, by using `(PREDICATE)' as ARGS: PREDICATE is then passed to `icicle-search-regexp-scan' as its PREDICATE argument. This command is intended for use only in Icicle mode." (interactive `(,@(icicle-region-or-buffer-limits) ,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (setq icicle-search-context-regexp (and (stringp scan-fn-or-regexp) scan-fn-or-regexp)) (let ((icicle-candidate-action-fn (or icicle-candidate-action-fn 'icicle-search-action)) (icicle-candidate-help-fn 'icicle-search-help) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn 'icicle-search-replace-all-search-hits)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn 'icicle-search-replace-search-hit)) (icicle-scan-fn-or-regexp scan-fn-or-regexp) ; Used free in `M-,'. (icicle-update-input-hook (list 'icicle-search-highlight-all-input-matches)) (icicle-search-ecm nil) (icicle-searching-p t) (icicle-search-replacement nil) (icicle-current-input "") (icicle-list-nth-parts-join-string "\t") (icicle-list-join-string "\t") ;; $$$$$$ (icicle-list-end-string "") ;; In general, we do not assume that `C-0' implies the use of multi-completions. (icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (icicle-list-use-nth-parts '(1)) (icicle-sort-comparer nil) ;; Alternative: If we used `icicle-search-replace-cand-in-alist', then we would inhibit ;; sorting, because we would be depending on the alist order. ;; (icicle-inhibit-sort-p t) (icicle-no-match-hook icicle-no-match-hook) (completion-ignore-case case-fold-search) (replace-count 0)) ; Defined in `replace.el'. Used for replacement. (add-hook 'icicle-no-match-hook (lambda () (when (overlayp icicle-search-current-overlay) (delete-overlay icicle-search-current-overlay)))) (setq icicle-search-final-choice (icicle-explore (lambda () (icicle-search-define-candidates beg end scan-fn-or-regexp require-match where args)) #'icicle-search-final-act #'icicle-search-quit-or-error #'icicle-search-quit-or-error #'icicle-search-cleanup "Choose an occurrence: " nil require-match nil 'icicle-search-history)))) ;; This is the same as `region-or-buffer-limits' in `misc-fns.el'. (defun icicle-region-or-buffer-limits () "Return the start and end of the region as a list, smallest first. If the region is not active or is empty, then use bob and eob." (if (or (not mark-active) (null (mark)) (= (point) (mark))) (list (point-min) (point-max)) (if (< (point) (mark)) (list (point) (mark)) (list (mark) (point))))) (defun icicle-search-read-context-regexp (&optional prompt pred init hist def i-i-m) "Read context regexp and determine `icicle-search-context-level'. Read the regexp using completion against previous regexp input. The arguments are for use by `completing-read' to read the regexp. HIST (or `regexp-history' if HIST is nil) is used for the `completing-read' COLLECTION argument. The REQUIRE-MATCH arg to `completing-read' is nil. A default prompt is used if PROMPT is nil." (setq prompt (or prompt (format "Search %swithin contexts (regexp): " (if icicle-search-complement-domain-p "*NOT* " ""))) hist (or hist 'regexp-history) def (or def (icicle-defaults-at-point))) (let* ((icicle-candidate-action-fn nil) (icicle-candidate-help-fn nil) (regexp (icicle-completing-read-history prompt 'regexp-history pred init def i-i-m))) (while (string= "" regexp) (message "Regexp cannot be empty. Try again...") (sit-for 2) (setq regexp (icicle-completing-read-history prompt 'regexp-history pred init def i-i-m))) (setq prompt "Subgroup to use as search context [0, 1, 2,...]: " icicle-search-context-level (if (string-match "\\\\(" regexp) (truncate (if (fboundp 'read-number) (read-number prompt 0) (read-from-minibuffer ; Hope for a number. prompt nil nil nil nil 0))) 0)) regexp)) (defmacro icicle-search-modes () `(case major-mode ,@(append icicle-search-modes '((t (error "Icicles search WHERE is not implemented for this mode"))) ()))) (defun icicle-search-where-arg () "Return WHERE arg for `icicle-search*' commands, based on prefix arg." (cond ((consp current-prefix-arg) (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this")) (message "Searching multiple bookmarks...") (sit-for 1) ;; $$$$$$ Originally, we just did this: (bmkp-region-alist-only)). Now we let users choose. (let ((icicle-show-Completions-initially-flag t) (icicle-prompt "Choose bookmarks to search (`RET' when done): ")) (save-selected-window (icicle-bookmark-list)))) ((= 0 (prefix-numeric-value current-prefix-arg)) (icicle-search-modes)) ((wholenump current-prefix-arg) (message "Searching multiple buffers...") (sit-for 1) (icicle-search-choose-buffers (= 99 (prefix-numeric-value current-prefix-arg)))) (current-prefix-arg (message "Searching multiple files...") (sit-for 1) (let ((icicle-show-Completions-initially-flag t) (icicle-prompt "Choose file to search (`RET' when done): ")) (save-selected-window (icicle-file-list)))) (t nil))) (defun icicle-search-choose-buffers (files-only-p) "Choose multiple buffers to search. FILES-ONLY-P non-nil means that only buffers visiting files are candidates." (let ((icicle-show-Completions-initially-flag t)) (mapcar #'get-buffer (let ((icicle-buffer-require-match-flag 'partial-match-ok) (current-prefix-arg files-only-p) (icicle-prompt (format "Choose %sbuffer to search (`RET' when done): " (if files-only-p "file " "")))) (save-selected-window (icicle-buffer-list)))))) ;;; $$$$$$ (defun icicle-search-read-word () ;;; "Read a word to search for (whole-word search). ;;; Regexp special characters within the word are escaped (quoted)." ;;; (setq icicle-search-context-level 0) ;;; (concat "\\b" ;;; (regexp-quote (icicle-completing-read-history "Search for whole word: " ;;; 'icicle-search-history)) ;;; "\\b")) (defun icicle-search-read-word () "Read a word to search for (whole-word search). The search string is regarded as a whole word, but a \"word\" here can contain embedded strings of non word-constituent chars (they are skipped over, when matching, included in the match), and any leading or trailing word-constituent chars in the search string are dropped \(ignored for matching, not included in the match): matches begin and end on a word boundary." (setq icicle-search-context-level 0) (concat "\\b" (replace-regexp-in-string "\\W+" "\\W+" (replace-regexp-in-string "^\\W+\\|\\W+$" "" (icicle-completing-read-history "Search for whole word: " 'icicle-search-history)) nil t) "\\b")) (defun icicle-search-final-act () "Go to the final search hit choice, then run `icicle-search-hook'. The hit's frame is raised and selected." (let* ((marker (cdr icicle-explore-final-choice-full)) (buf (marker-buffer marker))) (unless (bufferp buf) (error "No such buffer: %s" buf)) (pop-to-buffer buf) (raise-frame) (goto-char (marker-position marker)) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) (select-frame-set-input-focus (selected-frame)) (run-hooks 'icicle-search-hook))) ;; Free vars here: `icicle-orig-pt-explore', `icicle-orig-win-explore' are bound in `icicle-explore'. (defun icicle-search-quit-or-error () "Return to the starting point." (when (window-live-p icicle-orig-win-explore) (select-window icicle-orig-win-explore) (goto-char icicle-orig-pt-explore))) ;; Free vars here: `icicle-orig-win-explore' is bound in `icicle-explore'. (defun icicle-search-cleanup () "Clean up search highlighting, if `icicle-search-cleanup-flag'. Select original window." (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (when (window-live-p icicle-orig-win-explore) (select-window icicle-orig-win-explore) (select-frame-set-input-focus (selected-frame)))) (defun icicle-search-define-candidates (beg end scan-fn-or-regexp require-match where args) "Define completion candidates for `icicle-search'. The arguments are the same as for `icicle-search'." (when (and icicle-regexp-quote-flag (not icicle-search-whole-word-flag) (stringp scan-fn-or-regexp)) (setq scan-fn-or-regexp (regexp-quote scan-fn-or-regexp))) (let ((message-log-max nil) (nb-contexts 0) (nb-objects (length where))) (cond ((and (consp where) (bufferp (car where))) ; List of buffers - search buffers. (dolist (buf where) (incf nb-contexts) (message "%d contexts; searching %d/%d: `%s'" (length icicle-candidates-alist) nb-contexts nb-objects buf) (icicle-search-define-candidates-1 buf nil nil scan-fn-or-regexp args))) ((and (consp where) (stringp (car where)) ; List of files - search files. (Check only the first.) (or (icicle-file-remote-p (car where)) ; Don't let Tramp try to access it. (file-exists-p (car where)))) (dolist (file where) (incf nb-contexts) (message "%d contexts; searching %d/%d: `%s'" (length icicle-candidates-alist) nb-contexts nb-objects (file-relative-name file default-directory)) (when (or (functionp scan-fn-or-regexp) ; Punt - just assume that a function finds a match. (icicle-search-file-found-p file scan-fn-or-regexp)) (icicle-search-define-candidates-1 (find-file-noselect file 'nowarn) nil nil scan-fn-or-regexp args)))) ((and (consp where) (consp (car where))) ; Search bookmarks - or just their regions if defined. (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this")) (let ((non-existent-buffers ()) buf+beg buf beg end) (dolist (bmk where) (incf nb-contexts) (message "%d contexts; searching %d/%d: `%s'" (length icicle-candidates-alist) nb-contexts nb-objects bmk) (setq buf+beg (bookmark-jump-noselect bmk) buf (car buf+beg) beg (cdr buf+beg) end (bmkp-get-end-position bmk)) (when (and beg end (= beg end)) ; Search whole buffer if bookmarked region is empty. (setq beg nil end nil)) (if (bufferp buf) (icicle-search-define-candidates-1 buf beg end scan-fn-or-regexp args) (push buf non-existent-buffers))) (when non-existent-buffers (message "Skipping non-existent buffers: `%s'" (mapconcat #'identity (icicle-remove-duplicates non-existent-buffers) "', `")) (sit-for 3)))) (t ; Search this buffer only. (icicle-search-define-candidates-1 nil beg end scan-fn-or-regexp args)))) (when (and icicle-candidates-alist (null (cdr icicle-candidates-alist))) (message "Moving to sole context") (sit-for 1.5)) (unless icicle-candidates-alist (if (functionp scan-fn-or-regexp) (error "No %ssearch contexts" (if icicle-search-complement-domain-p "COMPLEMENT " "")) (error "No %ssearch contexts for `%s'" (if icicle-search-complement-domain-p "COMPLEMENT " "") scan-fn-or-regexp))) (setq mark-active nil)) ; Remove any region highlighting, so we can see search hits. (defun icicle-search-file-found-p (file regexp) "Return non-nil if find a match in FILE for REGEXP." (let* ((already-existed-p nil) (buffer (or (setq already-existed-p (find-buffer-visiting file)) (create-file-buffer file))) (found nil)) (unwind-protect (with-current-buffer buffer (unless already-existed-p (insert-file-contents file 'VISIT)) (save-excursion (goto-char (point-min)) (setq found (re-search-forward regexp (point-max) t)))) (unless already-existed-p (kill-buffer buffer))) found)) (defun icicle-search-define-candidates-1 (buffer beg end scan-fn-or-regexp args) "Helper function for `icicle-search-define-candidates'. BUFFER is a buffer to scan for candidates. The other arguments are the same as for `icicle-search'." (if (functionp scan-fn-or-regexp) (apply scan-fn-or-regexp buffer beg end args) (apply 'icicle-search-regexp-scan buffer beg end scan-fn-or-regexp args))) (defun icicle-search-regexp-scan (buffer beg end regexp &optional predicate action) "Scan BUFFER for REGEXP, pushing hits onto `icicle-candidates-alist'. If BUFFER is nil, scan the current buffer. If BEG and END are non-nil, scan only between positions BEG and END. If REGEXP has subgroups, then use what the Nth subgroup matches as the search context (hit), where N = `icicle-search-context-level'. If N=0, then use the overall match of REGEXP as the search context. PREDICATE is nil or a boolean function that takes these arguments: - the search-context string - a marker at the end of the search-context If PREDICATE is non-nil, then push only the hits for which it holds. Highlight the matches in face `icicle-search-main-regexp-others'." (setq regexp (or regexp (icicle-search-read-context-regexp))) (let ((add-bufname-p (and buffer icicle-show-multi-completion-flag)) (temp-list ()) (last-beg nil)) (unless buffer (setq buffer (current-buffer))) (when (bufferp buffer) ; Do nothing if BUFFER is not a buffer. (with-current-buffer buffer (unless (and beg end) (setq beg (point-min) end (point-max))) (icicle-condition-case-no-debug icicle-search-regexp-scan (save-excursion (goto-char (setq last-beg beg)) (while (and beg (< beg end) (not (eobp)) (progn (while (and (setq beg (re-search-forward regexp end t)) (eq last-beg beg) (not (eobp))) ;; Matched again, same place. Advance 1 char. (forward-char) (setq beg (1+ beg))) ;; Stop if no more match. But if complementing then continue until eobp. (or beg icicle-search-complement-domain-p))) (unless (or (not beg) (match-beginning icicle-search-context-level)) (icicle-user-error "Search context has no subgroup of level %d - try a lower number" icicle-search-context-level)) (let* ((hit-beg (if icicle-search-complement-domain-p last-beg (match-beginning icicle-search-context-level))) (hit-end (if icicle-search-complement-domain-p (if beg (match-beginning icicle-search-context-level) (point-max)) (match-end icicle-search-context-level))) (IGNORE (when action (save-excursion (funcall action) (setq hit-end (point))))) (hit-string (buffer-substring-no-properties hit-beg hit-end)) end-marker) (when (and (not (string= "" hit-string)) ; Do nothing if empty hit. (setq end-marker (copy-marker hit-end)) (or (not predicate) (save-match-data (funcall predicate hit-string end-marker)))) (icicle-candidate-short-help (concat (and add-bufname-p (format "Buffer: `%s', " (buffer-name (marker-buffer end-marker)))) (format "Position: %d, Length: %d" (marker-position end-marker) (length hit-string))) hit-string) ;; Add whole candidate to `temp-list'. Whole candidate is ;; (`hit-string' . `end-marker') or ((`hit-string' BUFNAME) . `end-marker'). (push (cons (if add-bufname-p (list hit-string (let ((string (copy-sequence (buffer-name)))) (put-text-property 0 (length string) 'face 'icicle-candidate-part string) string)) hit-string) end-marker) temp-list) ;; Highlight search context in buffer. (when (or (eq t icicle-search-highlight-threshold) (<= (+ (length temp-list) (length icicle-candidates-alist)) icicle-search-highlight-threshold)) (let ((ov (make-overlay hit-beg hit-end))) (push ov icicle-search-overlays) (overlay-put ov 'priority 200) ; > ediff's 100+, < isearch-overlay's 1001. (overlay-put ov 'face 'icicle-search-main-regexp-others))))) (setq last-beg beg)) (setq icicle-candidates-alist (append icicle-candidates-alist (nreverse temp-list)))) (quit (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup))) (error (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (error "%s" (error-message-string icicle-search-regexp-scan)))))))) ;; Free var here: `icicle-search-ecm' is bound in `icicle-search'. (defun icicle-search-highlight-all-input-matches (&optional input) "Highlight, inside each search context, what INPUT matches." (save-excursion ;; Update by deleting (if it exists) and then creating. ;; If a single overlay exists, it means that the user just changed ;; `icicle-search-highlight-threshold' to non-zero. ;; Otherwise, it's nil or a list of overlays. (when (overlayp icicle-search-refined-overlays) (delete-overlay icicle-search-refined-overlays) (setq icicle-search-refined-overlays ())) (while icicle-search-refined-overlays (delete-overlay (car icicle-search-refined-overlays)) (setq icicle-search-refined-overlays (cdr icicle-search-refined-overlays)))) (when icicle-search-highlight-all-current-flag (setq input (or input icicle-current-input)) (unless (or (string= "" input) (null icicle-search-overlays)) (let ((hits ()) pos) (save-excursion (dolist (ov icicle-search-overlays) (set-buffer (overlay-buffer ov)) (unless (equal (overlay-start ov) (overlay-end ov)) (save-restriction ; Search within the current search context. (narrow-to-region (overlay-start ov) (overlay-end ov)) (goto-char (point-min)) (when (condition-case nil (re-search-forward input nil 'move-to-end) (error nil)) (push (buffer-substring-no-properties (point-min) (point-max)) hits))))) (when (and hits (or (and (eq icicle-current-completion-mode 'apropos) (eq icicle-expand-input-to-common-match 4)) (and (eq icicle-current-completion-mode 'prefix) (memq icicle-expand-input-to-common-match '(3 4))))) (setq icicle-search-ecm (icicle-expanded-common-match input hits)) (when (string= "" icicle-search-ecm) (setq icicle-search-ecm nil))) (when (or icicle-search-ecm (and input (not (string= "" input)))) (dolist (ov icicle-search-overlays) (set-buffer (overlay-buffer ov)) (unless (equal (overlay-start ov) (overlay-end ov)) (save-restriction ; Search within the current search context. (narrow-to-region (overlay-start ov) (overlay-end ov)) (when (member (buffer-substring-no-properties (point-min) (point-max)) hits) (goto-char (setq pos (point-min))) (save-match-data (while (and (not (eobp)) (condition-case nil (re-search-forward (or icicle-search-ecm input) nil 'move-to-end) (error nil))) (if (or (and (equal (match-beginning 0) (match-end 0)) (not (eobp))) (equal (point) pos)) (forward-char) (setq pos (point)) (unless (equal (match-beginning 0) (match-end 0)) (setq ov (make-overlay (match-beginning 0) (match-end 0))) (push ov icicle-search-refined-overlays) (overlay-put ov 'priority 220) (overlay-put ov 'face 'icicle-search-current-input))))))))))))))) (defun icicle-search-replace-search-hit (candidate) ; Bound to `C-S-return' (`icicle-search'). "Replace search hit CANDIDATE with `icicle-search-replacement'." ;; NOTE: We allow side effects during replacement. ;; In particular, `icicle-completion-candidates', `icicle-candidate-nb', and `icicle-last-input' ;; can change. (let (;; (icicle-candidate-nb icicle-candidate-nb) ;; (icicle-completion-candidates icicle-completion-candidates) ;; (icicle-last-input icicle-last-input) (icicle-last-completion-command icicle-last-completion-command) (compl-win (get-buffer-window "*Completions*" 0))) (unless (or icicle-candidate-nb icicle-all-candidates-action) (icicle-user-error "No current candidate. Cycle or complete to get to a candidate")) (unless icicle-search-replacement (icicle-search-define-replacement) (when (and compl-win icicle-completion-candidates) (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates))))) (setq icicle-candidate-nb (or icicle-candidate-nb 0)) ; Replace-all has nil, so use 0. (funcall icicle-candidate-action-fn candidate icicle-search-replacement)) ; Call with second arg. (defun icicle-search-replace-all-search-hits (candidates) ; Bound to `M-|' (for `icicle-search'). "Default alternative list action function for `icicle-search'. CANDIDATES is a list of search-hit strings. They are all matched by the initial regexp (context regexp)." (let ((icicle-last-completion-command icicle-last-completion-command) (compl-win (get-buffer-window "*Completions*" 0))) ;;; $$$$$$ These are now avoided always for all candidates, in `icicle-all-candidates-action-1'. ;;; (icicle-minibuffer-message-ok-p nil) ; Avoid delays from `icicle-msg-maybe-in-minibuffer'. ;;; (icicle-help-in-mode-line-delay 0)) ; Avoid delays for individual candidate help. (unless icicle-search-replacement (icicle-search-define-replacement) (when (and compl-win icicle-completion-candidates) (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates)))) (dolist (cand+mrker (mapcar icicle-get-alist-candidate-function candidates)) (icicle-search-action-1 cand+mrker icicle-search-replacement))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame))) (defun icicle-search-action (string &optional replace-string) ; Bound to `C-return' (`icicle-search'). "Default completion action function for `icicle-search'. STRING is a search-hit string. It is matched by the initial regexp \(context regexp). 1. Move to the STRING occurrence in original buffer. Highlight it. 2. If `icicle-search-highlight-threshold' is zero, highlight what the current input matches, inside the STRING occurrence. 3. If REPLACE-STRING is non-nil, replace the current match with it. If `icicle-search-replace-whole-candidate-flag' is non-nil, replace the entire STRING occurrence. Otherwise, replace only the part that matches the current input. 4. Highlight the current candidate in `*Completions*'. Note: The replacement can be nearly anything allowed as a replacement by `query-replace-regexp', including Lisp-evaluation constructs (`\,...')." (prog1 (let* ((icicle-whole-candidate-as-text-prop-p t) ;; Alternative: If we used `icicle-search-replace-cand-in-alist', then we would bind that ;; to nil to force using the alist, because we would be performing side effects on it. (cand+mrker (funcall icicle-get-alist-candidate-function string))) (icicle-search-action-1 cand+mrker replace-string)) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)))) ;; Free vars here: `icicle-orig-win-explore' is bound in `icicle-explore'. (defun icicle-search-action-1 (cand+mrker &optional replace-string) "Same as `icicle-search-action', but using full candidate, not string. CAND+MRKER is a full alist completion-candidate entry, not just a display string as in `icicle-search-action'." (when icicle-completion-candidates (icicle-condition-case-no-debug icicle-search-action-1 (progn ;; Move cursor to the match in the original buffer and highlight it. (let* ((candidate (if (consp (car-safe cand+mrker)) (car-safe (car-safe cand+mrker)) (car-safe cand+mrker))) (marker (cdr-safe cand+mrker)) (icicle-search-in-context-fn (or icicle-search-in-context-fn 'icicle-search-in-context-default-fn))) (when (get-buffer-window (marker-buffer marker) 0) (setq icicle-other-window (get-buffer-window (marker-buffer marker) 0))) (unless marker (error "No such occurrence")) (icicle-condition-case-no-debug icicle-search-action-1-save-window (save-selected-window (when (window-live-p icicle-orig-win-explore) (select-window icicle-orig-win-explore)) (let ((completion-ignore-case case-fold-search) (buf (marker-buffer marker))) (unless (bufferp buf) (error "No such buffer: %s" buf)) (pop-to-buffer buf) (raise-frame) (goto-char marker) (unless (pos-visible-in-window-p) (recenter icicle-recenter)) ;; Highlight current search context using `icicle-search-main-regexp-current'. (icicle-place-overlay (- marker (length candidate)) marker 'icicle-search-current-overlay 'icicle-search-main-regexp-current 202 buf) (funcall icicle-search-in-context-fn cand+mrker replace-string) (icicle-highlight-candidate-in-Completions) (run-hooks 'icicle-search-hook))) (error ; Ignore disappearance of `*Completions*'. (unless (string-match "Wrong type argument: window-live-p," (error-message-string icicle-search-action-1-save-window)) (error "%s" (error-message-string icicle-search-action-1-save-window))))) nil)) ; Return nil for success. (error (message "%s" (error-message-string icicle-search-action-1)) (error-message-string icicle-search-action-1))))) ; Return the error string. (defun icicle-search-in-context-default-fn (cand+mrker replace-string) "Default value of `icicle-search-in-context-fn'." (let ((candidate (if (consp (car-safe cand+mrker)) (car-safe (car-safe cand+mrker)) (car-safe cand+mrker))) (marker (cdr-safe cand+mrker))) ;; Highlight match and possibly replace. If replacement tried, then update the dialog state. (when (save-excursion (save-restriction ; Search within the current search context. (narrow-to-region (- marker (length candidate)) marker) (icicle-search-highlight-and-maybe-replace cand+mrker replace-string))) ;; Update, since replacement might have changed the current candidate: ;; Rehighlight current context, update last candidate, update candidate in minibuffer. (if icicle-search-highlight-all-current-flag (let ((icicle-search-highlight-all-current-flag nil)) (icicle-search-highlight-input-matches-here)) (let ((ov icicle-search-current-overlay)) (save-restriction (narrow-to-region (overlay-start ov) (overlay-end ov)) (icicle-search-highlight-input-matches-here)))) (if (null icicle-completion-candidates) ; If have already replaced all, then no candidates. (when (overlayp icicle-search-current-overlay) (delete-overlay icicle-search-current-overlay)) (let* ((cand+mrker (funcall icicle-get-alist-candidate-function (setq icicle-last-completion-candidate (elt icicle-completion-candidates icicle-candidate-nb)))) (marker (cdr-safe cand+mrker))) (with-current-buffer (marker-buffer marker) (goto-char marker) ;; Highlight current search context using `icicle-search-main-regexp-current'. (icicle-place-overlay (- marker (if (consp (car cand+mrker)) (length (caar cand+mrker)) (length (car cand+mrker)))) marker 'icicle-search-current-overlay 'icicle-search-main-regexp-current 202 (current-buffer)) (unless icicle-search-highlight-all-current-flag (let ((ov icicle-search-current-overlay)) (save-restriction (narrow-to-region (overlay-start ov) (overlay-end ov)) (icicle-search-highlight-input-matches-here))))) (save-selected-window (select-window (minibuffer-window)) (icicle-clear-minibuffer) (setq icicle-nb-of-other-cycle-candidates (length icicle-completion-candidates)) (icicle-insert-cand-in-minibuffer icicle-last-completion-candidate t) (setq icicle-mode-line-help icicle-last-completion-candidate)))))) (let ((icicle-candidate-nb icicle-candidate-nb) (icicle-last-completion-candidate icicle-last-completion-candidate) (icicle-completion-candidates icicle-completion-candidates)) (icicle-complete-again-update))) ;; Free var here: `icicle-search-ecm' is bound in `icicle-search'. (defun icicle-search-highlight-and-maybe-replace (cand+mrker replace-string) "Highlight within search context and replace using REPLACE-STRING. If REPLACE-STRING is nil, no replacement occurs. Arguments are the same as for `icicle-search-in-context-fn'. Return non-nil if replacement occurred, nil otherwise." (icicle-search-highlight-context-levels) (icicle-search-highlight-input-matches-here) (let ((replacement-p nil)) (when replace-string (setq replacement-p t) (goto-char (point-min)) (let ((candidate (if (consp (car-safe cand+mrker)) (car-safe (car-safe cand+mrker)) (car-safe cand+mrker))) (ecm (and icicle-search-replace-common-match-flag icicle-search-ecm))) (cond (icicle-search-replace-whole-candidate-flag (cond ((string= candidate replace-string) ; Sanity check only. (save-restriction (widen) (message "Replacement = candidate, and \ current input matches candidate") (sit-for 2)) (setq replacement-p nil)) (t (set-match-data (list (point-min) (point-max))) (icicle-search-replace-match replace-string (icicle-search-replace-fixed-case-p icicle-search-context-regexp))))) ((not (save-excursion (re-search-forward (or ecm icicle-current-input) nil t))) (save-restriction (widen) (message "Text to be replaced not found in candidate") (sit-for 2)) (setq replacement-p nil)) (t (save-match-data (let ((first-p t)) ;; The condition order is important. Don't search unless first time (or all) (while (and (or first-p icicle-all-candidates-action) (re-search-forward (or ecm icicle-current-input) nil 'move-to-end)) (setq first-p nil) (icicle-search-replace-match replace-string (icicle-search-replace-fixed-case-p icicle-current-input))))))) (when replacement-p ;; Update the alist and `minibuffer-completion-table' with the new text. ;; An ALTERNATIVE approach would be to use `icicle-search-replace-cand-in-alist'. ;; In that case we would: ;; 1. Bind `icicle-whole-candidate-as-text-prop-p' to nil (in `icicle-search-action' ;; and `icicle-search-help'). ;; 2. Use these two lines, instead of calling `icicle-search-replace-cand-in-mct'. ;; (icicle-search-replace-cand-in-alist cand+mrker ;; (buffer-substring (point-min) (point-max))) ;; (setq minibuffer-completion-table ;; (car (icicle-mctize-all icicle-candidates-alist nil))) ;; If we used that method (as we used to), then users could not sort the search hits. (icicle-search-replace-cand-in-mct cand+mrker (buffer-substring (point-min) (point-max))) ;; If we are replacing input matches within a search context, and there are no more matches ;; in the current context, then this context is removed as a candidate. If the current ;; action command is one that moves to the next or previous candidate, then we might need ;; to adjust the current candidate number, to compensate for the removal. ;; ;; If the current action command is one (e.g. `C-S-next'), that moves to the next candidate ;; to do its action, then move back one. If the current action acts on the previous ;; candidate (e.g. `C-S-prior'), and that previous candidate is the last one, then move ;; forward one candidate, to the first. (when (and icicle-acting-on-next/prev (not (save-excursion (goto-char (point-min)) (re-search-forward icicle-current-input nil t)))) (let ((nb-cands (1- (length icicle-completion-candidates)))) ; -1 for replaced one. (unless (wholenump nb-cands) (setq nb-cands 0)) (setq icicle-candidate-nb (cond ((not icicle-candidate-nb) 0) ((eq icicle-acting-on-next/prev 'forward) (if (zerop icicle-candidate-nb) (1- nb-cands) (1- icicle-candidate-nb))) ((eq icicle-candidate-nb nb-cands) 0) (t icicle-candidate-nb))) (when (> icicle-candidate-nb nb-cands) (setq icicle-candidate-nb 0)) (when (< icicle-candidate-nb 0) (setq icicle-candidate-nb nb-cands)))) (let ((icicle-candidate-nb icicle-candidate-nb) (icicle-minibuffer-message-ok-p nil)) ; Inhibit no-candidates message. (icicle-complete-again-update)) ;; If we are using `C-S-RET' and we are on the last candidate, then wrap to the first one. (when (and (not icicle-acting-on-next/prev) (or (not icicle-candidate-nb) (>= icicle-candidate-nb (length icicle-completion-candidates)))) (setq icicle-candidate-nb 0)) (icicle-highlight-candidate-in-Completions) (icicle-search-highlight-context-levels)))) replacement-p)) ; Return indication of whether we tried to replace something. (defun icicle-search-replace-match (replace-string fixedcase) "Replace current match with REPLACE-STRING, interpreting escapes. Treat REPLACE-STRING as it would be treated by `query-replace-regexp'. FIXEDCASE is as for `replace-match'. Non-nil means do not alter case." (if (fboundp 'query-replace-compile-replacement) ; Emacs 22. (let ((compiled (save-match-data (query-replace-compile-replacement replace-string (not icicle-search-replace-literally-flag))))) (condition-case icicle-search-replace-match1 (let ((enable-recursive-minibuffers t) ; So we can read input from \?. ;; Save and restore these, because we might read input from \?. (icicle-last-completion-command icicle-last-completion-command) (icicle-last-input icicle-last-input)) (replace-match-maybe-edit (if (consp compiled) ;; `replace-count' is free here, bound in `icicle-search'. (funcall (car compiled) (cdr compiled) (setq replace-count (1+ replace-count))) compiled) fixedcase icicle-search-replace-literally-flag nil (match-data))) (buffer-read-only (ding) (icicle-user-error "Buffer is read-only")) (error (icicle-remove-Completions-window) (icicle-user-error "No match for `%s'" replace-string)))) (condition-case icicle-search-replace-match2 ; Emacs < 22. Try to interpret `\'. (replace-match replace-string fixedcase icicle-search-replace-literally-flag) (error (replace-match replace-string fixedcase t))))) ; If error, replace literally. (defun icicle-search-highlight-context-levels () "Highlight context levels differently (up to 8 levels). No such highlighting is done if any of these conditions holds: * `icicle-search-context-level' is not 0 (search context < regexp). * `icicle-search-highlight-context-levels-flag' is nil. * `icicle-search-context-regexp' is nil (non-regexp searching)." (unless (or (/= icicle-search-context-level 0) (not icicle-search-highlight-context-levels-flag) (not icicle-search-context-regexp)) ; E.g. text-property searching (while icicle-search-level-overlays (delete-overlay (car icicle-search-level-overlays)) (setq icicle-search-level-overlays (cdr icicle-search-level-overlays))) (save-match-data (let ((level 1) (max-levels (min (regexp-opt-depth icicle-search-context-regexp) 8))) (goto-char (point-min)) (re-search-forward icicle-search-context-regexp nil t) (condition-case nil (while (<= level max-levels) (unless (equal (match-beginning level) (match-end level)) (let ((ov (make-overlay (match-beginning level) (match-end level)))) (push ov icicle-search-level-overlays) (overlay-put ov 'priority (+ 205 level)) ; > ediff's 100+, < isearch-overlay's 1001. (overlay-put ov 'face (intern (concat "icicle-search-context-level-" (number-to-string level)))))) (setq level (1+ level))) (error nil)))))) ;; Free var here: `icicle-search-ecm' is bound in `icicle-search'. (defun icicle-search-highlight-input-matches-here () "Highlight all input matches in the current search context." (unless (or (eq t icicle-search-highlight-threshold) (> 0 icicle-search-highlight-threshold) (string= "" icicle-current-input)) (goto-char (point-min)) (when (and (not icicle-search-highlight-all-current-flag) (overlayp icicle-search-refined-overlays)) (delete-overlay icicle-search-refined-overlays) (setq icicle-search-refined-overlays ())) (unless icicle-search-highlight-all-current-flag (while icicle-search-refined-overlays (delete-overlay (car icicle-search-refined-overlays)) (setq icicle-search-refined-overlays (cdr icicle-search-refined-overlays)))) (let ((ov nil)) (save-match-data (while (and (not (eobp)) (re-search-forward (or icicle-search-ecm icicle-current-input) nil 'move-to-end)) (if (equal (match-beginning 0) (match-end 0)) (forward-char 1) (setq ov (make-overlay (match-beginning 0) (match-end 0))) (push ov icicle-search-refined-overlays) (overlay-put ov 'priority 220) ; Greater than any possible context-level priority (213). (overlay-put ov 'face 'icicle-search-current-input))))))) (defun icicle-search-replace-fixed-case-p (from) "Return non-nil if FROM should be replaced without transferring case. FROM is a string or nil. If FROM is nil, then return nil. Retuns non-nil if FROM is a string and one of the following holds: * FROM is not all lowercase * `case-replace' or `case-fold-search' is nil" (and from (not (and case-fold-search case-replace (string= from (downcase from)))))) ;; Not used for now - this could replace using mct. In that case, user must not be able to sort. (defun icicle-search-replace-cand-in-alist (cand+mrker new-cand) "In `icicle-candidates-alist', replace car of CAND+MRKER by NEW-CAND. Replace only the first occurrence of CAND+MRKER in `icicle-candidates-alist'. (There should be only one.)" (let ((newlist icicle-candidates-alist)) (catch 'icicle-search-replace-cand-in-alist (while newlist (when (equal (car newlist) cand+mrker) (setcar newlist (cons new-cand (cdr-safe cand+mrker))) (throw 'icicle-search-replace-cand-in-alist nil)) (setq newlist (cdr newlist)))) icicle-candidates-alist)) (defun icicle-search-replace-cand-in-mct (cand+mrker new-cand) "Replace candidate in `minibuffer-completion-table'. Update CAND+MRKER itself to use NEW-CAND (replacement string). Any text properties on CAND+MRKER's string are preserved. Use this only with a `minibuffer-completion-table' derived from an alist." (let ((newlist minibuffer-completion-table)) (catch 'icicle-search-replace-cand-in-mct ;; CAND+MRKER: ("aa" . c) or (("aa" "bb") . c) ;; `minibuffer-completion-table' entry: ("aa" "aa" . c) or ("aa^G^Jbb" . (("aa" "bb") . c)) (while newlist (when (equal (cdr (car newlist)) cand+mrker) (let ((new-compl (if (consp (car cand+mrker)) ; New completion: "QQ" or ("QQ" "bb") (cons new-cand (cdar cand+mrker)) new-cand)) (old-cand (if (consp (car cand+mrker)) (caar cand+mrker) (car cand+mrker))) rep-cand) (setcar newlist (icicle-mctized-full-candidate (cons new-compl (cdr-safe cand+mrker)))) ;; NEWLIST is done. ;; Now update CAND+MRKER to reflect the replacement but with the text properties it had. ;; (cdar NEWLIST) is the new cand+mrker. Its car or caar is the replaced candidate. ;; It is the first field of the multi-completion, in the latter case. (setq rep-cand (if (consp (car cand+mrker)) (caar (cdar newlist)) (car (cdar newlist)))) (let ((len-old (length old-cand)) (len-rep (length rep-cand)) (ii 0) props) (while (< ii len-old) (setq props (text-properties-at ii old-cand)) (when (< ii len-rep) (add-text-properties ii (1+ ii) props rep-cand)) (setq ii (1+ ii))) (let ((last-props (text-properties-at (1- len-old) old-cand))) (when (> len-rep len-old) (add-text-properties len-old len-rep last-props rep-cand)))) (if (consp (car cand+mrker)) (setcar (car cand+mrker) rep-cand) (setcar cand+mrker rep-cand))) (throw 'icicle-search-replace-cand-in-mct nil)) (setq newlist (cdr newlist)))) minibuffer-completion-table)) (defun icicle-search-help (cand) "Use as `icicle-candidate-help-fn' for `icicle-search' commands." (icicle-msg-maybe-in-minibuffer (let* ((icicle-whole-candidate-as-text-prop-p t) ;; Alternative: If we used `icicle-search-replace-cand-in-alist', then we would bind that ;; to nil to force using the alist, because we would be performing side effects on it. (marker (cdr (funcall icicle-get-alist-candidate-function cand)))) (concat "Buffer: `" (buffer-name (marker-buffer marker)) (format "', Position: %d" (marker-position marker)))))) (defun icicle-search-keywords (beg end keywords require-match ; Bound to `M-s M-s k', `C-c ^'. &optional where &rest args) "Search with one or more keywords, which can each be a regexp. Text that matches *any* of the keywords is found. You can use completion to choose one or more previously entered regexps (using `C-RET', `C-mouse-2', `C-next', and so on), or you can enter new keywords (using `C-RET'). Use `RET' or `mouse-2' to choose the last keyword. Keywords are interpreted as regexps. You can change to substring completion instead, matching regexp special characters literally, by using `C-`' during completion to toggle `icicle-regexp-quote-flag'. You can alternatively choose to search, not the search contexts as defined by keyword matches, but the non-contexts, that is, the text in the buffer that does not match the keyword patterns. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.) This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the `icicle-search' documentation." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-group-regexp (mapconcat #'icicle-group-regexp (icicle-keyword-list) "\\|")) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (icicle-search beg end keywords (not icicle-show-multi-completion-flag) where)) (defun icicle-group-regexp (regexp) "Wrap REGEXP between regexp parens, as a regexp group." (concat "\\(" regexp "\\)")) (icicle-define-command icicle-search-bookmark ; Bound to `M-s M-s j'. "Search bookmarked text. See also `icicle-search-bookmarks-together', which searches bookmarks together instead of one at a time. 1. Enter a context regexp (using `RET'), to define the possible search-hit contexts. 2. Choose a bookmark using completion. It is opened/visited/handled. 3. (Optional) Type some text to be matched in the search contexts. 4. Navigate to matches (search hits) using `C-next' etc. 5. Finish with that bookmark using `RET' (stay) or `C-g' (skip). 6. (Optional) Repeat steps 2-5 for other bookmarks. If you use library `Bookmark+' then: a. If a bookmark specifies a nonempty region, then search only the text in that region. Otherwise, search the whole bookmarked buffer/file. b. The candidate bookmarks are those in the current `*Bookmark List*' display (list `bmkp-sorted-alist', to be precise). This means that you can limit the candidates to bookmarks of a certain type (e.g., only autofiles, using `A S'), bookmarks with certain tags (e.g., those with tags matching a regexp using `T m %' followed by `>'), and so on. \(b) provides you with a great deal of flexibility. However, for your convenience, if you use `Bookmark+' then Icicles also provides some special-purpose commands for searching the content of bookmarks of various types. For example, `icicle-search-autofile-bookmark' searches autofiles. And you can define your own such commands using macro `icicle-define-search-bookmark-command'. You can alternatively choose to search, not the search contexts as defined by the context regexp, but the non-contexts, that is, the text in the bookmarked buffer that does not match the regexp. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.)" ; Doc string icicle-search-bookmark-action ; Action function prompt icicle-candidates-alist nil (not icicle-show-multi-completion-flag) ; `completing-read' args nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) (and (boundp 'bookmark-current-bookmark) bookmark-current-bookmark) nil ((enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on disk... (completion-ignore-case bookmark-completion-ignore-case) (prompt "Search bookmark: ") (icicle-search-context-regexp (icicle-search-read-context-regexp)) (bookmark-automatically-show-annotations nil) ; Do not show annotations (icicle-multi-completing-p icicle-show-multi-completion-flag) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) () (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) (icicle-candidates-alist (if (not (featurep 'bookmark+)) (mapcar (lambda (cand) (list (icicle-candidate-short-help (icicle-bookmark-help-string cand) (icicle-bookmark-propertize-candidate cand)))) (bookmark-all-names)) ; Loads bookmarks file, defining `bookmark-alist'. (bookmark-maybe-load-default-file) ; Loads bookmarks file, defining `bookmark-alist'. (mapcar #'icicle-make-bookmark-candidate (or (and (or (and (not icicle-bookmark-refresh-cache-flag) (not (consp current-prefix-arg))) (and icicle-bookmark-refresh-cache-flag (consp current-prefix-arg))) bmkp-sorted-alist) (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist)))))) (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p)) (and (featurep 'bookmark+) '(("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p) ("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p) ("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by file name" (bmkp-file-alpha-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p) ("by Info location" (bmkp-info-cp) icicle-alpha-p) ("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p) ("by URL" (bmkp-url-cp) icicle-alpha-p) ("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn (lambda (cand) (when (and (featurep 'bookmark+) icicle-show-multi-completion-flag) (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if (featurep 'bookmark+) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand)) (icicle-msg-maybe-in-minibuffer (icicle-bookmark-help-string cand)))))) (progn ; First code (require 'bookmark) (when (featurep 'bookmark+) ;; Bind keys to narrow bookmark candidates by type. Lax is for multi-completion case. (dolist (map '(minibuffer-local-must-match-map minibuffer-local-completion-map)) (define-key (symbol-value map) (icicle-kbd "C-M-b") 'icicle-bookmark-non-file-narrow) ; `C-M-b' (define-key (symbol-value map) (icicle-kbd "C-M-d") 'icicle-bookmark-dired-narrow) ; `C-M-d' (define-key (symbol-value map) (icicle-kbd "C-M-f") 'icicle-bookmark-file-narrow) ; `C-M-f' (define-key (symbol-value map) (icicle-kbd "C-M-g") 'icicle-bookmark-gnus-narrow) ; `C-M-g' (define-key (symbol-value map) (icicle-kbd "C-M-i") 'icicle-bookmark-info-narrow) ; `C-M-i' (define-key (symbol-value map) (icicle-kbd "C-M-m") 'icicle-bookmark-man-narrow) ; `C-M-m' (define-key (symbol-value map) (icicle-kbd "C-M-r") 'icicle-bookmark-region-narrow) ; `C-M-r' (define-key (symbol-value map) (icicle-kbd "C-M-u") 'icicle-bookmark-url-narrow) ; `C-M-u' (define-key (symbol-value map) (icicle-kbd "C-M-w") 'icicle-bookmark-w3m-narrow) ; `C-M-w' (define-key (symbol-value map) (icicle-kbd "C-M-@") 'icicle-bookmark-remote-file-narrow) ; `C-M-@' (define-key (symbol-value map) (icicle-kbd "C-M-B") ; `C-M-B' 'icicle-bookmark-bookmark-list-narrow) (define-key (symbol-value map) (icicle-kbd "C-M-F") ; `C-M-F' 'icicle-bookmark-local-file-narrow) (define-key (symbol-value map) (icicle-kbd "C-M-K") ; `C-M-K' 'icicle-bookmark-desktop-narrow)))) (icicle-bookmark-cleanup-on-quit) ; Undo code (icicle-bookmark-cleanup)) ; Last code (defun icicle-search-bookmark-action (bookmark-name) "Action function for `icicle-search-bookmark'." (setq bookmark-name (icicle-transform-multi-completion bookmark-name)) (bookmark-jump-other-window bookmark-name) (setq mark-active nil) ; Unhighlight region, so you can see search hits etc. (let ((icicle-show-Completions-initially-flag t) (icicle-candidate-action-fn 'icicle-search-action) (enable-recursive-minibuffers t) (beg (or (and (featurep 'bookmark+) (bmkp-region-bookmark-p bookmark-name) (bookmark-get-position bookmark-name)) (point-min))) (end (or (and (featurep 'bookmark+) (bmkp-region-bookmark-p bookmark-name) (bmkp-get-end-position bookmark-name)) (point-max)))) (when (= beg end) (setq beg (point-min) end (point-max))) (icicle-search beg end icicle-search-context-regexp t)) (with-current-buffer (window-buffer (minibuffer-window)) (icicle-erase-minibuffer))) ;; The following sexps macro-expand to define these commands: ;; `icicle-search-all-tags-bookmark' ;; `icicle-search-all-tags-regexp-bookmark' ;; `icicle-search-autofile-bookmark' ;; `icicle-search-autonamed-bookmark' ;; `icicle-search-bookmark-list-bookmark' ;; `icicle-search-dired-bookmark' ;; `icicle-search-file-bookmark' ;; `icicle-search-gnus-bookmark' ;; `icicle-search-info-bookmark' ;; `icicle-search-local-file-bookmark' ;; `icicle-search-man-bookmark' ;; `icicle-search-non-file-bookmark' ;; `icicle-search-region-bookmark' ;; `icicle-search-remote-file-bookmark' ;; `icicle-search-some-tags-bookmark' ;; `icicle-search-some-tags-regexp-bookmark' ;; `icicle-search-specific-buffers-bookmark' ;; `icicle-search-specific-files-bookmark' ;; `icicle-search-temporary-bookmark' ;; `icicle-search-this-buffer-bookmark' ;; `icicle-search-url-bookmark' ;; `icicle-search-w3m-bookmark' (icicle-define-search-bookmark-command "all-tags" nil (bmkp-read-tags-completing)) (icicle-define-search-bookmark-command "all-tags-regexp" nil (bmkp-read-tags-completing)) (icicle-define-search-bookmark-command "autofile") (icicle-define-search-bookmark-command "autonamed") (icicle-define-search-bookmark-command "bookmark-list") (icicle-define-search-bookmark-command "dired") (icicle-define-search-bookmark-command "file") (icicle-define-search-bookmark-command "gnus") (icicle-define-search-bookmark-command "info") (icicle-define-search-bookmark-command "local-file") (icicle-define-search-bookmark-command "man") (icicle-define-search-bookmark-command "non-file") (icicle-define-search-bookmark-command "region" "Search region: ") (icicle-define-search-bookmark-command "remote-file") (icicle-define-search-bookmark-command "some-tags" nil (bmkp-read-tags-completing)) (icicle-define-search-bookmark-command "some-tags-regexp" nil (bmkp-read-tags-completing)) (icicle-define-search-bookmark-command "specific-buffers" nil (icicle-bookmarked-buffer-list)) (icicle-define-search-bookmark-command "specific-files" nil (icicle-bookmarked-file-list)) (icicle-define-search-bookmark-command "temporary") (icicle-define-search-bookmark-command "this-buffer") (icicle-define-search-bookmark-command "url") (icicle-define-search-bookmark-command "w3m") ;;; Same as `thgcmd-last-thing-type' in `thing-cmds.el'. (defvar icicle-last-thing-type (if (boundp 'thgcmd-last-thing-type) thgcmd-last-thing-type 'sexp) "Type of thing last used by `icicle-next-visible-thing' (or previous).") (defun icicle-search-thing (thing &optional beg end require-match where ; Bound to `M-s M-s t'. predicate transform-fn) "`icicle-search' with THINGs as search contexts. Enter the type of THING to search: `sexp', `sentence', `list', `string', `comment', etc. Possible THINGs are those for which `icicle-bounds-of-thing-at-point' returns non-nil (and for which the bounds are not equal: an empty thing). This does not include everything THING that is defined as a thing-at-point type. You can search the region, buffer, multiple buffers, or multiple files. See `icicle-search' for a full explanation. If user option `icicle-ignore-comments-flag' is nil then include THINGs located within comments. Non-nil means to ignore comments for searching. You can toggle this option using `C-M-;' in the minibuffer, but depending on when you do so you might need to invoke this command again. Non-interactively, if optional arg PREDICATE is non-nil then it is a predicate that acceptable things must satisfy. It is passed the thing in the form of the cons returned by `icicle-next-visible-thing-and-bounds'. Non-interactively, if optional arg TRANSFORM-FN is non-nil then it is a function to apply to each thing plus its bounds and which returns the actual search-target to push to `icicle-candidates-alist' in place of THING. Its argument is the same as PREDICATE's. It returns the replacement for the thing plus its bounds, in the same form: a cons (STRING START . END), where STRING is the search hit string and START and END are its bounds). You can alternatively choose to search, not the THINGs as search contexts, but the non-THINGs (non-contexts), that is, the buffer text that is outside THINGs. To do this, use `C-M-~' during completion. \(This is a toggle, and it affects only future search commands, not the current one.) This command is intended only for use in Icicle mode. NOTE: 1. For best results, use also library `thingatpt+.el'. 2. In some cases it can take a while to gather the candidate THINGs. Use the command on an active region when you do not need to search THINGS throughout an entire buffer. 3. In `nxml-mode', remember that option `nxml-sexp-element-flag' controls what a `sexp' means. To use whole XML elements as search contexts, set it to t, not nil. (This is already done for the predefined Icicles XML search commands.) 4. Remember that if there is only one THING in the buffer or active region then no search is done. Icicles search does nothing when there is only one possible search hit. 5. The scan candidate things moves forward a THING at a time. In particular, if either PREDICATE or TRANSFORM-FN disqualifies the thing being scanned currently, then scanning skips forward to the next thing. The scan does not dig inside the current thing to look for a qualified THING. 6. In some Emacs releases, especially prior to Emacs 23, the thing-at-point functions can sometimes behave incorrectly. Thus, `icicle-search-thing' also behaves incorrectly in such cases. 7. Prior to Emacs 21 there is no possibility of ignoring comments." (interactive (icicle-search-thing-args)) (setq icicle-search-context-level 0) (icicle-search beg end 'icicle-search-thing-scan require-match where thing predicate transform-fn)) (defun icicle-search-thing-args () "Read and return interactive arguments for `icicle-search-thing'." (let* ((where (icicle-search-where-arg)) (beg+end (icicle-region-or-buffer-limits)) (beg1 (car beg+end)) (end1 (cadr beg+end)) (thing (intern (completing-read (format "%shing (type): " (if icicle-search-complement-domain-p "*NOT* t" "T")) (icicle-things-alist) nil nil nil nil (symbol-name icicle-last-thing-type))))) (when (and (eq thing 'comment) icicle-ignore-comments-flag) (message "Use `%s' if you do not want to ignore comments" (icicle-propertize "C-M-;" 'face 'icicle-msg-emphasis)) (sit-for 2)) `(,thing ,beg1 ,end1 ,(not icicle-show-multi-completion-flag) ,where))) ;;; Same as `thgcmd-things-alist' in `thing-cmds.el'. (defun icicle-things-alist () "Alist of most thing types currently defined. Each is a cons (STRING), where STRING names a type of text entity for which there is a either a corresponding `forward-'thing operation, or corresponding `beginning-of-'thing and `end-of-'thing operations. The list includes the names of the symbols that satisfy `icicle-defined-thing-p', but with these excluded: `thing', `buffer', `point'." (let ((types ())) (mapatoms (lambda (tt) (when (icicle-defined-thing-p tt) (push (symbol-name tt) types)))) (dolist (typ '("thing" "buffer" "point")) ; Remove types that do not make sense. (setq types (delete typ types))) (setq types (sort types #'string-lessp)) (mapcar #'list types))) ;;; Same as `thgcmd-defined-thing-p' in `thing-cmds.el'. (defun icicle-defined-thing-p (thing) "Return non-nil if THING (type) is defined as a thing-at-point type." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing)))) (beginning-op (get thing 'beginning-op)) (end-op (get thing 'end-op)) (bounds-fn (get thing 'bounds-of-thing-at-point)) (thing-fn (get thing 'thing-at-point))) (or (functionp forward-op) (and (functionp beginning-op) (functionp end-op)) (functionp bounds-fn) (functionp thing-fn)))) ;; Same as `hide/show-comments' in `hide-comnt.el'. ;; (defun icicle-hide/show-comments (&optional hide/show start end) "Hide or show comments from START to END. Interactively, hide comments, or show them if you use a prefix arg. Interactively, START and END default to the region limits, if active. Otherwise, including non-interactively, they default to `point-min' and `point-max'. Uses `save-excursion', restoring point. Be aware that using this command to show invisible text shows *all* such text, regardless of how it was hidden. IOW, it does not just show invisible text that you previously hid using this command. From Lisp, a HIDE/SHOW value of `hide' hides comments. Other values show them. This function does nothing in Emacs versions prior to Emacs 21, because it needs `comment-search-forward'." (interactive `(,(if current-prefix-arg 'show 'hide) ,@(icicle-region-or-buffer-limits))) (when (require 'newcomment nil t) ; `comment-search-forward' (comment-normalize-vars) ; Per Stefan, should call this first. (unless start (setq start (point-min))) (unless end (setq end (point-max))) (unless (<= start end) (setq start (prog1 end (setq end start)))) (let ((bufmodp (buffer-modified-p)) (buffer-read-only nil) cbeg cend) (unwind-protect (save-excursion (goto-char start) (while (and (< start end) (setq cbeg (comment-search-forward end 'NOERROR))) (setq cend (if (string= "" comment-end) (min (1+ (line-end-position)) (point-max)) (search-forward comment-end end 'NOERROR))) (when (and cbeg cend) (if (eq 'hide hide/show) (put-text-property cbeg cend 'invisible t) (put-text-property cbeg cend 'invisible nil))))) (set-buffer-modified-p bufmodp))))) ;;; Same as `with-comments-hidden' in `hide-comnt.el', except doc here mentions `C-M-;'. (defmacro icicle-with-comments-hidden (start end &rest body) "Evaluate the forms in BODY while comments are hidden from START to END. But if `icicle-ignore-comments-flag' is nil, just evaluate BODY, without hiding comments. Show comments again when BODY is finished. You can toggle `icicle-ignore-comments-flag' using `C-M-;' in the minibuffer, but depending on when you do so you might need to invoke the current command again. See `icicle-hide/show-comments', which is used to hide and show the comments. Note that prior to Emacs 21, this never hides comments." (let ((result (make-symbol "result")) (ostart (make-symbol "ostart")) (oend (make-symbol "oend"))) `(let ((,ostart ,start) (,oend ,end) ,result) (unwind-protect (setq ,result (progn (when icicle-ignore-comments-flag (icicle-hide/show-comments 'hide ,ostart ,oend)) ,@body)) (when icicle-ignore-comments-flag (icicle-hide/show-comments 'show ,ostart ,oend)) ,result)))) (defun icicle-search-thing-scan (buffer beg end thing &optional predicate transform-fn) "Scan BUFFER from BEG to END for things of type THING. Push the things found onto `icicle-candidates-alist'. If BUFFER is nil, scan the current buffer. Highlight the matches using face `icicle-search-main-regexp-others'. If BEG and END are nil, scan entire BUFFER. If PREDICATE is non-nil then it is a predicate that acceptable things must satisfy. It is passed the thing plus its bounds, in the form of the cons returned by `icicle-next-visible-thing-and-bounds'. If TRANSFORM-FN is non-nil then it is a function to apply to each thing plus its bounds. Its argument is the same as PREDICATE's. It returns the actual search-target to push to `icicle-candidates-alist' in place of THING. That is, it returns the replacement for the thing plus its bounds, in the same form: a cons (STRING START . END), where STRING is the search hit string and START and END are its bounds). It can also return nil, in which case it acts as another predicate: the thing is not included as a candidate. NOTE: The scan moves forward a THING at a time. In particular, if either PREDICATE or TRANSFORM-FN disqualifies the thing being scanned currently, then scanning skips forward to the next thing. The scan does not dig inside the current thing to look for a qualified THING. This function respects both `icicle-search-complement-domain-p' and `icicle-ignore-comments-flag'." (let ((add-bufname-p (and buffer icicle-show-multi-completion-flag)) (temp-list ()) (last-beg nil)) (unless buffer (setq buffer (current-buffer))) (when (bufferp buffer) ; Do nothing if BUFFER is not a buffer. (with-current-buffer buffer (unless beg (setq beg (point-min))) (unless end (setq end (point-max))) (unless (< beg end) (setq beg (prog1 end (setq end beg)))) ; Ensure BEG is before END. (icicle-with-comments-hidden beg end (icicle-condition-case-no-debug icicle-search-thing-scan (save-excursion (goto-char (setq last-beg beg)) ; `icicle-next-visible-thing-and-bounds' uses point. (while (and last-beg (< last-beg end)) (while (and (< beg end) (icicle-invisible-p beg)) ; Skip invisible, overlay or text. (when (get-char-property beg 'invisible) (setq beg (icicle-next-single-char-property-change beg 'invisible nil end)))) (let ((thg+bnds (icicle-next-visible-thing-and-bounds thing beg end))) (if (and (not thg+bnds) (not icicle-search-complement-domain-p)) (setq beg end) (let* ((thg-beg (cadr thg+bnds)) (thg-end (cddr thg+bnds)) (tr-thg-beg thg-beg) (tr-thg-end thg-end) (hit-beg (if icicle-search-complement-domain-p last-beg tr-thg-beg)) (hit-end (if icicle-search-complement-domain-p (or tr-thg-beg end) tr-thg-end)) (hit-string (buffer-substring hit-beg hit-end)) (end-marker (copy-marker hit-end)) (filteredp (or (not predicate) (not thg+bnds) (funcall predicate thg+bnds))) (new-thg+bnds (if icicle-search-complement-domain-p thg+bnds (and filteredp thg+bnds (if transform-fn (funcall transform-fn thg+bnds) thg+bnds))))) (when (and (not (string= "" hit-string)) ; No-op if empty hit. (or new-thg+bnds icicle-search-complement-domain-p)) (when (and transform-fn (not icicle-search-complement-domain-p)) (setq hit-string (car new-thg+bnds) tr-thg-beg (cadr new-thg+bnds) tr-thg-end (cddr new-thg+bnds) end-marker (copy-marker tr-thg-end))) (when (and icicle-ignore-comments-flag icicle-search-complement-domain-p) (put-text-property 0 (length hit-string) 'invisible nil hit-string)) (icicle-candidate-short-help (concat (and add-bufname-p (format "Buffer: `%s', " (buffer-name (marker-buffer end-marker)))) (format "Bounds: (%d, %d), Length: %d" hit-beg hit-end (length hit-string))) hit-string) (push (cons (if add-bufname-p (list hit-string (let ((string (copy-sequence (buffer-name)))) (put-text-property 0 (length string) 'face 'icicle-candidate-part string) string)) hit-string) end-marker) temp-list) ;; Highlight search context in buffer. (when (and (not (equal hit-beg hit-end)) (or (eq t icicle-search-highlight-threshold) (<= (+ (length temp-list) (length icicle-candidates-alist)) icicle-search-highlight-threshold))) (let ((ov (make-overlay hit-beg hit-end))) (push ov icicle-search-overlays) (overlay-put ov 'priority 200) ; > ediff's 100+, but < isearch overlays (overlay-put ov 'face 'icicle-search-main-regexp-others)))) (if thg-end ;; $$$$$$ ;; The correct code here is (setq beg end). However, unless you use my ;; library `thingatpt+.el' or unless Emacs bug #9300 is fixed (hopefully ;; in Emacs 24), that will loop forever. In that case we move forward a ;; char to prevent looping, but that means that the position just after ;; a THING is considered to be covered by the THING (which is incorrect). (setq beg (if (or (featurep 'thingatpt+) (> emacs-major-version 23)) thg-end (1+ thg-end))) ;; If visible then no more things - skip to END. (unless (icicle-invisible-p beg) (setq beg end))))) (setq last-beg beg))) (setq icicle-candidates-alist (append icicle-candidates-alist (nreverse temp-list)))) (quit (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup))) (error (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (error "%s" (error-message-string icicle-search-thing-scan))))))))) ;; Same as `thgcmd-invisible-p' in `thing-cmds.el'. (defun icicle-invisible-p (position) "Return non-nil if the character at POSITION is invisible." (if (fboundp 'invisible-p) ; Emacs 22+ (invisible-p position) (let ((prop (get-char-property position 'invisible))) ; Overlay or text property. (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec)))))) (defun icicle-invisible-face-p (face) "Return non-nil if FACE is currently invisibile." (and (consp buffer-invisibility-spec) (or (memq face buffer-invisibility-spec) (assq face buffer-invisibility-spec)))) (defun icicle-next-visible-thing-and-bounds (thing start end) "Return the next visible THING and its bounds. Start at BEG and end at END, when searching for THING. Return (THING THING-START . THING-END), with THING-START and THING-END the bounds of THING. Return nil if no such THING is found. The \"visible\" in the name refers to ignoring things that are within invisible text, such as hidden comments. You can toggle hiding of comments using `C-M-;' in the minibuffer, but depending on when you do so you might need to invoke the current command again." (save-excursion (icicle-next-visible-thing thing start end))) ;; Simple version of `previous-visible-thing' from `thing-cmds.el'. ;; (defun icicle-previous-visible-thing (thing start &optional end) "Same as `icicle-next-visible-thing', except it moves backward." (interactive (list (or (and (memq last-command '(icicle-next-visible-thing icicle-previous-visible-thing)) icicle-last-thing-type) (prog1 (intern (completing-read "Thing (type): " (icicle-things-alist) nil nil nil nil (symbol-name icicle-last-thing-type))))) (point) (if mark-active (min (region-beginning) (region-end)) (point-min)))) (if (interactive-p) (icicle-with-comments-hidden start end (icicle-next-visible-thing thing start end 'BACKWARD)) (icicle-next-visible-thing thing start end 'BACKWARD))) ;; Simple version of `next-visible-thing' from `thing-cmds.el'. ;; (defun icicle-next-visible-thing (thing &optional start end backward) "Go to the next visible THING. Start at START. If END is non-nil then look no farther than END. Interactively: - START is point. - If the region is not active, END is the buffer end. If the region is active, END is the region end: the greater of point and mark. Ignores (skips) comments if `icicle-ignore-comments-flag' is non-nil. You can toggle this ignoring of comments using `C-M-;' in the minibuffer, but depending on when you do so you might need to invoke the current command again. If you use this command or `icicle-previous-visible-thing' successively, even mixing the two, you are prompted for the type of THING only the first time. You can thus bind these two commands to simple, repeatable keys (e.g. `f11', `f12'), to navigate among things quickly. Non-interactively, THING is a symbol, and optional arg BACKWARD means go to the previous thing. Return (THING THING-START . THING-END), with THING-START and THING-END the bounds of THING. Return nil if no such THING is found." (interactive (list (or (and (memq last-command '(icicle-next-visible-thing icicle-previous-visible-thing)) icicle-last-thing-type) (prog1 (intern (completing-read "Thing (type): " (icicle-things-alist) nil nil nil nil (symbol-name icicle-last-thing-type))))) (point) (if mark-active (max (region-beginning) (region-end)) (point-max)))) (setq icicle-last-thing-type thing) (unless start (setq start (point))) (unless end (setq end (if backward (point-min) (point-max)))) (cond ((< start end) (when backward (setq start (prog1 end (setq end start))))) ((> start end) (unless backward (setq start (prog1 end (setq end start)))))) (if (interactive-p) (icicle-with-comments-hidden start end (icicle-next-visible-thing-1 thing start end backward)) (icicle-next-visible-thing-1 thing start end backward))) ;;; Same as `thgcmd-next-visible-thing-1' in `thing-cmds.el'. (if (fboundp 'thgcmd-next-visible-thing-1) (defalias 'icicle-next-visible-thing-1 'thgcmd-next-visible-thing-1) (defun icicle-next-visible-thing-1 (thing start end backward) "Helper for `icicle-next-visible-thing'. Get thing past point." (let ((thg+bds (icicle-next-visible-thing-2 thing start end backward))) (if (not thg+bds) nil ;; $$$$$$ Which is better, > or >=, < or <=, for the comparisons? ;; $$$$$$ Seems that < is better than <=, at least for `icicle-search-thing': ;; $$$$$$ for XML elements and lists, <= misses the first one. (while (and thg+bds (if backward (> (cddr thg+bds) (point)) (< (cadr thg+bds) (point)))) (if backward (setq start (max end (1- (cadr thg+bds)))) (setq start (min end (1+ (cddr thg+bds))))) (setq thg+bds (icicle-next-visible-thing-2 thing start end backward))) (when thg+bds (goto-char (cadr thg+bds))) thg+bds)))) ;;; Same as `thgcmd-next-visible-thing-2' in `thing-cmds.el'. (if (fboundp 'thgcmd-next-visible-thing-2) (defalias 'icicle-next-visible-thing-2 'thgcmd-next-visible-thing-2) (defun icicle-next-visible-thing-2 (thing start end &optional backward) "Helper for `icicle-next-visible-thing-1'. Thing might not be past START." (and (not (= start end)) (save-excursion (let ((bounds nil)) ;; If BACKWARD, swap START and END. (cond ((< start end) (when backward (setq start (prog1 end (setq end start))))) ((> start end) (unless backward (setq start (prog1 end (setq end start)))))) (catch 'icicle-next-visible-thing-2 (while (if backward (> start end) (< start end)) (goto-char start) ;; Skip invisible text. (when (and (if backward (> start end) (< start end)) (icicle-invisible-p start)) (setq start (if (get-text-property start 'invisible) ; Text prop. (if backward (previous-single-property-change start 'invisible nil end) (next-single-property-change start 'invisible nil end)) (if backward ; Overlay prop. (previous-overlay-change start) (next-overlay-change start)))) (goto-char start)) (when (and (setq bounds (icicle-bounds-of-thing-at-point thing)) (not (equal (car bounds) (cdr bounds)))) ; Not an empty thing, "". (throw 'icicle-next-visible-thing-2 (cons (buffer-substring (car bounds) (cdr bounds)) bounds))) (setq start (if backward (1- start) (1+ start)))) nil)))))) (defun icicle-search-xml-element (beg end require-match where element) "`icicle-search' with XML ELEMENTs as search contexts. ELEMENT is a regexp that is matched against actual element names. The search contexts are the top-level matching elements within the search limits, BEG and END. Those elements might or might not contain descendent elements that are themselves of type ELEMENT. You can alternatively choose to search, not the search contexts as defined by the element-name regexp, but the non-contexts, that is, the buffer text that is outside such elements. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.) You will no doubt need nXML for this command. It is included in vanilla Emacs, starting with Emacs 23. And you will need to load `thingatpt+.el', because of bugs in vanilla `thingatpt.el'." (interactive (let* ((where (icicle-search-where-arg)) (beg+end (icicle-region-or-buffer-limits)) (beg1 (car beg+end)) (end1 (cadr beg+end)) (elt (read-string "XML element (name regexp, no markup): " nil 'regexp-history))) `(,beg1 ,end1 ,(not icicle-show-multi-completion-flag) ,where ,elt))) (let ((nxml-sexp-element-flag t)) (icicle-search-thing 'sexp beg end require-match where `(lambda (thg+bds) (and thg+bds (icicle-string-match-p ,(format "\\`\\s-*<\\s-*%s\\s-*>" element) (car thg+bds))))))) (defun icicle-search-xml-element-text-node (beg end require-match where element) "`icicle-search', with text() nodes of XML ELEMENTs as search contexts. ELEMENT is a regexp that is matched against actual XML element names. The search contexts are the text() nodes of the top-level matching elements within the search limits, BEG and END. (Those elements might or might not contain descendent elements that are themselves of type ELEMENT.) You can alternatively choose to search, not the search contexts as defined by the element-name regexp, but the non-contexts, that is, the buffer text that is outside the text nodes of such elements. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.) You will no doubt need nXML for this command. It is included in vanilla Emacs, starting with Emacs 23. And you will need to load `thingatpt+.el', because of bugs in vanilla `thingatpt.el'." (interactive (let* ((where (icicle-search-where-arg)) (beg+end (icicle-region-or-buffer-limits)) (beg1 (car beg+end)) (end1 (cadr beg+end)) (elt (read-string "XML element (name regexp, no markup): " nil 'regexp-history))) `(,beg1 ,end1 ,(not icicle-show-multi-completion-flag) ,where ,elt))) (let ((nxml-sexp-element-flag t)) (icicle-search-thing 'sexp beg end require-match where `(lambda (thg+bds) (and thg+bds (icicle-string-match-p ,(format "\\`\\s-*<\\s-*%s\\s-*>" element) (car thg+bds)))) `(lambda (thg+bds) (save-excursion (let* ((tag-end (string-match ,(format "\\`\\s-*<\\s-*%s\\s-*>" element) (car thg+bds))) (child (icicle-next-visible-thing 'sexp (+ (match-end 0) (cadr thg+bds)) (cddr thg+bds))) (tag-regexp (concat "\\`\\s-*<\\s-*" (if (> emacs-major-version 20) (if (boundp 'xmltok-ncname-regexp) xmltok-ncname-regexp "\\(?:[_[:alpha:]][-._[:alnum:]]*\\)") "\\([_a-zA-Z][-._a-zA-Z0-9]\\)") "\\s-*>"))) (and child (not (icicle-string-match-p tag-regexp (car child))) child))))))) (defun icicle-search-char-property (beg end require-match ; Bound to `M-s M-s c'. &optional where prop values predicate match-fn) "Search for text that has a character property with a certain value. By \"character property\" is meant either an overlay property or a text property. If you want to search for only an overlay property or only a text property, then use `icicle-search-overlay-property' or `icicle-search-text-property' instead. Interactively, you are prompted for the property to search and its value. By default, an actual value of the property matches the value you specify if it is `equal'. Properties `mumamo-major-mode' and `face' (or `font-lock-face') are exceptions. For `mumamo-major-mode' you specify the major mode whose zones of text you want to search. The actual property value is a list whose car is the major mode symbol. For properties `face' and `font-lock-face', you can pick multiple faces, using completion (e.g., `C-RET' and finally `RET'). Text is searched that has a face property that includes any of the faces you choose. If you choose no face (empty input), then text with any face at all is searched. You can alternatively choose to search, not the search contexts as defined, but the zones of buffer text that do NOT have the given character property value. In other words, search the complement zones. To toggle such complementing, use `C-M-~' anytime during completion. (This toggling affects only future search commands, not the current one.) Non-interactively, arguments BEG, END, REQUIRE-MATCH, and WHERE are as for `icicle-search'. Arguments PROP, VALUES, and PREDICATE are passed to `icicle-search-char-property-scan' to define the search contexts. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive (icicle-search-property-args)) (icicle-search beg end 'icicle-search-char-property-scan require-match where prop values nil predicate match-fn)) (defun icicle-search-overlay-property (beg end require-match where ; Bound to `M-s M-s O' prop values predicate match-fn) "Same as `icicle-search-char-property', except only overlay property. That is, do not also search a text property." (interactive (icicle-search-property-args)) (icicle-search beg end 'icicle-search-char-property-scan require-match where prop values 'overlay predicate match-fn)) (defun icicle-search-text-property (beg end require-match ; Bound to `M-s M-s T', `C-c "'. where prop values predicate match-fn) "Same as `icicle-search-char-property', except only text property. That is, do not also search an overlay property." (interactive (icicle-search-property-args)) ;; Because font-lock is just-in-time or lazy, if PROP is `face' we fontify the region. ;; Should this be an option, so users who want to can font-lock on demand instead of each time? (when (and (eq prop 'face) font-lock-mode) (save-excursion (font-lock-fontify-region beg end 'VERBOSE))) (icicle-search beg end 'icicle-search-char-property-scan require-match where prop values 'text predicate match-fn)) (defun icicle-search-property-args () "Read and return interactive arguments for `icicle-search-*-property'." (let* ((where (icicle-search-where-arg)) (beg+end (icicle-region-or-buffer-limits)) (beg1 (car beg+end)) (end1 (cadr beg+end)) (props (mapcar (lambda (prop) (list (symbol-name prop))) (icicle-char-properties-in-buffers where beg1 end1))) (prop (intern (completing-read (format "Property %sto search: " (if icicle-search-complement-domain-p "*NOT* " "")) props nil nil nil nil "face"))) (icicle-prompt "Choose property value (`RET' when done): ") (icicle-hist-var 'icicle-char-property-value-history) (values (if (memq prop '(face font-lock-face)) (let ((faces (icicle-face-list))) (if faces (mapcar #'intern faces) (face-list))) ; Default: all faces. (icicle-sexp-list))) (match-fn (icicle-search-property-default-match-fn prop))) `(,beg1 ,end1 ,(not icicle-show-multi-completion-flag) ,where ,prop ,values nil ,match-fn))) (defun icicle-search-property-default-match-fn (prop) "Return the default match function for text or overlay property PROP. Properties `face' and `mumamo-major-mode' are handled specially. For other properties the values are matched using `equal'." (case prop ((face font-lock-face) (lambda (val rprop) (if (consp rprop) (condition-case nil ; Allow for dotted cons. (member val rprop) (error nil)) (eq val rprop)))) ((mumamo-major-mode) (lambda (val rprop) (equal val (car rprop)))) (t #'equal))) (defun icicle-char-properties-in-buffers (where beg end &optional type) "List of all character properties in WHERE. The other arguments are passed to `icicle-char-properties-in-buffer'. Only the character properties are included, not their values. WHERE is a list of buffers, a list of files, or a list of region bookmarks (in which case you must also use library `Bookmark+'). If nil, then only the current buffer is used. TYPE can be `overlay', `text', or nil, meaning overlay properties, text properties, or both, respectively." (cond ((and (consp where) (bufferp (car where))) ; List of buffers - search buffers. (dolist (buf where) (icicle-char-properties-in-buffer buf nil nil type))) ((and (consp where) (stringp (car where)) ; List of files - search files. (Check only the first.) (or (icicle-file-remote-p (car where)) ; Don't let Tramp try to access it. (file-exists-p (car where)))) (dolist (file where) (icicle-char-properties-in-buffer (find-file-noselect file) nil nil type))) ((consp where) ; Search bookmarked regions. (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this")) (let (buf+beg buf beg end) (dolist (bmk where) (setq buf+beg (bookmark-jump-noselect bmk) buf (car buf+beg) beg (cdr buf+beg) end (bmkp-get-end-position bmk)) (when (bufferp buf) (icicle-char-properties-in-buffer (get-buffer buf) beg end type))))) (t ; Search this buffer only. (icicle-char-properties-in-buffer (current-buffer) beg end type)))) (defun icicle-char-properties-in-buffer (&optional buffer beg end type) "List of all character properties in BUFFER between BEG and END. Only the character properties are included, not their values. TYPE can be `overlay', `text', or nil, meaning overlay properties, text properties, or both, respectively." (unless buffer (setq buffer (current-buffer))) (let ((props ()) ovrlays curr-props) (when (bufferp buffer) ; Do nothing if BUFFER is not a buffer. (with-current-buffer buffer (unless (and beg end) (setq beg (point-min) end (point-max))) (when (or (not type) (eq type 'overlay)) ; Get overlay properties. (setq ovrlays (overlays-in beg end)) (dolist (ovrly ovrlays) (setq curr-props (overlay-properties ovrly)) (while curr-props (unless (memq (car curr-props) props) (push (car curr-props) props)) (setq curr-props (cddr curr-props))))) (when (or (not type) (eq type 'text)) ; Get text properties. (while (< beg end) (setq beg (or (next-property-change beg nil end) end) curr-props (text-properties-at beg)) (while curr-props (unless (memq (car curr-props) props) (push (car curr-props) props)) (setq curr-props (cddr curr-props))))))) props)) (defun icicle-search-char-property-scan (buffer beg end prop values type predicate match-fn) "Scan BUFFER from BEG to END for character property PROP with VALUES. Push hits onto `icicle-candidates-alist'. If BUFFER is nil, scan the current buffer. Highlight the matches in face `icicle-search-main-regexp-others'. If BEG and END are nil, scan entire BUFFER. Find text with a PROP value that overlaps with VALUES. That is, if the value of PROP is an atom, then it must be a member of VALUES; if it is a list, then at least one list element must be a member of VALUES. TYPE is `overlay', `text', or nil, and specifies the type of character property - nil means look for both overlay and text properties. If PREDICATE is non-nil, then push only the hits for which it holds. PREDICATE is nil or a Boolean function that takes these arguments: - the search-context string - a marker at the end of the search-context MATCH-FN is a binary predicate that is applied to each item of VALUES and a zone of text with property PROP. If it returns non-nil then the zone is a search hit." (setq match-fn (or match-fn (icicle-search-property-default-match-fn prop))) (let ((add-bufname-p (and buffer icicle-show-multi-completion-flag)) (temp-list ()) (last nil) (zone-end nil)) (unless buffer (setq buffer (current-buffer))) (when (bufferp buffer) ; Do nothing if BUFFER is not a buffer. (with-current-buffer buffer (unless (and beg end) (setq beg (point-min) end (point-max))) (icicle-condition-case-no-debug icicle-search-char-property-scan (save-excursion (setq last beg) (while (and beg (< beg end) ; Skip to first zone. (not (icicle-search-char-prop-matches-p type prop values match-fn beg))) (setq beg (icicle-next-single-char-property-change beg prop nil end))) (while (and beg (< last end)) ; We have a zone. (setq zone-end (or (icicle-next-single-char-property-change beg prop nil end) end)) (let ((hit-beg (if icicle-search-complement-domain-p last beg)) (hit-end (if icicle-search-complement-domain-p beg zone-end)) saved-hit-beg saved-hit-end) (when (and (not (= hit-beg hit-end)) ; Do nothing if hit is empty. (setq hit-end (if (markerp hit-end) hit-end (copy-marker hit-end))) (or (not predicate) (save-match-data (funcall predicate (buffer-substring hit-beg hit-end) hit-end)))) (setq saved-hit-beg hit-beg saved-hit-end hit-end) ;; Try to extend zone. (let (hit-beg hit-end) (while (and beg (< last end) (icicle-search-char-prop-matches-p type prop values match-fn beg)) (setq zone-end (or (icicle-next-single-char-property-change beg prop nil end) end)) (setq hit-beg (if icicle-search-complement-domain-p last beg) hit-end (if icicle-search-complement-domain-p beg zone-end)) (when (and (not (= hit-beg hit-end)) ; Do nothing if hit is empty. (setq hit-end (if (markerp hit-end) hit-end (copy-marker hit-end))) (or (not predicate) (save-match-data (funcall predicate (buffer-substring hit-beg hit-end) hit-end)))) (setq saved-hit-end hit-end)) (setq beg zone-end last zone-end)) zone-end) ;; Add candidate to `temp-list'. (let ((hit-string (buffer-substring hit-beg saved-hit-end))) (icicle-candidate-short-help (concat (and add-bufname-p (format "Buffer: `%s', " (buffer-name (marker-buffer saved-hit-end)))) (format "Position: %d, Length: %d" (marker-position saved-hit-end) (length hit-string))) hit-string) (push (cons (if add-bufname-p (list hit-string (let ((string (copy-sequence (buffer-name)))) (put-text-property 0 (length string) 'face 'icicle-candidate-part string) string)) hit-string) saved-hit-end) temp-list) ;; Highlight search context in buffer. (when (or (eq t icicle-search-highlight-threshold) (<= (+ (length temp-list) (length icicle-candidates-alist)) icicle-search-highlight-threshold)) (let ((ov (make-overlay hit-beg saved-hit-end))) (push ov icicle-search-overlays) (overlay-put ov 'priority 200) ; > ediff's 100+, but < isearch overlays (overlay-put ov 'face 'icicle-search-main-regexp-others)))))) (setq beg zone-end last zone-end) (while (and beg (< beg end) ; Skip to next zone. (not (icicle-search-char-prop-matches-p type prop values match-fn beg))) (setq beg (icicle-next-single-char-property-change beg prop nil end)))) (setq icicle-candidates-alist (append icicle-candidates-alist (nreverse temp-list)))) (quit (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup))) (error (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (error "%s" (error-message-string icicle-search-char-property-scan)))))))) (defun icicle-search-char-prop-matches-p (type property values match-fn position) "Return non-nil if POSITION has PROPERTY with a value matching VALUES. TYPE, VALUES, MATCH-FN are as in `icicle-search-char-property-scan'." (let* ((ovlyval (and (or (not type) (eq type 'overlay)) (get-char-property position property))) (textval (and (or (not type) (eq type 'text)) (get-text-property position property)))) (or (and ovlyval (icicle-some values ovlyval match-fn)) (and textval (icicle-some values textval match-fn))))) (if (fboundp 'next-single-char-property-change) (defalias 'icicle-next-single-char-property-change 'next-single-char-property-change) (defun icicle-next-single-char-property-change (position prop &optional object limit) "Position of next change of PROP for text property or overlay change. Scans characters forward from buffer position POSITION until property PROP changes. Returns the position of that change. POSITION is a buffer position (integer or marker). Optional third arg OBJECT is ignored. It is present for compatibility with Emacs 22+. If optional fourth arg LIMIT is non-nil, search stops at position LIMIT. LIMIT is returned if nothing is found before reaching LIMIT. The property values are compared with `eq'. If the property is constant all the way to the end of the buffer, then return the last valid buffer position." (save-excursion (goto-char position) (let ((propval (get-char-property (point) prop)) (end (min limit (point-max)))) (while (and (< (point) end) (eq (get-char-property (point) prop) propval)) (goto-char (min (next-overlay-change (point)) (next-single-property-change (point) prop nil end))))) (point)))) (if (fboundp 'previous-single-char-property-change) (defalias 'icicle-previous-single-char-property-change 'previous-single-char-property-change) (defun icicle-previous-single-char-property-change (position prop &optional object limit) "Position of previous change of PROP for text property or overlay change. Scans characters backward from buffer position POSITION until property PROP changes. Returns the position of that change. POSITION is a buffer position (integer or marker). Optional third arg OBJECT is ignored. It is present for compatibility with Emacs 22+. If optional fourth arg LIMIT is non-nil, search stops at position LIMIT. LIMIT is returned if nothing is found before reaching LIMIT. The property values are compared with `eq'. If the property is constant all the way to the start of the buffer, then return the first valid buffer position." (save-excursion (goto-char position) (let ((propval (get-char-property (point) prop)) (end (max limit (point-min)))) (while (and (> (point) end) (eq (get-char-property (point) prop) propval)) (goto-char (max (next-overlay-change (point)) (next-single-property-change (point) prop nil end))))) (point)))) (defun icicle-search-highlight-cleanup () "Remove all highlighting from the last use of `icicle-search'." (interactive) (let ((inhibit-quit t)) (message "Removing search highlighting...") (while icicle-search-overlays (delete-overlay (car icicle-search-overlays)) (setq icicle-search-overlays (cdr icicle-search-overlays))) (while icicle-search-level-overlays (delete-overlay (car icicle-search-level-overlays)) (setq icicle-search-level-overlays (cdr icicle-search-level-overlays))) (when (overlayp icicle-search-current-overlay) (delete-overlay icicle-search-current-overlay)) (when (overlayp icicle-search-refined-overlays) (delete-overlay icicle-search-refined-overlays) (setq icicle-search-refined-overlays ())) (while icicle-search-refined-overlays (delete-overlay (car icicle-search-refined-overlays)) (setq icicle-search-refined-overlays (cdr icicle-search-refined-overlays))) (message "Removing search highlighting...done"))) (defun icicle-search-word (beg end word-regexp require-match ; Bound to `M-s M-s w', `C-c $'. &optional where &rest args) "Search for a whole word. The search string is regarded as a whole word, but a \"word\" here can contain embedded strings of non word-constituent chars (they are skipped over, when matching, included in the match), and any leading or trailing word-constituent chars in the search string are dropped \(ignored for matching, not included in the match): matches begin and end on a word boundary. At the prompt for a word, you can use completion against previous Icicles search inputs to choose the word, or you can enter a new word. Non-interactively, WORD-REGEXP should be a regexp that matches a word. The other arguments are the same as for `icicle-search'. You can alternatively choose to search, not the word search contexts you define, but the buffer text that is outside these contexts: the non-word text. To do this, use `C-M-~' during completion. \(This is a toggle, and it affects only future search commands, not the current one.) This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-search-read-word) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (icicle-search beg end word-regexp (not icicle-show-multi-completion-flag) where)) (defun icicle-search-bookmarks-together (scan-fn-or-regexp require-match ; Bound to `M-s M-s J'. &rest args) "Search bookmarks, together. The arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE. This is the same as using a plain prefix arg, `C-u', with `icicle-search'. You choose the bookmarks to search. If `icicle-show-multi-completion-flag' is non-nil, then completion candidates are multi-completions, with first part the bookmark name and second part the bookmark's file or buffer name. Otherwise, the candidates are just the bookmark names. You can alternatively choose to search, not the search contexts as defined by the context regexp, but the non-contexts, that is, the text in the bookmarked buffer that does not match the regexp. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.) An alternative is multi-command `icicle-search-bookmark', which searches the bookmarked regions/buffers you choose one at a time." (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (let ((icicle-multi-completing-p icicle-show-multi-completion-flag)) (apply #'icicle-search nil nil scan-fn-or-regexp require-match (let ((current-prefix-arg '(4))) (icicle-search-where-arg)) args))) (defun icicle-search-buffer (scan-fn-or-regexp require-match &rest args) ; Bound to `M-s M-s b'. "Search multiple buffers completely. Same as using a non-negative numeric prefix arg, such as `C-9', with `icicle-search'. You are prompted for the buffers to search. All of each buffer is searched. Any existing buffers can be chosen. Arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE. You can alternatively choose to search, not the search contexts as defined by the context regexp you provide, but the non-contexts, that is, the text in the buffers that does not match the regexp. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.)" (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (let ((icicle-multi-completing-p icicle-show-multi-completion-flag)) (apply #'icicle-search nil nil scan-fn-or-regexp require-match (let ((icicle-show-Completions-initially-flag t)) (mapcar #'get-buffer (let ((icicle-buffer-require-match-flag 'partial-match-ok) (icicle-prompt "Choose buffer to search (`RET' when done): ")) (icicle-buffer-list)))) args))) (defun icicle-search-file (scan-fn-or-regexp require-match &rest args) ; Bound to `M-s M-s f'. "Search multiple files completely. Same as using a negative numeric prefix arg, such as `C--', with `icicle-search'. You are prompted for the files to search. All of each file is searched. Any existing files in the current directory can be chosen. Arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE. You can alternatively choose to search, not the search contexts as defined by the context regexp you provide, but the non-contexts, that is, the text in the files that does not match the regexp. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.)" (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (let ((icicle-multi-completing-p icicle-show-multi-completion-flag)) (apply #'icicle-search nil nil scan-fn-or-regexp require-match (let ((icicle-show-Completions-initially-flag t) (icicle-prompt "Choose file to search (`RET' when done): ")) (icicle-file-list)) args))) (defun icicle-search-bookmark-list-marked (scan-fn-or-regexp require-match ; Bound to `M-s M-s m'. &rest args) ; Bound also to `C-0 M-s M-s M-s', `C-0 C-`'. "Search the files of the marked bookmarks in `*Bookmark List*'. Same as using `C-0' with `icicle-search' in `*Bookmark List*'. Arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE." (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this command")) (bmkp-bmenu-barf-if-not-in-menu-list) (let ((icicle-multi-completing-p icicle-show-multi-completion-flag)) (apply #'icicle-search nil nil scan-fn-or-regexp require-match (bmkp-bmenu-get-marked-files) args))) (defun icicle-search-dired-marked-recursive (ignore-marks-p scan-fn-or-regexp require-match &rest args) ; Bound to `M-s M-s m' in Dired with Dired+. ; Bound also to `C-0 M-s M-s M-s', `C-0 C-c `' in Dired. "Search marked files in Dired, including in marked subdirs, recursively. You need library `Dired+' for this command. With a prefix arg, ignore Dired markings: search all files in the directory. (Non-interactively, do this if argument IGNORE-MARKS-P is non-nil.) Otherwise, search only the marked files in the directory, or all of the files if none are marked. Marked subdirectories are handled recursively in the same way: If they have a Dired buffer then search their marked files, or all of their files if none are marked. If a marked directory at any level has no Dired buffer then search all of its files. If a marked directory has more than one Dired buffer then raise an error. Because you might not be aware of existing Dired buffers for some marked directories, you are asked to confirm searching their marked files. If you do not confirm this then *all* files in marked directories are searched, regardless of whether directories might have Dired buffers with marked files. That is, Dired buffers are ignored if you do not confirm using them. This is bound by default to `M-s M-s m' in Dired. This is the same as using `C-0' with `icicle-search' in Dired, that is, `C-0 M-s M-s M-s' or `C-0 C-c `', but in that case you cannot use the prefix arg to ignore markings. Non-interactively, the arguments other than IGNORE-MARKS-P are the same as for `icicle-search', but without arguments BEG, END, and WHERE." (interactive (progn (unless (fboundp 'diredp-get-files) (icicle-user-error "You need library `dired+.el' for this command")) (diredp-get-confirmation-recursive) ; Make user confirm, since this can explore *lots* of files. `(,current-prefix-arg ,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag)))) (unless (fboundp 'diredp-get-files) (icicle-user-error "You need library `dired+.el' for this command")) (unless (eq major-mode 'dired-mode) (icicle-user-error "This command must be called from a Dired buffer")) (apply #'icicle-search nil nil scan-fn-or-regexp require-match (diredp-get-files ignore-marks-p) args)) (defun icicle-search-ibuffer-marked (scan-fn-or-regexp require-match ; Bound to `M-s M-s m' in Ibuffer. &rest args) ; Bound also to `C-0 M-s M-s M-s', `C-0 C-`' in Ibuffer. "Search the marked buffers in Ibuffer, in order. Same as using `C-0' with `icicle-search' in Ibuffer. Arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE." (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (unless (eq major-mode 'ibuffer-mode) (icicle-user-error "This command must be called from an Ibuffer buffer")) (let ((marked-bufs (nreverse (ibuffer-get-marked-buffers)))) (unless marked-bufs (setq marked-bufs (list (ibuffer-current-buffer t)))) (apply #'icicle-search nil nil scan-fn-or-regexp require-match marked-bufs args))) (defun icicle-search-buff-menu-marked (scan-fn-or-regexp require-match ; Bound to `M-s M-s m' in buff menu &rest args) ; Bound also to `C-0 M-s M-s M-s', `C-0 C-`' there. "Search the marked buffers in Buffer Menu, in order. Same as using `C-0' with `icicle-search' in `*Buffer List*'. Arguments are the same as for `icicle-search', but without arguments BEG, END, and WHERE." (interactive `(,(if icicle-search-whole-word-flag (icicle-search-read-word) (icicle-search-read-context-regexp)) ,(not icicle-show-multi-completion-flag))) (unless (eq major-mode 'Buffer-menu-mode) (icicle-user-error "This command must be called from a Buffer Menu buffer")) (let ((marked-bufs ())) (save-excursion (Buffer-menu-beginning) (while (re-search-forward "^>" nil t) (push (Buffer-menu-buffer t) marked-bufs))) (setq marked-bufs (nreverse marked-bufs)) (unless marked-bufs (setq marked-bufs (list (Buffer-menu-buffer t)))) (apply #'icicle-search nil nil scan-fn-or-regexp require-match marked-bufs args))) (defalias 'icicle-search-lines 'icicle-occur) ; Bound to `M-s M-s l'. (defun icicle-occur (beg end &optional where) ; Bound to `M-s M-s o', `C-c ''. "`icicle-search' with a regexp of \".*\". An `occur' with icompletion. Type a regexp to match within each line of one or more buffers, files, or bookmarks. Use `S-TAB' to show matching lines. Use `C-RET' or `C-mouse-2' to go to the line of the current candidate. Use `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home', to cycle among the matching lines. If you use this command with a prefix argument then multiple buffers, files, or bookmarks are used (see `icicle-search' for information about prefix arg behavior). This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-search-where-arg))) (let ((icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (fg (face-foreground 'icicle-search-main-regexp-others)) (bg (face-background 'icicle-search-main-regexp-others)) (icicle-transform-function (if (interactive-p) nil icicle-transform-function))) (unwind-protect (progn (set-face-foreground 'icicle-search-main-regexp-others nil) (set-face-background 'icicle-search-main-regexp-others nil) (icicle-search beg end ".*" (not icicle-show-multi-completion-flag) where)) (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (set-face-foreground 'icicle-search-main-regexp-others fg) (set-face-background 'icicle-search-main-regexp-others bg)))) (defun icicle-search-sentences (beg end &optional where) ; Bound to `M-s M-s s'. "`icicle-search' with sentences as contexts. Type a regexp to match within each sentence of one or more buffers, files, or bookmarks. Use `S-TAB' to show matching sentences. Use `C-RET' or `C-mouse-2' to go to the line of the current candidate. Use `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home' to cycle among the matching sentences. If you use this command with a prefix argument then multiple buffers, files, or bookmarks are used (see `icicle-search' for information about prefix arg behavior). You can use `M-*' to further narrow the match candidates, typing additional regexps to match. You can alternatively choose to search, not the search contexts \(sentences), but the non-sentences, that is, the text in the buffer that is outside sentences. To do this, use `C-M-~' during completion. \(This is a toggle, and it affects only future search commands, not the current one.) This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-search-where-arg))) (let ((icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (fg (face-foreground 'icicle-search-main-regexp-others)) (bg (face-background 'icicle-search-main-regexp-others)) (icicle-transform-function (if (interactive-p) nil icicle-transform-function))) (unwind-protect (progn (set-face-foreground 'icicle-search-main-regexp-others nil) (set-face-background 'icicle-search-main-regexp-others nil) (icicle-search beg end (concat "[A-Z][^.?!]+[.?!]") (not icicle-show-multi-completion-flag) where)) (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (set-face-foreground 'icicle-search-main-regexp-others fg) (set-face-background 'icicle-search-main-regexp-others bg)))) (defun icicle-search-paragraphs (beg end &optional where) ; Bound to `M-s M-s p'. "`icicle-search' with paragraphs as contexts. Type a regexp to match within each paragraph of one or more buffers, files, or bookmarks. Use `S-TAB' to show matching paragraphs. Use `C-RET' or `C-mouse-2' to go to the line of the current candidate. Use `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home' to cycle among the matching paragraphs. If you use this command with a prefix argument then multiple buffers, files, or bookmarks are used (see `icicle-search' for information about prefix arg behavior). You can use `M-*' to further narrow the match candidates, typing additional regexps to match. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-search-where-arg))) (let ((icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (fg (face-foreground 'icicle-search-main-regexp-others)) (bg (face-background 'icicle-search-main-regexp-others)) (icicle-transform-function (if (interactive-p) nil icicle-transform-function))) (unwind-protect (progn (set-face-foreground 'icicle-search-main-regexp-others nil) (set-face-background 'icicle-search-main-regexp-others nil) (icicle-search beg end "\\(.+\n\\)+" (not icicle-show-multi-completion-flag) where)) (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (set-face-foreground 'icicle-search-main-regexp-others fg) (set-face-background 'icicle-search-main-regexp-others bg)))) (defun icicle-search-pages (beg end &optional where) ; Bound to `M-s M-s C-l'. "`icicle-search' with pages as contexts. Type a regexp to match within each page of one or more buffers, files, or bookmarks. Use `S-TAB' to show matching page. Use `C-RET' or `C-mouse-2' to go to the line of the current candidate. Use `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home', to cycle among the matching pages. If you use this command with a prefix argument then multiple buffers, files, or bookmarks are used (see `icicle-search' for information about prefix arg behavior). You can use `M-*' to further narrow the match candidates, typing additional regexps to match. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(icicle-search-where-arg))) (let ((icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (fg (face-foreground 'icicle-search-main-regexp-others)) (bg (face-background 'icicle-search-main-regexp-others)) (icicle-transform-function (if (interactive-p) nil icicle-transform-function))) (unwind-protect (progn (set-face-foreground 'icicle-search-main-regexp-others nil) (set-face-background 'icicle-search-main-regexp-others nil) (icicle-search beg end "\\([^\f]*[\f]\\|[^\f]+$\\)" (not icicle-show-multi-completion-flag) where)) (when icicle-search-cleanup-flag (icicle-search-highlight-cleanup)) (set-face-foreground 'icicle-search-main-regexp-others fg) (set-face-background 'icicle-search-main-regexp-others bg)))) (defun icicle-comint-search (beg end) ; Bound to `M-s M-s M-s', `C-c `' in `comint-mode'. "Use `icicle-search' to pick up a previous input for reuse. Use this in a `comint-mode' buffer, such as *shell* or *inferior-lisp*. This searches your interactive history in the buffer for a match to your current input, which you can change dynamically. When you choose a previous input, it is copied to the current prompt, for reuse. If the region is active, then only it is searched; otherwise, the entire buffer is searched. Use `C-RET' or `C-mouse-2' to choose a previous input for reuse. Use `down', `up', `next', `prior', `end', or `home' to cycle among your previous inputs. (You probably do NOT want to use `C-next' etc., since such keys will not only cycle to another candidate but also reuse it immediately.) As for other Icicles search commands, your current input narrows the set of possible candidates. See `icicle-search' for more information. You can use `M-*' to further narrow the match candidates, typing additional regexps to match. Note that previous commands are identified by looking through the shell buffer for a shell prompt. This is not foolproof. If, for instance you use command `ls', the output includes an auto-save file such as #foo.el#, and `#' in the first column represents a shell prompt, then #foo.el# will be misinterpreted as a previous command. Also, depending on your shell, you might want to customize variables such as the following: `shell-prompt-pattern',`telnet-prompt-pattern'. Being a search command, `icicle-comint-search' cannot give you access to previous shell commands that are not visible in the current buffer. See also \\\\[icicle-comint-command] for another way to reuse commands, including those from previous sessions. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments, see the doc for command `icicle-search'." ;; $$$$$$ It would be good to somehow rebind C-next etc. to just what next etc. does. (interactive (icicle-region-or-buffer-limits)) ;; Is there a better test we can use, to make sure the current mode inherits from `comint-mode'? (unless (where-is-internal 'comint-send-input (keymap-parent (current-local-map))) (icicle-user-error "Current mode must be derived from comint mode")) (let ((orig-search-hook icicle-search-hook) (icicle-transform-function 'icicle-remove-duplicates)) (add-hook 'icicle-search-hook 'icicle-comint-search-send-input) (unwind-protect (icicle-search beg end (concat comint-prompt-regexp "\\S-.*") nil) ; Match not required (edit). (remove-hook 'icicle-search-hook 'icicle-comint-search-send-input))) (goto-char (point-max)) (unless (pos-visible-in-window-p) (recenter icicle-recenter))) (defun icicle-comint-search-send-input () "Grab current completion input and use that for comint input." (unless (comint-check-proc (current-buffer)) (icicle-user-error "No live process associated with this buffer")) (let ((comint-get-old-input (if (minibuffer-window-active-p (minibuffer-window)) 'icicle-comint-search-get-minibuffer-input ; Use minibuffer input (e.g. for action fn). 'icicle-comint-search-get-final-choice))) ; Use final choice. (comint-copy-old-input)) (comint-send-input)) (defun icicle-comint-search-get-minibuffer-input () "Return the minibuffer input, beyond the prompt." (let* ((cand (icicle-minibuf-input)) (input-start (and (string-match comint-prompt-regexp cand) (match-end 0)))) (if input-start (substring cand input-start) cand))) (defun icicle-comint-search-get-final-choice () "Return the final choice, beyond the prompt." (let ((input-start (and (string-match comint-prompt-regexp icicle-explore-final-choice) (match-end 0)))) (if input-start (substring icicle-explore-final-choice input-start) icicle-explore-final-choice))) (icicle-define-command icicle-comint-command ; Bound to `C-c TAB' in `comint-mode'. "Retrieve a previously used command. Use this in a `comint-mode' buffer such as `*shell*' or `*inferior-lisp*'. Note, depending on your shell, you might want to customize variables such as the following: `shell-prompt-pattern',`telnet-prompt-pattern'. See also \\\\[icicle-comint-search] for another way to reuse commands." ; Doc string insert ; Action function "Choose a previous command: " ; `completing-read' args (mapcar #'list (cddr comint-input-ring)) nil nil nil 'shell-command-history (aref (cddr comint-input-ring) 0) nil ((icicle-transform-function 'icicle-remove-duplicates))) ; Bindings (defun icicle-comint-hook-fn () "Hook to set up Comint mode for Icicles." (set (make-local-variable 'icicle-search-command) 'icicle-comint-search)) (defun icicle-compilation-search (beg end) ; Bound to `M-s M-s M-s, `C-c `' in `compilation(-minor)-mode'. "Like `icicle-search', but show the matching compilation-buffer hit. Use this in a compilation buffer, such as `*grep*', searching for a regexp as with `icicle-search'. Use `C-RET' or `C-mouse-2' to show the target-buffer hit corresponding to the current completion candidate. Use `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home' to cycle among the target-buffer hits. As for `icicle-search', you can further narrow the match candidates by typing a second regexp to search for among the first matches. See `icicle-search' for more information. Altogether, using this with `grep' gives you two or three levels of regexp searching: 1) the `grep' regexp, 2) the major `icicle-search' regexp, and optionally 3) the refining `icicle-search' regexp. In Emacs 22 and later, you can replace search-hit text, as in `icicle-search'. In earlier Emacs versions, you cannot replace text. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments, see the doc for command `icicle-search'." (interactive (icicle-region-or-buffer-limits)) (unless (condition-case nil (eq (current-buffer) (compilation-find-buffer)) (error nil)) (icicle-user-error "Current buffer must be a compilation buffer")) (save-excursion (goto-char (point-min)) (compilation-next-error 1) (setq beg (if beg (max beg (point)) (point)))) (let ((icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-candidate-alt-action-fn (if (boundp 'compilation-highlight-overlay) ; Emacs 22 test. icicle-candidate-alt-action-fn (lambda (cand) (message "Cannot replace matching text in Emacs before version 22")))) (next-error-highlight ;; Highlight indefinitely. `until-move' should be part of Emacs (patch sent), but it's not. (if (and (featurep 'compile+) (featurep 'simple+)) 'until-move 1000000)) (icicle-search-in-context-fn 'icicle-compilation-search-in-context-fn) (fg (face-foreground 'icicle-search-main-regexp-others)) (bg (face-background 'icicle-search-main-regexp-others))) (unwind-protect (progn (set-face-foreground 'icicle-search-main-regexp-others nil) (set-face-background 'icicle-search-main-regexp-others nil) (icicle-search beg end ".*" t)) (set-face-foreground 'icicle-search-main-regexp-others fg) (set-face-background 'icicle-search-main-regexp-others bg)))) (defun icicle-compilation-search-in-context-fn (cand+mrker replace-string) "`icicle-search-in-context-fn' used for `icicle-compilation-search'. If `crosshairs.el' is loaded, then the target position is highlighted." (if (not (fboundp 'compilation-next-error-function)) (compile-goto-error) ; Emacs 20, 21. (setq compilation-current-error (point)) ; Emacs 22+. (compilation-next-error-function 0 nil)) (save-excursion (save-restriction (let ((inhibit-field-text-motion t)) ; Just to be sure, for `line-end-position'. (narrow-to-region (line-beginning-position) (line-end-position))) (icicle-search-highlight-and-maybe-replace cand+mrker replace-string))) (when (fboundp 'crosshairs-highlight) (crosshairs-highlight 'line-only 'nomsg)) (let ((icicle-candidate-nb icicle-candidate-nb)) (icicle-complete-again-update))) (defun icicle-compilation-hook-fn () "Hook setting `icicle-search-command' for compilation modes. Used on `compilation-mode-hook' and `compilation-minor-mode-hook'." (set (make-local-variable 'icicle-search-command) 'icicle-compilation-search)) (defun icicle-search-w-isearch-string (&optional use-context-p) ; Bound to `S-TAB' in Isearch. "Icicles-search the buffer using an Isearch string chosen by completion. The Isearch string you choose is used as the Icicles search context. You can navigate among its occurrences or search within those occurrences for a subpattern. For Emacs 22 and later, if option `isearch-allow-scroll' is non-nil then a prefix argument changes the behavior, as follows: 1. You are prompted for an Icicles search-context regexp. 2. You choose an Isearch string using completion. It is copied to the `kill-ring'. 3. You can yank that string anytime during Icicles search, to search for it within the search contexts defined by the regexp matches." (interactive "P") (isearch-done) (if (or (not use-context-p) (not (boundp 'isearch-allow-scroll))) (icicle-search (point-min) (point-max) (icicle-isearch-complete-past-string) t) (let ((regexp (icicle-search-read-context-regexp))) (kill-new (icicle-isearch-complete-past-string)) (icicle-search (point-min) (point-max) regexp t)))) (defalias 'icicle-search-defs 'icicle-imenu) ; Bound to `M-s M-s d'. (defun icicle-imenu (beg end require-match &optional where) ; Bound to `M-s M-s i', `C-c ='. "Search/go to an Imenu entry using `icicle-search'. Recommended: Use library `imenu+.el' also. In Emacs-Lisp mode, `imenu+.el' classifies definitions using these submenus: 1. Keys - keys in the global keymap 2. Keys in Maps - keys in keymaps other than global keymap 3. Functions - functions, whether interactive or not 4. Macros - macros defined with `defmacro' 5. User Options - user variables, from `defcustom' 6. Variables - other variables (non-options), from `defvar' 7. Faces - faces, from `defface' 8. Other - other definitions If you use this command with a prefix argument then multiple buffers, files, or bookmarks are used. See `icicle-search' for information about prefix arg behavior and the use of `icicle-show-multi-completion-flag' in this context. When multiple buffers, files, or bookmarks are used, the Imenu mode \(and `imenu-generic-expression') of the current buffer at time of command invocation determines what kinds of definitions are found. So, if you want to search for definitions in a certain language, then invoke this command from a buffer in that language. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'. See also these type-specific Icicles Imenu multi-commands: * `icicle-imenu-command' - search/go to Emacs command definitions * `icicle-imenu-non-interactive-function' - non-command Lisp fn defs * `icicle-imenu-macro' - search/go to Lisp macro definitions * `icicle-imenu-user-option' - search/go to user option definitions * `icicle-imenu-variable' - search/go to Lisp variable definitions * `icicle-imenu-face' - search/go to Emacs face definitions * `icicle-imenu-key-explicit-map', `icicle-imenu-key-implicit-map' - search/go to Emacs key definitions In addition, there are commands like each of the Imenu commands mentioned above, but with the suffix `-full'. These commands use \"full\" definitions as completion candidates, rather than using only whatever the buffer's Imenu regexps matches. A \"full\" candidate is obtained by first matching the Imenu regexp, then moving forward one sexp from the match beginning. For a Lisp function, for instance, the regexp match starts at the `defun' sexp's opening parenthesis, and the full candidate is the entire `defun' sexp. Outside of Lisp, \"full\" does not always mean that the candidate is larger. Example: a C-language procedure/function definition. The text between the regexp match beginning and `forward-sexp' is just the procedure name." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (icicle-imenu-1 nil beg end require-match where)) (defalias 'icicle-search-defs-full 'icicle-imenu-full) ; Bound to `M-s M-s D'. (defun icicle-imenu-full (beg end require-match &optional where) ; Bound to `M-s M-s I'. "Search/go to an Imenu entry using `icicle-search'. Same as `icicle-imenu', except candidates are full definitions. This really means that a candidate is the text between the beginning of the Imenu regexp match and `forward-sexp' from there. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (icicle-imenu-1 'FULL beg end require-match where)) (defun icicle-imenu-command (beg end require-match &optional where) "Search/go to an Emacs command definition using `icicle-search'. This uses `commandp', so it finds only currently defined commands. That is, if the buffer has not been evaluated, then its function definitions are NOT considered commands by `icicle-imenu-command'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where 'icicle-imenu-command-p (lambda (menus) (or (car (assoc "Functions" menus)) (car (assoc "Other" menus)) (icicle-user-error "No command definitions in buffer"))))) (defun icicle-imenu-command-full (beg end require-match &optional where) "Search/go to an Emacs command definition using `icicle-search'. Same as `icicle-imenu-command', except candidates are complete command definitions. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (eq major-mode 'emacs-lisp-mode) beg end require-match where 'icicle-imenu-command-p (lambda (menus) (or (car (assoc "Functions" menus)) (car (assoc "Other" menus)) (icicle-user-error "No command definitions in buffer"))))) (defun icicle-imenu-command-p (ignored-hit-string ignored-marker) "Return non-nil for a command definition. Predicate for `icicle-search'. Both arguments are ignored here." (let ((indx (if (< emacs-major-version 21) 6 2))) (commandp (intern-soft (buffer-substring-no-properties (match-beginning indx) (match-end indx)))))) (defun icicle-imenu-non-interactive-function (beg end require-match &optional where) "Search/go to an Emacs non-command function definition with `icicle-search'. This uses `commandp' to distinguish currently defined commands from other functions. This means that if the buffer has not yet been evaluated, then ALL of its function definitions are considered non-interactive by `icicle-imenu-non-interactive-function'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where 'icicle-imenu-non-interactive-function-p (lambda (menus) (or (car (assoc "Functions" menus)) (car (assoc "Other" menus)) (icicle-user-error "No non-command function definitions in buffer"))))) (defun icicle-imenu-non-interactive-function-full (beg end require-match &optional where) "Search/go to an Emacs non-command function definition with `icicle-search'. Same as `icicle-imenu-non-interactive-function', except candidates are complete function definitions. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (memq major-mode '(emacs-lisp-mode lisp-mode)) beg end require-match where 'icicle-imenu-non-interactive-function-p (lambda (menus) (or (car (assoc "Functions" menus)) (car (assoc "Other" menus)) (icicle-user-error "No non-command function definitions in buffer"))))) (defun icicle-imenu-non-interactive-function-p (ignored-hit-string ignored-marker) "Return non-nil for a non-interactive function definition. Predicate for `icicle-search'. Both arguments are ignored." (let* ((indx (if (< emacs-major-version 21) 6 2)) (fn (intern-soft (buffer-substring-no-properties (match-beginning indx) (match-end indx))))) (and (fboundp fn) (not (commandp fn))))) (defun icicle-imenu-macro (beg end require-match &optional where) "Search/go to an Emacs macro definition using `icicle-search'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode or Lisp mode")) (icicle-imenu-1 nil beg end require-match where 'icicle-imenu-macro-p (lambda (menus) (or (car (assoc "Macros" menus)) (car (assoc "Other" menus)) (icicle-user-error "No macro definitions in buffer"))))) (defun icicle-imenu-macro-full (beg end require-match &optional where) "Search/go to an Emacs macro definition using `icicle-search'. Same as `icicle-imenu-non-interactive-function', except candidates are complete function definitions. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (memq major-mode '(emacs-lisp-mode lisp-mode)) beg end require-match where 'icicle-imenu-macro-p (lambda (menus) (or (car (assoc "Macro" menus)) (car (assoc "Other" menus)) (icicle-user-error "No macro definitions in buffer"))))) (defun icicle-imenu-variable (beg end require-match &optional where) "Search/go to an Emacs non-option variable definition using `icicle-search'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode or Lisp mode")) (icicle-imenu-1 nil beg end require-match where nil (lambda (menus) (or (car (assoc "Variables" menus)) (car (assoc "Other" menus)) (icicle-user-error "No non-option variable definitions in buffer"))))) (defun icicle-imenu-variable-full (beg end require-match &optional where) "Search/go to an Emacs non-option variable definition using `icicle-search'. Same as `icicle-imenu-variable', except candidates are complete variable definitions. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (memq major-mode '(emacs-lisp-mode lisp-mode))) (icicle-user-error "This command is only for Emacs-Lisp mode or Lisp mode")) (icicle-imenu-1 (memq major-mode '(emacs-lisp-mode lisp-mode)) beg end require-match where nil (lambda (menus) (or (car (assoc "Variables" menus)) (car (assoc "Other" menus)) (icicle-user-error "No non-option variable definitions in buffer"))))) (defun icicle-imenu-user-option (beg end require-match &optional where) "Search/go to an Emacs user option definition using `icicle-search'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where nil (lambda (menus) (or (car (assoc "User Options" menus)) (car (assoc "Other" menus)) (icicle-user-error "No user option definitions in buffer"))))) (defun icicle-imenu-user-option-full (beg end require-match &optional where) "Search/go to an Emacs user option definition using `icicle-search'. Same as `icicle-imenu-user-option', except candidates are complete option definitions. Remember that non-nil option `icicle-hide-non-matching-lines-flag' hides, in `*Completions*', all lines of multi-line candidates that do not match your current minibuffer input. You can toggle this at anytime during completion using `C-u C-x .'" ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (eq major-mode 'emacs-lisp-mode) beg end require-match where nil (lambda (menus) (or (car (assoc "User Options" menus)) (car (assoc "Other" menus)) (icicle-user-error "No user option definitions in buffer"))))) (defun icicle-imenu-key-implicit-map (beg end require-match &optional where) "Search/go to a global/local Emacs key definition using `icicle-search'. This means a definition where no key map is specified explicitly - e.g., `global-set-key'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where nil (lambda (menus) (or (car (assoc "Keys" menus)) (car (assoc "Other" menus)) (icicle-user-error "No implicit-map key definitions in buffer"))))) (defun icicle-imenu-key-implicit-map-full (beg end require-match &optional where) "Search/go to a global/local Emacs key definition using `icicle-search'. Same as `icicle-imenu-key-implicit-map', except candidates are complete key definitions." ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (eq major-mode 'emacs-lisp-mode) beg end require-match where nil (lambda (menus) (or (car (assoc "Keys" menus)) (car (assoc "Other" menus)) (icicle-user-error "No implicit-map key definitions in buffer"))))) (defun icicle-imenu-key-explicit-map (beg end require-match &optional where) "Search/go to an Emacs key definition for a named map using `icicle-search'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where nil (lambda (menus) (or (car (assoc "Keys in Maps" menus)) (car (assoc "Other" menus)) (icicle-user-error "No explicit-map key definitions in buffer"))))) (defun icicle-imenu-key-explicit-map-full (beg end require-match &optional where) "Search/go to an Emacs key definition for a named map using `icicle-search'. Same as `icicle-imenu-key-explicit-map', except candidates are complete key definitions." ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (eq major-mode 'emacs-lisp-mode) beg end require-match where nil (lambda (menus) (or (car (assoc "Keys in Maps" menus)) (car (assoc "Other" menus)) (icicle-user-error "No explicit-map key definitions in buffer"))))) (defun icicle-imenu-face (beg end require-match &optional where) "Search/go to an Emacs face definition using `icicle-search'. This command is intended only for use in Icicle mode. It is defined using `icicle-search'. For more information, in particular for information about the arguments and the use of a prefix argument to search multiple regions, buffers, or files, see the doc for command `icicle-search'." (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 nil beg end require-match where nil (lambda (menus) (or (car (assoc "Faces" menus)) (car (assoc "Other" menus)) (icicle-user-error "No face definitions in buffer"))))) (defun icicle-imenu-face-full (beg end require-match &optional where) "Search/go to an Emacs face definition using `icicle-search'. Same as `icicle-imenu-face', except candidates are complete face definitions." ;; Note: For this command, the candidate does not correspond to the regexp match. ;; Instead, it corresponds to that match plus text at the end to complete the definition. (interactive `(,@(icicle-region-or-buffer-limits) ,(not icicle-show-multi-completion-flag) ,(icicle-search-where-arg))) (unless (or where (eq major-mode 'emacs-lisp-mode)) (icicle-user-error "This command is only for Emacs-Lisp mode")) (icicle-imenu-1 (eq major-mode 'emacs-lisp-mode) beg end require-match where nil (lambda (menus) (or (car (assoc "Faces" menus)) (car (assoc "Other" menus)) (icicle-user-error "No face definitions in buffer"))))) (defun icicle-imenu-1 (fullp beg end require-match &optional where predicate submenu-fn) "Helper for `icicle-imenu*' commands. Non-nil FULLP means candidate is from the regexp match beginning through `forward-sexp' from there. Optional arg SUBMENU-FN is a function to apply to the list of Imenu submenus to choose one. If nil then the user chooses one using completion. The other args are as for `icicle-search'." (unless imenu-generic-expression (icicle-user-error "No Imenu pattern for this buffer")) (let ((icicle-multi-completing-p (and current-prefix-arg (not (zerop (prefix-numeric-value current-prefix-arg))) icicle-show-multi-completion-flag)) (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search) (not (local-variable-p 'font-lock-defaults))) imenu-case-fold-search (nth 2 font-lock-defaults))) (old-table (syntax-table)) (table (copy-syntax-table (syntax-table))) (slist imenu-syntax-alist)) (dolist (syn slist) ; Modify the syntax table used while matching regexps. (if (numberp (car syn)) (modify-syntax-entry (car syn) (cdr syn) table) ; Single character. (dolist (char (car syn)) (modify-syntax-entry char (cdr syn) table)))) ; String. (unwind-protect (save-match-data (set-syntax-table table) (let* ((others 0) (menus (mapcar (lambda (menu) (when (equal (car menu) "Other") (setq others (1+ others)) (when (> others 1) (setcar menu (format "Other<%d>" others)))) menu) (icicle-remove-if-not #'icicle-imenu-in-buffer-p ; Use only menus that match buffer. (mapcar (lambda (menu) ; Name unlabeled menu(s) `Other[]'. (if (stringp (car menu)) menu (cons "Other" (cdr menu)))) imenu-generic-expression)))) (submenu (if submenu-fn (funcall submenu-fn menus) (if (cadr menus) (let ((icicle-show-Completions-initially-flag t) (completion-ignore-case t)) (completing-read "Choose: " menus nil t)) (caar menus)))) ; Only one submenu, so use it. (regexp (cadr (assoc submenu menus))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function))) (unless (stringp regexp) (icicle-user-error "No match")) (icicle-search beg end regexp require-match where predicate ;; We rely on the match data having been preserved. ;; $$$$$$ An alternative fn for Lisp only: (lambda () (up-list -1) (forward-sexp)))))) (and fullp (lambda () (goto-char (match-beginning 0)) (condition-case icicle-imenu-1 (forward-sexp) (error (goto-char (match-end 0))))))))) ; Punt: just use regexp match. (set-syntax-table old-table)))) (defun icicle-imenu-in-buffer-p (menu) "Return non-nil if the regexp in MENU has a match in the buffer." (save-excursion (goto-char (point-min)) (re-search-forward (cadr menu) nil t))) (defun icicle-tags-search (regexp &optional arg) ; Bound to `M-s M-s ,' "Search all source files listed in tags tables for matches for REGEXP. You are prompted for the REGEXP to match. Enter REGEXP with `RET'. You do not need `M-,' - you see all matches as search hits to visit. All tags in a tags file are used, including duplicate tags from the same or different source files. By default, all tags files are used, but if you provide a prefix argument then only the current tag table is used. If your TAGS file references source files that no longer exist, those files are listed. In that case, you might want to update your TAGS file. You can alternatively choose to search, not the search contexts as defined by the context regexp you provide, but the non-contexts, that is, the text in the files that does not match the regexp. To do this, use `C-M-~' during completion. (This is a toggle, and it affects only future search commands, not the current one.)" (interactive (let ((completion-ignore-case (if (and (boundp 'tags-case-fold-search) (memq tags-case-fold-search '(t nil))) tags-case-fold-search case-fold-search))) (require 'etags) (list (icicle-search-read-context-regexp (format "Search files with tags %smatching regexp: " (if icicle-search-complement-domain-p "*NOT* " ""))) current-prefix-arg))) (let ((files ())) (save-excursion (let ((first-time t) (morep t)) (while (and morep (visit-tags-table-buffer (not first-time))) (when arg (setq morep nil)) (setq first-time nil) (let ((tail (last files))) (if tail (setcdr tail (mapcar 'expand-file-name (tags-table-files))) (setq files (mapcar 'expand-file-name (tags-table-files)))))))) (let ((tail files) ; Remove names of non-existent or unreadable files. (unreadable-files ())) (while tail (if (file-readable-p (car tail)) (setq tail (cdr tail)) (push (car tail) unreadable-files) (setcar tail (cadr tail)) (setcdr tail (cddr tail)))) (when unreadable-files (with-output-to-temp-buffer "*Unreadable Files*" (princ "These missing or unreadable files were ignored:") (terpri) (terpri) (dolist (file unreadable-files) (princ file) (terpri))))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) (icicle-search nil nil regexp nil files))) (defun icicle-save-string-to-variable (askp) "Save a string (text) to a variable. You are prompted for the string to save. Typically, you store a regexp or part of a regexp in the variable. By default, the variable is user option `icicle-input-string'. To save to a different variable, use a prefix argument; you are then prompted for the variable to use. You can use `\\\ \\[icicle-insert-string-from-variable]' to insert a string from a variable." (interactive "P") (let* ((enable-recursive-minibuffers t) (pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (boundp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (var (if askp (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "variable"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "variable")))) (intern (completing-read "Variable: " obarray (and icompletep pred) nil nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) (symbol-name 'icicle-input-string)))) 'icicle-input-string)) (text (icicle-completing-read-history (format "Text to save in `%s': " var)))) (set var text))) (when (> emacs-major-version 21) (when (and icicle-define-alias-commands-flag (not (fboundp 'any))) (defalias 'any 'icicle-anything)) (defun icicle-anything (type) "Act on an object of type TYPE. You are prompted for the type, then for an object of that type. The type is either the declared `type' of an Anything source, or its `name' if it has no `type'. This command is available only if you use library `anything.el'. This is an Icicles multi-command: You can act on multiple objects in multiple ways during a single command invocation. When you choose an object using `RET' or `mouse-2', the default action is applied to it. The default action is also applied to the current completion candidate when you use `C-RET', `C-mouse-2', and so on. You can apply a different action by using an alternative action key\\: `\\[icicle-candidate-alt-action]', `C-S-mouse-2', and so on. This lets you choose the action to apply using completion. You can use `C-RET', `C-mouse-2', and so on, to perform multiple actions. This command is intended for use only in Icicle mode." (interactive (let ((icicle-show-Completions-initially-flag t) (icicle-whole-candidate-as-text-prop-p icicle-anything-transform-candidates-flag)) (unless (require 'anything nil t) (icicle-user-error "You must load library `anything.el' first")) (list (intern (completing-read "What (type): " (icicle-remove-duplicates (mapcar #'list (icicle-get-anything-types))) nil t))))) (icicle-object-action type))) (when (and icicle-define-alias-commands-flag (not (fboundp 'file))) (defun file () "Act on a file. You are prompted for the file and the action. During file-name completion, you can delete the file named by the current candidate, using \\`\\[icicle-delete-candidate-object]'. This is just `icicle-object-action' with type `file'." (interactive) (icicle-object-action 'file))) (when (and icicle-define-alias-commands-flag (not (fboundp 'buffer))) (defun buffer () "Act on a buffer. You are prompted for the buffer and the action. During buffer-name completion, you can kill the buffer named by the current candidate, using \\`\\[icicle-delete-candidate-object]'. This is just `icicle-object-action' with type `buffer'." (interactive) (icicle-object-action 'buffer))) (when (and icicle-define-alias-commands-flag (not (fboundp 'a))) (defalias 'a 'icicle-object-action)) (when (and icicle-define-alias-commands-flag (not (fboundp 'what-which-how))) (defalias 'what-which-how 'icicle-object-action)) (defun icicle-object-action (&optional type) "Act on an object of type TYPE (a symbol). You are prompted for the type (\"What\"), then for an object of that type (\"Which\"), then for the action function to apply to the object (\"How\"). For Anything types (see below), you are not prompted for the action function. The \"type\" of an object is one of these: a. A type defining an entry `icicle-predicate-types-alist'. These are type predicates, such as `bufferp', `keywordp', or `atom'. b. The `type' of an Anything source, or its `name' if it has no `type'. This is available only if you use library `anything.el' and option `icicle-use-anything-candidates-flag' is non-nil. c. A type defining an entry in user option `icicle-type-actions-alist'. In the case of Anything types (only), this is a multi-command\\: * `C-RET', `C-mouse-2', and so on perform the default action. * `\\[icicle-candidate-alt-action]', `C-S-mouse-2', and so on let you choose the action using completion. Though this is not a multi-command for non-Anything types, for types `buffer' and `file' you can use `\\[icicle-delete-candidate-object]' during completion to delete the object (buffer or file) named by the current completion candidate. Objects of types (b) and (c) are easily associated with names. Their names are the completion candidates. So, for instance, if you choose type `buffer', then you can act on a buffer by choosing its name. Objects of predicate type (type a) are not necessarily named. The completion candidates for these objects are variables (symbols) whose values are the objects acted upon. So, for instance, if you choose type `bufferp', then you can choose a variable whose value is a buffer, in order to act on that buffer. Whereas a buffer is always named, an object of type `stringp' is not. The value of variable `emacs-version' is one such string that you can act on. Anything types and Anything actions are highlighted when used as candidates in `*Completions*', using face `icicle-special-candidate'. Be aware that the action function you choose must accommodate the object you choose as its only an argument. Also, completion of the function candidate itself is not strict, so you can enter a lambda form. With a prefix argument, the result of applying the function to the object is pretty-printed using `icicle-pp-eval-expression'. Otherwise, the function is called for its effect only, and its value is not displayed. You can use a prefix argument similarly when you act on an individual function (\"How\") candidate to apply it to the object, without ending completion. That is, `C-u C-RET', `C-u C-mouse-2', and so on, will pretty-print the result of the individual action. This command is intended for use only in Icicle mode." (interactive) (let* ((anything-loaded-p (and (> emacs-major-version 21) icicle-use-anything-candidates-flag (require 'anything nil t))) (anything-types (and (not type) anything-loaded-p (icicle-get-anything-types))) (typ (or type (let ((icicle-show-Completions-initially-flag t)) (intern (completing-read "What (type): " (icicle-remove-duplicates (append (mapcar #'list anything-types) icicle-type-actions-alist icicle-predicate-types-alist)) nil t))))) (predicate-type-p (and (assoc (symbol-name typ) icicle-predicate-types-alist) (not (memq (symbol-name typ) anything-types)))) (anything-candidates (and anything-loaded-p (not predicate-type-p) (icicle-get-anything-candidates-of-type typ))) (anything-default-actions (and anything-candidates (icicle-get-anything-default-actions-for-type typ))) (anything-actions (and anything-candidates (icicle-get-anything-actions-for-type typ))) (icicle-saved-completion-candidate (cond (predicate-type-p (icicle-read-var-value-satisfying typ)) (anything-candidates (icicle-choose-anything-candidate typ anything-candidates anything-default-actions anything-actions)) ((member (symbol-name typ) (and anything-loaded-p (icicle-get-anything-types))) (icicle-user-error "No candidates for type `%s'" (symbol-name typ))) (t (icicle-choose-candidate-of-type typ)))) (icicle-candidate-action-fn ; For "how". (lambda (fn) (icicle-apply-to-saved-candidate fn anything-candidates typ))) (icicle-candidate-alt-action-fn ; For "how". (and anything-candidates (lambda (fn) (icicle-apply-to-saved-candidate fn t typ))))) (funcall (icicle-alt-act-fn-for-type (if predicate-type-p (or (cdr (assoc (symbol-name typ) icicle-predicate-types-alist)) (symbol-name typ)) (symbol-name typ))) icicle-saved-completion-candidate))) (when (> emacs-major-version 21) (defun icicle-get-anything-types () "Return list of types defined in `anything-sources'. See `anything.el'." (and (boundp 'anything-sources) (consp anything-sources) (let ((types ()) type) (dolist (source (anything-get-sources)) (if (setq type (assoc-default 'type source)) (push (symbol-name type) types) (when (setq type (assoc-default 'name source)) (push type types)))) (setq types (mapcar (lambda (typ) (setq typ (copy-sequence typ)) (put-text-property 0 (length typ) 'face 'icicle-special-candidate typ) typ) (icicle-remove-duplicates types))))))) (when (> emacs-major-version 21) (defun icicle-get-anything-candidates-of-type (type) "Return list of Anything candidates for type TYPE. Used only when `anything-sources' is non-nil - see `anything.el'." (and (boundp 'anything-sources) (consp anything-sources) (let ((anything-candidate-cache ()) (candidates ())) (dolist (source (anything-get-sources)) (let ((init-fn (assoc-default 'init source))) (when init-fn (funcall init-fn))) (when (or (eq type (assoc-default 'type source)) (string= (symbol-name type) (assoc-default 'name source))) (setq candidates (icicle-get-anything-cached-candidates source)))) (when (and (not (functionp candidates)) (consp candidates)) (mapcar (lambda (cand) (if (consp cand) cand (list cand))) candidates)) candidates)))) ;; Similar to `anything-get-cached-candidates' in `anything.el', but ignores processes. ;; Free var here: `anything-candidate-cache'. (when (> emacs-major-version 21) (defun icicle-get-anything-cached-candidates (source) "Return cached value of candidates for Anything SOURCE. Cache the candidates if there is not yet a cached value." (let* ((source-name (assoc-default 'name source)) (candidate-cache (assoc source-name anything-candidate-cache)) candidates) (if candidate-cache (setq candidates (cdr candidate-cache)) (setq candidates (icicle-get-anything-candidates source)) (when (processp candidates) (setq candidates ())) (setq candidate-cache (cons source-name candidates)) (push candidate-cache anything-candidate-cache)) candidates))) (when (> emacs-major-version 21) (defun icicle-get-anything-candidates (source) "Return the list of candidates from Anything SOURCE." (let* ((candidate-source (assoc-default 'candidates source)) (candidates (cond ((functionp candidate-source) `(lambda (string pred mode) (let ((anything-pattern icicle-current-input)) (setq string anything-pattern) (let ((all-cands (funcall ,candidate-source))) (setq all-cands (icicle-remove-if-not (lambda (cand) (string-match (if (eq 'prefix icicle-current-completion-mode) (concat "^" (regexp-quote string)) string) cand)) all-cands)) (cond ((eq mode t) all-cands) ((eq mode nil) (icicle-expanded-common-match icicle-current-input all-cands)) ((eq mode 'lambda) t)))))) ((listp candidate-source) candidate-source) ((and (symbolp candidate-source) (boundp candidate-source)) (symbol-value candidate-source)) (t (error (concat "Source `candidates' value is not a function, variable or list: %s") candidate-source))))) (if (or (not icicle-anything-transform-candidates-flag) (processp candidates)) candidates (anything-transform-candidates candidates source))))) (when (> emacs-major-version 21) (defun icicle-get-anything-actions-for-type (type) "Set and return `icicle-candidates-alist' of actions for type TYPE. The display string for each action is highlighted using face `icicle-special-candidate'." (setq icicle-candidates-alist ()) (let ((all-sources-actions ()) this-source-actions faced-act) (dolist (source (anything-get-sources)) (when (or (eq type (assoc-default 'type source)) (string= (symbol-name type) (assoc-default 'name source))) (setq this-source-actions (assoc-default 'action source)) (dolist (action this-source-actions) (unless (member action all-sources-actions) (setq faced-act (copy-sequence (car action))) ; Highlight Anything action. (put-text-property 0 (length faced-act) 'face 'icicle-special-candidate faced-act) (push (cons faced-act (cdr action)) all-sources-actions))))) (setq icicle-candidates-alist (sort all-sources-actions (lambda (a1 a2) (funcall icicle-sort-comparer (car a1) (car a2)))))))) (when (> emacs-major-version 21) (defun icicle-choose-anything-candidate (type candidates default-actions actions) "Read an Anything object of type TYPE with completion, and return it. During completion, you can act on selected completion candidates, in turn, using the action keys (`C-RET', `C-mouse-2', `C-down', etc.). CANDIDATES is the list of candidates of type TYPE. DEFAULT-ACTIONS is the list of default actions for type TYPE. ACTIONS is the list of all actions for type TYPE." (let* ((win (selected-window)) (icicle-sort-comparer nil) (icicle-transform-function nil) (icicle-Completions-display-min-input-chars (icicle-get-anything-req-pat-chars type)) (icicle-incremental-completion-delay (icicle-get-anything-input-delay type)) (icicle-whole-candidate-as-text-prop-p icicle-anything-transform-candidates-flag) (icicle-candidates-alist (if (or (functionp candidates) icicle-whole-candidate-as-text-prop-p) candidates icicle-candidates-alist)) (icicle-candidate-action-fn (lambda (obj) (when icicle-whole-candidate-as-text-prop-p (setq obj (icicle-anything-candidate-value obj))) (let ((enable-recursive-minibuffers t)) (with-selected-window win (if (null (cdr default-actions)) (funcall (cdar default-actions) obj) (funcall (completing-read "How (action): " default-actions nil t) obj)))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) (icicle-raise-Completions-frame))) (icicle-candidate-alt-action-fn `(lambda (obj) (when icicle-whole-candidate-as-text-prop-p (setq obj (icicle-anything-candidate-value obj))) (let ((icicle-show-Completions-initially-flag t) (icicle-saved-completion-candidate obj) (icicle-candidates-alist actions) (enable-recursive-minibuffers t)) (with-selected-window win (icicle-apply-to-saved-candidate (let ((enable-recursive-minibuffers t) (icicle-last-completion-candidate icicle-last-completion-candidate) (icicle-candidate-alt-action-fn nil) (icicle-candidate-action-fn `(lambda (actn) (with-selected-window win (let ((enable-recursive-minibuffers t) (icicle-candidates-alist actions)) (icicle-apply-to-saved-candidate actn t ,type)))))) (completing-read "How (action): " actions nil t)) t ,type))))) (orig-action-fn icicle-candidate-action-fn) (icicle-candidate-help-fn (if icicle-whole-candidate-as-text-prop-p (lambda (obj) (let ((icicle-candidate-help-fn nil)) (icicle-help-on-candidate-symbol (intern (icicle-anything-candidate-value obj))))) icicle-candidate-help-fn)) (icicle-candidate-action-fn (if icicle-whole-candidate-as-text-prop-p (lambda (obj) (let ((icicle-last-input (icicle-anything-candidate-value obj))) (funcall orig-action-fn obj))) icicle-candidate-action-fn))) (if icicle-whole-candidate-as-text-prop-p (icicle-anything-candidate-value (completing-read (concat "Which (" (symbol-name type) "): ") candidates nil t)) (completing-read (concat "Which (" (symbol-name type) "): ") candidates nil t))))) (when (> emacs-major-version 21) (defun icicle-get-anything-req-pat-chars (type) "Return max `required-pattern' value for sources of type TYPE. The value returned is also always at least as big as `icicle-Completions-display-min-input-chars'." (let ((req-pat icicle-Completions-display-min-input-chars) (req-pat-this-source nil)) (dolist (source (anything-get-sources)) (when (and (or (eq type (assoc-default 'type source)) (string= (symbol-name type) (assoc-default 'name source))) (setq req-pat-this-source (assoc-default 'requires-pattern source))) (setq req-pat (max req-pat req-pat-this-source)))) req-pat))) (when (> emacs-major-version 21) (defun icicle-get-anything-input-delay (type) "Return max `delay' value for sources of type TYPE. The value returned is also always at least as big as `icicle-incremental-completion-delay'." (let ((delay icicle-incremental-completion-delay) (delay-this-source nil)) (dolist (source (anything-get-sources)) (when (and (or (eq type (assoc-default 'type source)) (string= (symbol-name type) (assoc-default 'name source))) (setq delay-this-source (and (assoc 'delayed source) anything-idle-delay))) (setq delay (max delay delay-this-source)))) delay))) (when (> emacs-major-version 21) (defun icicle-anything-candidate-value (candidate) "Return the real value associated with string CANDIDATE." (or (cdr-safe (funcall icicle-get-alist-candidate-function candidate)) candidate))) (when (> emacs-major-version 21) (defun icicle-get-anything-default-actions-for-type (type) "Set and return `icicle-candidates-alist' of default actions for type TYPE." (setq icicle-candidates-alist ()) (let ((all-sources-actions ()) this-source-actions) (dolist (source (anything-get-sources)) (when (or (eq type (assoc-default 'type source)) (string= (symbol-name type) (assoc-default 'name source))) (setq this-source-actions (assoc-default 'action source)) (unless (memq (car this-source-actions) all-sources-actions) (push (car this-source-actions) all-sources-actions)))) (setq icicle-candidates-alist (sort all-sources-actions ; Must sort, or `icicle-candidate-nb' will be wrong. (lambda (a1 a2) (funcall icicle-sort-comparer (car a1) (car a2)))))))) (defun icicle-choose-candidate-of-type (type) "Read an object of type TYPE (a symbol) with completion, and return it. These options, when non-nil, control buffer candidate matching and filtering: `icicle-buffer-ignore-space-prefix-flag' - Ignore space-prefix names `icicle-buffer-extras' - Extra buffers to display `icicle-buffer-match-regexp' - Regexp that buffers must match `icicle-buffer-no-match-regexp' - Regexp buffers must not match `icicle-buffer-predicate' - Predicate buffer must satisfy `icicle-buffer-sort' - Sort function for candidates" (let ((icicle-orig-window (selected-window))) ; For alternative actions. (case type (buffer (let* ((completion-ignore-case (or (and (boundp 'read-buffer-completion-ignore-case) read-buffer-completion-ignore-case) completion-ignore-case)) (icicle-must-match-regexp icicle-buffer-match-regexp) (icicle-must-not-match-regexp icicle-buffer-no-match-regexp) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate icicle-buffer-predicate) (icicle-require-match-flag icicle-buffer-require-match-flag) (icicle-extra-candidates icicle-buffer-extras) (icicle-delete-candidate-object 'icicle-kill-a-buffer) ; `S-delete' kills buf (icicle-transform-function 'icicle-remove-dups-if-extras) (icicle--temp-orders (append (list '("by last access") ; Renamed from "turned OFF'. '("*...* last" . icicle-buffer-sort-*...*-last) '("by buffer size" . icicle-buffer-smaller-p) '("by major mode name" . icicle-major-mode-name-less-p) (and (fboundp 'icicle-mode-line-name-less-p) '("by mode-line mode name" . icicle-mode-line-name-less-p)) '("by file/process name" . icicle-buffer-file/process-name-less-p)) (delete '("turned OFF") (copy-sequence icicle-sort-orders-alist)))) ;; Put `icicle-buffer-sort' first. If already in list, move it, else add it, to start. (icicle-sort-orders-alist (progn (when (and icicle-buffer-sort-first-time-p icicle-buffer-sort) (setq icicle-sort-comparer icicle-buffer-sort icicle-buffer-sort-first-time-p nil)) (if icicle-buffer-sort (let ((already-there (rassq icicle-buffer-sort icicle--temp-orders))) (if already-there (cons already-there (setq icicle--temp-orders (delete already-there icicle--temp-orders))) (cons `("by `icicle-buffer-sort'" . ,icicle-buffer-sort) icicle--temp-orders))) icicle--temp-orders))) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "buffer")))) (get-buffer-create (completing-read "Which (buffer): " (mapcar (lambda (buf) (list (buffer-name buf))) (buffer-list)) (and icompletep icicle-buffer-predicate (lambda (buf) (funcall icicle-buffer-predicate (car buf)))) (and (fboundp 'confirm-nonexistent-file-or-buffer) ; Emacs 23. (confirm-nonexistent-file-or-buffer)) nil 'buffer-name-history nil nil)))) (color (icicle-read-color-wysiwyg 1)) ; Use the color name (only). (command (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (commandp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "command"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "command")))) (intern (completing-read "Which (command): " obarray (and icompletep pred))))) (face (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "face"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "face")))) (intern (completing-read "Which (face): " (mapcar (lambda (x) (list (format "%s" x))) (face-list)))))) (file (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "file"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "file"))) (icicle-delete-candidate-object 'icicle-delete-file-or-directory)) ; `S-delete' (read-file-name "Which (file): " nil (and (eq major-mode 'dired-mode) (fboundp 'dired-get-file-for-visit) ; Emacs 22+. (condition-case nil ; E.g. error because not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error nil)))))) (frame (let ((frame-alist (icicle-make-frame-alist)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "frame"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "frame")))) (cdr (assoc (completing-read "Which (frame): " frame-alist) frame-alist)))) (function (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (fboundp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "function"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "function")))) (intern (completing-read "Which (function): " obarray (and icompletep pred))))) (option (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (user-variable-p s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "option"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "option")))) (intern (completing-read "Which (user option): " obarray (and icompletep pred))))) (process (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "process"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "process")))) (get-process (completing-read "Which (process): " (mapcar (lambda (proc) (list (process-name proc))) (process-list)))))) (symbol (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "symbol"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "symbol")))) (intern (completing-read "Which (symbol): " obarray)))) (variable (let* ((pred (lambda (s) (unless (symbolp s) (setq s (intern s))) (boundp s))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "variable"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "variable")))) (intern (completing-read "Which (variable): " obarray (and icompletep pred))))) (window (let ((icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "window"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "window"))) (buffers ())) (walk-windows (lambda (win) (push (list (format "%s" (window-buffer win))) buffers)) nil t) (get-buffer-window (completing-read "Window showing buffer: " buffers) 0))) (otherwise (error "Bad object type: %S" type))))) (defun icicle-read-var-value-satisfying (predicate) "Read a variable that satisfies PREDICATE and returns its value." (symbol-value (let* ((icicle-orig-window (selected-window)) (pred `(lambda (s) (unless (symbolp s) (setq s (intern s))) (and (boundp s) (funcall ',predicate (symbol-value s))))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred)) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "variable"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "variable")))) (intern (completing-read (format "Which (%s value of variable): " predicate) obarray (and icompletep pred)))))) (icicle-define-command icicle-select-text-at-point "Invoke a function in `er/try-expand-list' to select text at point. This command requires library `expand-region.el'." (lambda (fn) (ignore-errors (funcall (intern fn)))) ; Action function "Text selection function: " ; `completing-read' args (mapcar (lambda (fn) (list (symbol-name fn))) (and (boundp 'er/try-expand-list) er/try-expand-list)) nil t nil nil "er/mark-word" nil ((icicle-sort-comparer nil)) ; Bindings (unless (require 'expand-region nil t) ; First code (icicle-user-error "You need library `expand-region.el' for this command"))) (defvar icicle-key-prefix nil "A prefix key.") (defvar icicle-key-prefix-2 nil "A prefix key.") (defvar icicle-active-map nil "An active keymap.") ;;; $$$$$$(defvar icicle-orig-buff-key-complete nil ;;; "Current buffer when you invoked `icicle-complete-keys'.") (defvar icicle-orig-extra-cands () "Value of `icicle-extra-candidates', before command.") (defvar icicle-orig-show-initially-flag nil "Value of `icicle-show-Completions-initially-flag', before command.") (defvar icicle-orig-sort-orders-alist () "Value of `icicle-sort-orders-alist', before command.") ;;; $$$$$$(defvar icicle-orig-win-key-complete nil ;;; "Selected window when you invoked `icicle-complete-keys'.") (defvar icicle-this-cmd-keys () "Value of `this-command-keys-vector' at some point in key completion.") (when (fboundp 'map-keymap) ; Emacs 22+. (defun icicle-complete-keys () ; Bound to prefix keys followed by `S-TAB' (unless defined). "Complete a key sequence for the currently invoked prefix key. Input-candidate completion and cycling are available. You can navigate the key-binding hierarchy (prefix-key hierarchy), just as would navigate a file-system hierarchy (to complete directory and file names) or a menu hierarchy (to complete submenu and menu-item names). Completion candidates generally have the form `KEY = COMMAND'. If COMMAND is `...', then KEY is a prefix key; choosing it updates the completion candidates list to the keys under that prefix. For example, choosing `C-x = ...' changes the candidates to those with prefix `C-x'. The special candidate `..' means to go up one level of the key-binding hierarchy and complete candidates there. For example, if you are currently completing prefix key `C-x 5', and you choose candidate `..', then you will be completing prefix `C-x', the parent of `C-x 5'. Except at the top level, the default value for completion is `..'. You can use `C-M-,' at any time to switch between sorting with local bindings first and sorting with prefix keys first. You can use `C-,' at any time to change the sort order among these two and sorting by command name. If option `icicle-complete-keys-self-insert-ranges' is non-`nil', then some keys that are bound to `self-insert-command' are included as possible key-completion candidates; otherwise they are not. The default value is `nil'. For Emacs 22, this option is effectively Boolean: any non-`nil' value means allow all self-inserting keys as candidates. In Emacs 23+, there are thousands of self-inserting keys, so it is not practical to allow all as candidates. Instead, a non-`nil' value is a list of character ranges of the form (MIN . MAX). Characters in the inclusive range MIN through MAX are possible key-completion candidates. Most of the thousands of self-inserting characters for Emacs 23+ are Unicode characters. For a self-inserting character CHAR, the completion candidate is generally `CHAR = self-insert-command', but if CHAR is a Unicode character then it is `CHAR = UNICODE-NAME', where UNICODE-NAME is the name of the Unicode character. This is so that you can complete against the name. For Emacs 23+, if you use a non-`nil' value for `icicle-complete-keys-self-insert-ranges' then I recommend that you use only small ranges for good performance. In general, you might want to leave this option value as `nil' and use command `ucs-insert' \(`C-x 8 RET') to insert characters. In Icicle mode, `ucs-insert' displays the character itself after its name, though only the name is used for completion. So it is WYSIWYG. And you can of course use all Icicles completion features when matching the character name. While cycling, these keys describe candidates\\: `C-RET' - Describe command of current completion candidate only `C-down' - Move to next completion candidate and describe `C-up' - Move to previous completion candidate and describe `C-next' - Move to next apropos-completion candidate and describe `C-prior' - Move to previous apropos-completion candidate and describe `C-end' - Move to next prefix-completion candidate and describe `C-home' - Move to previous prefix-completion candidate and describe `\\[icicle-all-candidates-action]' - Describe *all* candidates (or all that are saved), successively - use the [back] button in buffer *Help* to visit the descriptions When candidate action and cycling are combined (e.g. `C-next'), option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `\\[icicle-help-on-candidate]', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'." (interactive) (let* ((icicle-transform-function 'icicle-remove-duplicates) (icicle-orig-sort-orders-alist icicle-sort-orders-alist) ; For recursive use. (icicle-orig-show-initially-flag icicle-show-Completions-initially-flag) (icicle-show-Completions-initially-flag t) (icicle-candidate-action-fn 'icicle-complete-keys-action) (enable-recursive-minibuffers t) ;; $$$$$$ (icicle-orig-buff-key-complete (current-buffer)) ;; $$$$$$ (icicle-orig-win-key-complete (selected-window)) (icicle-orig-buff (current-buffer)) (icicle-orig-window (selected-window)) (icicle-completing-keys-p t) ; Provide a condition to test key completion. (icicle-sort-comparer 'icicle-local-keys-first-p) (icicle-alternative-sort-comparer 'icicle-prefix-keys-first-p) (icicle-sort-orders-alist '(("by key name, local bindings first" . icicle-local-keys-first-p) ("by key name, prefix keys first" . icicle-prefix-keys-first-p) ("by command name" . icicle-command-names-alphabetic-p) ("turned OFF"))) (icicle-hist-cands-no-highlight '(".."))) (icicle-complete-keys-1 (icicle-this-command-keys-prefix)))) (defun icicle-this-command-keys-prefix () "Return the prefix of the currently invoked key sequence." (let ((this-key (this-command-keys))) (substring this-key 0 (1- (length this-key))))) ;; Free vars here: `icicle-complete-keys-alist' is bound in `icicles-var.el'. (defun icicle-complete-keys-1 (prefix) ; PREFIX is a free var in `icicle-complete-keys-action'. "Complete a key sequence for prefix key PREFIX (a vector)." ;; `icicle-orig-extra-cands' is free in `icicle-complete-keys-action'. (let ((icicle-orig-extra-cands icicle-extra-candidates) (icicle-key-prefix prefix)) (unwind-protect (progn (icicle-keys+cmds-w-prefix prefix) (unless icicle-complete-keys-alist (icicle-user-error "No keys for prefix `%s'" prefix)) (let* ((icicle-this-cmd-keys ; For error report - e.g. mouse command. (this-command-keys-vector)) ; Free var in `icicle-complete-keys-action'. (icicle-key-prefix-description (icicle-key-description prefix nil icicle-key-descriptions-use-<>-flag)) (prompt (concat "Complete keys" (and (not (string= "" icicle-key-prefix-description)) (concat " " icicle-key-prefix-description)) ": "))) (put-text-property 0 1 'icicle-fancy-candidates t prompt) (icicle-complete-keys-action (completing-read prompt icicle-complete-keys-alist nil t nil nil ;;$$ (if (equal [] prefix) nil "\\.\\.") )))) (dolist (cand icicle-complete-keys-alist) (put (car cand) 'icicle-special-candidate nil))))) ; Reset the property. ;; Free vars here: ;; `icicle-orig-buff', `icicle-orig-window', bound in `icicle-complete-keys'. ;; `icicle-orig-extra-cands', `icicle-this-cmd-keys', `icicle-key-prefix', ;; bound in `icicle-complete-keys-1'. (defun icicle-complete-keys-action (candidate) "Completion action function for `icicle-complete-keys'." (let* ((key+binding (cdr-safe (assq (intern candidate) icicle-complete-keys-alist))) (key (car-safe key+binding)) (binding (cdr-safe key+binding)) (cmd-name nil) (action-window (selected-window))) (unwind-protect (progn ;; $$$$$$ (set-buffer icicle-orig-buff-key-complete) ;; $$$$$$ (select-window icicle-orig-win-key-complete) (set-buffer icicle-orig-buff) (select-window icicle-orig-window) (if (string= ".." candidate) (setq cmd-name "..") (unless (and (string-match "\\(.+\\) = \\(.+\\)" candidate) (match-beginning 2)) (icicle-user-error "No match")) (setq cmd-name (substring candidate (match-beginning 2) (match-end 2)))) (cond ((string= ".." cmd-name) ; Go back up to parent prefix. (setq last-command 'icicle-complete-keys) (icicle-complete-keys-1 (vconcat (nbutlast (append icicle-key-prefix ()))))) ((and key (string= "..." cmd-name)) ; Go down to prefix. (setq last-command 'icicle-complete-keys) (icicle-complete-keys-1 (vconcat icicle-key-prefix key))) (t (setq this-command binding last-command binding icicle-extra-candidates icicle-orig-extra-cands) ; Restore it. (when (eq 'self-insert-command binding) (unless key (error "Cannot insert `%s'" key)) (setq last-command-event (aref key 0))) (when (eq 'digit-argument binding) (setq last-command-event (aref key 0)) (icicle-msg-maybe-in-minibuffer "Numeric argument")) (when (eq 'negative-argument binding) (icicle-msg-maybe-in-minibuffer "Negative argument")) (setq last-nonmenu-event 1) ; So `*Completions*' mouse-click info is ignored. ;; Bind so vanilla context when invoke chosen command. (let ((icicle-candidate-action-fn nil) (icicle-completing-keys-p nil) (icicle-sort-orders-alist icicle-orig-sort-orders-alist) (icicle-sort-comparer 'icicle-case-string-less-p) (icicle-alternative-sort-comparer 'icicle-historical-alphabetic-p) (icicle-show-Completions-initially-flag icicle-orig-show-initially-flag)) (call-interactively binding nil icicle-this-cmd-keys))))) (select-window action-window)))) (defun icicle-keys+cmds-w-prefix (prefix) "Fill `icicle-complete-keys-alist' for prefix key PREFIX (a vector)." (let ((prefix-map nil) (icicle-key-prefix-2 prefix)) (setq icicle-complete-keys-alist ()) (dolist (icicle-active-map (current-active-maps t)) (setq prefix-map (lookup-key icicle-active-map prefix)) ;; NOTE: `icicle-add-key+cmd' uses `icicle-key-prefix-2' and `icicle-active-map' as free vars. (when (keymapp prefix-map) (map-keymap #'icicle-add-key+cmd prefix-map))) (unless (equal [] prefix) (push (list (intern (propertize ".." 'face 'icicle-multi-command-completion))) icicle-complete-keys-alist)) ;; Delete duplicates. Shadowing of bindings can produce dups. E.g., `ESC' can be in submaps of ;; different active keymaps, giving more than one `ESC ...' entries. Also, one binding for a ;; command can shadow another to the same command. (icicle-delete-alist-dups icicle-complete-keys-alist))) ;; Free vars here: `icicle-key-prefix-2' and `icicle-active-map' are bound in ;; `icicle-keys+cmds-w-prefix'. (defun icicle-add-key+cmd (event binding) "Add completion for EVENT and BINDING to `icicle-complete-keys-alist'." (cond ;; (menu-item ITEM-STRING): non-selectable item - skip it. ((and (eq 'menu-item (car-safe binding)) (null (cdr-safe (cdr-safe binding)))) (setq binding nil)) ; So `keymapp' test, below, fails. ;; (ITEM-STRING): non-selectable item - skip it. ((and (stringp (car-safe binding)) (null (cdr-safe binding))) (setq binding nil)) ; So `keymapp' test, below, fails. ;; (menu-item ITEM-STRING REAL-BINDING . PROPERTIES) ((eq 'menu-item (car-safe binding)) (let ((enable-condition (memq ':enable (cdr-safe (cdr-safe (cdr-safe binding)))))) (if (or (not enable-condition) (condition-case nil ; Don't enable if we can't check the condition. (eval (cadr enable-condition)) (error nil))) (setq binding (car-safe (cdr-safe (cdr-safe binding)))) (setq binding nil)))) ;; (ITEM-STRING . REAL-BINDING) or ;; (ITEM-STRING [HELP-STRING] . REAL-BINDING) or ;; (ITEM-STRING [HELP-STRING] (KEYBD-SHORTCUTS) . REAL-BINDING) ((stringp (car-safe binding)) (setq binding (cdr binding)) ;; Skip HELP-STRING (when (stringp (car-safe binding)) (setq binding (cdr binding))) ;; Skip (KEYBD-SHORTCUTS): cached key-equivalence data for menu items. (when (and (consp binding) (consp (car binding))) (setq binding (cdr binding))))) ;; `icicle-key-prefix-2' and `icicle-active-map' are free here, bound in ;; `icicle-keys+cmds-w-prefix'. (cond ((and (eq binding 'self-insert-command) ; Insert `self-insert-command' char ranges. icicle-complete-keys-self-insert-ranges (consp event) ; Emacs 23+ uses char ranges. (fboundp 'characterp) (characterp (car event))) (let ((chr1 (car event)) (chr2 (cdr event))) (loop for range in icicle-complete-keys-self-insert-ranges do (loop for char from (max chr1 (car range)) to (min chr2 (cdr range)) do (let* ((key-desc (propertize (single-key-description char (not icicle-key-descriptions-use-<>-flag)) 'face 'icicle-candidate-part)) (name.char (rassq char (ucs-names))) (candidate (and (or (not name.char) (not (string= "" (car name.char)))) ;; $$$$$$ (and (not (string= "" (car name.char))) ;; ;; $$$$$$ Maybe make this optional? ;; (not (string-match ;; "\\`VARIATION SELECTOR" ;; (car name.char))))) (intern (concat key-desc (if name.char (concat " = " (car name.char)) " = self-insert-command")))))) (when candidate (push (cons candidate (cons (vector char) 'self-insert-command)) icicle-complete-keys-alist) (when (eq icicle-active-map (current-local-map)) (put candidate 'icicle-special-candidate t)))))))) ((and ;; Include BINDING if key (EVENT) is on `icicle-key-prefix-2'. ;; Do not include a shadowed binding to a command. Always include binding if it's a keymap, ;; because the same prefix key can be bound to different keymaps without any of those keymaps ;; shadowing all of the bindings in another of them. (or (keymapp binding) (and (commandp binding) (equal binding (key-binding (vconcat icicle-key-prefix-2 (vector event)) nil 'NO-REMAP)) (not (eq binding 'icicle-complete-keys)))) ;; Include BINDING if it is not `self-insert-command' or user has OK'd use of such. (or (not (eq binding 'self-insert-command)) ; Command, keymap. (and icicle-complete-keys-self-insert-ranges ; Insert char (Emacs 22). (char-valid-p event)))) (when (and (if (fboundp 'characterp) (characterp event) (char-valid-p event)) ; `ESC' -> `M-'. (eq event meta-prefix-char) (keymapp binding)) (map-keymap (lambda (key bndg) (when (if (fboundp 'characterp) (characterp key) (char-valid-p key)) (icicle-add-key+cmd (event-apply-modifier key 'meta 27 "M-") bndg))) binding)) (when (and (functionp binding) (commandp binding)) ; Follow remapped command to target command. (setq binding (key-binding (vconcat icicle-key-prefix-2 (vector event))))) (let* ((key-desc (propertize (single-key-description event (not icicle-key-descriptions-use-<>-flag)) 'face 'icicle-candidate-part)) (candidate (intern (concat key-desc " = " (if (keymapp binding) "..." (prin1-to-string binding)))))) ;; Skip keys bound to `undefined'. (unless (string= "undefined" (prin1-to-string binding)) (push (cons candidate (cons (vector event) binding)) icicle-complete-keys-alist)) (when (eq icicle-active-map (current-local-map)) (put candidate 'icicle-special-candidate t)))) ((and (integerp event) (generic-char-p event) ; Insert generic char (Emacs 22). (eq 'self-insert-command binding)) (ignore)))) ; Placeholder for future use. ;;; ;; $$$$$$ No longer used. Was used in `icicle-complete-keys-1'. ;;; (defun icicle-read-single-key-description (string need-vector &optional angles) ;;; "If STRING contains a space, then the vector containing the symbol named STRING. ;;; Otherwise, call `icicle-read-kbd-macro'. ;;; Other args are as for `icicle-read-kbd-macro'." ;;; (cond ((and (not angles) (string-match " " string)) ;;; (vector (intern string))) ;;; ((string-match "^<\\([^>]* [^>]*\\)>" string) ;;; (vector (intern (substring string (match-beginning 1) (match-end 1))))) ;;; (t (icicle-read-kbd-macro string need-vector angles)))) ;; $$ No longer used. Was used as `icicle-candidate-action-fn' in `icicle-complete-keys'. (defun icicle-complete-keys-help (candidate) "Describe the command associated with the current completion candidate." (interactive) ; Interactively, just describes itself. (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (string-match "\\(.+\\) = \\(.+\\)" candidate) (let ((frame-with-focus (selected-frame)) (cmd (intern-soft (substring candidate (match-beginning 2) (match-end 2))))) (if (not (fboundp cmd)) (icicle-msg-maybe-in-minibuffer "No help") (describe-function cmd)) (icicle-raise-Completions-frame) ;; This is a hack for MS Windows - otherwise, we can't continue to get more candidates, ;; because the *Help* frame takes the focus away from the minibuffer frame. ;; MS Windows always gives focus to a newly created frame - in this case, *Help*. (let* ((help-window (get-buffer-window "*Help*" 0)) (help-frame (and help-window (window-frame help-window)))) (when help-frame (redirect-frame-focus help-frame frame-with-focus)))) (message nil)) ; Let minibuffer contents show immediately. ) (when (fboundp 'define-minor-mode) ; Emacs 21+ ------------ (eval '(define-minor-mode icicle-ido-like-mode "Ido-like mode for use with Icicles. No, this mode does not pretend to give you exactly the Ido behavior. Turning the mode ON sets these options to t: `icicle-show-Completions-initially-flag' `icicle-top-level-when-sole-completion-flag' Turning the mode OFF sets those options to non-nil. A positive prefix arg turns the mode on and also sets option `icicle-max-candidates' to the prefix-arg numeric value. By default, that option is nil, meaning that there is no limit to the number of completion candidates. Since Ido shows only a few completion candidates, you might want to customize that option or use a prefix arg with this mode to set it. You can also use `C-x #' in the minibuffer to increment or decrement the option at any time during completion. Turning the mode off by toggling (no prefix arg) resets option `icicle-max-candidates' to nil. If you have customized that option to a non-nil value and do not want to lose that preference, then use a zero or negative prefix arg to turn the mode off. See also these options, which control how much time you have to edit input before automatic incremental completion and automatic acceptance of a sole candidate kick in: `icicle-incremental-completion-delay' `icicle-top-level-when-sole-completion-delay' When you use this mode, you might also want to use nil or t as the value of option `icicle-default-value', in order to not insert the default value in the minibuffer. If you want to change that option dynamically for the mode, use `icicle-ido-like-mode-hook'. E.g.: (add-hook 'icicle-ido-like-mode-hook (lambda () (setq icicle-default-value (if icicle-ido-like-mode t 'insert-end))))" nil nil nil :global t :group 'Icicles-Miscellaneous (setq icicle-show-Completions-initially-flag icicle-ido-like-mode icicle-top-level-when-sole-completion-flag icicle-ido-like-mode) (if icicle-ido-like-mode (when (and current-prefix-arg (not (eq 'toggle current-prefix-arg))) (setq icicle-max-candidates (prefix-numeric-value current-prefix-arg))) (unless (and current-prefix-arg (not (eq 'toggle current-prefix-arg))) (setq icicle-max-candidates nil)))))) (defun icicle-set-TAB-methods-for-command (command methods &optional arg msgp) "Set the possible TAB completion methods for COMMAND. This works by advising COMMAND. With a negative prefix arg, restore the original, unadvised behavior. With a non-negative prefix arg, advise but do not enable the advice. You can later enable the advice and activate it, using `ad-enable-advice' and `ad-activate'. The advice name is `icicle-TAB-completion-methods' (same name as option). See also `icicle-set-S-TAB-methods-for-command'." (interactive (icicle-read-args-for-set-completion-methods 'icicle-TAB-completion-methods)) (icicle-set-completion-methods-for-command command methods 'icicle-TAB-completion-methods arg msgp)) (defun icicle-set-S-TAB-methods-for-command (command methods &optional arg msgp) "Set the possible S-TAB completion methods for COMMAND. This works by advising COMMAND. With a negative prefix arg, restore the original, unadvised behavior. With a non-negative prefix arg, advise but do not enable the advice. You can later enable the advice and activate it, using `ad-enable-advice' and `ad-activate'. The advice name is `icicle-S-TAB-completion-methods-alist' (same name as option). See also `icicle-set-TAB-methods-for-command'." (interactive (icicle-read-args-for-set-completion-methods 'icicle-S-TAB-completion-methods-alist)) (icicle-set-completion-methods-for-command command methods 'icicle-S-TAB-completion-methods-alist arg msgp)) (defun icicle-read-args-for-set-completion-methods (var) "Read arguments for `icicle-set-(S-)TAB-methods-for-command'. VAR is symbol `icicle-(S-)TAB-completion-methods(-alist)'." (let ((command (intern (let* ((pred (lambda (c) (unless (symbolp c) (setq c (intern c))) (commandp c))) (icompletep (and (boundp 'icomplete-mode) icomplete-mode)) (icicle-must-pass-after-match-predicate (and (not icompletep) pred))) (completing-read "Command: " obarray (and icompletep pred) t)))) (methods ())) (unless (< (prefix-numeric-value current-prefix-arg) 0) (let ((prompt (format "%s methods (empty `RET' to end): " (if (eq var 'icicle-TAB-completion-methods) "TAB" "S-TAB"))) (cmeths (symbol-value var)) meth) (setq cmeths (if (consp (car cmeths)) cmeths (mapcar (lambda (m) (list (symbol-name m))) cmeths))) (while (not (string= "" (setq meth (completing-read prompt cmeths nil t)))) (if (eq var 'icicle-TAB-completion-methods) (push (intern meth) methods) (push (assoc meth icicle-S-TAB-completion-methods-alist) methods))) (setq methods (nreverse methods)))) (list command methods current-prefix-arg (prefix-numeric-value current-prefix-arg)))) (defun icicle-set-completion-methods-for-command (command methods var arg msgp) "Set the possible completion methods for COMMAND. This works by advising COMMAND. VAR is the methods option to affect, `icicle-TAB-completion-methods' or `icicle-S-TAB-completion-methods-alist'. Negative ARG means restore the original, unadvised behavior. Non-negative ARG means advise but do not enable the advice. Null ARG means advise and enable." (let ((type (if (eq var 'icicle-TAB-completion-methods) "TAB methods" "S-TAB methods"))) (cond ((< (prefix-numeric-value arg) 0) (condition-case nil (ad-remove-advice command 'around var) (error nil)) (ad-activate command) ; This restores original definition unless otherwise advised. (when msgp (message "`%s' now uses default %s" command type))) (t (ad-add-advice command `(,var nil ,(not arg) (advice . (lambda () (let ((,var ',methods)) ad-do-it)))) 'around 'first) (ad-activate command) (when msgp (message "`%s' %s: %s" command type (icicle-propertize (if (consp (car methods)) (mapcar #'car methods) methods) 'face 'icicle-msg-emphasis))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-cmd2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-cmd2.el ends here icicles-2013.04.23.23400/icicles-doc1.el000066400000000000000000015625331214003072700167640ustar00rootroot00000000000000;;; icicles-doc1.el --- Minibuffer input completion and cycling. ;; ;; Filename: icicles-doc1.el ;; Description: Minibuffer completion and cycling. ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Tue Aug 1 14:21:16 1995 ;; Version: 22.0 ;; Last-Updated: Fri Apr 26 09:23:54 2013 (-0700) ;; By: dradams ;; Update #: 27782 ;; URL: http://www.emacswiki.org/icicles-doc1.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; None ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; Icicles documentation, part 1. ;; ;; Files `icicles-doc1.el' and `icicles-doc2.el' contain the doc for ;; Icicles, including how to install and use Icicles. You can also ;; read the Icicles doc, in formatted form, on the Emacs-Wiki Web ;; site: http://www.emacswiki.org/cgi-bin/wiki/Icicles. Emacs Wiki ;; also has a few addtional pages about Icicles. In particular, if ;; you are new to Emacs, as well as Icicles, see this page: ;; http://www.emacswiki.org/cgi-bin/wiki/EmacsNewbieWithIcicles. ;;(@* "Installing Icicles") ;; ;; To use this library: ;; ;; Add this to your initialization file (~/.emacs or ~/_emacs): ;; ;; (require 'icicles) ; Load this library. ;; (icicle-mode 1) ; Turn on Icicle mode. ;; ;; It is best to add this code *after* any code that creates or ;; changes key bindings, so Icicles can pick up all of your key ;; definitions (bindings). However, if you make new bindings, you ;; can always exit and then reenter Icicle mode to pick them up. ;; ;; You will need all of these libraries (loaded by `icicles.el'): ;; ;; `icicles-chg.el' (not loaded - change logs only) ;; `icicles-cmd1.el' ;; `icicles-cmd2.el' ;; `icicles-doc1.el' (not loaded - doc only) ;; `icicles-doc2.el' (not loaded - doc only) ;; `icicles-face.el' ;; `icicles-fn.el' ;; `icicles-mac.el' ;; `icicles-mcmd.el' ;; `icicles-mode.el' ;; `icicles-opt.el' ;; `icicles-var.el' ;; ;; The following libraries are recommended but optional (loaded by ;; `icicles.el' if in your `load-path'). They are enhanced by ;; Icicles, or Icicles is enhanced by them, or both. They are all ;; available at Emacs Wiki, ;; http://www.emacswiki.org/cgi-bin/wiki/ElispArea. ;; ;; `apropos-fn+var.el' - Apropos enhancements for fns and vars. ;; `bookmark+.el' etc. - Many bookmark enhancements. Includes: ;; `bookmark+-1.el', `bookmark+-bmu.el', ;; `bookmark+-doc.el', `bookmark+-key.el', ;; `bookmark+-lit.el', `bookmark+-mac.el'. ;; `col-highlight.el' - Required by `crosshairs.el'. Emacs 22+ ;; `crosshairs.el' - Highlight target positions. Emacs 22+ ;; `doremi.el' and ;; `doremi-frm.el' - Incremental changes. ;; `frame-cmds.el' - Frame and window commands. ;; `fuzzy-match.el' - Fuzzy completion (matching). ;; `hexrgb.el' - Color manipulation. ;; `hl-line+.el' - Required by `crosshairs.el'. Emacs 22+ ;; `icomplete+.el' - Enhancements to `icomplete.el' ;; `info+.el' - Enhancements to `info'. ;; `lacarte.el' - Keyboard access to the menubar menus. ;; `mb-depth+.el' - Minibuffer depth indicator. Emacs 22+ ;; `pp+.el' - Pretty-printing for `M-:'. ;; `synonyms.el' - A hypertext thesaurus. ;; `thingatpt+.el' - Better defaults for commands, `M-.'. ;; `vline.el' - Required by `crosshairs.el'. Emacs 22+ ;; ;; Be aware that some of these libraries in turn require other ;; libraries. For example, library `frame-cmds.el' requires ;; library `frame-fns.el'. ;; ;; Depending on your platform, if you use Icicles in a text ;; terminal (that is, without a window system/manager), then you ;; might need to change some of the key bindings, if some of the ;; default bindings are not available to you. ;; ;; If on your platform, for example, Emacs in a text terminal does ;; not recognize a key such as `S-TAB' (as something different from ;; `TAB'), then you will want to change that key binding. To ;; customize Icicles key bindings, see ;; (@file :file-name "icicles-doc2.el" :to "Customizing Key Bindings"). ;; You might also want to customize some of the Icicles faces, ;; since a text terminal is sometimes limited in the colors it can ;; handle. ;; ;; It is of course best to byte-compile all of the libraries ;; (except `icicle-chg.el', `icicles-doc1.el', and ;; `icicles-doc2.el'). You will likely get some byte-compiler ;; warning messages. These are probably benign - ignore them. ;; Icicles is designed to work with multiple versions of Emacs, and ;; that fact provokes compiler warnings. If you get byte-compiler ;; errors (not warnings), then please report a bug, using `M-x ;; icicle-send-bug-report'. ;; ;; Whenever you update Icicles (i.e., download new versions of ;; Icicles source files), I recommend that you do the following: ;; ;; 1. Delete all existing byte-compiled Icicles files ;; (icicles*.elc). ;; 2. Load Icicles (`load-library' or `require'). ;; 3. Byte-compile the source files. ;; ;; In particular, always load `icicles-mac.el' (not ;; `icicles-mac.elc') before you byte-compile new versions of the ;; files, in case there have been any changes to Lisp macros (in ;; `icicles-mac.el'). ;; ;; After startup, you can turn Icicle mode on or off at any time ;; interactively, using command `icy-mode' (aka `icicle-mode' - ;; prefix `icy' is unique to this command, so it is easier to ;; complete). ;; ;; Note: If you turn on Icicle mode in your init file, it's ;; generally best to do so as late as possible - after you or any ;; libraries that you load do any key binding. This is because ;; Icicles uses the current global key bindings to determine which ;; keys to bind for minibuffer completion and cycling. To pick up ;; the latest bindings at any time, you can of course enter Icicle ;; mode interactively using command `icy-mode' (if necessary, exit, ;; then re-enter). ;; ;; Note: Icicles redefines some functions when you are in Icicle ;; mode (it restores them when you leave Icicle mode). It ;; generally does not use `defadvice' to alter the functions; it ;; redefines them instead. Because of this, there can be ;; incompatibilities with other libraries that also change the same ;; functions (using `defadvice' or otherwise). An example is Viper ;; mode. If you load Viper before Icicles, then you will run into ;; problems with function `read-file-name' because it is tweaked by ;; both Viper and Icicles. If you load Icicles before Viper, you ;; should not encounter this problem (but you might encounter other ;; problems: both Icicles and Viper try to control the minibuffer). ;;(@* "Index") ;; ;; Index ;; ----- ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index and render it more readable. Likewise, for ;; the cross-references and section headings throughout this file. ;; You can get `linkd.el' here: ;; http://www.emacswiki.org/cgi-bin/wiki/linkd.el. ;; ;; (@* "Documentation in File `icicles-doc1.el'") ;; ---------------------------------------------- ;; ;; (@> "Nutshell View of Icicles") ;; (@> "README for NON-Readers") ;; (@> "Menus") ;; (@> "README") ;; (@> "Flashy Demo to Pique Your Curiosity") ;; (@> "First Example: Multi-Inputs") ;; (@> "Second Example: Multi-Completions") ;; (@> "Third Example: Narrowing a Manual") ;; (@> "Fourth Example: Tagged Files") ;; ;; (@> "Top Level to Minibuffer ... and Back Again") ;; (@> "Toggle Options on the Fly") ;; (@> "Cycle Completion Candidates") ;; (@> "Display Completion Candidates") ;; (@> "Prefix Completion and Apropos Completion") ;; (@> "Chains of Simple Match Patterns - Progressive Completion") ;; (@> "Chip Away the Non-Elephant") ;; (@> "Choose Before You Act") ;; (@> "Help on Completion Candidates") ;; (@> "Perform Multiple Operations in One Command") ;; (@> "Perform Alternative Operations on the Fly") ;; (@> "Completion Status Indicators") ;; (@> "Icicles Search") ;; (@> "Complete Key Sequences Too") ;; (@> "Available for Almost Any Input") ;; (@> "Component Icicles Libraries") ;; (@> "If You Are an Emacs-Lisp Programmer") ;; ;; (@> "Inserting Text Found Near the Cursor") ;; (@> "FFAP: Find File At Point") ;; (@> "Proxy Candidates, `M-.'") ;; (@> "Repeat `M-.' To Grab More or Different") ;; (@> "Resolve File Names") ;; ;; (@> "Background on Vanilla Emacs Input Completion") ;; (@> "Cycling Completions") ;; (@> "Traversing Minibuffer Histories") ;; (@> "Apropos Completions") ;; (@> "Expanded-Common-Match Completion") ;; (@> "Progressive Completion") ;; (@> "`M-*' and `S-SPC': Matching Additional Regexps") ;; (@> "Successive Approximation...") ;; (@> "`M-&': Satisfying Additional Predicates") ;; ;; (@> "Regressive Completion") ;; (@> "Completion On Demand") ;; (@> "Moving Between the Minibuffer and Other Buffers") ;; (@> "Inserting a Regexp from a Variable or Register") ;; (@> "Special Characters in Input Patterns") ;; (@> "Exiting the Minibuffer Without Confirmation") ;; (@> "Ido and IswitchB") ;; (@> "*Completions* Display") ;; (@> "Icompletion") ;; (@> "icomplete+.el Displays the Number of Other Prefix Candidates") ;; (@> "Icicles Highlights the Input that Won't Complete") ;; (@> "Icompletion in *Completions*: Apropos and Prefix Completion") ;; (@> "Incremental Completion (Input Expansion) in the Minibuffer") ;; ;; (@> "Sorting Candidates and Removing Duplicates") ;; (@> "Changing the Sort Order") ;; (@> "Defining New Sort Orders") ;; (@> "Different Sorts for Different Sorts of Uses") ;; ;; (@> "A Propos d'Apropos") ;; (@> "Get Help on Completion Candidates") ;; (@> "Use Candidate Help Like You Use Emacs Command `apropos'") ;; ;; (@> "Icicles Apropos Commands") ;; (@> "Replacements for Standard Apropos Commands") ;; (@> "Documentation-Apropos Multi-Commands") ;; (@> "Type-Aware Variable-Apropos Multi-Commands") ;; (@> "Value-Aware Variable-Apropos Multi-Commands") ;; ;; (@> "Multi-Commands") ;; (@> "What Is a Multi-Command?") ;; (@> "How Does a Multi-Command Work?") ;; ;; (@> "Multi-Completions") ;; (@> "Icicles Multi-Completion Commands") ;; (@> "Mode-Line Lighter Indication of Multi-Completion") ;; (@> "How Multi-Completions Work") ;; (@> "Multi-Completions vs `completing-read-multiple'") ;; (@> "Sorting Candidates by Their Second Part") ;; (@> "Multi-Completions with a Part You Never See") ;; ;; (@> "Chapter & Verse: Searching Named Containers") ;; (@> "Dot, Dot, Dot") ;; ;; (@> "More about Multi-Commands") ;; (@> "Alternative Actions") ;; (@> "Deleting Objects") ;; (@> "Option `icicle-use-C-for-actions-flag'") ;; (@> "Accessing Saved Locations (Bookmarks) on the Fly") ;; ;; (@> "Multi-Inputs") ;; ;; (@> "Icicles Tripping") ;; (@> "Highlighting the Destination") ;; ;; (@> "Key Completion") ;; (@> "Completing Keys") ;; (@> "`S-TAB' Is Everywhere - Start With It") ;; (@> "Completing Keys By Name") ;; (@> "Completing Prefix Keys") ;; (@> "Navigate the Key-Binding Hierarchy") ;; (@> "Local Bindings Are Highlighted") ;; (@> "Completing Keys By Just Hitting Them") ;; (@> "Key and Command Help") ;; (@> "`S-TAB' Is a Multi-Command") ;; (@> "Possible Source of Confusion") ;; (@> "Three-Key Emacs") ;; (@> "Entering Special and Foreign Characters") ;; (@> "Handling Keymaps That Are Inaccessible From the Global Map") ;; ;; (@> "Icicles Multi `M-x'") ;; (@> "Examples of Using Multi `M-x'") ;; (@> "What about describe-variable and describe-function?") ;; ;; (@> "Multi `M-x' Turns Every Command into a Multi-Command") ;; ;; (@> "Choose All Completion Candidates") ;; (@> "Sets of Completion Candidates") ;; (@> "Saving and Retrieving Completion Candidates") ;; (@> "Saving or Retrieving Additional Candidates") ;; (@> "Different Places for Saving and Retrieving Candidates") ;; (@> "Set Operations") ;; ;; (@> "Google Matching") ;; (@> "Domain of Discourse") ;; (@> "Global Filtering") ;; (@> "Word Matching and String Matching") ;; (@> "AND Matching and OR Matching") ;; (@> "NOT Matching") ;; ;; (@> "Buffer-Name Input") ;; ;; (@> "File-Name Input and Locating Files Anywhere") ;; (@> "Function `read-file-name'") ;; (@> "Function `completing-read'") ;; (@> "Icicles Commands that Read File Names") ;; (@> "`icicle-file', `icicle-find-file', `icicle-find-file-absolute'") ;; (@> "Match File Names and File Content Too") ;; (@> "Visit Recent Files or Files for Emacs Tags") ;; (@> "Find Files Anywhere, Without Knowing Where") ;; ;; (@> "Absolute File Names and Different Directories") ;; ;; (@> "Persistent Sets of Completion Candidates") ;; (@> "Saving Candidates in Cache Files") ;; (@> "Filesets and Icicles Saved Completion Sets") ;; (@> "Improving Performance with Persistent Sets") ;; (@> "Avoid Remote File-Name Completion") ;; (@> "Avoid Generating A Large Completion Set") ;; ;; (@> "Dealing With Large Candidate Sets") ;; (@> "History Enhancements") ;; (@> "What Input, What History?") ;; (@> "Overview of Minibuffer History Enhancements") ;; (@> "Using Completion to Insert Previous Inputs: `M-o'") ;; (@> "Putting Previous Candidates First: `C-M-,'") ;; (@> "Matching Only Historical Candidates: `M-h' and `M-pause'") ;; (@> "Using Other Histories; Commands Any Which Way") ;; (@> "Completing Against All Interactive Commands") ;; (@> "Using an Alternative History") ;; ;; (@> "Cleaning Up History Lists") ;; ;; (@> "Isearch Enhancements") ;; (@> "Content-Matching Pattern as Isearch Regexp") ;; (@> "Launch Occur using the Isearch Search String") ;; (@> "Launch Icicles Search using the Isearch Search String") ;; ;; ;; (@file :file-name "icicles-doc2.el" :to "Documentation in File `icicles-doc2.el'") ;; ----------------------------------------------------------- ;; ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; (@file :file-name "icicles-doc2.el" :to "Introduction: On Beyond Occur...") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Key Bindings") ;; (@file :file-name "icicles-doc2.el" :to "How Icicles Search Works") ;; (@file :file-name "icicles-doc2.el" :to "Why Use 2 Search Patterns?") ;; (@file :file-name "icicles-doc2.el" :to "Search Outside the Defined Search Contexts?") ;; (@file :file-name "icicles-doc2.el" :to "Search Multiple Buffers, Files, and Bookmarks") ;; (@file :file-name "icicles-doc2.el" :to "User Options for Icicles Searching") ;; (@file :file-name "icicles-doc2.el" :to "Using Regexps with Icicles Search") ;; ;; (@file :file-name "icicles-doc2.el" :to "Search and Replace") ;; (@file :file-name "icicles-doc2.el" :to "Other Icicles Search Commands") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Imenu") ;; (@file :file-name "icicles-doc2.el" :to "Type-Specific Imenu Commands") ;; (@file :file-name "icicles-doc2.el" :to "Imenu Commands that Search Full Definitions") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Imenu Combines Benefits of Imenu and Emacs Tags") ;; ;; (@file :file-name "icicles-doc2.el" :to "Compile/Grep Search") ;; (@file :file-name "icicles-doc2.el" :to "Input Reuse in Interactive Interpreter Modes") ;; (@file :file-name "icicles-doc2.el" :to "Define Your Own Icicles Search Commands") ;; ;; (@file :file-name "icicles-doc2.el" :to "Icicles Bookmark Enhancements") ;; (@file :file-name "icicles-doc2.el" :to "Using Tagged Files") ;; (@file :file-name "icicles-doc2.el" :to "`icicle-find-file-tagged'") ;; (@file :file-name "icicles-doc2.el" :to "Jumping to Tagged Files (Other)") ;; (@file :file-name "icicles-doc2.el" :to "Saving Regions and Selecting Them") ;; (@file :file-name "icicles-doc2.el" :to "Setting a Bookmark and Jumping to a Bookmark") ;; (@file :file-name "icicles-doc2.el" :to "Jumping to a Bookmark") ;; (@file :file-name "icicles-doc2.el" :to "Searching Bookmarked Objects") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Enhancements for Emacs Tags") ;; (@file :file-name "icicles-doc2.el" :to "`icicle-find-tag': Find Tags in All Tags Tables") ;; (@file :file-name "icicles-doc2.el" :to "`icicle-find-first-tag': Find First Tag in Current Table") ;; (@file :file-name "icicles-doc2.el" :to "`icicle-tags-search': Search and Replace Using Tags") ;; ;; (@file :file-name "icicles-doc2.el" :to "Icicles Shell-Command Enhancements") ;; (@file :file-name "icicles-doc2.el" :to "Shell Command Completion as File-Name Completion") ;; (@file :file-name "icicles-doc2.el" :to "Gotcha: `$' in Shell Commands") ;; (@file :file-name "icicles-doc2.el" :to "Known Shell Commands as Proxy Candidates") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Dired Enhancements") ;; (@file :file-name "icicles-doc2.el" :to "Search-and-Replace Marked Files") ;; (@file :file-name "icicles-doc2.el" :to "Save Marked Names as Completion Candidates") ;; (@file :file-name "icicles-doc2.el" :to "Save Marked Names Here and Below") ;; (@file :file-name "icicles-doc2.el" :to "Open Dired for a Set of File and Dir Names") ;; (@file :file-name "icicles-doc2.el" :to "Marked Files and Dirs as a Project") ;; (@file :file-name "icicles-doc2.el" :to "Shell Commands on Marked Files") ;; ;; (@file :file-name "icicles-doc2.el" :to "Icicles Info Enhancements") ;; (@file :file-name "icicles-doc2.el" :to "Icicles Completion for Info") ;; (@file :file-name "icicles-doc2.el" :to "Virtual Info Books") ;; ;; (@file :file-name "icicles-doc2.el" :to "Using Icicle-Search With Info") ;; ;; (@file :file-name "icicles-doc2.el" :to "Support for Projects") ;; (@file :file-name "icicles-doc2.el" :to "Bookmarks for Project Access and Organization") ;; (@file :file-name "icicles-doc2.el" :to "A Tags File Can Define a Project") ;; (@file :file-name "icicles-doc2.el" :to "Navigating Among Code Definitions") ;; (@file :file-name "icicles-doc2.el" :to "Searching Project Files") ;; (@file :file-name "icicles-doc2.el" :to "Defining and Saving Sets of Files or Buffers") ;; (@file :file-name "icicles-doc2.el" :to "Retrieving and Reusing a Saved Project") ;; (@file :file-name "icicles-doc2.el" :to "Semantics? Roll Your Own?") ;; ;; (@file :file-name "icicles-doc2.el" :to "Using Complex Completion Candidates") ;; (@file :file-name "icicles-doc2.el" :to "Icicles OO: Object-Action Interaction") ;; (@file :file-name "icicles-doc2.el" :to "Apropos Completion as OO") ;; (@file :file-name "icicles-doc2.el" :to "M-RET") ;; (@file :file-name "icicles-doc2.el" :to "`icicle-object-action' and `icicle-anything'") ;; (@file :file-name "icicles-doc2.el" :to "Icicles with Anything") ;; ;; (@file :file-name "icicles-doc2.el" :to "Fuzzy Completion") ;; (@file :file-name "icicles-doc2.el" :to "Partial Completion") ;; (@file :file-name "icicles-doc2.el" :to "Scatter-Match Completion") ;; (@file :file-name "icicles-doc2.el" :to "Swank (Fuzzy Symbol) Completion") ;; (@file :file-name "icicles-doc2.el" :to "Fuzzy-Match Completion") ;; (@file :file-name "icicles-doc2.el" :to "Levenshtein Completion") ;; (@file :file-name "icicles-doc2.el" :to "Jaro-Winkler Completion") ;; ;; (@file :file-name "icicles-doc2.el" :to "Completion in Other Buffers") ;; (@file :file-name "icicles-doc2.el" :to "Dynamic Abbreviation") ;; (@file :file-name "icicles-doc2.el" :to "BBDB Completion") ;; (@file :file-name "icicles-doc2.el" :to "Thesaurus Lookup and Completion") ;; (@file :file-name "icicles-doc2.el" :to "Completion in Comint Modes") ;; ;; (@file :file-name "icicles-doc2.el" :to "Customization and General Tips") ;; (@file :file-name "icicles-doc2.el" :to "Using Icicles with Delete Selection Mode") ;; (@file :file-name "icicles-doc2.el" :to "Icicles User Options and Faces") ;; ;; (@file :file-name "icicles-doc2.el" :to "File-Name and Directory-Name Completion Tips") ;; (@file :file-name "icicles-doc2.el" :to "Key Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Global Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Icicles-Mode Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Minibuffer Bindings") ;; ;; (@file :file-name "icicles-doc2.el" :to "Customizing Key Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Customizing Global Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Customizing Icicle Mode Bindings") ;; (@file :file-name "icicles-doc2.el" :to "Customizing Minibuffer Bindings") ;; ;; (@file :file-name "icicles-doc2.el" :to "Icicles Redefines Some Standard Functions") ;; (@file :file-name "icicles-doc2.el" :to "Debugging and Reporting Icicles Bugs") ;; (@file :file-name "icicles-doc2.el" :to "Debugging Tips") ;; (@file :file-name "icicles-doc2.el" :to "Programming with Fancy Candidates") ;; (@file :file-name "icicles-doc2.el" :to "Programming Multi-Completions") ;; (@file :file-name "icicles-doc2.el" :to "Variable icicle-list-use-nth-parts") ;; (@file :file-name "icicles-doc2.el" :to "Variable icicle-candidate-properties-alist") ;; (@file :file-name "icicles-doc2.el" :to "What You See Is Not What You Get") ;; ;; (@file :file-name "icicles-doc2.el" :to "Candidates with Text Properties") ;; (@file :file-name "icicles-doc2.el" :to "Using Property icicle-special-candidate") ;; (@file :file-name "icicles-doc2.el" :to "Applying Text Properties to a Candidate String") ;; ;; (@file :file-name "icicles-doc2.el" :to "Defining Icicles Commands (Including Multi-Commands)") ;; (@file :file-name "icicles-doc2.el" :to "Nothing To It!") ;; (@file :file-name "icicles-doc2.el" :to "Multi-Commands Are Easy To Define Too") ;; (@file :file-name "icicles-doc2.el" :to "Are Users Dependent on Icicles To Use Multi-Commands?") ;; ;; (@file :file-name "icicles-doc2.el" :to "Defining Icicles Tripping Commands") ;; (@file :file-name "icicles-doc2.el" :to "Defining Multiple-Choice Menus") ;; (@file :file-name "icicles-doc2.el" :to "Defining Icicles Multi `M-x'") ;; (@file :file-name "icicles-doc2.el" :to "How Multi `M-x' is Defined") ;; ;; (@file :file-name "icicles-doc2.el" :to "Defining Multi-Commands the Hard Way") ;; (@file :file-name "icicles-doc2.el" :to "Global Filters") ;; (@file :file-name "icicles-doc2.el" :to "Specifying Match Functions for Commands") ;; (@file :file-name "icicles-doc2.el" :to "Defining Buffer-Text Completion for Comint Modes") ;; (@file :file-name "icicles-doc2.el" :to "Note to Programmers") ;; (@file :file-name "icicles-doc2.el" :to "La Petite Histoire") ;; (@file :file-name "icicles-doc2.el" :to "Note on Non-`nil' `pop-up-frames' on MS Windows") ;;(@* "Nutshell View of Icicles") ;; ;; Nutshell View of Icicles ;; ------------------------ ;; ;;(@* "README for NON-Readers") ;; ** README for NON-Readers ** ;; ;; Load library `icicles.el', turn on Icicle mode, and you're good to ;; go. You can turn Icicle mode off or on at any time with command ;; `icy-mode'. When you turn it off, you're back in vanilla Emacs. ;; ;; Beyond that, the most important thing to know about Icicles is ;; that you can get help on Icicle mode during minibuffer input. You ;; do that either by using item Help of the menu-bar Icicles menu or ;; Minibuf menu, or by hitting `M-?' (`icicle-minibuffer-help'). ;; ;; You now know enough to use Icicles. If you have doc-phobia or are ;; easily overwhelmed by explanations, then *read no more* - just try ;; it! ;; ;; If you want a little more explanation than the help page (`M-?'), ;; then read the rest of section (@> "Nutshell View of Icicles"), but ;; no more. It shows a sample of what you can do in Icicle mode. ;; ;; If you want to know more about Icicles by reading instead of just ;; trying, then read beyond section (@> "Nutshell View of Icicles"). ;; There is a lot you can learn, but there is not much that you need ;; to learn, to use Icicles usefully. Do not be afraid to get in and ;; get wet. Above all, do not be overwhelmed by the doc - if it ;; helps, fine. ;; ;;(@* "Menus") ;; ** Menus ** ;; ;; One good way to start with Icicles is to explore menu-bar menus ;; `Icicles' and `Minibuf'. You can access most Icicles features ;; using these menus, without at the same time struggling to learn ;; new key bindings. ;; ;; Menu `Icicles' is available all of the time (that is, whenever you ;; are in Icicle mode). Menu `Minibuf' is available whenever the ;; minibuffer is active. It is enhanced for Icicle mode. ;; ;; Menu `Icicles' offers top-level commands of all sorts that are ;; available in Icicle mode. Instead of grouping these all in the ;; same menu, `Icicles', by default they are spread among appropriate ;; existing menus such as `File' and `Edit', on `Icicles' submenus. ;; Whether this is done is controlled by user option ;; `icicle-touche-pas-aux-menus-flag'. When it is done, menu-bar ;; menu `Icicles' contains only menu items that do not fit elsewhere. ;; ;; During minibuffer input completion, you can also press Control and ;; right-click (`C-mouse-3') on a completion candidate in buffer ;; `*Completions*', and choose from a contextual popup menu, ;; `Completion'. ;; ;; You can customize this menu. By default, its submenu `This ;; Candidate' has menu items that apply to the candidate you clicked ;; to pop up the menu. The other submenus have items that apply to ;; all candidates, candidates you have selected (the region in ;; `*Completions*'), or candidates you have saved (marked). ;; ;; Altogether, there are many menu items in the popup menu. Think of ;; the menu as a learning device and a way to remind you of possible ;; operations on completion candidates and the keys they are bound ;; to. In this it is similar to the help you get when you use `M-?' ;; in the minibuffer, but with the menu you can also act, not just be ;; reminded. ;; ;; See Also: (@> "*Completions* Display"). ;; ;;(@* "README") ;; ** README ** ;; ;; Icicles enhances minibuffer completion. It does so generally, ;; throughout Emacs. It does this by improving the basic Emacs ;; functions that read minibuffer input with completion: ;; `completing-read', `read-file-name', and `read-from-minibuffer'. ;; ;; This means that Icicles affects every kind of minibuffer ;; completion, not just buffers or files or commands or variables or ;; faces or... Every kind. (You can even complete key sequences.) ;; Lisp code need not call a special completion function to get this ;; advantage - each call to `completing-read' etc. benefits ;; automatically. ;; ;; Icicles has this effect only when you are in Icicle minor mode. ;; Turn off Icicle mode and Emacs behaves as usual (vanilla). ;; ;; To best understand what Icicles offers you, you need to think a ;; bit differently about minibuffer completion. ;; ;; During (vanilla) Emacs completion: ;; ;; v1. You type some input. Then you ask Emacs (`TAB') to look for a ;; match of your input against the domain of input possibilities: ;; the completion candidates. If a match is found, your input is ;; completed and you hit `RET' to accept it (commit it as your ;; final input). If there are several matches you type some more ;; text and recomplete ... until there is only one match. Then ;; you hit `RET'. ;; ;; v2. The goal here is to complete and then enter your input, as ;; easily and rapidly as possible. ;; ;; v3. The process starts with a domain of possible inputs: the ;; initial set of candidates. This domain can be realized ;; intensionally, via a function, or more commonly extensionally, ;; via an explicit set. ;; ;; v4. Sometimes completion is "lax" instead of "strict", meaning ;; that you can input any text you like in the end (`RET'), but a ;; set of candidates is still provided for the convenience of ;; completion (`TAB'). ;; ;; v5. When you hit `TAB' to complete, your current input in the ;; minibuffer (the contents) filters the domain, narrowing it ;; down to the set of matching candidates, which is shown in ;; buffer `*Completions*'. ;; ;; See Also: (@> "Background on Vanilla Emacs Input Completion"). ;; ;; For Icicles it is the completion *process* that is important, and ;; this process can serve several goals. So instead of focusing on ;; the goal of entering a final input (v2), let's consider the ;; overall process: There is a set (domain) of possible candidates ;; (v3) that you filter with your input (v1). ;; ;; If you edit your input and recomplete using `TAB', then the domain ;; is refiltered to a different set of matching completion ;; candidates. Each time you do this your input corresponds to a ;; different set. The process of completion thus provides a great ;; way to filter a set interactively. ;; ;; Now if all you do in the minibuffer at the end of the day is enter ;; your final input (`RET'), then changing your input and ;; recompleting (`TAB') is pretty much a waste of time, a detour. ;; But if you can do more along the way, if you can make use of the ;; current set of matches in some way, then the story is different. ;; ;; This is the key to understanding what Icicles offers. Think of ;; minibuffer completion as a pattern-matching user interface, a ;; general way to interact with sets of named objects. ;; ;; No doubt you have already used completion sometimes as more than ;; just a means toward the end of inputting a value. Perhaps you ;; have used `TAB' during file-name completion to take a look at the ;; nearby directory structure, possibly even finishing with `C-g' ;; instead of entering any file name definitively (`RET'). In that ;; scenario, you are exploring the set of file-name candidates, using ;; minibuffer completion as a help feature. ;; ;; Icicles binds different keys in the minibuffer keymaps to provide ;; different ways to interact with the current set of matches ;; (completion candidates). To exploit the possibilities of ;; filtering a set dynamically by pattern matching, Icicles provides ;; different features that work together. ;; ;; These are the most important Icicles features: ;; ;; i1. Incremental completion. By default, each change you make to ;; your minibuffer input automatically rematches and recompletes ;; it (v5). IOW, the set of current candidates is updated ;; dynamically, incrementally. You can always see (in the ;; `*Completions*' window) what your current input (the ;; minibuffer content) matches. This is a help and exploration ;; feature. ;; ;; i2. Cycling and the current candidate. You can cycle among the ;; current set of candidates (minibuffer matches). The current ;; candidate is placed in the minibuffer as you do this, for ;; possible editing. You can of course hit `RET' to commit the ;; current candidate, edited or not, as your final input. ;; ;; i3. Help, multiple actions, alternative actions. But you can also ;; instead hit a key to provide information (help) about the ;; current candidate; hit a key to act on it (accept it as input ;; but without ending the minibuffer); hit a key to perform some ;; alternative action on it (without ending the minibuffer); and ;; so on. Candidate help is perhaps the Icicles feature used ;; most often. ;; ;; i4. Multi-commands and multi-inputs. A "multi-command" is one ;; that lets you act on a completion candidate without exiting ;; the minibuffer, so that you can thus act on several ;; candidates. Not every command is a multi-command. In ;; addition to acting on multiple candidates that you choose ;; (perhaps all of them), you can act on multiple inputs in the ;; same minibuffer (called "multi-inputs"), all at once. ;; ;; i5. Multi-completions. Use completion to match two different ;; things at once. The completion candidates are multi-part, so ;; your input can also be multi-part or can match only particular ;; parts. An example of using multi-completions is matching both ;; file name and file content, in parallel. ;; ;; i6. Set operations. You can hit a key to act not on any ;; particular matching candidate but on each of them individually ;; or on all of them collectively. Among the collective set ;; operations are union, intersection, difference/complementing, ;; and saving for later reuse. ;; ;; i7. Progressive completion. Set intersection can take a couple of ;; forms. The most useful is "progressive completion": use the ;; current set of matching candidates as the domain for a ;; recursive minibuffer. That is, start over and match different ;; inputs against a subset of the original domain that was ;; defined by the previous matching operation. This is analogous ;; to piping `grep' outputs through additional `grep' filters. ;; ;; i8. More powerful matching. Using your input (minibuffer content) ;; as a dynamic filter is very important in Icicles. In line ;; with this, you can employ different matching methods. The ;; most powerful is regexp matching (which includes substring ;; matching). ;; ;; i9. Candidate sorting. You can sort the current candidates on the ;; fly in different ways, so that you can cycle them in different ;; orders. The possible sort orders at any time depend on the ;; context and type of candidates. You can define your own sort ;; orders. ;; ;; Most of these features are unique to Icicles. Others were ;; original with Icicles but have since been copied by vanilla Emacs ;; or other libraries. But only Icicles offers these features (and ;; more) together, combining them cooperatively. ;; ;; Icicles is very general. It affects many aspects of minibuffer ;; completion. As you learn to take advantage of its features it can ;; change how you use Emacs. But Icicles also stays out of the way ;; if you do not ask for its help. If you just use `TAB' completion ;; and you use none of the keys bound specially during completion ;; (for cycling, progressive completion, etc.), then you will hardly ;; notice Icicles. ;; ;; All Lisp code that uses minibuffer completion automatically takes ;; advantage of Icicles. But some other libraries go beyond this by ;; defining Icicles multi-commands or otherwise making some special ;; use of Icicles features. None of these libraries are required in ;; order to use Icicles, but they are recommended because of the ;; synergy they provide. See (@> "Installing Icicles"). ;; ;;(@* "Flashy Demo to Pique Your Curiosity") ;; ** Flashy Demo to Pique Your Curiosity ** ;; ;; This section shows a few examples to get you started and hopefully ;; interested. Subsequent sections in this nutshell view show more ;; Icicles features in more detail, but still giving an overview. ;; ;;(@* "First Example: Multi-Inputs") ;; *** First Example: Multi-Inputs *** ;; ;; In vanilla Emacs you can do this to visit all files whose names ;; match the glob pattern `ici*.el': ;; ;; C-x 4 f i c i * . e l RET ;; ;; In Icicle mode you can also do the following, to visit all ;; `ici*.el' files, file `my file.txt', and file `bookmark+.el', just ;; as if you had used `C-x 4 f' three separate times [*]: ;; ;; C-x 4 f ici*.el "my file.txt" bookmark+.el M-R C-g ;; ;; Your multi-input here is split into separate file-name patterns, ;; which are then acted on individually. You wrap the second pattern ;; with "..." because the file name contains a space character, which ;; is otherwise used to separate patterns. ;; ;; The `C-g' at the end just ends the command. Without it you can ;; continue to enter the names of more files to visit. This is ;; because `C-x 4 f' is bound to a multi-command ;; (`icicle-file-other-window'). ;; ;; [*] (For brevity, spaces were not used here to separate each ;; printable character typed: `ici*.el' instead of `i c i * . e l'.) ;; ;;(@* "Second Example: Multi-Completions") ;; *** Second Example: Multi-Completions *** ;; ;; Suppose that you do this: ;; ;; C-x 4 f i c i C-M-j c o l o r S-SPC ;; ;; The completion candidates, shown in `*Completions*', are the files ;; (a) whose name contains `icicles' (completed from `ici') and (b) ;; whose content includes `color' - that is, the files themselves ;; contain the text `color'. ;; ;; The file content is in fact part of the two-part completion ;; candidate, but of course it is not shown. It is used only for ;; filtering. Only the file names are shown in `*Completions*'. ;; ;; Then you do this, with the previous candidates still current: ;; ;; c m C-M-j i n e - f ;; ;; As you type, the candidates shown in `*Completions*' are updated. ;; When you finish typing, the set of candidates is reduced to just ;; `icicles-cmd1.el' and `icicles-cmd2.el', the files whose name ;; contains also `cm' and whose content contains also `ine-f' (as in ;; `icicle-define-file-command'). ;; ;; Then you hit `C-!' to visit each of those files. ;; ;; (Yes, it's a toy example to show you some features. Clearly you ;; could just as well have used only `icicles-cm' as your input, or ;; even `ici.*cm', or `s-cm', or perhaps only `cm', depending on the ;; files in your directory.) ;; ;; You have just used the following Icicles features: ;; ;; * incremental completion - candidate set updated as you type ;; ;; * apropos completion - matching not just a completion-candidate ;; prefix but a substring (or even a regexp) ;; ;; * multi-completion matching - matching in parallel two different ;; things at once (in this case, file name and file content), ;; separating the patterns with `C-M-j' ;; ;; * progressive completion - matching sequentially two different ;; inputs (each a multi-completion in this case), separated by ;; `S-SPC' ;; ;; * multi-command action - acting on more than one matching ;; candidate, in this case all (both) of them: `C-!' ;; ;; Using `C-M-j' followed by a content-matching pattern in your input ;; is optional. If you do not provide it then no content-searching ;; is done. ;; ;; The file-name pattern is also optional: you can search content ;; without having any idea about the file names - just start with ;; `C-M-j'. Obviously, content-searching is much slower than ;; file-name matching. If you can match names, that reduces the ;; number of files whose content needs to be searched. ;; ;; Most of the behavior you see in this example is available for most ;; Icicles commands. The name+content behavior is available for only ;; some Icicles commands. ;; ;; See Also: ;; ;; * (@> "Icompletion") ;; * (@> "Prefix Completion and Apropos Completion") ;; * (@> "Multi-Completions") ;; * (@> "Progressive Completion") ;; * (@> "Multi-Commands") ;; ;;(@* "Third Example: Narrowing a Manual") ;; *** Third Example: Narrowing a Manual *** ;; ;; The second example showed how you can match either the name or the ;; contents of a file, or both. The same behavior of matching both ;; the name and the contents of a container is available for visiting ;; an Info node (chapter of a manual) or a buffer. In Icicle mode, ;; by default, `g' in Info mode is bound to `icicle-Info-goto-node', ;; and `C-x b' is bound to `icicle-buffer'. ;; ;; These multi-commands act just as described in the second example, ;; but using buffer-name/contents and node-name/contents candidates ;; instead of file name/contents. ;; ;; In this example you look up information about indenting text to a ;; column in the Emacs manual. ;; ;; Using the indexes of the manual is always a good way to start. ;; And Icicles helps with that too, by letting you match index ;; entries using patterns (e.g., `indent') that are substrings and ;; regexps. ;; ;; You could use incremental search to search the whole manual for ;; terms like `indent', but that would be quite laborious. (You can ;; also use Icicles search to search a manual - see ;; (@file :file-name "icicles-doc2.el" :to "Using Icicle-Search With Info").) ;; ;; But this example uses the same approach as in the second one: ;; match node names and node content. ;; ;; 1. Start by searching all nodes of the Emacs manual for `indent': ;; ;; C-h r ;; ;; g C-M-j indent S-TAB ;; ;; That takes a moment, and shows lots of matching nodes. ;; ;; 2. Search also for `column': ;; ;; S-SPC C-M-j column ;; ;; There are a lot fewer nodes in `*Completions*' now. But still ;; too many to browse. ;; ;; 3. There are a bunch of nodes whose names all start with ;; `Glossary', and they just get in the way, so get rid of them. ;; First match only those nodes, by name: ;; ;; S-SPC loss S-TAB ;; ;; Then toss those nodes out and ask to match something else: ;; ;; C-~ ;; ;; 4. You're down to just these nodes now, in `*Completions*': ;; ;; Acknowledgments Basic Indent Command Index ;; Comment Commands Concept Index Directory Variables ;; Directory Variables-Footnote-1 Enriched Indentation ;; Fill Prefix ForIndent Cont ForIndent Num ;; Fortran Fortran Autofill Fortran Columns ;; Fortran Comments Fortran Indent Indentation Commands ;; Just Spaces Key Index Left Margin Paren ;; Lisp Indent Multi-Line Comments Multi-line Indent ;; Options for Comments Picture Mode Program Modes ;; Selective Display Tab Stops Table Conversion ;; Text Top Variable Index ;; ;; 5. There's a lot of Fortran stuff there, which you can remove: ;; ;; S-SPC fortr S-TAB C-~ ;; ;; 6. Now selectively remove some of the other ones individually. ;; You can do that by clicking them with `S-mouse-2' or by ;; cycling to them and hitting the `delete' key. Click ;; `Acknowledgments' and `Top' to begin with. ;; ;; 7. Not being too sure about some of the others, you can take a ;; quick look at them and hit `delete' if they don't look ;; interesting. Use `down' or `up' to cycle among them. Use ;; `C-RET' to take a look at the node that is the current ;; candidate (highlighted in `*Completions*'). Use `C-M-s' in ;; the Info window to check occurrences of the content pattern, ;; if you want. Use `delete' (in the minibuffer) to remove the ;; current candidate node if not pertinent. ;; ;; 8. Now you're down to just these node names: ;; ;; Basic Indent Command Index Comment Commands ;; Concept Index Enriched Indentation Indentation Commands ;; Just Spaces Key Index Multi-line Indent ;; Program Modes Tab Stops Text ;; Variable Index ;; ;; That might seem like a lot of trouble, but each of the ;; operations is simple and you will soon make use of them ;; everywhere in Icicles. ;; ;; What you have now is essentially a customized, mini-manual ;; about indenting text. You can visit any of its nodes by ;; cycling to them and hitting `C-RET', or by just clicking ;; `C-mouse-2' on the node name in `*Completions*'. ;; ;; 9. You can "save", or "mark", this set of nodes, so you can ;; easily come back and reuse it later. ;; ;; C-M-> ;; ;; The nodes are now shaded/highlighted, showing that they are ;; "saved" for the current Emacs session. Hit `RET' to end at ;; one of the nodes or repeat `C-g' or `C-]' to cancel the ;; command and return to `Top'. ;; ;; 10. To restore the mini-manual: ;; ;; g C-M-< ;; ;; 11. You can save the mini-manual persistently, so you can come ;; back to it in a later Emacs session. Retrieve the node-name ;; candidates, then use `C-}' to save them. You are prompted for ;; a saved-candidates-set name and the cache file location, which ;; can be anything you like. ;; ;; g C-M-< C-} Indentation Topics RET ;; ;; /here/IndentationTopics.icy RET ;; ;; 12. To restore the mini-manual in any Emacs session: ;; ;; g C-{ ;; ;; Alternatively, you could have just saved the candidates ;; persistently to begin with, using `C-}' instead of `C-M->'. ;; ;; These are the features used in this example, which you did not use ;; in the second example: ;; ;; * removing selected candidates from the current matching set ;; (`delete' key, `S-mouse-2', and `C-~') ;; ;; * saving and retrieving a set of candidates (`C-M->', `C-}', ;; `C-M-<', `C-{') ;; ;; See Also: ;; ;; * (@> "Chip Away the Non-Elephant") ;; * (@> "Persistent Sets of Completion Candidates") ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Info Enhancements") ;; * (@file :file-name "icicles-doc2.el" :to "Virtual Info Books") ;; * (@file :file-name "icicles-doc2.el" :to "Using Icicle-Search With Info") ;; * (@> "Buffer-Name Input") ;; ;;(@* "Fourth Example: Tagged Files") ;; *** Fourth Example: Tagged Files *** ;; ;; This feature works only if you also use library Bookmark+, which ;; lets you tag files with arbitrary labels (delicious-style tags) ;; that you come up with. ;; ;; Suppose you have previously tagged some files, and now you want to ;; visit one or more of the files that have both of the tags `2013' ;; and `mountains'. If you also have some idea of the file names or ;; file contents, then you can match those too, as explained in the ;; second example - see (@> "Second Example: Multi-Completions"). ;; But let's suppose you do not and you just want to match tags. ;; ;; C-x 4 f TAB C-x C-t * 2013 RET mountains RET RET ;; ;; During file-name completion, `C-x C-t *' narrows the current ;; candidates to those naming files have been tagged with each of the ;; tags you enter. You type each tag to be matched, followed by ;; `RET', then you add a second `RET' after the last tag. ;; ;; In this case, the current candidates before using `C-x C-t *' ;; included all files in the current directory (you hit `TAB' ;; immediately, without typing anything to match file names or file ;; contents). ;; ;; Besides narrowing candidates during ordinary file-visiting ;; commands (e.g., `C-x C-f'), you can use multi-command ;; `icicle-find-file-tagged' (`C-x j t C-f C-f') to directly visit a ;; file that has tags matching the second part of your ;; multi-completion input, the part after `C-M-j'. For example: ;; ;; C-x j t C-f C-f C-M-j 2013 S-SPC mountains C-! C-g C-g C-g ;; ;; (The `C-M-j' is not needed if neither tag matches a file name.) ;; ;; Tagging the files in the first place is also easy. Here is how to ;; tag the files whose names match both `ici' and `doc' with the tags ;; `Icicles' and `help' (this should really be shown on a single ;; line): ;; ;; C-x p t + a Icicles RET help RET RET ;; ici S-SPC doc C-! C-g C-g ;; ;; `C-x p t + a' runs multi-command `icicle-tag-a-file', which adds ;; the tags you type (ending the last with `RET RET' instead of ;; `RET') to the files whose candidate names you act on. In this ;; case, you hit `C-!', which acts on all candidates, which in this ;; case are the file names matching both `ici' and `doc'. ;; ;; You can also tag files on the fly during file-name completion. To ;; tag the current candidate, hit `C-x a +', then enter the tags to ;; add. ;; ;; See (@file :file-name "icicles-doc2.el" :to "Using Tagged Files"). ;; ;;(@* "Top Level to Minibuffer ... and Back Again") ;; ** Top Level to Minibuffer ... and Back Again ** ;; ;; While the minibuffer is active, waiting for you to finish your ;; input, you can optionally perform various side actions, ;; interacting with Emacs in pretty much the usual ways. For ;; example, you can move to another buffer, type some text there, ;; check the definition of a key using `C-h k', and then return to ;; typing your input in the minibuffer. This is true of vanilla ;; Emacs, not just Icicles. ;; ;; In other words, the Emacs minibuffer is not "modal", in the sense ;; that while it is interacting with you it does not force you to ;; stop interacting with Emacs in other ways. You can select some ;; other window, edit some text there, hit keys that perform various ;; actions, and so on. ;; ;; You can tell by now that Icicles uses the minibuffer heavily. It ;; takes advantage of and enhances such side-trip interaction. It ;; does this in part by binding lots of keys in the minibuffer ;; keymaps. The examples seen so far exhibit some of those keys: ;; ;; M-? Show Icicles minibuffer help ;; M-R Act on multiple minibuffer inputs ;; C-M-j Separate multi-completion component patterns ;; S-SPC Initiate progressive completion ;; C-! Act on each matching candidate, in turn ;; S-TAB Apropos-complete (regexp or substring matching) ;; down, up Cycle to the next or previous candidate ;; C-RET Act on the current candidate ;; delete Remove the current candidate from the matches ;; C-~ Remove all of the current candidates (complement) ;; C-M-> Save (mark) the current candidates, for later reuse ;; C-M-< Retrieve (reuse) the saved (marked) candidates ;; C-} Save the current candidates persistently ;; C-{ Retrieve a persistently saved set of candidates ;; C-x C-t * Narrow to files having each of the tags you specify ;; C-x a + Add tags to the current file-name candidate ;; ;; (How to remember all of this? You don't need to. You will learn ;; some of the keys little by little. And `M-?' in the minibuffer ;; lists many of them. And the keys you don't know won't hurt you. ;; You can also use `C-h M-k' from library `help-fns+.el' to list the ;; keys in any keymap, including the minibuffer maps.) ;; ;; Sometimes this temporary, side-track, or parallel interaction can ;; itself involve inputting something different in a separate ;; minibuffer. That is, in some cases it can mean that you are ;; prompted for minibuffer input at a different level. ;; ;; A recursive minibuffer is used for this interaction: the original ;; minibuffer interaction disappears from view temporarily, replaced ;; by the new, recursive one. The original minibuffer interaction is ;; not shown, but it is still there, waiting for the new, recursive ;; minibuffer interaction to finish before showing itself again. ;; ;; Node `Recursive Editing Levels' in the Emacs manual covers the ;; general topic of recursive editing levels, of which recursive ;; minibuffer levels is a particular case. You will want to read ;; this. ;; ;; Unfortunately however, though it is worth reading it says next to ;; nothing about the case of recursive minibuffers, because vanilla ;; Emacs makes little use of this feature. The Elisp manual, node ;; `Recursive Mini', says a little about the topic, but still not ;; much. ;; ;; Whereas Emacs provides a special indication of recursive editing ;; in the mode line, using nested `[...]' to show the current ;; recursive-edit depth, It offers less to show you the depth of ;; minibuffer recursion. To get it to show anything at all, you need ;; to turn on `minibuffer-depth-indicate-mode'. Then it prepends a ;; depth indicator to the minibuffer prompt. ;; ;; Emacs bug #14147 asks Emacs Dev to turn on ;; `minibuffer-depth-indicate-mode' by default. In any case, it is ;; turned on automatically whenever you are in Icicle mode, because a ;; recursive minibuffer is not uncommon in Icicles. In addition, if ;; you use library `mb-depth+.el' then you can customize the ;; appearance of the depth indicator. ;; ;;(@* "Canceling Minibuffer Interaction") ;; *** Canceling Minibuffer Interaction *** ;; ;; Whether or not the minibuffer is active, `C-g' cancels the current ;; Emacs operation, essentially the current command. If the current ;; command is reading your input from the minibuffer, then `C-g' ;; exits the minibuffer. If this is a recursive minibuffer then you ;; pop up a level, either to a shallower minibuffer or, if there is ;; none, to the top level of Emacs (no active minibuffer). ;; ;; But sometimes when the minibuffer is active the current command is ;; something other than the command that initiated reading input from ;; the minibuffer. This is common in Icicles, but not so common in ;; vanilla Emacs. When you hit a key during minibuffer input, the ;; command bound to that key becomes the current command until it is ;; finished. If it is a self-inserting key like `e' then the command ;; (`self-insert-command') finishes immediately, of course. ;; ;; But sometimes the command expects more interaction on your part, ;; or perhaps it performs an operation that takes a while. If you ;; then hit `C-g', it is that command, the now current command, that ;; is interrupted (canceled), and not the minibuffer. ;; ;; Repeating `C-g' a few times can in many cases cancel the ;; minibuffer as well. But you can always cancel a minibuffer ;; immediately and pop up to the previous level by hitting `C-]' ;; (`icicle-abort-recursive-edit'). ;; ;; So `C-g' cancels the current command, which sometimes means ;; canceling the minibuffer. And `C-]' cancels the current ;; minibuffer, popping up to the previous one or to the top level if ;; there is no other minibuffer level. ;; ;; But suppose you are in a fairly deep recursive minibuffer (for ;; example, you have used progressive completion several times, where ;; each time pushes you down another minibuffer level). How can you ;; jump directly all the way up to the top level, instead of hitting ;; `C-]' once for each minibuffer level? ;; ;; Answer: use `C-M-T' (that is, `C-M-S-t'), which is bound to ;; `icicle-top-level'. ;; ;; So you have three degrees of canceling when you are in the ;; minibuffer: `C-g' (cancel the current command), `C-]' (cancel the ;; current minibuffer), and `C-M-T' (cancel all minibuffers). ;; ;; Which you use depends on what you want. Sometimes you want to ;; cancel the current operation and resume editing the same ;; minibuffer. Sometimes you want to cancel the current minibuffer ;; level. And sometimes you want to get out of the minibuffer ;; altogether. ;; ;; For example, suppose you are using `g' in Info to look up some ;; information and you use progressive completion with a content ;; search, such as in (@* "Third Example: Narrowing a Manual"). You ;; might decide that the current search is taking too long, or that ;; perhaps you change your mind about which pattern to search for. ;; ;; In this case, you might hit `C-g' to cancel the current matching ;; operation. After `C-g', you can type the pattern you really want ;; and hit `S-TAB' again. Alternatively, you could hit `C-]' to ;; cancel the current minibuffer, and then hit `S-SPC' to create ;; another recursive minibuffer. ;; ;; The effect is the same: you abandon the current search and start ;; another, without starting over from scratch. You keep the ;; progressive-completion filtering already accomplished at previous ;; minibuffer levels. If you instead decide to stop searching ;; altogether then you hit `C-M-T'. ;; ;;(@* "Toggle Options on the Fly") ;; ** Toggle Options on the Fly ** ;; ;; There are many user options that affect the behavior of Icicles ;; features. Some of these are Boolean (on/off) or allow for simple ;; alternation or cycling of the possible values. Many of those ;; options are associated with toggle commands that are bound to keys ;; whenever the minibuffer is active, or at least active for ;; completion. ;; ;; Throughout this doc you will see references to such options and ;; their toggles. For example: "You can toggle case-sensitivity at ;; any time using `C-A' (that is, `C-S-a') in the minibuffer." ;; ;; The reason for making it so easy to change the values of these ;; options on the fly is that different kinds of completion, in ;; different contexts, can take advantage of different option values. ;; Icicles completion is very general, and a single option value is ;; not always optimal for all contexts. ;; ;; You will become acquainted with a few of these toggle keys and ;; remember them, but you will forget others. What is important to ;; point out here is that `M-?' (`icicle-minibuffer-help') is your ;; friend in the minibuffer. During completion, the help it displays ;; includes, near the top, a list of the toggle keys and the ;; corresponding current values of their options. ;; ;; Whenever you use an Icicles toggle command, a momentary message ;; shows you the new option value. So as an alternative to using ;; `M-?' to see the current value of an option, you can just toggle ;; it twice. ;; ;;(@* "Cycle Completion Candidates") ;; ** Cycle Completion Candidates ** ;; ;; M-x t o o l next ;; ;; That is, type "tool" and then hit the `next' key, which is often ;; labeled "Page Down". Each time you hit `next', another match for ;; your input (`tool') replaces it in the minibuffer: ;; ;; M-x ediff-toggle-use-toolbar next ;; M-x scroll-bar-toolkit-scroll next ;; M-x tool-bar-mode next ;; M-x tooltip-mode next ;; M-x ediff-toggle-use-toolbar ; Back to the beginning ;; ;; Keys `next' and `prior' ("Page Up") cycle among all of the ;; commands that contain (match) the minibuffer input - `tool', in ;; this case. Just hit `RET' (Return) when you get to the command ;; you want. ;; ;; (Note: The particular candidates shown here and in other examples ;; might be different from what you see, depending on your version of ;; Emacs and what other libraries you might have loaded.) ;; ;; You can use a regular expression, to narrow the field of matching ;; inputs: ;; ;; M-x i s e . + c h a r next ;; M-x isearch-delete-char next ;; M-x isearch-other-control-char next ;; ... ;; ;; Note that when you cycle, a one-line description of the current ;; candidate is shown in the mode line (of buffer `*Completions*' if ;; visible; otherwise of the current buffer). You can get more ;; detailed info about individual candidates by holding the Control ;; and Meta keys (e.g. `C-M-next') while you cycle - see ;; (@> "*Completions* Display") and (@> "Help on Completion Candidates"). ;; ;; Try cycling candidates for `C-h v' for instance, using `next'. ;; Look for their descriptions in the mode line. Now try cycling ;; using `C-M-next' - complete candidate help is shown in buffer ;; `*Help*'. ;; ;; See (@> "Cycling Completions") for more about cycling completion ;; candidates. ;; ;;(@* "Display Completion Candidates") ;; ** Display Completion Candidates ** ;; ;; You can display all of the matches for the current minibuffer ;; input, in the `*Completions*' buffer, using `S-TAB' (Shift TAB). ;; So, for instance, `S-TAB' with `M-x ise.+char' in the minibuffer ;; displays all commands whose names contain `ise' followed ;; (somewhere) by `char'. ;; ;; See (@> "*Completions* Display") for more about using the ;; `*Completions*' window. ;; ;;(@* "Prefix Completion and Apropos Completion") ;; ** Prefix Completion and Apropos Completion ** ;; ;; You can get the standard Emacs "prefix" completion, instead of the ;; "apropos" completion just described, by using `TAB' instead of ;; `S-TAB'. You can cycle prefix-completion candidates by using the ;; `end' and `home' keys instead of `next' and `prior'. (All four of ;; these keys are typically together in a central keypad to the right ;; of the main keyboard.) ;; ;; You can also cycle candidates according to the current completion ;; mode, prefix or apropos, using either the mouse wheel or the arrow ;; keys `down' and `up'. These are all called the "modal" cycling ;; keys because they respect the current completion mode. ;; ;; The current completion mode is determined by the last completion ;; key you used, `TAB' or `S-TAB'. If you have not used either so ;; far during the current minibuffer invocation, then the modal keys ;; cycle according to the value of option ;; `icicle-default-cycling-mode'. By default the option value is ;; `prefix', which means that you can use `down', `up', or the mouse ;; wheel to cycle prefix completions without needing to first hit ;; `TAB'. ;; ;; The non-modal cycling keys, `next', `prior', `end', and `home' ;; automatically set the completion mode and update the candidate ;; completions. The modal cycling keys just cycle according to the ;; current completion mode, whether it is apropos or prefix. ;; ;; To cycle using the mouse wheel, the mouse must not be over the ;; `*Completions*' window; if it is, then the wheel scrolls that ;; window instead of cycling candidates - see (@> "*Completions* Display"). ;; ;; As an alternative to using `end' or `next', you can cycle ;; candidates downward (forward) by just repeating the same ;; completion key: `TAB' or `S-TAB'. For example: ;; ;; M-x tool TAB ; Display candidates with prefix `tool' ;; M-x tool-bar-mode TAB ;; M-x tooltip-mode TAB ;; M-x tool-bar-mode ; Back to the beginning ;; ;; Or: ;; ;; M-x tool S-TAB ; Display matching candidates ;; M-x ediff-toggle-use-toolbar S-TAB ;; M-x scroll-bar-toolkit-scroll S-TAB ;; M-x tool-bar-mode S-TAB ;; M-x tooltip-mode S-TAB ;; M-x ediff-toggle-use-toolbar ; Back to the beginning ;; ;; Changing to a different completion key (`TAB' to `S-TAB' or vice ;; versa) always switches completion type and completes, but you can ;; then repeat that new completion key to cycle among the candidates. ;; ;; Note: In vanilla Emacs, repeating `TAB' scrolls the ;; `*Completions*' window. In Icicles, you can use `C-v' to scroll ;; `*Completions*' down and `M-v' to scroll up. You can also use the ;; mouse wheel to scroll `*Completions*'. ;; ;; See (@> "Apropos Completions") for more about apropos and prefix ;; completion. ;; ;;(@* "Chains of Simple Match Patterns - Progressive Completion") ;; ** Chains of Simple Match Patterns - Progressive Completion ** ;; ;; To see which functions contain `char', `delete', and `back' in ;; their names, in any order: ;; ;; C-h f c h a r S-TAB - Display all function names that contain ;; `char'. ;; ;; M-* d e l e t e - Narrow that set of names to those that also ;; contain `delete'. ;; ;; M-* b a c k - Narrow the set of matching names further, to ;; those that also contain `back'. ;; ;; This displays a list of functions like this in buffer ;; `*Completions*' (your list might be somewhat different): ;; ;; backward-delete-char backward-delete-char-untabify ;; delete-backward-char icicle-backward-delete-char-untabify ;; icicle-delete-backward-char ;; quail-conversion-backward-delete-char ;; ;; Since you are completing input to `C-h f', you can then cycle to a ;; name using `next' and hit `RET', or click `mouse-2', to see the ;; doc for that function. If, instead, you were completing input to ;; `M-x', you could choose a command to execute. And so on. ;; ;; The thing to notice here is that you can use `M-*' to input chains ;; of multiple simple regexps, to narrow down the set of completion ;; candidates progressively. This is analogous to piping the result ;; of `grep' to another `grep', and piping that result to another ;; `grep'... ;; ;; Here are a couple others to try (I'm always forgetting the order ;; in these compound names): ;; ;; C-h f w i n d o w S-TAB M-* f r a m e ;; ;; C-h f w i n d o w S-TAB M-* b u f f e r ;; ;; As a shortcut, you can use just `S-SPC' instead of `S-TAB M-*'. ;; See (@> "Progressive Completion") for more about progressive ;; completion with `M-*'. ;; ;;(@* "Chip Away the Non-Elephant") ;; ** Chip Away the Non-Elephant ** ;; ;; There's a joke about a sculptor who, when asked how he created ;; such a life-like statue of an elephant, said that he just chipped ;; steadily away, removing marble that did not resemble an elephant. ;; (Actually, Michelangelo supposedly said something similar.) ;; ;; Icicles lets you sculpt this way too - it is in fact a common ;; Icicles usage idiom. There are two ways to say, "I do not want ;; that" when it comes to possible completions: ;; ;; * The `delete' key or `S-mouse-2' says, "Get rid of this ;; completion candidate." ;; ;; * `C-~' says "I want all possible completions *except* those that ;; are the current matches." That is, "Remove all of this, and let ;; me see what's left." `C-~' takes the complement of the current ;; set of matches, using the initial set of possible candidates as ;; the universe of discourse. ;; ;; In other words, instead of coming up with input that you want a ;; completion to match, get rid of one or all of the candidates that ;; do match. You can keep clicking `mouse-2' while holding Shift, or ;; keep hitting `delete' (without Shift), to chip away at the set of ;; possible completions. If there are several candidates in a row ;; that you want to eliminate, just hold down the `delete' key until ;; they're gone. ;; ;; So that you can use `delete' this way to delete candidates one ;; after the other, in order, the next candidate is chosen each time ;; you delete one. This means that it becomes the current candidate ;; in the minibuffer. You can, however, use `M-k' to clear the ;; minibuffer or use `C-l' (bound to command ;; `icicle-retrieve-previous-input') to clear the minibuffer and ;; retrieve your last real input - see (@> "History Enhancements"). ;; ;; `delete' works well to delete isolated candidates or groups of ;; candidates that are in order (the current sort order), one right ;; after the other, and you can of course combine it with positive ;; matching. ;; ;; Note: In Emacs releases prior to Emacs 22, `delete' has no real ;; effect on file-name completion candidates (but it works fine on ;; non file-name candidates). It removes them temporarily, but they ;; are not really removed as possible candidates, so `TAB' and ;; `S-TAB' will still show them as candidates. ;; ;; `C-~' is particularly handy in combination with progressive ;; completion (`M-*') to narrow down a set of candidates, especially ;; when you are not exactly sure what you are looking for. You can ;; repeat `C-~' with different inputs to eliminate everything matched ;; by each of them. In other words, this is a variable-size chisel, ;; and you can use it to remove very large chips. ;; ;; For instance, suppose you are looking for a standard Emacs command ;; involving buffers. You try `M-x buff S-TAB', but that shows ;; zillions of matches. Suppose that you know you do not want a ;; command in some 3rd-party package. You proceed to eliminate ;; those, progressively, using something like this: ;; ;; M-* ediff C-~ ibuffer C-~ icicle C-~ Buffer-menu C-~ ps- C-~ ;; ido C-~ search-buffers C-~ moccur C-~ swbuff C-~ ;; ;; And so on. That is, instead of using `M-*' repeatedly to specify ;; multiple patterns that candidates must match, you use `C-~' ;; repeatedly (after an initial `M-*'), to chip away candidates you ;; do not want. You could, alternatively, hold down the `delete' key ;; to eliminate each of these groups of command names. There are ;; over 100 commands whose names begin with `ediff', however, so `M-* ;; C-~' can be quicker in that case. It can definitely be quicker ;; when apropos matching is involved. And you can of course combine ;; the fine chiseling of `delete' with the variable-size chiseling of ;; `C-~'. ;; ;; See (@> "Sets of Completion Candidates") for more about `C-~'. ;; ;;(@* "Choose Before You Act") ;; ** Choose Before You Act ** ;; ;; The opposite operation from chipping away at a set of candidates ;; to refine it is to build up a set of candidates that you want to ;; act on. This too is easy with Icicles. In some user interfaces, ;; including Dired in Emacs, you can mark items in a checklist and ;; then, when you've selected the items you want and verified the ;; list, act on those that are selected. You might do this, for ;; instance, if you were deleting some files. Icicles lets you ;; interact with completion candidates this same way. ;; ;; You do this by building up a saved set of candidates, and then ;; retrieving these saved candidates later. You can use the ;; retrieved candidates just as you would any current set of ;; candidates. One of the things you can do is act on all of them, ;; that is, act on each, in turn. You do that with `C-!'. ;; ;; Of course, if you can use a regexp to match exactly the candidates ;; you want to act on, then you need not bother to save and retrieve ;; them, before acting on them: you can see them all alone in buffer ;; `*Completions*'. Here's an exercise in choosing candidates to ;; save with the mouse in `*Completions*': ;; ;; C-x C-f i c i TAB - Match all file names that begin with `ici'. ;; ;; Click `mouse-1' inside (or to the left of) `icicles-face.el'. [*] ;; Click `mouse-3' inside (or to the right of) `icicles-mode.el'. ;; Click `mouse-3' again, in the same place. ;; Click `M-S-mouse-2' on each of `icicles.el' and `icicles-cmd1.el'. ;; ;; [* If you click `mouse-1' on a candidate and (starting with Emacs ;; 22) `mouse-1-click-follows-link' is an integer, then you will need ;; to hold the mouse button depressed longer than that many seconds, ;; or else that candidate will simply by chosen. If the value is ;; `t', then this will not work at all. Any other value presents no ;; problem. (Personally, I use `nil'.)] ;; ;; The candidates that you selected - those between `icicles-face.el' ;; and `icicles-mode.el', inclusive, plus `icicles.el' and ;; `icicles-cmd1.el', are highlighted specially in buffer ;; `*Completions*', and feedback in the minibuffer tells you that ;; they were "saved", which you can also think of as "marked". ;; ;; Next, use `C-M-<'. This retrieves the set of saved candidates; ;; that is, it replaces the current set of candidates with the saved ;; candidates. If you now use `C-!', it applies the action to each ;; candidate. In this case, the action is to visit the file (`C-x ;; C-f'). ;; ;; The combination of saving (marking) candidates and then retrieving ;; only those you have saved is like progressive completion or ;; chipping away: it is another way of progressively narrowing the ;; set of candidates that you act on. ;; ;; See (@> "Choose All Completion Candidates") for more about `C-!'. ;; See (@> "Sets of Completion Candidates") for more about saving and ;; retrieving sets of candidates. ;; ;;(@* "Help on Completion Candidates") ;; ** Help on Completion Candidates ** ;; ;; Sometimes, you'd like to be able to ask for help about individual ;; completion candidates while you're in the process of choosing one. ;; That is the purpose of the Icicles `C-M-' key bindings available ;; during completion. ;; ;; The simplest such bindings are `C-M-RET' and `C-M-mouse2'. They ;; each do the same thing: provide help on the current candidate. ;; You can use them during cycling or whenever you've narrowed the ;; choice down to a single candidate. You can check this way, before ;; you execute a command you're unsure of. ;; ;; During completion, you can also cycle among the doc strings for ;; the candidates that match your input, by holding `C-M-' while ;; using any of the cycling keys: ;; ;; - `C-M-down', `C-M-up', or `C-M-' + wheel - current-mode matching ;; - `C-M-next', `C-M-prior' - apropos matching ;; - `C-M-end', `C-M-home' - prefix matching ;; ;; See (@> "Prefix Completion and Apropos Completion")). ;; ;; This gives you a very useful on-the-fly apropos feature - use it ;; while you're completing a command, to check the difference between ;; several possible commands. Or just use it to browse doc strings, ;; to learn more about Emacs. ;; ;; See (@> "Get Help on Completion Candidates") for more about this. ;; ;;(@* "Perform Multiple Operations in One Command") ;; ** Perform Multiple Operations in One Command ** ;; ;; C-x C-f i c i TAB - Find a file whose name starts with `ici'. ;; ;; down (that is, the down arrow) ... until you get to candidate ;; `icicles-cmd1.el' ;; ;; RET - Open file `icicles-cmd1.el'. ;; ;; Nothing new here. Now try the same thing, but use `C-RET' ;; (`C-return') instead of `RET' (`return). The command is not ;; ended, and you can continue to choose files to open: ;; ;; C-x C-f i c i TAB - Find a file whose name starts with `ici'. ;; ;; down ... until you get to `icicles-cmd1.el' ;; ;; C-RET - Open file `icicles-cmd1.el'. ;; ;; down ... until you get to `icicles-opt.el' ;; ;; C-RET - Open file `icicles-opt.el'. ;; ;; down ... until you get to `icicles.el' ;; ;; RET - Open file `icicles.el' (end). ;; ;; You just opened three files in a single command. Command ;; `icicle-file' (`C-x C-f') is an Icicles multi-command. You can ;; tell if a command is a multi-command when you execute it - if so, ;; the input prompt is prefixed by `+'. So, for example, when you ;; used `C-x C-f', the prompt was "+ File or directory:". Icicles ;; menu items that are multi-commands are also prefixed by `+'. ;; ;; In addition to using `down' (or `end' or `next') and choosing ;; (acting on) candidates with `C-RET', you can combine these ;; operations by using `C-down' (or `C-next'): act on candidates in ;; succession. And, as mentioned, you can use `C-!' to act on all ;; candidates at once. ;; ;; There are many possible uses of multi-commands. They all make use ;; of the same key bindings, which begin with `C-'. These keys are ;; analogous to the `C-M-' keys that provide help on completion ;; candidates. ;; ;; See (@> "Multi-Commands") for more information about Icicles ;; multi-commands. ;; ;;(@* "Match Multiple Things Together") ;; ** Match Multiple Things Together ** ;; ;; Some Icicles commands that ask for your input provide completion ;; candidates that are multi-part, called "multi-completions". ;; ;; For instance, with a non-positive prefix argument (or with `C-u ;; C-u'), command `icicle-locate-file' lets you find files anywhere ;; under a given directory (or under each of a set of directories you ;; choose) by matching the file name or the last-modification date, ;; or both. The first part of the multi-completion is the file name; ;; the second part is the date. The two-part candidates are shown in ;; `*Completions*' like this: ;; ;; c:/foo/bar.el ;; 2012 09 24 16:20:14 ;; ;; c:/foo/bar-none.el ;; 2012 08 06 10:02:17 ;; ;; You use the key sequence `C-M-j' to separate the two parts of your ;; input. So if you type `.* C-M-j .*14 S-TAB' then your input ;; matches only the first candidate above. The first `.*' matches ;; any file name, and the `.*14' matches the date of only the first ;; candidate. ;; ;; If you instead type `.*on S-TAB' then only the second candidate is ;; matched, by its file name this time. In this case you do not ;; bother matching a date - no `C-M-j' or second part, just a first ;; part to match. ;; ;; Notice that I said `S-TAB', not `TAB'. You use apropos, not ;; prefix, completion with multi-completion candidates, at least ;; whenever you use an input pattern that matches other than just the ;; first multi-completion part. ;; ;; Command `icicle-fundoc' describes a function. You match the ;; function name or the function documentation or both, as the two ;; multi-completion parts. Sometimes it is easy to choose by name, ;; sometimes by doc content, sometimes by a combination. ;; ;; By default, `C-x b' is bound to `icicle-buffer' in Icicle mode. ;; Here, the second multi-completion part is never shown. The first ;; part matches buffer names, so if you do not input a second part ;; then `C-x b' just matches buffer names, as you are used to (except ;; that Icicles completion is available - apropos, progressive, ;; etc.). ;; ;; The second multi-completion part is buffer content. Matching ;; searches the available buffers (whose names match the first part ;; of your input, if present), and only those whose contents match ;; the second part of your input remain candidates. You see the ;; buffer-name matches in `*Completions*', but not the content ;; matches. ;; ;; For example: ;; ;; C-x b foo ; Match buffer names against `foo' ;; C-x b C-M-j toto ; Match buffer contents against `toto' ;; C-x b foo C-M-j toto ; Match both buffer name and contents ;; ;; See (@> "Multi-Completions"). ;; ;;(@* "Perform Alternative Operations on the Fly") ;; ** Perform Alternative Operations on the Fly ** ;; ;; (If this section seems a bit weird or advanced to you, just skip ;; it the first time through.) ;; ;; C-x C-f i c i TAB - Find a file whose name starts with `ici'. ;; ;; down ... until you get to candidate `icicles-cmd1.el' ;; ;; C-S-RET - You are prompted to choose a function to apply. ;; ;; f i n d e TAB RET - Choose function `finder-commentary'. ;; ;; down ... until you get to candidate `icicles-fn.el' ;; ;; C-S-RET TAB TAB ... until you get to `find-file-read-only'. ;; ;; RET - Visit file `icicles-fn.el' in read-only mode. ;; ;; C-k TAB - Kill rest of input, then complete the prefix `ici'. ;; ;; C-| b y t e - c TAB - Byte-compile all files matching `ici'. ;; ;; TAB ... until you get to `icicles-doc1.el', then RET to visit. ;; ;; What's going on? `C-S-RET' (`C-S-return') invokes an alternative ;; action on the current completion candidate. Here, you do this, in ;; turn, for the file-name candidates `icicles-cmd1.el' and ;; `icicles-fn.el'. `C-|' invokes an alternative action on *all* of ;; the current completion candidates. Here, you do this for all file ;; names that begin with `ici'. Finally, you cycle to ;; `icicles-doc1.el' and hit RET to visit that file. ;; ;; The alternative action for `C-x C-f' (command `icicle-file') ;; prompts you for a function to apply to the current completion ;; candidate (for `C-S-RET') or to all candidates (for `C-|'). ;; ;; Here, you choose function `finder-commentary' to visit the ;; Commentary of file `icicles-cmd1.el', function ;; `find-file-read-only' to visit file `icicles-fn.el' in read-only ;; mode, and function `byte-compile-file' to byte-compile all files ;; whose names start with `ici'. ;; ;; You can use `C-u' with a function you choose, to pretty-print its ;; result (in buffer `*Pp Eval Output*', if too large for the echo ;; area). That is useful for functions that have no side effects. ;; For this to work, use `C-RET', not `RET', to choose the function. ;; ;; Each command defines its own alternative action, but many Icicles ;; commands have the behavior described here for `icicle-file': their ;; alternative action is to let you apply any function that is ;; appropriate for the given type of candidate (here, file names). ;; ;; You can even enter an appropriate lambda expression, instead of ;; completing to one of the function candidates provided. For ;; example, you could use `C-|' with the following input to copy all ;; Icicles libraries to directory `ICICLES': ;; ;; (lambda (f) (copy-file f "ICICLES" t)) ;; ;; Note that function `copy-file' is effectively curried here, to ;; create a function of a single argument on the fly. ;; ;; See Also: (@> "Alternative Actions"). ;; ;;(@* "Completion Status Indicators") ;; ** Completion Status Indicators ** ;; ;; You can always know whether completion is possible when you are ;; inputting text in the minibuffer and, if so, what kind of ;; completion. Completion status is indicated in two places: (1) at ;; the beginning of the minibuffer prompt and (2) in the `Icy' ;; minor-mode lighter in the mode line. The second is optional, ;; controlled by option `icicle-highlight-lighter-flag'. ;; ;; Whenever input completion is available, the prompt is prefixed by ;; `.' or `+', indicating simple or multi-command completion, ;; respectively. If completion is strict (your input must match one ;; of the candidates), then this character is enclosed in a box. If ;; completion is lax (permissive), there is no box. ;; ;; The `Icy' minor-mode lighter text is highlighted red during ;; completion. `+' is appended to the lighter (`Icy+') for ;; multi-command completion, `||' is appended if completion ;; candidates are multi-completions, and the lighter is boxed for ;; strict completion. When minibuffer input is read without Icicles ;; completion, the lighter is not highlighted in any way. ;; ;; If the list of candidates shown in `*Completions*' is truncated ;; (because of option `icicle-max-candidates'), then the lighter text ;; is suffixed by `...'. So if you see `...' then you know that if ;; you increase `icicle-max-candidates' (e.g. by using `C-x #' during ;; completion) then more candidates will be available. See ;; (@file :file-name "icicles-doc2.el" :to "Customization and General Tips") ;; for info about `C-x #' and option `icicle-max-candidates'. ;; ;; In addition, the lighter text (with or without `+', `||', and ;; `...') is `Icy' if completion is case-sensitive and `ICY' if not. ;; You can toggle case-sensitivity at any time using `C-A' (that is, ;; `C-S-a') in the minibuffer. ;; ;; The faces used for this highlighting in the minibuffer and the ;; mode line are `icicle-completion', ;; `icicle-multi-command-completion', and ;; `icicle-mustmatch-completion'. Consult their doc strings for more ;; information. These faces are combined to produce the various ;; highlighting effects - keep that in mind if you customize them. ;; ;; When you are inputting, keep an eye out for this highlighting. If ;; you do not see it when you are prompted for input, it means that ;; Icicles input completion is not available. This in turn means ;; that `S-TAB' is available, not for input completion, but for key ;; completion - see (@> "Key Completion"). ;; ;;(@* "Icicles Search") ;; ** Icicles Search ** ;; ;; Icicles provides a unique way of searching incrementally. Command ;; `icicle-search' (`C-c `') is a multi-command. In this case, the ;; completion candidates are the buffer occurrences that match a ;; regexp that you input. `C-RET' visits a search-hit candidate, and ;; `C-next' visits a candidate and prepares to visit the next in ;; succession. If you visit file `icicles-doc1.el', which contains ;; the text you are reading now, do this in that buffer: ;; ;; C-c ` ;; ;; Search within contexts (regexp): . * r e c u r s i v e . * RET ;; ;; Search within contexts defined by the regexp `.*recursive.*'. ;; ;; Choose an occurrence: S-TAB - Show the search hits, in buffer ;; `*Completions*' (optional). ;; ;; C-next ... - Cycle among the search hits, navigating to them in ;; turn. ;; ;; S-TAB next ... - Cycle among the search hits without navigating. ;; ;; next ... C-RET next ... C-RET - Cycle to particular hits and ;; visit (only) those hits. ;; ;; next ... RET - Cycle to a hit and stay there (end). ;; ;; ;; C-c ` ;; ;; Search within contexts (regexp): M-p RET ;; ;; Search again within `.*recursive.*' (`M-p' uses input history). ;; ;; S-TAB e d i t C-next ... - Search for the substring `edit' ;; within all search hits for `.*recursive.*'. Cycle among the ;; matches. The substring `edit' is highlighted inside the ;; (differently) highlighted `.*recursive.*' hits. Whatever you ;; type filters the initial set of hits. ;; ;; M-k - Empty the minibuffer, then S-TAB. All `.*recursive.*' ;; hits are restored as candidates. Again, whatever your input is ;; (nothing, now), the set of candidates is dynamically updated to ;; match it. ;; ;; t \ w + n S-TAB C-next ... - Search for matches of the regexp ;; `t\w+n' within all search hits for `.*recursive.*' - that is, ;; `t' followed by at least one other word character, followed by ;; `n'. Whatever the regexp `t\w+n' matches (`thin', `then', ;; `traighten', `tion') is highlighted inside each candidate. ;; ;; RET - Stop searching at the current candidate (end). ;; ;; Now try the same thing, but first use `C-^' in the minibuffer ;; (e.g. after you enter `.*recursive.*'). That toggles an Icicles ;; search option for highlighting your input matches. The behavior ;; is the same as before, except that all matches to your input are ;; highlighted at once, not just the current match. And not only the ;; exact match is highlighted, but the longest common match among all ;; input matches is highlighted: If your input is `edi', then `edi' ;; is highlighted (there is no longer common match), but if you input ;; the four characters `e d i t', then ``abort-recursive-edit'' is ;; highlighted. You can use `C-^' at any time during searching to ;; change the highlighting behavior. ;; ;; Now try the same thing, but first select some text. The search is ;; confined to the active region (selection) instead of the entire ;; buffer. ;; ;; Now try the same thing (without a region), but use a negative ;; prefix argument such as `C--' with `C-c `'. This time, after you ;; input the regexp to search for, you are prompted for one or more ;; files to search. This too is multi-command input: you can input ;; any number of file names, using completion. ;; ;; C-- C-c ` ;; ;; Search within contexts (regexp): . * r e c u r s i v e . * RET ;; ;; Search within contexts defined by the regexp `.*recursive.*'. ;; ;; Choose file (`RET' when done): i c i TAB - Choose among file ;; candidates that begin with `ici' (shown in `*Completions*'). ;; ;; C-! - Choose all matching file names: icicles-cmd1.el, ;; icicles-cmd2.el, icicles-doc1.el, icicles-doc2.el, ;; icicles-face.el, icicles-fn.el, icicles-mac.el, icicles-mcmd.el, ;; icicles-mode.el, icicles-opt.el, icicles-var.el, and icicles.el. ;; ;; Choose an occurrence: S-TAB - Show the hits in buffer ;; `*Completions*' (optional). ;; ;; C-next ... - Cycle among the search hits in all chosen ;; files... ;; ;; Just as you can choose particular search hits to visit, using ;; `C-RET', so you can use `C-RET' to choose particular files (whose ;; names match the input, e.g. ici) to search. Just as you can visit ;; search hits in order, using `C-next' (or `C-end' or `C-down'), so ;; you can use `C-next' (or `C-end' or `C-down') to choose files to ;; visit, one after the other. ;; ;; When you input the initial regexp (`.*recursive.*' in the example ;; above) to `icicle-search', you can use completion to retrieve a ;; regexp that you entered previously. ;; ;; You can use `C-`' in the minibuffer to toggle escaping of regexp ;; special characters. Use that if you want to find a literal string ;; - for example, if you want to search for the string `form.' and ;; not text that matches the regexp `form.' (`form' followed by any ;; character except newline). If you use `C-`' during Icicles ;; search, start the search over again for the toggle to take effect. ;; ;; Oh, can you use progressive completion with Icicles search? Sure. ;; And chipping away the non-elephant (complementing)? Yep. Try ;; using vanilla Emacs incremental search to find a line that ;; contains a given set of words in any (unknown) order and that also ;; does not contain another given set of words. No can do. But that ;; is simple using Icicles search. (Yes, you can do it using ;; `grep'.) ;; ;; And while you're searching, you can perform on-the-fly, on-demand ;; replacement. You tell Emacs whenever you want to replace text, ;; instead of replying to an endless litany of `query-replace' ;; queries. Unlike `query-replace', you need not visit search ;; matches successively or exhaustively. You can visit and replace ;; selected matches in any order. And you can even change the order ;; (using `C-,') in which search hits appear and are navigated ;; sequentially. ;; ;; In addition to Icicles search (which is also incremental), Icicles ;; offers some enhancements to the standard Emacs incremental search, ;; Isearch: ;; ;; * You can reuse previous Isearch search strings using Icicles ;; completion. There are two ways you can do this: ;; ;; . `M-TAB' or `C-M-TAB': Complete the current search string, ;; choosing a previous one to replace it. ;; ;; . `M-o': Append one or more previous search strings to the ;; current one. This is similar to `M-o' in the minibuffer ;; (`icicle-insert-history-element'), except that a prefix ;; argument has no effect here: no candidate is wrapped with ;; "...", and no space character is appended. ;; ;; (The actual keys for this are those defined by user options ;; `icicle-isearch-complete-keys' and ;; `icicle-isearch-history-insert-keys', respectively.) ;; ;; * You can start Icicles search from Isearch. The current Isearch ;; search string becomes the starting point for the Icicles search ;; regexp. You can edit it or type something different. And you ;; can complete what you type against the Isearch regexp history. ;; You can optionally define search contexts with a regexp and then ;; search for the Isearch string within those contexts. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; for more about searching with Icicles. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Search and Replace") ;; for information about replacing selected search hits. ;; ;; * (@> "Expanded-Common-Match Completion") for more about Icicles ;; expansion of your input to a common match among all candidates. ;; ;; * (@> "Isearch Enhancements") ;; ;; * (@> "Using Completion to Insert Previous Inputs: `M-o'") for ;; more about `M-o' - you can use it anywhere to complete against ;; previous inputs. ;; ;;(@* "Complete Key Sequences Too") ;; ** Complete Key Sequences Too ** ;; ;; Try `S-TAB' at the top level (without first invoking a command ;; that reads input). Icicles presents all of the possible keys and ;; their bindings in the current context - for completion. For ;; example, if you are in Dired mode, the completion candidates ;; include all key sequences in the global map and the Dired-mode map ;; (and any current minor-mode maps, such as Icicle mode). ;; ;; (The documentation always refers to the key that performs key ;; completion as `S-TAB'. Actually, it is `S-TAB' only by default. ;; You can customize it, using option `icicle-key-complete-keys'.) ;; ;; You can then type part of a key name or a command name, and hit ;; `S-TAB' again to apropos-complete your input. You can navigate ;; down the key-sequence hierarchy by completing a key sequence piece ;; by piece: ;; ;; S-TAB to see the available keys at top level ;; ;; Click (using `mouse-2') candidate `C-x = ...', to see the keys ;; that start with `C-x' ;; ;; Click `r = ...', to see the keys that start with `C-x r' ;; ;; Click `b = bookmark-jump', to invoke that command and visit a ;; bookmark ;; ;; Whenever you're completing a prefix key, such as `C-x', you can ;; click `..' to navigate back up the key-sequence hierarchy. For ;; instance, if you are completing `C-x p', click `..' to go back to ;; completing `C-x', and then click `..' to go back to the top level. ;; ;; The available keys at any level include the following important ;; keys, which means that you can use Icicles key completion to do ;; almost anything in Emacs: ;; ;; * `M-x' - Execute an arbitrary command. ;; `M-x' is treated as `ESC-x', so complete first `ESC = ...', ;; then `x = icicle-execute-extended-command'. ;; ;; * `M-:' - Evaluate any Emacs-Lisp expression. ;; In Icicles, `M-:' gives you a quick pop-up mode for evaluating a ;; Lisp sexp. Most of the normal Emacs-Lisp mode bindings are in ;; effect, except that `RET' evaluates the minibuffer contents and ;; pretty-prints the result. You can also use it with a prefix arg ;; (`C-u M-:') to insert the result of such an on-the-fly Lisp ;; evaluation into the current buffer (including the minibuffer). ;; ;; * `menu-bar = ...' - Invoke any menu-bar menu. ;; Continue completing, to navigate the entire menu hierarchy. ;; ;; You can start directly with a key prefix, and then hit `S-TAB' to ;; complete it - you need not start with `S-TAB'. You can use ;; Icicles key completion to learn key bindings - `C-M-mouse-2' ;; displays help on any key. ;; ;; Instead of clicking a completion candidate with `mouse-2', you can ;; of course type part of the key name or command name, and then ;; complete the name and enter it. Gotcha: `S-TAB' uses apropos ;; completion, by default, so remember that typing `.' matches any ;; character (except a newline). To match only `..' (to go up a ;; level), either use prefix completion (`TAB') or escape the regexp ;; special character: `\.\.' (or use `^\.'). Or cycle to it. ;; ;; Icicles key completion is also available in the minibuffer, but ;; there, since `S-TAB' performs apropos completion of your input, ;; the key that initiates key completion is `M-S-TAB', not `S-TAB'. ;; ;; See (@> "Key Completion") for more about Icicles key completion. ;; ;;(@* "Available for Almost Any Input") ;; ** Available for Almost Any Input ** ;; ;; All of this works not only for the input of commands, with `M-x', ;; but for the input of nearly anything. For instance, you can use ;; `C-x b' (`switch-to-buffer') and cycle among buffer names. Or use ;; `C-h v' (`describe-variable') and cycle among variable names. It ;; works whenever a command reads input with completion. ;; ;; Whenever you're in Icicle mode, you see "Icy" in the mode-line. ;; ;;(@* "Component Icicles Libraries") ;; ** Component Icicles Libraries ** ;; ;; Icicles is composed of the following libraries. When you load the ;; driver library, `icicles.el', the others are all loaded ;; automatically . ;; ;; `icicles.el' - driver library ;; `icicles-doc1.el' - first part of the doc (this!) ;; `icicles-doc2.el' - second part of the doc ;; `icicles-cmd1.el' - top-level commands (part 1) ;; `icicles-cmd2.el' - top-level commands (part 2) ;; `icicles-face.el' - faces ;; `icicles-fn.el' - non-interactive functions ;; `icicles-mac.el' - macros ;; `icicles-mcmd.el' - minibuffer commands ;; `icicles-mode.el' - Icicle mode definition ;; `icicles-opt.el' - user options (variables) ;; `icicles-var.el' - internal variables ;; ;; Libraries `icicles-doc1.el' and `icicles-doc2.el' are not really ;; libraries. They contain only comments, with the Icicles doc. ;; ;; Library `lacarte.el' is not part of Icicles, but it is especially ;; useful when used with Icicles. ;; ;;(@* "If You Are an Emacs-Lisp Programmer") ;; ** If You Are an Emacs-Lisp Programmer ** ;; ;; If you are an Emacs-Lisp programmer, this is the no-brainer, ;; nutshell view of how to take advantage of Icicles in your own code ;; that calls `completing-read' or `read-file-name': ;; ;; Add this line to your library: (require 'icicles nil t) ;; ;; That is really all you need to do. And there is no consequence if ;; users do not have Icicles (no load error is raised, because of the ;; non-`nil' third argument). In other words, there is no reason not ;; to add this soft `require', unless your library somehow conflicts ;; with Icicles features. (Even then, users will not be affected ;; unless they turn on Icicle mode.) ;; ;; ;; For more (and there is a lot more), read on... ;;(@* "Inserting Text Found Near the Cursor") ;; ;; Inserting Text Found Near the Cursor ;; ------------------------------------ ;; ;; Most of Icicles is about completing text that you type in the ;; minibuffer against some set of possible completion candidates. ;; This feature is not. It is related only in the sense that it is ;; also about inputting text that is already available elsewhere. ;; ;; Some Emacs commands provide, as the default value for minibuffer ;; input, a word or other text at the cursor position (aka "point"). ;; You can insert this default value in the minibuffer with `M-n'. ;; Icicles option `icicle-default-value' can be used to automatically ;; insert the default value into the minibuffer as an initial value, ;; if you prefer that optional behavior (I do; many people do not). ;; ;; ;;(@* "FFAP: Find File At Point") ;; ** FFAP: Find File At Point ** ;; ;; Sometimes you would like to use the text at the cursor, but the ;; command asking for input does not let you retrieve that text as ;; the default value. For example, if the text at point is a file ;; name, you might like to use it with `C-x C-f' to open that file. ;; Or, if the text is a URL, you might want to visit it using a Web ;; browser. ;; ;; Some Emacs-Lisp libraries, such as `ffap.el', have as their ;; specific purpose to help you do this. "Ffap" stands for ;; `find-file-at-point', the main command in that library. It tries ;; to interpret the text at point and "do the right thing" with it: ;; visit a file, open a URL in a Web browser, and so on. ;; ;; If you like, you can use library `ffap.el' with Icicles. All ;; Icicles features are then available during file-name and URL ;; completion. And if you like `ffap.el', you might also like to try ;; my extension library `ffap-.el'. However, if you use ffap with ;; Icicles, you might not want to use the ffap key bindings, ;; preferring the Icicles bindings or the standard Emacs bindings for ;; keys such as `C-x C-f'. (In that case, do not call function ;; `ffap-bindings'.) ;; ;; Icicles provides a couple of simple ways to take advantage of ;; `ffap-guesser', which is the ffap function that guesses which ;; string at the cursor position you want to grab, without ;; sacrificing any key bindings to ffap. One way is to use `M-.' ;; (command `icicle-insert-string-at-point') at any time in the ;; minibuffer. It grabs text at or near the cursor and yanks it into ;; the minibuffer. One of the alternative types of thing it grabs is ;; whatever text `ffap-guesser' guesses. ;; ;;(@* "Proxy Candidates, `M-.'") ;; ** Proxy Candidates, `M-.' **) ;; ;; Another way is to use one of the proxy completion candidates ;; `*point file name*' or `*mouse-2 file name*' whenever Emacs asks ;; you to input a file name (provided option ;; `icicle-add-proxy-candidates-flag' is non-`nil' - toggle with ;; `C-M-_'). The former picks up the file name at point, just like ;; `M-.'. The latter lets you click a file name anywhere with ;; `mouse-2' to pick up the name. ;; ;; Using `M-.' or a proxy candidate on demand, instead of binding ;; keys to ffap commands, lets you control which buffer text you use ;; as minibuffer input and how that text should be interpreted (file ;; name, URL, and so on). You can change the behavior of `M-.' ;; (which string-inserting functions are used) by customizing user ;; option `icicle-thing-at-point-functions'. ;; ;; See Also: (@> "*Completions* Display"). ;; ;;(@* "Repeat `M-.' To Grab More or Different") ;; ** Repeat `M-.' To Grab More or Different ** ;; ;; Actually, `M-.' acts differently if you use it successively. ;; Successive uses of `M-.' grab and insert either 1) alternative ;; bits of text (different text "things") or 2) successive bits of ;; text. The default behavior is #1, but you can change this choice ;; by customizing option `icicle-default-thing-insertion' (setting it ;; to `more-of-the-same', instead of `alternatives'). ;; ;; As an example of grabbing successive bits of text (#2), suppose ;; that the cursor is at the beginning of the word "use" in the ;; previous paragraph. Then, during minibuffer input, suppose that ;; you use `M-. M-. M-.'. Each time you hit `M-.', another word is ;; inserted in the minibuffer: ;; ;; use ;; use it ;; use it successively ;; ... ;; ;; The rest of this section is a bit technical, so you might want to ;; skip it if you are reading the Icicles doc for the first time. It ;; details the behavior and definitions of options ;; `icicle-default-thing-insertion' and ;; `icicle-thing-at-point-functions', and how to temporarily override ;; those settings interactively. ;; ;; Option `icicle-thing-at-point-functions' controls which text at or ;; near the cursor `M-.' inserts into the minibuffer. It is a cons ;; cell, that is, an ordered pair: ;; ;; * The car (first part) is a list of functions that grab different ;; kinds of strings at or near point (#1, above). Any number of ;; functions can be used. They are used in sequence by `M-.'. I ;; recommend that you also use library `thingatpt+.el', so that ;; `M-.' can take advantage of the string-grabbing functions it ;; defines. ;; ;; * The cdr (second part) is a function that advances point one text ;; thing (#2, above). Each time command `M-.' is used ;; successively, this is called to grab more things of text (of the ;; same kind). The default function grabs successive words. ;; ;; If either the car or cdr is empty, then the other alone determines ;; the behavior of `M-.'. Otherwise, option ;; `icicle-default-thing-insertion' determines whether the car or the ;; cdr is used by `M-.'. ;; ;; For example, if the value of `icicle-default-thing-insertion' is ;; `alternatives' (the default value), then repeated use of `M-.' ;; inserts a different kind of thing at point each time. By default, ;; these are the thing types, in order: ;; ;; `non-nil-symbol-name-nearest-point' (*) or `symbol-at-point' ;; `word-nearest-point' (*) or the word at point ;; `list-nearest-point-as-string' (*), the first enclosing list ;; `list-nearest-point-as-string' (*), the second enclosing list ;; `list-nearest-point-as-string' (*), the third enclosing list ;; `ffap-guesser' ;; `thing-at-point-url-at-point' ;; ;; The alternatives marked with an asterisk (*) are available only if ;; you use library `thingatpt+.el'. Alternative `ffap-guesser' is ;; used only if you use library `ffap.el'. ;; ;; The first alternative inserts text that has the syntax of an ;; Emacs-Lisp symbol name. In practice, this can also be a file ;; name or a URL - it can include characters such as -, /, +, ., :, ;; @, and _. ;; ;; The second alternative inserts a word, which includes letters, ', ;; and -. ;; ;; The third, fourth, and fifth alternatives insert a (non-`nil') ;; list that is around point - three different enclosing levels. ;; ;; The sixth alternative inserts whatever `ffap-guesser' returns: a ;; file name or a URL at point. ;; ;; The seventh alternative inserts a URL at point, adding prefix ;; "http://" if needed. ;; ;; This means that you can quickly pick up a symbol name, a list, a ;; file name, or a URL at point. ;; ;; If you use library `thingatpt+.el' then the first two alternatives ;; pick up the symbol or word nearest point - the cursor need not be ;; exactly on the symbol or word. ;; ;; You can of course add to or replace any of the alternatives that ;; are provided by default. ;; ;; If you set `icicle-default-thing-insertion' to `more-of-the-same' ;; instead of `alternatives', then repeated use of `M-.' inserts ;; successive words into the minibuffer, as shown in the example ;; above. ;; ;; You need not make a final choice once and for all between ;; `alternatives' and `more-of-the-same'. You can also make an ;; interactive choice by using a prefix argument (`C-u') at any time ;; to override the value of `icicle-default-thing-insertion'. If you ;; use plain `C-u', then `M-.' inserts alternative strings. If you ;; use a numeric prefix argument N (not just plain `C-u'), then it is ;; the same as using `M-.' N times with `more-of-the-same' as the ;; value of `icicle-default-thing-insertion'. ;; ;; And, if the numeric argument is negative, then text is grabbed to ;; the left of the cursor, instead of to the right. In the example ;; above, if you used `M-- M-. M-. M-.', then the successive ;; insertions would be as follows: ;; ;; differently ;; differently if ;; differently if you ;; ... ;; ;; If you used `M--3 M-.', then you would immediately insert ;; `differently if you'. ;; ;;(@* "Resolve File Names") ;; ** Resolve File Names ** ;; ;; Finally, something that is not directly related to the topic of ;; this page, but fits here as well as anywhere: you can use `C-x ;; C-f' in the minibuffer to resolve a file name to its true, ;; absolute name. Yes, that's the same key that is bound at top ;; level to `icicle-file' or `find-file' or whatever, but this is ;; about its use when you are already in the minibuffer. ;; ;; `C-x C-f' (`icicle-resolve-file-name'), replaces a file name at or ;; near point (in the minibuffer) with its true, absolute name. (For ;; it to work near but not precisely at point, you need library ;; `thingatpt+.el'.) If the file name is relative, it first converts ;; it to absolute (using the default directory). It then converts an ;; absolute name that is a symbolic link to its target name. You can ;; use this anytime in the minibuffer, and you can use it on multiple ;; parts of the same minibuffer input (e.g. shell command arguments). ;; (This feature does not work for Emacs 20 or 21.) ;; ;; See Also: ;; ;; * (@> "Inserting a Regexp from a Variable or Register") for ;; information on inserting text saved in a variable or register. ;; ;; * (@> "Moving Between the Minibuffer and Other Buffers") for ;; another way to insert buffer text in the minibuffer. ;; ;; * (@> "Multi-Inputs") for ways to act on multiple minibuffer ;; insertions all at once. ;;(@* "Background on Vanilla Emacs Input Completion") ;; ;; Background on Vanilla Emacs Input Completion ;; -------------------------------------------- ;; ;; This section reviews standard Emacs behavior regarding input ;; completion. It does not describe any Icicles completion features. ;; See also (@> "README"). ;; ;; When you are prompted in the minibuffer to enter something, you ;; are sometimes presented with a default value. This might be ;; automatically inserted after the prompt, initially. If not, you ;; can retrieve the default value yourself, using `M-n' (Emacs 21 or ;; later). ;; ;; Often, there is more than one reasonable default value that might ;; make sense. Depending on what you're being asked to enter, these ;; "candidate default values" might be command names, buffer names, ;; existing file names, variable names, and so on. ;; ;; For most Emacs functions that prompt you for input, the person who ;; wrote the function decided on the reasonable set of default ;; values, and passed these to an "input-completing function" such as ;; `completing-read' or `read-file-name', which prompts you and reads ;; your input. The programmer also decided whether you will be ;; *required* to pick one of the default values or you will be free ;; to enter something else. The programmer might also have told the ;; input-completing function to require that your input pass some ;; special test (predicate). ;; ;; Be aware that standard Emacs terminology does not refer to such a ;; set of default values as "default values"; they are called ;; "completions". By "default value", standard Emacs terminology ;; means only the values that you can access via `M-n'. Icicles ;; refers to all such potential inputs indifferently as "default ;; values", "completions", "completion candidates", and "candidates". ;; Whenever completion is not requiring you to pick one of the ;; available candidates, they are effectively only default choices. ;; ;; So, how do you get access to the default values that the ;; programmer has made available to you, in order to choose one? You ;; hit certain keys to complete the current contents of the ;; minibuffer (excluding the prompt). This current, partial input is ;; considered as a prefix of one of the default values, and it is ;; completed in the minibuffer to the entire default value ;; (completion). ;; ;; Keys `TAB', `RET' (Return), and `SPC' (Space) perform different ;; degrees of this "prefix completion" in standard Emacs. If you ;; type a prefix of one of the available default values, you can ;; complete the value this way in the minibuffer, and then enter ;; (commit) it, using `RET'. ;; ;; But if your partial input matches the prefix of more than one ;; default value, then completion pops up the list of all matching ;; completions for you to choose from (in buffer `*Completions*'). ;; You choose a candidate by clicking it with `mouse-2' or placing ;; the cursor on it and hitting `RET'. ;; ;; Because this is the way you access the default values supplied to ;; an input-completing function, I call those values ;; "prefix-completion candidates". If there is no partial input yet ;; (empty minibuffer), then the entire list of default values ;; supplied to the input-completing function appears in the pop-up ;; `*Completions*' buffer. See the Emacs manual (`C-h i') for more ;; on this general mechanism of prefix completion (called simply ;; "completion" there). ;; ;; Calls to `completing-read' and `read-file-name' are not the only ;; places where input completion is used. When you use `M-x' ;; (command `execute-extended-command'), completion is also ;; available. ;;(@* "Cycling Completions") ;; ;; Cycling Completions ;; ------------------- ;; ;; Icicles lets you use the `end' and `home' keys to cycle through ;; the list of candidate prefix completions that match whatever input ;; is present in the minibuffer (or all candidate completions, if ;; there is no input in the minibuffer). In the minibuffer, each ;; candidate replaces your partial input, in turn, when you cycle. ;; The prefix (root) that was completed is underlined in the ;; minibuffer completion candidate. ;; ;; As an alternative to using `end' to cycle forward, you can hit ;; `TAB' repeatedly. See (@> "Prefix Completion and Apropos Completion"). ;; ;; Suppose you use `C-x b' (command `switch-to-buffer'). You can ;; then use `end' until the right buffer name appears in the ;; minibuffer, then hit `RET'. Or you can type some text that begins ;; one or more of the buffer names, and then use `end' to cycle among ;; those names that match that prefix. If there are many candidates, ;; typing part of the name to narrow the field can save time. ;; ;; Another example: Suppose you use `C-h v' (`describe-variable') and ;; type `cal'. Use `end' to cycle among all variables that start ;; with `cal', until you find the one you want (then hit `RET'). ;; ;; In other words, the current partial input in the minibuffer ;; determines a matching set of default values, and those are the ;; values that you can cycle through. You can at any time erase or ;; change the partial input - the list of matching candidates ;; automatically reflects the change. ;; ;; This also means that it's good to have a quick way to clear the ;; minibuffer of any input, so Icicles also provides minibuffer key ;; binding `M-k' to do that. ;; ;; A visible and audible signal lets you know when you have reached ;; one end of the list of completion candidates, but you can of ;; course continue to cycle, wrapping around. ;; ;; If the completion candidates are already displayed in buffer ;; `*Completions*' when you try to cycle among them (because you hit ;; `TAB'), then the current candidate is highlighted in ;; `*Completions*' as you access it in the minibuffer with the `home' ;; and `end' keys. If you change the minibuffer input, then the ;; `*Completions*' list is updated accordingly, to reflect the new ;; set of matching candidates. The root that was completed (the ;; minibuffer input) is highlighted in each candidate of the ;; `*Completions*' display. The `*Completions*' window is ;; automatically scrolled as needed, to show the current candidate. ;; ;; A numeric prefix argument N means cycle forward or backward N ;; candidates (default = 1). A plain prefix argument (`C-u') means ;; use the first candidate directly, instead of cycling forward or ;; backward. ;; ;; Do not become a cycling drone! Input some text to narrow the set ;; of candidates, before cycling among them to choose one. This is a ;; good habit to adopt, generally, in Icicles. Most of the power of ;; Icicles comes in your ability to filter a set of candidates. This ;; is especially true when it comes to regexp filtering (see ;; (@> "Apropos Completions")). ;; ;; Cycling and filtering work hand in hand. If the set of candidates ;; is small to begin with, then just cycling might be quick enough - ;; that is the case if you move among a small set of buffers, for ;; instance. But with Icicles you can profitably use cycling on even ;; a very large set of candidates - by filtering the set first. The ;; reason this is not very practical with vanilla Emacs is that ;; filtering by a prefix only is not very potent. ;; ;; Tip: Whenever you type or delete text in the minibuffer, your ;; partial input is remembered. When you cycle completion ;; candidates, your input is replaced by each candidate, but you can ;; at any time refresh the minibuffer to retrieve what you last ;; typed. You do this with `C-l', which is bound in the minibuffer ;; to command `icicle-retrieve-previous-input'. Editing a completion ;; candidate that you have cycled into the minibuffer counts as ;; input. Editing tells Icicles to remember what is in the ;; minibuffer as your last real input. If you want to replace the ;; candidate and go back to editing the input you had already typed ;; before cycling, then use `C-l' - do not just delete characters ;; from the candidate. See (@> "History Enhancements"). ;; ;; You can change the keys that are bound to completion-candidate ;; cycling. And you can change whether `down' and `up' start off by ;; cycling prefix completions or apropos completions. ;; See (@file :file-name "icicles-doc2.el" :to "Customizing Key Bindings"). ;; ;; Finally, you can use the mouse wheel (Emacs 22 or later) to cycle ;; candidates according to the current completion mode (prefix or ;; apropos). See (@> "Prefix Completion and Apropos Completion"). ;; ;; Mouse-wheel cycling works also with modifier keys: `C-M-' for ;; candidate help, `C-' for candidate actions, and `C-S-' for ;; alternative candidate actions. In particular, `C-' with the wheel ;; gives you a very quick way to visit search hits during Icicles ;; search (and `C-S-' works for search-and-replace). ;; (See (@> "Icicles Search Commands, Overview").) ;; ;; If you are an Emacs-Lisp programmer, then you can use ;; `completing-read' and `read-file-name' to define your own ;; commands, enabling them to take advantage of Icicles completion ;; and cycling. The definition of command `icicle-recent-file' is a ;; good model to follow. Emacs has a `recentf-mode' that lets you ;; open recently accessed files. But this mode makes you open a file ;; using a menu interface. Command `icicle-recent-file' lets you use ;; the usual `find-file' minibuffer interface, with completion and ;; cycling among your recent files. See sections ;; (@> "Defining Icicles Commands") and ;; (@file :file-name "icicles-doc2.el" :to "Note to Programmers") ;; for more on defining your own commands with `completing-read' and ;; `read-file-name'. ;;(@* "Traversing Minibuffer Histories") ;; ;; Traversing Minibuffer Histories ;; ------------------------------- ;; ;; Perhaps you are already used to accessing past inputs with vanilla ;; Emacs using the `down' and `up' arrow keys (or `M-n', `M-p', and ;; `next'). If not, try it (not in Icicle mode). You can go ;; backward and forward in the minibuffer histories (there are ;; different history lists for different kinds of input). You cannot ;; really cycle them (with wraparound), but when you get to one end ;; you can reverse the direction. ;; ;; Anyway, the input-cycling behavior that Icicles offers is in ;; addition to this standard traversal of histories. Since there ;; are, by default, several extra pairs of keys used for history ;; traversal, rebinding some of them to use for Icicles completion is ;; no real loss. ;; ;; By default, Icicles rebinds the arrow keys `down' and `up' for ;; current-mode completion cycling. Icicles also rebinds `end' and ;; `home' for prefix-completion cycling, and `next' and `prior' for ;; apropos-completion cycling. But you still have `M-n' and `M-p' ;; available to access past inputs (history). And the rebindings are ;; only for minibuffer input; global bindings are not affected. ;; ;; You can at any time switch back and forth between input-history ;; traversal (`M-n', `M-p') and completion cycling (`down', `up', ;; `next', `prior', `end', `home'). ;; ;; See Also: ;; ;; * (@> "History Enhancements") for new ways to use Emacs history ;; lists with Icicles ;; ;; * (@file :file-name "icicles-doc2.el" :to "Customizing Key Bindings") ;; for how to change the default Icicles key bindings, including ;; the keys used for candidate cycling ;;(@* "Apropos Completions") ;; ;; Apropos Completions ;; ------------------- ;; ;; Icicles offers a new way to complete your partial input in the ;; minibuffer. Instead of considering the string of input characters ;; to be the prefix of various complete names, you can look for names ;; that match that string anywhere. ;; ;; This is the single most important feature that Icicles offers. ;; ;; This is similar in effect to using command `apropos' to find ;; "apropos completions" of a string (except it works also for file ;; and buffer names), so that's the term I use for this: apropos ;; completion. The more correct characterization of this is that of ;; the previous paragraph, however: names that match the given ;; string. ;; ;; Just as with prefix completion, Icicles lets you cycle among the ;; apropos candidates. To do this, you use keys `next' and `prior'. ;; The root that was completed is underlined in the minibuffer ;; completion candidate. ;; ;; For example, suppose you use `M-x' to enter a command. You do not ;; remember the exact command name, but it has something to do with ;; lines, so you type `M-x line', then hit `next' repeatedly, until ;; you see the right "line" command - `transpose-lines', perhaps. ;; Prefix completion cannot find this command, because "line" is not ;; a prefix of "transpose-lines". ;; ;; Because `M-x' expects a command name, only command names are ;; inserted into the minibuffer as the apropos-completion candidates ;; for `M-x'. Likewise, in other contexts, where names of other ;; kinds of object are expected, apropos completion inserts only ;; names of objects of the appropriate type. Prefix completion works ;; the same way. ;; ;; For example, using `next' and `prior' with `C-x b at' lets you ;; cycle through all buffers (such as `*scratch*') that have "at" in ;; their name - only buffer names appear as candidates. ;; ;; As an alternative to using `next' to cycle forward, you can hit ;; `S-TAB' (`S-tab') repeatedly. Similarly, for prefix completion ;; you can repeat `TAB' to cycle forward. See ;; (@> "Prefix Completion and Apropos Completion"). ;; ;; Apropos completion uses a regular expression (regexp) as its input ;; string. You can type `M-x \bes', for instance, to find commands ;; with "es" at the start of a word within the command name (`\b' ;; matches the start of a word). It will find `eshell-test' and ;; `color-theme-blue-eshell', but not `count-lines' - "es" does not ;; start a word in `count-lines'. Similarly, for file names, buffer ;; names, and so on. ;; ;; Prefix completion is actually a special case of apropos ;; completion, where the regexp starts with "^". (That is not how it ;; is implemented, however.) ;; ;; What if you want to see the list of all completion candidates that ;; match the minibuffer input? Instead of cycling candidates ;; blindly, just hit `S-TAB' (Shift TAB) at any time to display the ;; matching candidates in pop-up buffer `*Completions*'. This is ;; analogous to `TAB' for prefix completion. ;; ;; (The documentation always refers to the key that performs apropos ;; completion as `S-TAB'. Actually, it is `S-TAB' only by default. ;; You can customize it, using option ;; `icicle-apropos-complete-keys'.) ;; ;; Everything said in section (@> "Cycling Completions") about the ;; `*Completions*' buffer for prefix completion is also true for ;; apropos completion. It is updated to reflect the current set of ;; matching candidates, and the current completion is highlighted. ;; The root that was completed is highlighted within each candidate ;; (first occurrence only). Root highlighting is more important in ;; the case of apropos completion, because the match position is ;; different in different candidates. In the case of apropos ;; completion, the root is not the input string, taken literally, but ;; the part of a candidate that the input matches. See ;; (@> "*Completions* Display") for additional ways to use the ;; minibuffer with `*Completions*'. ;; ;; Regexp matching is one of the most powerful features of Icicles. ;; Enjoy! Explore! You can at any time switch back and forth ;; between prefix completion (`end', `home'), apropos completion ;; (`next', `prior'), and input history traversal (`M-n', `M-p'). ;;(@* "Expanded-Common-Match Completion") ;; ;; Expanded-Common-Match Completion ;; -------------------------------- ;; ;; Apropos (regexp) matching and prefix completion each match a ;; pattern against a completion candidate. This operation concerns ;; only a single candidate; it does not take into account the fact ;; that there are others. Since the matching operation is repeated ;; anyway for each candidate, however, we can also find an expanded ;; string that includes the same match (apropos or prefix) for all ;; candidates. ;; ;; For prefix completion, Emacs completes your input to the longest ;; common prefix match. Icicles uses a similar notion for apropos ;; completion. ;; ;; For example, if you enter `M-x minib' and hit `TAB', Emacs ;; completes your input to `minibuffer', which is the longest prefix ;; match for `minib' among all command names. The actual string that ;; matches prefix `minib' among all candidates is, itself, `minib'. ;; ;; If you hit `S-TAB', then each matching candidate contains a ;; substring that matches your regexp input `minib'. In this case, ;; that substring is `minib', just as in the prefix-matching case. ;; And, as in the prefix case, each matching candidate also includes ;; a longer substring, `minibuffer', which includes what your input ;; matches for each candidate. ;; ;; Icicles replaces your regexp input in the minibuffer by a common ;; substring. Icicles highlights this expanded common match in ;; buffer `*Completions*' using face ;; `icicle-common-match-highlight-Completions' (magenta foreground, ;; by default). What your input matches directly is highlighted in ;; `*Completions*' using face `icicle-match-highlight-Completions' ;; (red foreground, by default). ;; ;; It is of course possible that a given regexp matches different ;; candidates differently, so that there is no common match. In that ;; case, only the individual matches are highlighted in ;; `*Completions*' - you will see only red, no magenta, highlighting. ;; For example, if your regexp input is `min.*buf' then various ;; different substrings (such as `minibuf' from `minibuffer-complete' ;; and `mint-truncate-buf' from `comint-truncate-buffer') are ;; highlighted in red, but these share no common substring. ;; ;; You will also see only red highlighting if what your input matches ;; directly is the same as the expanded common match. For example, ;; if a function `moccur-regexp-read-from-minibuf' is defined (it is ;; in library `color-moccur.el'), and your input to `C-h f' is ;; `min[^-]*buf', then only `minibuf' is highlighted in red. ;; ;; Expanded-common-match completion is convenient, but when ;; apropos-completing you often need to try variants of a regexp, ;; editing it and observing which candidates match in ;; `*Completions*', until you get the regexp right. ;; Expanded-common-match completion has the disadvantage that you ;; lose your regexp as input, which makes it hard to edit it! ;; ;; To retrieve it, use `C-l' (`icicle-retrieve-previous-input') ;; during completion. You can repeat `C-l' to retrieve older ;; completion inputs, cycling among them, and you can use `C-S-l' ;; (that is, `C-L') to cycle previous inputs in the other direction - ;; see (@> "History Enhancements"). You can use option ;; `icicle-expand-input-to-common-match' to turn off ;; expanded-common-match completion altogether, if you prefer. You ;; can cycle the value of this option from the minibuffer at any ;; time, using `C-M-"'. ;; ;; Just what is meant by the "expanded common match" that Icicles ;; finds? It is the longest match of your input pattern that is ;; common to all candidates and also contains the first input match ;; in the first or second candidate, whichever is longer. ;; ;; For apropos completion, this is not always the longest common ;; match of your input, but in most cases it is, and it is quicker to ;; compute. In general, the longest common match does not ;; necessarily contain the first match of your input with either the ;; first candidate or the second candidate. It might contain a ;; different input match from the first in both the first and second ;; candidates. ;; ;; For example, with input `a' and candidates `abacb', `abbac', and ;; `bacba' (in that order), `bac' is the longest common match. But ;; `a' is the longest common match that contains the first match in ;; the first candidate. It is the second match of `a' against ;; `abacb' that yields `bac'. Likewise for the second candidate: it ;; is the second match of `a' against `abbac' that yields `bac'. ;; ;; So in this case Icicles will use `a' as the expanded input and ;; miss the longest common match. If the candidate order is ;; different, so that `bacba' is either the first or the second ;; candidate, then Icicles finds the longest common match, because ;; the first match of `a' against `bacba' yields `bac'. ;; ;; The reason that Icicles common-match expansion typically finds the ;; longest common match is that your input typically matches the ;; first or the second candidate in only one place. And the longer ;; the input you type, the more likely this is. In practice, it is ;; only with very short input such as `a' that Icicles expansion ;; sometimes misses the longest common match. Icicles independently ;; tries two candidates (first and second) as its starting point, to ;; increase the probability of finding the longest common match. ;; ;; It is also technically incorrect to speak of "the" longest common ;; match: in general, there can be more than one. For example, if ;; the input is `a' and the candidates are `abab', `abba', and ;; `baba', then both `ab' and `ba' are longest common substrings. ;; Again, however, for typical input and typical candidates there is ;; a single longest common match, and Icicles finds it. ;; ;; Note that Icicles expanded common match is not just a common ;; substring among all of the candidates that are matched by your ;; input pattern. It is a substring common to all candidates matched ;; by your input, but a substring that also matches your input. For ;; example, with apropos completion input `a.z' and candidates `abz' ;; and `apz', there is no expanded common match. The substring `a' ;; is common to both candidates, but it is not matched by the ;; (complete) input pattern. ;; ;; Finally, note that in Emacs 20 no common match is found if your ;; input or any of the candidates contains binary data. This is ;; because function `string-match' cannot handle strings with binary ;; data in Emacs 20. ;;(@* "Progressive Completion") ;; ;; Progressive Completion ;; ---------------------- ;; ;; Perhaps the best way to explain this feature is to use a familiar ;; analogy. Unix or GNU/Linux command `grep' takes a ;; regular-expression argument, and matches it against lines in ;; files. A common idiom that people use is to chain, or cascade, ;; multiple calls to `grep', using the output of one as the input to ;; the next. For example: ;; ;; grep plant *.txt | grep food | grep mineral ;; ;; The output of the search for "plant" is used as the input for the ;; search for "food", and the output of that search serves as the ;; input for the search for "mineral". The order of the three ;; component searches can make a difference in terms of performance, ;; but not in terms of the result, which is always the set of lines ;; in files *.txt that match "plant" AND "food" AND "mineral", in any ;; order. Each of the `grep' operations defines a set of matches, ;; and the chain of `grep' operations effects the intersection of ;; those sets. ;; ;; Of course, you could try to accomplish the same thing with a ;; single call to `grep' using a complex regexp. But why would you? ;; ;; Moreover, it is in fact impossible to express such an unordered ;; set intersection using a single regexp. On their own, regular ;; expressions cannot express set intersection (conjunction) or ;; complementing (negation). (However, most `grep' programs provide ;; a way to obtain the lines that do not match a regexp.) ;; ;; The same idea of combining multiple regexp matches is behind the ;; Icicles feature of progressive completion: instead of trying to ;; come up with a single complex regexp that does what you want, try ;; getting there a step at a time: ;; ;; 1. Match an input regexp against the set of all possible ;; completions. ;; ;; 2. Narrow the set of matched candidates by matching them against ;; another input regexp (or by filtering them with a predicate). ;; ;; 3. Narrow those results down by matching them against a third ;; input regexp (or by filtering them with another predicate). ;; ;; 4... And so on. ;; ;;(@* "`M-*' and `S-SPC': Matching Additional Regexps") ;; ** `M-*' and `S-SPC': Matching Additional Regexps ** ;; ;; During completion, `M-*' is bound in the minibuffer to command ;; `icicle-narrow-candidates', which prompts for a new regexp and ;; matches it against the current set of completion candidates. ;; ;; As is often the case in Icicles, you can think of the `*' in `M-*' ;; as mnemonic for Boolean multiplication, that is, AND, or set ;; intersection. (It is more common and handier to use `S-SPC' than ;; `M-*' - see (@> "Successive Approximation...").) ;; ;; For example, suppose that you want to know about an Emacs function ;; that deletes the character to the left of point (that is, ;; backward). You do not recall if it is `delete-character-back', ;; `delete-backward-char', `character-delete-backward', or whatever. ;; You take a guess that the name contains `delete', `char', and ;; `back'. ;; ;; 1. `C-h f char S-TAB' displays function names that contain ;; `char'. ;; ;; 2. `M-* delete' narrows that set of function names to those that ;; also contain `delete'. ;; ;; 3. `M-* back' narrows the set of matching names further, to those ;; that also contain `back'. ;; ;; This displays a list of functions like this in `*Completions*' ;; (your list might be somewhat different): ;; ;; backward-delete-char backward-delete-char-untabify ;; delete-backward-char icicle-backward-delete-char-untabify ;; icicle-delete-backward-char ;; quail-conversion-backward-delete-char ;; ;; Then, of course, you can pick one (or you can use `C-M-next' ;; repeatedly to view the doc of each of these functions in turn - ;; see (@> "Get Help on Completion Candidates")). ;; ;; You get the idea. This feature is both very simple to use and ;; very useful. It's easy to appreciate using multiple simple ;; matching steps (regexp or not) instead of a single regexp. Try it ;; once, and you'll be hooked. ;; ;;(@* "Successive Approximation...") ;; ** Successive Approximation... ** ;; ;; You can use as many invocations of `M-*' (and of `M-&', described ;; in the next section) as you like, in any order. It works with ;; both prefix completion and apropos completion. ;; ;; You can, for instance, first use `TAB' to require the target to ;; start with some string, and then use `M-*' to specify other ;; patterns that parts of it must also match. However, it of course ;; makes no sense to use `TAB' instead of `S-TAB' after you use ;; `M-*': once you've said that the target must start with "fo" there ;; is no sense saying that it also starts with "ti"! ;; ;; As a shortcut, instead of using `S-TAB' followed by `M-*', you can ;; use `S-SPC' (command `icicle-apropos-complete-and-narrow') to do ;; the same thing. You can thus use only `S-SPC', any number of ;; times, to choose a candidate by narrowing down the matches. ;; ;; I call this process of completion by successive approximation, or ;; progressively narrowing the candidate set, "progressive ;; completion". If the name "incremental completion" (= icompletion) ;; were not already taken to mean incremental completion *help* ;; (which performs no completion), then that might be a good name for ;; this. This might also be called "stepped", "cascaded", or ;; "piecewise" completion. ;; ;; Another possible name for it would be "multiple completion", but I ;; use that to stand for simultaneous (parallel) completion of ;; multiple parts of a compound target, which is something different ;; (see (@> "Multi-Completions")). ;; Progressive completion is a set of mini-completions that are wired ;; in series, not in parallel. ;; ;; Note that when you use `M-*' or `S-SPC' in the minibuffer, it ;; calls `completing-read' or `read-file-name', which creates a ;; recursive minibuffer. That is, the minibuffer depth is increased. ;; (This is not the case for `M-&', however.) In vanilla Emacs, ;; there is no indicator of the current minibuffer depth, and this ;; can sometimes be disorienting. Each time you use `M-*' or `S-SPC' ;; you push down one level of minibuffer recursion (that is, ;; minibuffer depth is incremented). Each time you use, say, `C-g', ;; you pop up one level of minibuffer recursion (that is, minibuffer ;; depth is decremented). ;; ;; If you use library `mb-depth.el', which is included with Emacs 23 ;; and which also works with Emacs 22, Icicle mode takes advantage of ;; this library by indicating the current depth in the minibuffer. I ;; recommend you also use my library `mb-depth+.el', which lets you ;; customize the form and face of the depth indicator. ;; ;; If you use my library `oneonone.el', then you get visual feedback ;; on the current minibuffer depth. One-On-One Emacs gives you a ;; standalone minibuffer frame, and it changes the background hue ;; (color) of that frame slightly with each change in minibuffer ;; depth. This is especially helpful with Icicles, where use of ;; `M-*' or `S-SPC' is common. ;; ;; There is a slight difference in behavior between Icicles commands ;; and some other Emacs commands when you accept input after `M-*' or ;; `SPC'. When possible, Icicles accepts your input and passes it ;; immediately to the top level, bypassing any intermediate recursive ;; minibuffer levels that are waiting for input. However, Emacs ;; commands that are defined with literal-string `interactive' specs, ;; such as (interactive "fFile: "), do not use `completing-read' or ;; `read-file-name', so there is no way for Icicles to take this ;; shortcut with them. In that case, you will simply need to hit ;; `RET' again to accept your input at each recursive minibuffer ;; level, until you get back to the top level. Sorry for this ;; inconvenience! If you are an Emacs-Lisp programmer, note that ;; this is one reason to use `completing-read' and `read-file-name' ;; when you write commands that use completion. ;; ;; Note: If you use progressive completion with file names in Emacs ;; 20 or 21, `M-*' or `S-SPC' calls `completing-read', not ;; `read-file-name'. This is because `read-file-name' does not ;; accept a PREDICATE argument before Emacs 22. The effect is that ;; instead of there being a default directory for completion, the ;; current directory at the time you hit `M-*' or `S-SPC' is tacked ;; onto each file name, to become part of the completion candidates ;; themselves. Yes, this is a hack. It works, but be aware of the ;; behavior. ;; ;; Progressive completion lets you match multiple regexps, some of ;; which could of course be literal substrings, with their regexp ;; special characters, if any, escaped. If you need to match such ;; substrings at particular locations in the target completion ;; candidate, then progressive completion will not do the job - it ;; matches its component regexps independently. You can regexp-quote ;; (escape) parts or all of your input using `M-%' ;; (`icicle-regexp-quote-input'). ;; See (@> "Quoting (Escaping) Special Characters") ;; ;;(@* "`M-&': Satisfying Additional Predicates") ;; ** `M-&': Satisfying Additional Predicates ** ;; ;; If you use Icicles, then you will use `M-*' or `S-SPC' very often. ;; This section describes a seldom-used feature that can be useful in ;; certain contexts. If you are new to Icicles or you are unfamiliar ;; with Emacs Lisp, then you might want to just skim this section or ;; skip it and come back to it later. ;; ;; Just as you can use `M-*' or `S-SPC' to narrow the set of ;; candidates by matching an additional regexp, so you can use `M-&' ;; (bound to `icicle-narrow-candidates-with-predicate') to narrow by ;; satisfying an additional predicate. The idea is the same; the ;; only difference is that, instead of typing a regexp to match, you ;; type a predicate to satisfy. ;; ;; The predicate is a Boolean function of a single completion ;; candidate. At the prompt, you enter its name or its ;; lambda-expression definition (anonymous function). The predicate ;; is used the same way as the PREDICATE argument to ;; `completing-read' and `read-file-name'. This means that the ;; candidate argument to the predicate is whatever is used in the ;; original call to `completing-read' or `read-file-name'; it is not ;; just a string such as you see in buffer `*Completions*'. To ;; provide an appropriate predicate, you must be familiar with the ;; kind of candidate expected by the command you invoked before just ;; before `M-&'. ;; ;; For example: ;; ;; * Command `describe-function' (`C-h f') uses candidates that are ;; symbols. An appropriate predicate would accept a symbol as ;; argument. ;; ;; * Command `icicle-search' (`C-c `') uses candidates that have this ;; form: (CONTEXT . MARKER), where CONTEXT is a string, the search ;; hit (search context), and MARKER is a buffer marker that locates ;; the CONTEXT. An appropriate predicate would accept such a ;; candidate as argument. ;; ;; Although entering a lambda expression at a prompt might not seem ;; too convenient, you can at least retrieve previously entered ;; predicates (using `M-p' and so on). ;; ;; You can also use `C-M-&' (bound to ;; `icicle-save-predicate-to-variable') at any time during completion ;; to save the current predicate as a string-valued variable. By ;; default, the variable is `icicle-input-string'. You can then ;; retrieve the saved string later, using `C-=' at the prompt for ;; `M-&'. The current predicate is what is saved. You can build up ;; a complex predicate, and then save it for later use. ;; ;; The inconvenience of typing an Emacs-Lisp sexp must be balanced ;; against the power of applying predicates on the fly. Whereas ;; regexp matching is purely syntactic, with a predicate you can ;; perform semantic tests. During search, for instance, you can look ;; not only for a syntax match; you can look for matching search ;; candidates that also belong to a particular class of objects ;; (e.g. function, variable, type) or that satisfy some other ;; semantic property. ;; See also (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview"). ;; ;; See Also: ;; ;; * (@> "Sets of Completion Candidates") for another way to perform ;; a set intersection on sets of candidate completions. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; for a way to search using two regexps - command `icicle-search' ;; uses the same idea as that behind progressive completion. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Compile/Grep Search") ;; for a way to grep files using multiple levels of regexps, and ;; performing selected replacements. ;;(@* "Regressive Completion") ;; ;; Regressive Completion ;; --------------------- ;; ;; Though generally less useful than progressive completion, you can ;; also widen, instead of narrow, the current set of completion ;; candidates, by providing an alternative pattern (regexp) to match. ;; By analogy, I call this "regressive completion". ;; ;; The analogy is not exact. By definition, your current input is ;; always matched against all candidates in the domain of discourse. ;; With progressive completion, a recursive minibuffer is entered for ;; each new pattern to match. The candidates that matched the ;; previous input of the progression become the new domain of ;; discourse for the current act (recursive level) of completion. ;; ;; That same technique is not applicable for widening. Instead, you ;; enter, using `RET', a new pattern to match as an alternative, and ;; Icicles changes the current input to a regexp that matches either ;; what the previous input matched or the alternative pattern. In ;; other words, it is just a short cut for typing a regexp that ;; matches a choice: \(...\|...\). The domain of discourse remains ;; the same - in particular, there is no way to widen the domain of ;; discourse like narrowing narrows it. ;; ;; You use `M-+' (`icicle-widen-candidates') for regressive ;; completion - think of the `+' as set union (OR), just as you think ;; of the `*' in `M-*' as set intersection (AND). And, just as for ;; progressive completion, there is a shortcut, `S-backspace', for ;; `S-TAB' followed by `M-+'. ;; ;; For example, if you want to see all of the candidates that contain ;; either `for' or `back', you could type `\(for\|back\)' in the ;; minibuffer, or you could just type `for', then `S-backspace' (or ;; `S-TAB' followed by `M-+'), then `back'. Icicles replaces your ;; input by `\(for\|back\)'. You can continue with additional ;; alternative match patterns. And you can combine narrowing with ;; widening, that is, progressive with regressive completion. ;; ;; You can of course cycle among all matching candidates, regardless ;; of which alternative they match. One use of regressive completion ;; is with Icicles search - it corresponds to the OR searching of ;; common search engines. ;; ;; Gotcha: When completing file names that are not absolute ;; (e.g. using `C-x C-f', not `C-u C-x C-f'), be sure that the ;; default directory is not included in your minibuffer input when ;; you hit `M-+'. You do not want the overall regexp that `M-+' ;; constructs to be something like \(/my/default/dir/foo\|bar\) - you ;; want it to be just \(foo\|bar\). For absolute file name ;; completion there is no such problem, because the completion ;; candidates themselves have a directory component. So either use a ;; `nil' value of `insert-default-directory' or use `M-k' to remove ;; the directory component before hitting `M-+'. ;;(@* "Completion On Demand") ;; ;; Completion On Demand ;; -------------------- ;; ;; When the minibuffer is active for your input, completion is not ;; always available. Functions such as `completing-read' and ;; `read-file-name' provide completion, but other functions that read ;; input in the minibuffer, such as `read-from-minibuffer' and ;; `read-string', do not provide completion. ;; (See (@> "Completion Status Indicators"), for how to tell when ;; completion is available in Icicles.) ;; ;; But in Icicles you can always invoke (lax) completion to insert ;; some completed text in the minibuffer - this is completion on ;; demand. ;; ;; On-demand completion is always available to insert a file name. ;; You invoke this using `C-M-F', that is, `C-M-S-f' ;; (`icicle-read+insert-file-name'). A recursive minibuffer is used ;; to perform the completion. The result of completing is inserted ;; at point in the parent minibuffer, without replacing any other ;; text that might already be there. ;; ;; You can use this feature to add multiple file or directory names ;; to the same minibuffer input. In this way, for instance, you can ;; use it to add particular file or directory names as arguments to a ;; shell command that you input in the minibuffer. By default, a ;; relative name is inserted, but if you use a prefix argument then ;; the directory component is included. ;; ;; Similarly, you can use `C-M-C', that is, `C-M-S-c' ;; (`icicle-completing-read+insert'), to invoke non file-name ;; completion. This, however, is available only if the command ;; reading from the minibuffer allows it, by defining a set of ;; possible completions. ;; ;; The actual keys used for on-demand completion are customizable, ;; using options `icicle-read+insert-file-name-keys' and ;; `icicle-completing-read+insert-keys'. The default values are ;; `C-M-S-f' and `C-M-S-c'. ;; ;; Another kind of on-demand completion is provided by minibuffer ;; multi-command `icicle-insert-history-element' (`M-o'). This is ;; always available in the minibuffer, regardless of whether input is ;; being read with completion. It lets you use completion to insert ;; any number of entries from the current minibuffer history into the ;; minibuffer at point. See (@> "History Enhancements"). ;;(@* "Moving Between the Minibuffer and Other Buffers") ;; ;; Moving Between the Minibuffer and Other Buffers ;; ----------------------------------------------- ;; ;; Sometimes, when the minibuffer is active, you might want to move ;; the cursor and focus from the minibuffer back to the original ;; buffer from which you activated the minibuffer. When you are in ;; Icicle mode, the `pause' key is bound (by default) to command ;; `icicle-switch-to/from-minibuffer', which does that. This lets ;; you start minibuffer input (with or without completion), and then ;; interrupt it to search, edit, and so on, in the original buffer. ;; This same command (bound to `pause') then lets you switch back to ;; the minibuffer - it acts as a toggle for the input focus; go back ;; and forth as much as you like. ;; ;; This can be especially useful when you use multi-commands (see ;; (@> "Multi-Commands")). In that case, you often keep the ;; minibuffer active for completion while performing multiple ;; completion actions. It can be handy to interrupt this to perform ;; some normal editing or search, and then resume multi-command ;; actions. ;; ;; Another use for this feature is to select text in the original ;; buffer and then insert it in the minibuffer. See also ;; (@> "Inserting Text Found Near the Cursor") for another way to do ;; that. ;; ;; A somewhat related toggle is available using `C-insert'. This ;; lets you switch the focus between the minibuffer and buffer ;; `*Completions*'. See (@> "*Completions* Display") for more ;; information. ;;(@* "Inserting a Regexp from a Variable or Register") ;; ;; Inserting a Regexp from a Variable or Register ;; ---------------------------------------------- ;; ;; Regexps are powerful, but they can sometimes be complex to compose ;; and hard to remember once composed. A shortcut is to compose a ;; regexp that you want to use and assign it to an Emacs variable or ;; register. ;; ;; If you assign it to a register (using `C-x r s'), then you can use ;; `C-x r i' (`insert-register') in the minibuffer to insert it. If ;; you assign it to a string, then you can use `C-=' ;; (`icicle-insert-string-from-variable') to insert it. ;; ;; If you use `C-u C-=' (provide a prefix argument) then you are ;; prompted for the variable to use. Completion candidates for this ;; include all string-valued variables. ;; ;; Without `C-u', the default variable is used (no prompting), ;; `icicle-input-string'. So for example, if `icicle-input-string' ;; had value "[a-zA-Z]+" then it would match any completion candidate ;; composed only of letters. You can customize ;; `icicle-input-string'. ;; ;; For convenience, instead of using Lisp evaluation of a sexp such ;; as (setq icicle-input-string "[a-zA-Z]+") or (setq my-var ".*"), ;; you can use Icicles command `icicle-save-string-to-variable' to ;; save a regexp to a variable. You are prompted for the regexp to ;; save. Just as for `icicle-insert-string-from-variable', with a ;; prefix argument you are prompted for the variable to use (all ;; variables are completion candidates). With no prefix argument the ;; regexp is saved to variable `icicle-input-string'. ;; ;; Another way of inserting a string into the minibuffer is to use a ;; negative prefix arg with `M-:' (e.g. `M-- M-:') during minibuffer ;; input. With this method, you can type not only a string-valued ;; variable name but any Emacs-Lisp expression. The expression need ;; not evaluate to a string - whatever the result of evaluation is, ;; it is pretty-printed in the minibuffer, to be used as part of your ;; input text. ;; ;; These shortcut features are especially convenient for use with ;; command `icicle-search' - you can use it to search text for ;; sentences, paragraphs, file names, URLs, dates, times, function ;; definitions, and any other text entities that you can specify by ;; regexp. Create a library of regexp-valued variables that are ;; useful to you, and use `C-=' to quickly access them in ;; `icicle-search'. See ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; for more information. ;; ;; These shortcuts are also handy for Isearch, in particular, regexp ;; search. Use `M-e' after `C-M-s', to edit the search string (which ;; puts you in a minibuffer), then use `C-u C-=' or `C-x r i' to ;; insert a saved regexp. ;; ;; See Also: ;; ;; * (@> "Inserting Text Found Near the Cursor") ;; * (@> "Multi-Inputs") for ways to act on multiple minibuffer ;; insertions all at once. ;;(@* "Special Characters in Input Patterns") ;; ;; Special Characters in Input Patterns ;; ------------------------------------ ;; ;; Regular-expression syntax treats some characters specially, but ;; some of these special characters have another special meaning in ;; Emacs when used with file-name inputs. What about the conflict ;; between interpreting characters such as `$', `\', `.', `?', and ;; `*' as 1) regexp special characters and 2) special characters for ;; file-name input? For example, when inputting a file name, should ;; `*' be treated as a regexp multiple-occurrences operator or as a ;; file-name wildcard? ;; ;; In Emacs file-name input: ;; ;; - `$' can be used to prefix environment variables. ;; ;; - `*' and `?' can be used as wildcards, effectively inputting ;; multiple file names at once. ;; ;; - `.' and `..' can be used to navigate a directory hierarchy. ;; ;; - `\' is a directory separator, like `/', on MS Windows, at least. ;; ;; Icicles handles the conflict by interpreting such characters as ;; regexp special characters only during input completion and cycling ;; - and then only if you do not escape them (with `\'). If present ;; in the input when you finally accept it (using `RET'), they take ;; on their normal Emacs meanings for file-name input: ;; environment-variable prefix, wildcard, directory abbreviation, or ;; directory separator. ;; ;; That is, whenever there is a potential conflict of interpretation, ;; the regexp meaning is used for completion and cycling, and the ;; standard interpretation for file-name input is used for accepting ;; the input. So, for example, to get the wildcard interpretation of ;; `*', just forego regexp completion and cycling. And vice versa: ;; forego the wildcard interpretation to use regexp completion and ;; cycling. ;; ;; This is in any case the behavior of vanilla Emacs as well. If, in ;; vanilla Emacs, you use `ici*' or `ici*.el' as input to `find-file' ;; and hit `TAB', there is no completion available. File-name ;; globbing and completion are independent. ;; ;; Note: Because `?' is useful in regexp syntax, the standard Emacs ;; minibuffer binding of `?', which just displays the ;; completion-candidates list, is not used in Icicles. In ;; Icicles, `?' self-inserts in the minibuffer, like any other ;; printable character. (Use `TAB' or `S-TAB' to display the ;; list.) In standard Emacs, you must quote `?' or ;; copy-and-paste it, to insert it in the minibuffer for use as ;; a file-name wildcard. ;; ;; The interpretation conflict for `\' (on MS Windows) is not really ;; a problem, anyway. Although you cannot use a backslash (`\') as a ;; directory separator during apropos completion and cycling, you can ;; always use a slash (`/') instead - even on MS Windows. The best ;; practice is to just break with MS-Windows syntax, and get in the ;; habit of always using `/' as the directory-separator character. ;; ;; But what if you copy an absolute filename from some MS Windows ;; application, so it has backslashes, and you want to use it in ;; Emacs? You can go ahead and paste it in the minibuffer for ;; filename completion, as long as you are not doing regexp ;; completion. You can (a) use prefix completion with it, (b) use ;; `C-`' to turn on regexp quoting for apropos completion (so you can ;; complete a substring), or (c) change the backslashes to slashes. ;; ;; Even if you always use only slash, not backslash, as a directory ;; separator when inputting, however, it is possible that you could ;; run into some trouble on MS Windows. You might (knowingly or not) ;; use `\' as a directory separator in the values of environment ;; variables that you use as part of file-name input. If you are ;; regexp completing, then those backslashes will be treated as ;; regexp escapes. So you should use only non-regexp completion with ;; input that includes environment variables whose expansions might ;; include backslashes. ;; ;; The interpretation conflict for `$' is also not a real problem. ;; You can get the effect of both interpretations of `$' at the same ;; time, because Icicles recognizes that `$' at the end of input ;; cannot be an environment-variable prefix. This means, for ;; example, that you can use a pattern such as `$HOME.*t$' to match ;; the files in your home directory whose names end in `t'. ;; ;; The first `$' here is not treated specially during regexp matching ;; and cycling; the environment variable `$HOME' is expanded by the ;; shell to a directory name. The second `$' is treated as the ;; regexp special character that matches at the end of a line. When ;; using environment variables, you can also enclose them in braces: ;; `${HOME}', for example. ;; ;; Note: Starting with Emacs 23, if option ;; `icicle-TAB-completion-methods' includes `vanilla', and you choose ;; `vanilla' completion for `TAB' (by cycling using `C-(' or by ;; customizing `icicle-TAB-completion-methods' to use `vanilla' as ;; the default), then Icicles `TAB' completion will complete an ;; environment variable during file-name completion. This is in ;; addition to the traditional shell expansion of a variable when you ;; hit `RET'. ;; ;; Tip: Because slash (`/') is about the only non-word syntax ;; character that is likely to appear in file-name completions, ;; you can usually use `\W$' to match only directories (by ;; matching the `/' at the end of their names). `\W' is the ;; regexp pattern that matches any character that does not ;; appear in words. For example, you can use `${HOME}\W$' to ;; match all direct subdirectories in your home directory. ;; ;;(@* "Quoting (Escaping) Special Characters") ;; ** Quoting (Escaping) Special Characters ** ;; ;; You can toggle interpretation vs escaping of regexp special ;; characters at any time, using `C-`' in the minibuffer (command ;; `icicle-toggle-regexp-quote'). Escaping special characters this ;; way means they are no longer special; they simply match ;; themselves. This has the effect of reducing apropos completion to ;; simple substring completion. If you never want to use regexp ;; matching (*not* recommended!), you can customize user option ;; `icicle-regexp-quote-flag', setting it to non-`nil'. ;; ;; Apropos (regexp) completion contains literal substring completion ;; as a (common) special case. Sometimes you want to use regexp ;; completion, but you also want to match a literal substring that ;; contains special characters. You can of course quote (escape) ;; each of these characters by hand. Alternatively, you can use ;; `M-%' (`icicle-regexp-quote-input') to quote the text that you ;; want to match literally. If the region is active, then it is ;; quoted; otherwise, your entire minibuffer input is quoted. ;; ;; Note that if a substring that you want to match literally can ;; occur anywhere in the target completion candidate, then it is ;; simpler to just use progressive completion. Quoting a literal ;; substring is useful when the overall regexp requires it to be at a ;; certain location in the target. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Dired Enhancements") ;; for how to use Icicles regexp-matching to open Dired on sets of ;; files that you might not be able to specify using file-name ;; wildcards. ;; ;; * (@> "Multi-Commands") for a way to open multiple files whose ;; names match a regular expression. ;; ;; * (@file :file-name "icicles-doc2.el" :to "File-Name and Directory-Name Completion Tips") ;; for: ;; - Information about abbreviating your home directory as `~' or ;; expanding it. ;; - A way to locate and open files by regexp anywhere in your file ;; system - that is, match against directory-name as well as ;; file-name components. ;; ;; * (@> "Progressive Completion") ;;(@* "Exiting the Minibuffer Without Confirmation") ;; ;; Exiting the Minibuffer Without Confirmation ;; ------------------------------------------- ;; ;; Normally, if you exit the minibuffer with input that only ;; partially matches a completion candidate, the value you input is ;; exactly what you typed. That is, exiting does not automatically ;; complete your input - what you type is what you get. This is ;; "lax" (or "permissive") completion, and it is desirable most of ;; the time, because it lets you input a value that does not ;; correspond to any of the completion candidates. This is how, for ;; instance, you can use `C-x C-f' to open a new file or `C-x b' to ;; create a new buffer. ;; ;; However, some people prefer "strict" completion: limiting input to ;; the available completion candidates. This can be handy in the ;; case of switching to a buffer, for instance. If you have a buffer ;; named `new-ideas.txt', you might like to be able to type only ;; `new' followed by `RET', and not have to first complete the input ;; text. This is the behavior of libraries `ido.el' and ;; `iswitchb.el'. ;; ;; It is the command you use that decides whether `RET' first ;; completes your input before exiting the minibuffer (strict ;; completion) or not (lax completion). This is done in the command ;; definition by providing a non-`nil' or `nil' REQUIRE-MATCH ;; argument to function `completing-read', which prompts you and ;; reads your input, possibly completing it. ;; ;; If you use standard Emacs command `switch-to-buffer' then ;; completion is lax: `RET' does not complete your input `new' to ;; `new-ideas.txt'; it simply accepts your input as is, and creates a ;; new buffer with that name, `new'. ;; ;;(@* "Using `S-RET' to Accept a Partial Match") ;; ** Using `S-RET' to Accept a Partial Match ** ;; ;; By default, Icicles command `icicle-buffer', not vanilla command ;; `switch-to-buffer', is bound to `C-x b' in Icicle mode. (You can ;; customize option `icicle-top-level-key-bindings' to prevent this ;; rebinding of `C-x b' in Icicle mode.) ;; ;; The default behavior of `icicle-buffer' is the same as the ;; behavior of `switch-to-buffer' with respect to `RET'. However, ;; you can obtain the complete-and-exit `RET' behavior with ;; `icicle-buffer' by setting option ;; `icicle-buffer-require-match-flag' to `partial-match-ok'. This ;; value overrides the REQUIRE-MATCH argument to `completing-read', ;; in effect forcing it to `t'. ;; ;; Whenever completion is strict, requiring a match against one of ;; the completion candidates (typically, an existing file or buffer ;; name), you can complete and exit the minibuffer all at once, with ;; only partial input in the minibuffer, by using `RET'. ;; ;; But what about apropos completion? And what about non-strict ;; (lax) completion, whether prefix or apropos? You can use `S-RET' ;; (`S-return'), bound to command `icicle-apropos-complete-and-exit', ;; to force completion and acceptance of the completed input. It ;; acts similarly to what `RET' does for strict prefix completion. ;; It works for both strict and lax completion. ;; ;; `S-RET' first completes your input according to the current ;; completion mode (`icicle-default-cycling-mode' or the last ;; completion command used - prefix or apropos). If there is only ;; one completion then it completes your input to that match and then ;; exits. ;; ;; For example, if you use `C-x C-f' with input `abc' and you hit ;; `S-RET', then it is either prefix-completed or apropos-completed, ;; depending on the current completion mode. If the only match is, ;; say, `abcdefg.el', for prefix completion or, say, ;; `123abcde456.txt' for apropos completion, then that complete file ;; name is entered. ;; ;;(@* "Accepting Partial Matches by Default") ;; ** Accepting Partial Matches by Default ** ;; ;; For those people who prefer that a partial match always be ;; accepted immediately, regardless of the context (whether a match ;; is required or not) and without having to use `RET' or `S-RET', ;; there is Icicles user option ;; `icicle-top-level-when-sole-completion-flag'. If you set this to ;; non-`nil', then, whenever your input matches only one candidate ;; completion, that candidate is used immediately. I do not ;; recommend this practice generally, but some people might prefer ;; it. ;; ;; Option `icicle-top-level-when-sole-completion-delay' is the number ;; of seconds Icicles waits, before returning to top level with the ;; sole completion. It has no effect if ;; `icicle-top-level-when-sole-completion-flag' is `nil'. The delay ;; gives you a chance to forestall acceptance of the sole completion: ;; editing the completion (typing or deleting a character) before the ;; delay expires prevents its automatic acceptance. ;; ;; See Also: (@* "Ido and IswitchB") ;;(@* "Ido and IswitchB") ;; ;; Ido and IswitchB ;; ---------------- ;; ;; Libraries Ido and IswitchB are alternatives to Icicles that also ;; enhance minibuffer completion in various ways. Their UIs are ;; similar to each other - Ido essentially extends IswitchB's ;; buffer-name completion to file names as well. Neither completes ;; other kinds of candidates. They work only for buffer names or ;; file names, but you can advise the standard completion functions ;; to get them to use Ido completion more generally. ;; ;; The behavior of Ido and IswitchB is different from the default ;; Icicles behavior. If you prefer their behavior for buffers then ;; you can just use IswitchB and Icicles together. You cannot use ;; Icicles and Ido together, however - they use the minibuffer in ;; incompatible ways. ;; ;; The default behavior of Icicles is different, but you can make ;; Icicles behave more like Ido if you like. It would be a mistake ;; to look for a complete reproduction of the Ido behavior in ;; Icicles, however. If you want exactly the same behavior as Ido, ;; then use Ido. ;-) ;; ;; The Icicles UI is different by design. Some of this difference in ;; approach has to do with the fact that Ido is specialized to ;; buffer- and file-name completion. The generality of Icicles makes ;; a different approach appropriate. Icicles has many additional ;; features that are not available in other libraries, but its main ;; advantage is its generality: you use the same user interface for ;; input of any kind. As you learn more about Icicles you may begin ;; to appreciate its approach, even if you are a diehard Ido addict. ;; ;; This section summarizes some differences between Icicles and Ido ;; and tells you how you can get more Ido-like behavior in Icicles if ;; that's what you prefer. It does not cover Icicles features that ;; have no counterpart in Ido or features that they have in common ;; (except to emphasize some differences). ;; ;; If you have the Ido habit but want to give Icicles a try, then ;; this section is for you. I recommend, however, that you give the ;; default Icicles behavior a good try before convincing yourself ;; that you still prefer a more Ido-like approach. ;; ;; See also the references at the section end for other sections that ;; go into more detail about some of the things mentioned here. ;; ;; 1. Incremental completion. By default, Icicles does not turn on ;; incremental completion until you have hit `TAB' or `S-TAB' to ;; display the matching candidates. Ido turns it on immediately. ;; You can get that behavior by setting option ;; `icicle-show-Completions-initially-flag' to `t'. ;; ;; You can get an intermediate behavior in this regard by instead ;; setting option `icicle-incremental-completion' to a value that ;; is neither `nil' nor `t'. That makes Icicles show the matching ;; candidates as soon as you start typing input, but not before ;; that. See also (@> "Icompletion") and option ;; `icicle-incremental-completion-delay'. ;; ;; 2. Non-expansion of minibuffer input. By default, Icicles expands ;; your minibuffer input when you complete. This is like vanilla ;; Emacs (for prefix completion), but it is unlike Ido, which only ;; shows you the available candidates but does not change your ;; input text. You can get this non-expansion behavior in Icicles ;; by setting option `icicle-expand-input-to-common-match' to 0. ;; See (@> "Incremental Completion (Input Expansion) in the Minibuffer"). ;; ;; 3. Matching. By default, Ido uses substring matching for ;; completion. You can hit a key to switch to prefix matching, ;; "flex" matching, or regexp matching. Icicles gives you these ;; same matching possibilities, and more. (What Ido calls "flex" ;; matching Icicles calls "scatter" matching.) The main ;; difference here is that Icicles regexp support is general and ;; complete. Regexp-matching in Ido does not work with Ido-style ;; completion. ;; ;; 4. Current candidate, cycling, sorting. Both Ido and Icicles have ;; a notion of "current candidate". In Ido, completion candidates ;; are presented in a predefined sort order, most recently used ;; first. The current candidate is the first one. You cycle ;; candidates by moving the first to last or the last to first. ;; ;; In Icicles, you can switch among any number of sort orders at ;; any time by hitting a key. (And you can easily define your own ;; sort orders.) When you cycle candidates, the candidates stay ;; in order. If the candidates are displayed in `*Completions*' ;; then the current one is highlighted there, in place. The ;; highlight moves, not the candidate. ;; ;; 5. Input editing. In Ido, cycling does not replace your input by ;; the current candidate. To edit the current candidate you hit a ;; key to enter an edit mode (recursive minibuffer). In Icicles, ;; cycling replaces your input in the minibuffer by the current ;; candidate, so you can just edit it there normally. You can use ;; `C-l' to retrieve your original input. ;; ;; 6. Completions shown. In Ido, a limited number of matching ;; completion candidates are shown in the minibuffer. You can hit ;; a key to see all matches in a separate buffer. ;; ;; In Icicles, completion candidates are always shown in buffer ;; `*Completions*', not in the minibuffer. You can limit the ;; number of matches shown by customizing option ;; `icicle-max-candidates'. Only the first ;; `icicle-max-candidates' (in the current sort order) are shown. ;; ;; You can also increment and decrement this truncation value on ;; the fly during completion, by hitting `C-x #' and then using ;; the vertical arrow keys or the mouse wheel. (For that feature ;; you also need library `doremi.el'.) ;; ;; 6. Auto-choice of sole candidate. In Ido, if there is only one ;; match for your input then `TAB', which normally completes, also ;; chooses that candidate - you do not need to hit `RET'. By ;; default, Icicles always requires you to explicitly choose, with ;; `RET' (or `C-RET'). If you set option ;; `icicle-top-level-when-sole-completion-flag' to non-`nil', then ;; Icicles provides similar behavior to Ido. See also option ;; `icicle-top-level-when-sole-completion-delay'. ;; ;;(@* "Ido-Like Behavior Everywhere: `icicle-ido-like-mode'") ;; ** Ido-Like Behavior Everywhere: `icicle-ido-like-mode' ** ;; ;; If you want Icicles to be Ido-like in general, then turn on global ;; minor mode `icicle-ido-like-mode' (not available in Emacs 20). ;; Doing that sets options `icicle-show-Completions-initially-flag' ;; and `icicle-top-level-when-sole-completion-flag' to `t'. Turning ;; the mode off sets them to `nil'. ;; ;; You can simultaneously set option `icicle-max-candidates' when you ;; turn on `icicle-ido-like-mode', by using a positive prefix ;; argument. If you want the option to keep that value when you turn ;; the mode off, then use a zero or negative prefix argument. ;; Otherwise, it is reset to `nil' (no limit on the number of ;; candidates displayed). ;; ;; When you use this mode, you might also want to use `nil' or `t' as ;; the value of option `icicle-default-value', in order to not insert ;; the default value in the minibuffer. If you want to change that ;; option dynamically for the mode, use `icicle-ido-like-mode-hook'. ;; E.g.: ;; ;; (add-hook 'icicle-ido-like-mode-hook ;; (lambda () (setq icicle-default-value ;; (if icicle-ido-like-mode t 'insert-end)))) ;; ;;(@* "Ido-Like Behavior for Buffers and Files") ;; ** Ido-Like Behavior for Buffers and Files ** ;; ;; If you want Ido-like behavior in Icicles for buffers or files, but ;; not in general, then customize either or both options ;; `icicle-buffers-ido-like-flag' and `icicle-files-ido-like-flag' to ;; non-`nil'. ;; ;; See Also: ;; ;; * (@> "Exiting the Minibuffer Without Confirmation") ;; * (@file :file-name "icicles-doc2.el" :to "Customization and General Tips"): ;; `icicle-buffer-require-match-flag', ;; `icicle-deletion-action-flag', ;; `icicle-file-require-match-flag', ;; `icicle-show-Completions-initially-flag', ;; `icicle-incremental-completion', ;; `icicle-incremental-completion-delay', ;; `icicle-max-candidates', ;; `icicle-regexp-quote-flag', ;; `icicle-top-level-when-sole-completion-flag', ;; `icicle-top-level-when-sole-completion-delay', ;; * (@file :file-name "icicles-doc2.el" :to "Fuzzy Completion") ;; * (@> "Special Characters in Input Patterns") ;; * (@> "Prefix Completion and Apropos Completion") ;; * http://www.emacswiki.org/emacs/IciclesDiscussion#IdoAndIcicles ;; (out-of-date discussion, but it might be helpful) ;;(@* "*Completions* Display") ;; ;; *Completions* Display ;; --------------------- ;; ;; Icicles enhances the `*Completions*' display in several ways. The ;; following features are available whenever buffer `*Completions*' ;; is displayed. ;; ;; * In buffer `*Completions*', you can use the arrow keys (`down', ;; `up', `right', `left') to navigate among the candidate ;; completions. The current candidate (under the cursor) is ;; highlighted. ;; ;; * When you cycle completions in the minibuffer: ;; ;; - The current candidate is highlighted in `*Completions*'. ;; ;; - Help on the current candidate (typically the first line of a ;; doc string) is displayed in the mode line, provided user ;; option `icicle-help-in-mode-line-delay' is greater than zero. ;; ;; * The mode line of buffer `*Completions*' shows information about ;; the current completion state, in order from the left: ;; ;; . The minor-mode lighter for Icicles, `Icy'. This includes one ;; or more of these suffixes when appropriate: ;; ;; `+' for a multi-command ;; `||' when candidates are multi-completions ;; `...' if the set of candidates in `*Completions' is truncated ;; ;; . The total number of completion candidates - e.g. `567 ;; candidates'. If the set of candidates in `*Completions*' is ;; currently truncated (because of option `icicle-max-candidates' ;; - see (@file :file-name "icicles-doc2.el" :to "Customization and General Tips"), ;; then the total number of candidates before truncation is also ;; shown - e.g. `149/567 candidates shown'. ;; ;; . The current completion method: (basic) prefix, vanilla, fuzzy, ;; swank (fuzzy symbol), apropos, scatter, Levenshtein, ;; Levenshtein strict. See ;; (@file :file-name "icicles-doc2.el" :to "Fuzzy Completion") ;; and user options `icicle-TAB-completion-methods' and ;; `icicle-S-TAB-completion-methods-alist'. ;; ;; . The current sort order, and whether it is reversed. See ;; (@> "Sorting Candidates and Removing Duplicates") ;; ;; * You can use `C-insert' to move back and forth between the ;; minibuffer and `*Completions*'. In each direction, the current ;; candidate is tracked in the destination buffer. For example, if ;; the candidate in the minibuffer is `foobar', after you hit ;; `C-insert' the cursor is on `foobar' in `*Completions*'. In the ;; other direction, if the cursor is on `foobar' in ;; `*Completions*', after you hit `C-insert' the current input in ;; the minibuffer is `foobar'. ;; ;; * `*Completions*' can also serve as a new kind of icompletion help ;; - see (@> "Icompletion"). ;; ;; * You can choose multiple candidates during completion, by ;; clicking them with `mouse-2' while holding the Control key ;; pressed. See (@> "Multi-Commands"). You can choose a set of ;; candidates in additional ways, and then act on all of them - see ;; (@> "Sets of Completion Candidates"). ;; ;; * Icicles dynamically resizes the `*Completions*' window ;; vertically, to fit the current set of completion candidates. ;; The window is not resized, however, if buffer `*Completions*' ;; appears in its own frame. (It is also not resized in Emacs ;; releases prior to 21.) ;; ;; You can control this automatic resizing generally or on a ;; per-command basis: ;; ;; * User option `icicle-Completions-window-max-height' is the ;; maximum number of lines to show in the `*Completions*' ;; window. ;; ;; * You can override the behavior of option ;; `icicle-Completions-window-max-height' for any given command, ;; by setting property `icicle-Completions-window-max-height' on ;; the command symbol to a different maximum window height ;; value. This property value is predefined for commands, such ;; as `icicle-buffer' and `icicle-file', for which you do not ;; need to see much of the current buffer contents during ;; completion. A large value is used for these commands, so ;; that nearly all of the frame real estate is given to the ;; `*Completions*' window. ;; ;; For example, you can use the following code to set the maximum ;; `*Completions*' height for command `foo' to 100 and turn off ;; per-command control of the height for command `bar'. If you use ;; such code, evaluate it after you load Icicles. ;; ;; (put 'foo 'icicle-Completions-window-max-height 100) ;; (put 'bar 'icicle-Completions-window-max-height nil) ;; ;; * Starting with Emacs 23, if you also use Do Re Mi library ;; `doremi-frm.el', then you can use `C-x -' in the minibuffer to ;; zoom the `*Completions*' buffer text, shrinking or enlarging it ;; incrementally using `-' or `=', respectively (`=' is typically ;; on the same keyboard key as `+', but it needs no Shift). ;; ;; Also starting with Emacs 23 (whether or not you use ;; `doremi-frm.el'), you can specify an initial text-scale amount ;; for the `*Completions*' text, by customizing option ;; `icicle-Completions-text-scale-decrease'. This controls the ;; default appearance. ;; ;; You typically use these features to make the `*Completions*' ;; text a bit smaller and thus save screen real estate - show more ;; candidates in less space. However, Emacs 23 text-scaling does ;; not by itself let you recuperate the saved window space - it ;; shrinks the text, but it does not shrink the window accordingly. ;; For that, you also need library `face-remap+.el' and its option ;; `text-scale-resize-window', which lets you resize the window or ;; not, horizontally, vertically, or in both directions. ;; ;; (For example, you might set `split-width-threshold' to a small ;; number, so `*Completions*' appears on the side rather than above ;; or below other windows, and in that case you might want to ;; resize it only horizontally.) ;; ;; If you use library `oneonone.el' with a standalone ;; `*Completions*' frame, then see option ;; `1on1-completions-frame-zoom-font-difference'. ;; ;; * If you use a dedicated frame for buffer `*Completions*' then ;; Icicles gives it the same font as the window that was selected ;; when `*Completions*' is displayed. This means, for instance, ;; that if that original window has a font tailored to a specific ;; locale or Unicode character set then `*Completions*' will use ;; that same font. ;; ;; * Icicles varies the number of columns used to display completion ;; candidates, for a better fit. You can tweak this with options ;; `icicle-candidate-width-factor' and ;; `icicle-inter-candidates-min-spaces'. ;; ;; If you use Do Re Mi (library `doremi.el'), then you can modify ;; these options incrementally during completion, seeing the effect ;; as they change. Use `C-x w' or `C-x |' from the minibuffer, ;; then use the arrow keys or the mouse wheel to increment and ;; decrement the current value. WYSIWYG. ;; ;; Why is this important enough to merit changing it dynamically, ;; instead of just customizing the options once and for all? ;; Because different sets of candidates have different candidate ;; lengths and distributions of those lengths. Play with it a bit ;; and you will see. One size does not fit all in an ideal way. ;; ;; (You can use option `icicle-Completions-max-columns' to prevent ;; Icicles from automatically calculating the number of columns to ;; display, but I do not recommend this.) ;; ;; * You can use `C-x .' (`icicle-toggle-hiding-common-match') in the ;; minibuffer at any time during completion to toggle hiding of the ;; matched portions of the candidates in `*Completions*'. This ;; portion is replaced by ellipsis, `...'. (In Emacs 20, it is ;; replaced by nothing.) ;; ;; This can be useful when you do not care about the text that ;; matches or when that text is particularly long. For example, if ;; you use `icicle-find-file-absolute' (`C-u C-x C-f') and the ;; completion candidates are absolute file names that share a ;; common directory, it can be convenient to hide the directory ;; portion that is common to all candidates. ;; ;; * Starting with Emacs 22, if option ;; `icicle-image-files-in-Completions' is non-`nil' (it is `t' by ;; default) then thumbnail images are shown in `*Completions*' for ;; candidates that are either (relative or absolute) names of image ;; files or names of image-file bookmarks (see Bookmark+). If the ;; option value is `image-only', then only the thumbnail images are ;; shown. If it is otherwise non-`nil' then the file names are ;; also shown. You can cycle the option value using `C-x t' in the ;; minibuffer at any time during completion. ;; ;; * You can scroll `*Completions*' down using `C-v', and up using ;; `M-v'. You can use `C-u' at any time to reverse the scroll ;; directions. In Emacs 22 or later, you can also use the mouse ;; wheel to scroll `*Completions*'. ;; ;; * You can lay completion candidates out vertically, if you like, ;; instead of horizontally (the default). To do that, customize ;; option `icicle-completions-format' to have the value `vertical'. ;; ;; You can toggle the completions layout between horizontal and ;; vertical at any time during completion, using `C-M-^'. ;; ;; Starting with Emacs 23.2, this is also possible in vanilla ;; Emacs, and the vanilla option for this is `completions-format'. ;; The default value of `icicle-completions-format' is the value of ;; `completions-format', so if you prefer you can simply use the ;; vanilla Emacs option. Vertical layout works in Icicles for all ;; Emacs versions, starting with Emacs 20. ;; ;; Unlike the case for vanilla Emacs, in Icicles the arrow keys in ;; buffer `*Completions*' correctly reflect the candidate order ;; (e.g. as currently sorted). This also means that candidate ;; cycling acts properly for a vertical layout. ;; ;; Note: For visual clarity, when multi-line candidates are used ;; (and this includes multi-line multi-completions) the candidates ;; are displayed in a single column. When this is the case, the ;; completions format (horizontal or vertical) makes no difference ;; - the effect is the same. (Icicles also inserts an empty line ;; after each multi-line candidate, for readability.) ;; See also (@file :file-name "icicles-doc2.el" :to "Icicles User Options and Faces") ;; ;; * In some cases, Icicles adds one or more additional, proxy ;; completion candidates. These are placeholders for real ;; candidates. If you choose a proxy candidate, then the real ;; candidate that it refers to is used. Typical proxy candidates ;; include a reference to a name under the cursor, a reference to ;; whatever you then click `mouse-2' on, and a reference to a name ;; that is the value of a variable. ;; ;; The inclusion of proxy candidates is controlled by user option ;; `icicle-add-proxy-candidates-flag'. You can toggle this ;; inclusion at any time during completion, using `C-M-_'. For ;; performance reasons, you must re-invoke some commands after ;; toggling the flag on, to make the proxy candidates available. ;; ;; Examples: ;; ;; . When you read a file name with completion, the proxy ;; candidates include the following (reading a face name is ;; similar): ;; ;; - `*mouse-2 file name*' - proxy for a file name that you ;; click with `mouse-2'. ;; ;; - `*point file name*' - proxy for the file name at point (if ;; available). ;; ;; - Single-quoted names of file-name variables - proxy for the ;; variable value. ;; ;; . When a command reads input using `icicle-read-number' or ;; `icicle-read-string-completing', the proxy candidates are all ;; variables whose values are numbers or strings, respectively. ;; You can choose such a proxy candidate to use its value. (All ;; candidates are proxy candidates for these functions.) ;; ;; . When you use command `icicle-read-color-wysiwyg', the proxy ;; candidates include the following: ;; ;; - `*point foreground*' - proxy for the foreground color at ;; the cursor position (point). ;; ;; - `*mouse-2 foreground*' - proxy for the foreground color ;; where you then click `mouse-2'. ;; ;; - `*copied foreground*' - proxy for a previously copied ;; foreground color, the value of variable ;; `eyedrop-picked-foreground'. ;; ;; - Background versions of the first three: `*copied ;; background*' etc. ;; ;; - Single-quoted names of color-valued variables - proxy for ;; the variable value. ;; ;; See Also: ;; (@> "Different Places for Saving and Retrieving Candidates") ;; for information about using `C-M-{' in the minibuffer to ;; retrieve the value of any variable as minibuffer input. ;; ;; Proxy Gotcha #1: Your minibuffer input is matched against proxy ;; candidates, as usual. If `insert-default-directory' is ;; non-`nil' when you use `C-x d' (`icicle-dired'), then the ;; default directory is inserted as part of your input. If you ;; then use `TAB' for completion then you will first need to use ;; `M-k' to remove the inserted directory, as it will not match any ;; of the proxy candidates. ;; ;; Proxy Gotcha #2: If you enter text that matches a proxy ;; candidate then the value of that proxy is taken as the real ;; input - that's the whole point of proxy candidates. But ;; suppose, in Info, you want to (non-incrementally) search for the ;; text `ftp-program', which is the name of a variable? If you ;; type `s ftp-program RET' then the *value* of that variable ;; (typically `ftp') is taken as the text to search for, instead of ;; the literal text `ftp-program'. To take care of this, use ;; `C-M-_' in the minibuffer to turn off including proxy ;; candidates. ;; ;; * Clicking `C-mouse-3' on a candidate in `*Completions*' pops up a ;; contextual menu for acting on completion candidates. You can ;; customize the menu using option ;; `icicle-Completions-mouse-3-menu-entries'. By default, the menu ;; has the following submenus: ;; ;; . `This Candidate' - Act on the candidate that you clicked to ;; pop up the menu. Or act on all current candidates, ;; individually or collectively. ;; ;; . `Sorting' - Change the current candidate sort order. ;; ;; . `Save/Retrieve' - Save (mark) candidates or retrieve them, ;; including to/from a variable or a cache file. ;; ;; . `Sets' - Perform operations on sets of candidates, in ;; particular, the set of current candidates and the set of ;; saved candidates. ;; ;; . `Toggle/Cycle/Change' - Toggle, cycle, or otherwise change an ;; Icicles setting, altering the behavior on the fly. ;; ;; . `Miscellaneous' - Other candidate operations and general ;; help. ;; ;; The popup menu is contextual. In particular, the available ;; items can change depending on whether you use a prefix argument ;; (`C-u C-mouse-3') and whether you have selected candidates using ;; the region (e.g. mouse drag). The menu also provides a good ;; reminder of key bindings available during completion. ;; ;; There are lots more Icicles features that enhance the display and ;; behavior of `*Completions*' in some way. Read on... ;; ;; See Also: ;; ;; * (@> "Moving Between the Minibuffer and Other Buffers"), for ;; information on the `pause' key, which is somewhat related to ;; using `C-insert'. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Candidates with Text Properties") ;; and (@file :file-name "icicles-doc2.el" :to "Programming Multi-Completions") ;; for information about using text properties in `*Completions*'. ;; These sections are for Emacs-Lisp programmers. ;;(@* "Icompletion") ;; ;; Icompletion ;; ----------- ;; ;; Emacs incremental completion, or icompletion, provided by standard ;; library `icomplete.el', displays matching prefix completions in ;; the minibuffer. This display is updated incrementally as you type ;; characters. In spite of the name, icompletion does not, in fact, ;; provide any completion; it provides completion help, letting you ;; know which (prefix) completions are available. ;; ;; Icicles enhances Emacs icompletion in three ways: ;; ;; 1. It works with my library `icomplete+.el' to provide minibuffer ;; feedback on the number of completion candidates. ;; ;; 2. It highlights the part of your input that does not match any ;; completion candidate. ;; ;; 3. It provides a new kind of icompletion, using buffer ;; `*Completions*'. ;; ;;(@* "icomplete+.el Displays the Number of Other Prefix Candidates") ;; ** icomplete+.el Displays the Number of Other Prefix Candidates ** ;; ;; Library `icomplete+.el' enhances `icomplete.el' in various ways. ;; One of these ways is to complement Icicles by displaying the ;; number of other prefix-completion candidates when cycling. This ;; number is displayed whenever you change direction when cycling. ;; For example: ;; ;; M-x forward-line [Matched] (13 more) ;; ;; Like `icomplete.el', `icomplete+.el' provides help for only prefix ;; completions, not apropos completions. (Reminder: There is no ;; icompletion for file-name completion - see standard library ;; `icomplete.el'.) ;; ;;(@* "Icompletion in *Completions*: Apropos and Prefix Completion") ;; ** Icompletion in *Completions*: Apropos and Prefix Completion ** ;; ;; Buffer `*Completions*' shows you the current set of candidates for ;; either prefix or apropos completion. Together, user options ;; `icicle-incremental-completion', ;; `icicle-incremental-completion-delay', and ;; `icicle-incremental-completion-threshold' control incremental ;; updating of `*Completions*'. ;; ;; And together with option `icicle-expand-input-to-common-match' ;; they control incremental expansion (completion) of your input in ;; the minibuffer. ;; ;; If option `icicle-incremental-completion' is non-`nil', then ;; `*Completions*' is automatically updated whenever you change your ;; input in the minibuffer - that is, with each character that you ;; type or delete. This is another form of icompletion, unique to ;; Icicles. Unlike vanilla icompletion, it uses buffer ;; `*Completions*', not the minibuffer, to show the completion help. ;; ;; The particular non-`nil' value of `icicle-incremental-completion' ;; determines when `*Completions*' is displayed and updated. The ;; default value, `t', means that `*Completions*' is updated only if ;; it is already displayed. Use `t' if you do not want ;; `*Completions*' to be too intrusive, but you want it to provide ;; the most help when you ask for help (via `TAB' or `S-TAB'). ;; ;; Any other non-`nil' value is more eager. It displays and updates ;; `*Completions*' whenever there is more than one completion ;; candidate. That can be more helpful, but it can also be more ;; distracting. A value of `nil' turns off automatic updating ;; altogether - `*Completions*' is then displayed only upon demand. ;; I find that `t' represents a good compromise, providing help when ;; I ask for it, and then continuing to help until I've finished ;; choosing a candidate. ;; ;; A completion behavior even more eager than that produced by ;; setting `icicle-incremental-completion' to non`nil' and non-`t' ;; can be had by setting option ;; `icicle-show-Completions-initially-flag' to non-`nil'. In that ;; case, completions are shown even before you type any input. You ;; see all of the possible candidates initially, unfiltered by any ;; typed input. In this regard, see also (@> "Ido and IswitchB"). ;; ;; When you are editing, Icicles normally does not interrupt you to ;; recalculate and redisplay the matches after each character you ;; type or delete. Option `icicle-incremental-completion-delay' is ;; the number of seconds to wait before updating `*Completions*' ;; incrementally. It has an effect only when the number of ;; completion candidates is greater than ;; `icicle-incremental-completion-threshold'. This delay can improve ;; performance when there are many candidates. It lets you type ;; ahead before candidate redisplay occurs. ;; ;; You can cycle incremental completion at any time (changing ;; `icicle-incremental-completion' among `nil', `t', and `always') ;; using command `icicle-cycle-incremental-completion', which is ;; bound to `C-#' in the minibuffer. If the number of completion ;; candidates is very large, then use `C-#' to turn off incremental ;; completion - that will save time by not updating `*Completions*'. ;; See also (@> "Dealing With Large Candidate Sets") for other ways ;; to deal with a large number of candidates. ;; ;; Note: Incremental completion is effectively turned off whenever a ;; remote file name is read, that is, whenever your file-name input ;; matches a remote-file syntax. ;; ;; There are several advantages of using `*Completions*' for ;; icompletion, as opposed to the minibuffer as in vanilla Emacs: ;; ;; 1. Many more candidates can be displayed in `*Completions*' than ;; can be displayed by standard icompletion, which uses the ;; minibuffer for feedback. ;; ;; 2. Standard (minibuffer) icompletion provides feedback only on ;; matches for prefix completion. If you use both standard ;; icompletion and Icicles icompletion, you can have incremental ;; help for both prefix completion and apropos completion at the ;; same time, one in the minibuffer and the other in ;; `*Completions*'. ;; ;; 3. The other Icicles `*Completions*' features are available for ;; the current set of matching candidates: cycling, highlighting ;; of match root, highlighting of previously used candidates, and ;; so on. See (@> "*Completions* Display"). ;; ;;(@* "Incremental Completion (Input Expansion) in the Minibuffer") ;; ** Incremental Completion (Input Expansion) in the Minibuffer ** ;; ;; As mentioned in (@> "Icompletion in *Completions*: Apropos and Prefix Completion"), ;; another Icicles option, `icicle-expand-input-to-common-match', ;; controls whether Icicles completes your input in the minibuffer. ;; There are five levels of this expansion behavior to choose from: ;; option values 0 to 4. When expansion occurs it is always the ;; same. See (@> "Expanded-Common-Match Completion") for the ;; description. What this option controls is whether and when ;; expansion takes place. ;; ;; At one extreme (value 0), your input is never expanded (except ;; when you use `C-M-TAB' or `C-M-S-TAB', which do not display ;; `*Completions*'). This is unlike vanilla Emacs but similar to Ido ;; and IswitchB: you look to `*Completions*' for the matches, and you ;; keep typing (or you cycle) narrow things down and choose. If you ;; use a non-`nil', non-`t' value for `icicle-incremental-completion' ;; then you might also want to try a value of 0 for ;; `icicle-expand-input-to-common-match'. ;; ;; At the other extreme (value 4), your input is expanded in the ;; minibuffer whenever it is completed in `*Completions*'. This ;; includes automatic, incremental expansion, analogous to ;; incremental completion. ;; ;; A value of 1 means expand your input only when you explicitly ;; request completion, using `TAB' or `S-TAB'. ;; ;; A value of 2 means do that, but also expand your input whenever it ;; matches only one completion candidate. This lets you hit `RET' to ;; choose it (instead of having to hit `S-RET'). ;; ;; A value of 3 means do what 2 does, but also expand your input each ;; time prefix completion occurs. It is the same as 4, except that ;; it does not incrementally expand your input for apropos ;; completion. ;; ;; For a long time Icicles had only the equivalent of values 3 and 4, ;; and I consider them the most useful. Sometimes you will want to ;; temporarily turn off expansion for apropos completion. You can do ;; that using `C-"' in the minibuffer: it toggles between 3 and 4 (by ;; default - see option `icicle-incremental-completion-alt'). ;; ;; See Also: ;; ;; * (@> "Expanded-Common-Match Completion") ;; ;; * (@> "What Input, What History?") ;; ;; * (@file :file-name "icicles-doc2.el" :to "Customization and General Tips") ;; ;;(@* "Icicles Highlights the Input that Won't Complete") ;; ** Icicles Highlights the Input that Won't Complete ** ;; ;; When you are typing or correcting your input during completion, ;; Icicles highlights the part of your minibuffer input that prevents ;; it from matching any completion candidates, by default. This ;; works for both prefix completion and apropos completion. For ;; both, it highlights your input from the leftmost mismatch through ;; the input end. ;; ;; You can use `C-M-l' to move the cursor to the start of the ;; highlighted, mismatched part of your input. Repeat `C-M-l' to ;; kill the highlighted portion. (Because it is killed, you can use ;; `C-y' to yank it back.) ;; ;; User options `icicle-incremental-completion', ;; `icicle-test-for-remote-files-flag', ;; `icicle-highlight-input-completion-failure', ;; `icicle-highlight-input-completion-failure-delay', and ;; `icicle-highlight-input-completion-failure-threshold' control this ;; highlighting, which is done using face ;; `icicle-input-completion-fail' (for strict completion) or ;; `icicle-input-completion-fail-lax' (for lax completion). ;; ;; If either `icicle-incremental-completion' or ;; `icicle-highlight-input-completion-failure' is `nil', then no such ;; highlighting is done. Remember that you can cycle incremental ;; completion on and off using `C-#' in the minibuffer. ;; ;; Because this highlighting can have a negative impact on ;; performance, you can fine-tune when you want it to occur. The ;; value of `icicle-highlight-input-completion-failure' determines ;; when this highlighting can take place. ;; ;; In particular, highlighting the non-matching part of remote file ;; names can be slow. Two values of the option allow remote file ;; name highlighting: `always' and `explicit-remote'. The other ;; values do not highlight remote file names. You probably do not ;; want to use a value of `always'. ;; ;; If the value is `nil', then highlighting never occurs. If the ;; value is `explicit-strict', `explicit', or `explicit-remote', then ;; highlighting occurs only upon demand: when you hit `TAB' or ;; `S-TAB' to request completion. If the value is `implicit-strict', ;; `implicit', or `always', then highlighting occurs also when you ;; update input during incremental completion (if incremental ;; completion is turned on). ;; ;; I use a value of `implicit' myself, but the default value is ;; `implicit-strict' because, depending on your setup and use cases, ;; `implicit' can impact performance for file-name completion (which ;; is lax, not strict). I suggest you try `implicit' to see - this ;; feature is especially useful for file names. ;; ;; TIP: An alternative way to be informed about a file name ;; mismatch (when you use `TAB' or `S-TAB') is to use ;; `icicle-no-match-hook' to signal you using a visual or ;; audible cue. For example: ;; ;; (add-hook 'icicle-no-match-hook ;; (lambda () ;; (when (icicle-file-name-input-p) (ding)))) ;; ;; Summary of `icicle-highlight-input-completion-failure' choices: ;; ;; `nil' Never ;; `explicit-strict' Only on demand and only during strict completion ;; `explicit' Only on demand (lax and strict completion) ;; `explicit-remote' Only on demand, even for remote file names ;; `implicit-strict' Incremental or explicit completion - strict only ;; `implicit' Incremental/explicit, lax/strict completion ;; `always' Always (including for remote file names) ;; ;; These values are listed here in terms of increasing ;; permissiveness, which also can mean increasing performance impact. ;; That is, a value of `implicit' is more likely to affect ;; performance than a value of `explicit'. The greatest performance ;; hit comes from file-name matching, in particular if remote files ;; are involved. ;; ;; If you know that you will not be using remote file names for a ;; while, you can let Icicles and Tramp know this by using the toggle ;; `C-^' in the minibuffer to turn off option ;; `icicle-test-for-remote-files-flag'. When this is off, you cannot ;; use remote files. ;; ;; Turning off `icicle-test-for-remote-files-flag' using `C-^' turns ;; off Tramp's remote file-name completion and remote file handling. ;; If you turn off the option using `C-^', then turn it back on using ;; `C-^' also (instead of just setting the option to non-`nil'), in ;; order to re-enable Tramp's file-name handling and completion. ;; ;; Turning off `icicle-test-for-remote-files-flag' can slightly speed ;; up file-name completion for local files, by avoiding any check for ;; remote file names. If you seldom use remote files, then you might ;; want to customize `icicle-test-for-remote-files-flag' to `nil' and ;; use `C-^' to toggle it back on whenever you do use remote files. ;; ;; A `nil' value of `icicle-test-for-remote-files-flag' also ;; overrides the `icicle-highlight-input-completion-failure' values ;; `implicit-strict', and `explicit-strict' for file-name completion, ;; treating them the same as `implicit'. It is assumed that you use ;; those values only to avoid the cost of remote file-name matching. ;; ;; Finally, whether to treat files on MS Windows mapped network ;; drives as remote or local for things like incremental completion ;; is controlled by option `icicle-network-drive-means-remote-flag'. ;; Customize it to `nil' if you would like such files to be treated ;; as local files. You can toggle this option anytime during ;; completion, using `C-x :'. ;;(@* "Sorting Candidates and Removing Duplicates") ;; ;; Sorting Candidates and Removing Duplicates ;; ------------------------------------------ ;; ;; By default, completion candidates are usually presented in buffer ;; `*Completions*' in alphabetic order. But some commands use ;; different sort orders by default. Whatever sort order is used for ;; `*Completions*' is also the order of cycling among candidates. ;; ;; Also, duplicate candidates are typically removed as completion ;; choices, by default. But for some commands duplicates are ;; appropriate, so they are not removed. For example, command ;; `icicle-search' (`C-c `') uses completion to navigate among search ;; hits. Duplicate search hits are retained. Although some ;; search-hit candidates might have the same text, they are located ;; at different buffer positions. ;; ;; You can interactively control the order of candidates and whether ;; duplicates are removed. Use `C-,' during completion to choose a ;; different sort order or to turn off sorting altogether (one of the ;; available sort orders is in fact called "turned OFF"). Use `C-$' ;; to toggle the removal of duplicate candidates. A few commands, ;; for which sorting is inappropriate, prevent you from sorting. ;; ;; The available sort orders for `C-,' are those defined by user ;; option `icicle-sort-orders-alist' - see ;; (@> "Defining New Sort Orders"), below. However, some commands ;; adjust this list of possibilities by adding command-relevant sort ;; orders or removing some that might be inappropriate. ;; ;; The sort order generally remains as you last set it, for ;; subsequent commands. However, if the last order you set is ;; inappropriate for the current command then sorting is turned off. ;; You can then use `C-,' to choose a sort order appropriate for the ;; current command. ;; ;;(@* "Changing the Sort Order") ;; ** Changing the Sort Order ** ;; ;; There are a couple of ways to use `C-,' (bound to command ;; `icicle-change-sort-order'). Its behavior depends on the value of ;; user option `icicle-change-sort-order-completion-flag', which is ;; `nil' by default. This value means to simply cycle to the next ;; sort order each time you hit `C-,'. A non-`nil' value means to ;; use completion to choose another sort order. If you have many ;; available sort orders, then you might prefer a non-`nil' value. ;; In any case, you can also change this behavior on the fly: using ;; plain `C-u' (no number) with `C-,' reverses the meaning of ;; `icicle-change-sort-order-completion-flag' for `C-,'. ;; ;; However, a numeric prefix argument, such as `C-9', means to simply ;; reverse the direction of the current sort order; it invokes ;; command `icicle-reverse-sort-order'. For example, if candidates ;; are sorted alphabetically from A to Z, then `C-9 C-,' flips the ;; sort order, so that from then on sorting is from Z to A. If ;; buffer names are sorted from small to large buffer size, then `C-9 ;; C-,' sorts large buffers first. This works for all sort orders. ;; The new sort order is echoed, so you can use this twice to just ;; remind yourself of the current sort order. ;; ;; In addition to the current sort order, which is defined by the ;; value of user option `icicle-sort-comparer', an alternative sort ;; order is available at all times. It is the value of option ;; `icicle-alternative-sort-comparer'. By default, this sorts ;; candidates into two alphabetical groups: those previously used as ;; accepted input, followed by those not yet used. ;; ;; Just as you can choose a different current sort order using `C-,', ;; so you can choose a different alternative sort order using `M-,'. ;; ;; How do you actually use the alternative sort order? Use `C-M-,' ;; (command `icicle-toggle-alternative-sorting') to swap the ;; alternative sort for the current sort. This is the quickest way ;; to flip between two sort orders. If, for example, you set your ;; alternative sort order to "turned OFF", then this is a quick way ;; to toggle sorting on and off. ;; ;; The first time during a session that you use a command that ;; completes a buffer name or a file name, sorting changes to (that ;; is, `icicle-sort-comparer' is set to) whatever is specified by ;; user option `icicle-buffer-sort' or `icicle-file-sort', ;; respectively, provided the option is non-`nil'. This gives you a ;; way to privilege a particular sorting method for each of these ;; kinds of completion. ;; ;;(@* "Defining New Sort Orders") ;; ** Defining New Sort Orders ** ;; ;; When you use `C-,' or `M-,', the sort orders that you can choose ;; from are those in user option `icicle-sort-orders-alist'. You can ;; customize this option to add or remove available sort orders. A ;; better way to define a new sort order is to use macro ;; `icicle-define-sort-command' in your Emacs init file (~/.emacs). ;; This defines a new Icicles command, named `icicle-sort-ORDER', ;; where `ORDER' is the name of the new sort order. The definition ;; of the "alphabetical" sort order provides an example: ;; ;; (icicle-define-sort-command "alphabetical" ;; icicle-case-string-less-p ;; "Sort completion candidates alphabetically.") ;; ;; The first argument, "alphabetical", is a string naming the new ;; sort order. When you change to this sort order, a message says ;; "Sorting is now alphabetical". Whatever sort-order name you ;; provide is used in the message. ;; ;; The second argument is the actual function used for sorting. It ;; can be any function, including a lambda expression. The function ;; takes two string arguments and returns non-`nil' if and only if ;; the first string sorts before (is "less than") the second. In ;; this case, function `icicle-case-string-less-p' is used, which ;; compares its two arguments alphabetically (lexicographically). ;; The third argument is the doc string for the new sorting command. ;; ;; The result of this definition is: ;; ;; 1. The creation of command `icicle-sort-alphabetical'. ;; 2. The addition of an entry for the new sort order in option ;; `icicle-sort-orders-alist'. The entry associates sort order ;; "alphabetical" with comparison function ;; `icicle-case-string-less-p'. ;; ;; You can invoke the new sorting command any time using `M-x', but ;; you can also change to the new sort order using `C-,' (or `M-,') ;; during minibuffer completion. ;; ;;(@* "Different Sorts for Different Sorts of Uses") ;; ** Different Sorts for Different Sorts of Uses ** ;; ;; There are many different uses of completion in Emacs, and this ;; means that sorting candidates needs to be flexible - there cannot ;; be a single sort order, or even a single set of sort orders, that ;; is useful for all purposes. Completion, and therefore also ;; sorting of completion candidates, needs to deal with different ;; types of candidates and different numbers of them, in different ;; contexts. ;; ;; Icicles predefines many sort functions, and you can easily define ;; more of your own. You can choose a different sort at any time, as ;; mentioned above. A good sort order can be a big help, depending ;; on the context. However, sorting is not free, and it can be ;; helpful to think for a moment about some of the consequences of ;; sorting, in terms of performance. ;; ;; What does a sort function do? It determines which of two strings ;; should come first, that is, which is "less than" the other. ;; During sorting, pairs of candidates are compared using the sort ;; function. And each time you change your input by typing or ;; deleting a character, the new set of matching candidates is sorted ;; (if `icicle-incremental-completion' is non-`nil'). ;; ;; The number of candidates to be sorted depends on the kind of ;; completion and how you use Icicles. Some Icicles users like to ;; use cycling more and completion less, which means sorting more ;; candidates. Other users favor using completion to narrow down the ;; number of matches (which I recommend). Some commands typically ;; have few possible completion candidates; others have many. ;; Buffer-name completion, for example, typically involves relatively ;; few candidates, whereas file-name completion typically involves ;; many. ;; ;; If there are many candidates matching your input, then many ;; comparisons will be made each time the candidate set is sorted. ;; This means that if your sort function is complex, response can be ;; slow. A complex sort function might be OK for sorting a small or ;; medium set of candidates, but it might not be appropriate for ;; sorting a very large set. ;; ;; Only you, as a user, can control which sort makes the best sense ;; for you in any given situation. If you are likely to have ;; zillions of candidates in some context, then you probably will ;; want to change to a sort that computes quickly. You can, of ;; course, even choose not to sort at all, but simple sort ;; comparisons do not noticeably impact performance, even for a very ;; large number of candidates. ;; ;; Icicles could offer a threshold option similar to ;; `icicle-incremental-completion-threshold' (or it could reuse that ;; option), and not bother to sort if the number of candidates passed ;; the threshold, but there can be many sort orders of differing ;; complexity, so a set of thresholds would really be needed, perhaps ;; one per sort order. ;; ;; Rather than having you try to manage such complexity ahead of time ;; using options, it's better to just let you manage it at completion ;; time: Choose the sort order with knowledge of the possible ;; candidate set. For example, if the set of candidates to sort will ;; include every file on your file system, then you probably will ;; want to use a simple sort. On the other hand, there are ;; situations where you might nevertheless prefer to wait a few ;; seconds, in order to perform a complex sort that is of particular ;; use. ;; ;; In sum, Icicles keeps it simple, and leaves it up to you to choose ;; the appropriate sort order for any given context. This design ;; choice is one reason why Icicles makes it easy to choose a sort ;; even while you are completing input - each act of completion is ;; different. ;; ;; It can help you choose, however, to know which of the predefined ;; Icicles sort orders are more complex, and therefore tend to be ;; slower. Here they are: ;; ;; Sort Order Sort Function Used ;; ---------- ------------------ ;; by previous use alphabetically `icicle-historical-alphabetic-p' ;; by last use `icicle-most-recent-first-p' ;; ;; The reason these sorts are slower is that they check the current ;; minibuffer history, to see whether, and where, each candidate is ;; located in the history list. If you, like I, have very long ;; history lists, then this can take a while. I use histories of ;; virtually unlimited length - I let library `savehist-20+.el' save ;; all of my histories from one Emacs session to the next. ;; ;; Here are some of the Icicles sort orders that exist by default: ;; ;; - alphabetical - see ;; (@> "Putting Previous Candidates First: `C-M-,'") ;; - case-insensitive - (@> "Completion Status Indicators") ;; - by last use as input ;; - by previous use alphabetically - see ;; (@> "Putting Previous Candidates First: `C-M-,'") ;; by color name (colors) - see ;; (@file :file-name "icicles-doc2.el" :to "Candidates with Text Properties") ;; by hue (colors) ;; by purity/saturation (colors) ;; by brightness/value/luminance (colors) ;; by all HSV components, in order (colors) ;; by HSV distance from a base color (colors) ;; by amount of red (colors) ;; by amount of green (colors) ;; by amount of blue (colors) ;; by all RGB components, in order (colors) ;; by RGB distance from a base color (colors) ;; 22 by key name, prefix keys first (keys)- see (@> "Completing Prefix Keys") ;; 22 by key name, local bindings first (keys)- see ;; (@> "Local Bindings Are Highlighted") ;; 22 by command name (commands) ;; - by abbrev frequency (commands) - see ;; (@> "Multi `M-x' Turns Every Command into a Multi-Command") ;; by buffer size (buffer names) ;; *...* buffers last (buffer names) ;; by major mode name (buffer names) ;; 22 by mode-line mode name (buffer names) ;; by file/process name (buffer names) ;; - by last file modification time (file names) - see ;; (@> "Icicles Commands that Read File Names") ;; - by file type (extension) (file names) ;; - by directories first or last (file names) ;; - in book order (Info) - see ;; (@file :file-name "icicles-doc2.el" :to "Icicles Completion for Info") ;; - special candidates first - see ;; (@> "Local Bindings Are Highlighted"), ;; (@file :file-name "icicles-doc2.el" :to "Candidates with Text Properties"), ;; (@file :file-name "icicles-doc2.el" :to "Icicles OO: Object-Action Interaction") ;; - proxy candidates first - see (> "*Completions* Display") ;; - extra candidates first - see ;; (@file :file-name "icicles-doc2.el" :to "Global Filters") ;; - by second multi-completion part (multi-completions) - see ;; (@> "Sorting Candidates by Their Second Part") ;; - turned OFF (does not sort at all) ;; ;; As you can see, some are appropriate for color-name completion, ;; some for buffer-name completion, and some for file-name ;; completion. Some are general, appropriate for most kinds of ;; completion. ;; ;; Those marked above with the label `22' can be used only with Emacs ;; 22 or later. Those marked with a hyphen (-) are defined using ;; `icicle-define-sort-command', so they correspond to explicit ;; commands whose doc you can examine. The command names in this ;; case are `icicle-sort-' followed by the sort-order names (with ;; hyphens substituted for spaces) - for example, ;; `icicle-sort-by-directories-last' and `icicle-sort-turned-OFF'. ;; ;;(@* "Adding a Saved Sort Order") ;; ** Adding a Saved Sort Order ** ;; ;; There are many predefined sort orders (see ;; (@> "Different Sorts for Different Sorts of Uses")), and you can ;; define your own new sort orders (see ;; (@> "Defining New Sort Orders")). This section is about a unique ;; Icicles feature that lets you combine any number of sort orders ;; interactively, melding them together. ;; ;; You do this as follows: ;; ;; 1. Start with a given sort order (use `C-u C-,' to choose one). ;; ;; 2. Save the set of candidates you are interested in, using `C-M->' ;; (see (@> "Saving and Retrieving Completion Candidates")). This ;; saves the candidates in their current order at the time of the ;; save: the saved order. ;; ;; 3. Choose a different sort order (e.g., use `C-u C-,'). ;; ;; 4. Use `C-M-+' (`icicle-plus-saved-sort') to combine the two sort ;; orders, that is, the (new) current order and the saved order. ;; ;; What `icicle-plus-saved-sort' does is sum, for each completion ;; candidate, its ranks (indexes) in the two sort orders, and then ;; reorder candidates based on the summed ranks. ;; ;; For example, if a given candidate is the 4th candidate in the ;; current list of candidates, and it is the 7th candidate in the ;; saved list of candidates, then its combined sort rank is 4 + 7 = ;; 11. With a score of 11 it sorts after a candidate whose score is, ;; for example, 6, and before a candidate whose score is, for ;; example, 13. ;; ;; The candidates are reordered according to the combined sort ;; orders, forming a new current order. ;; ;; When you use `C-M-+' it does not matter what order the saved ;; candidates are in or what order you used to sort the current ;; candidates. (But you will generally want to use the same set of ;; candidates.) In particular, after using `C-M-+' the candidates ;; are typically in an order that corresponds to no predefined sort - ;; that's OK. ;; ;; You can use `C-M-+' again if you like, to add in the saved sort ;; order again with the new current order. This gives the saved ;; order more weight than the original current sort order. Continued ;; repetition of `C-M-+' gives the saved sort order more and more ;; weight. Eventually a fixed point is reached: `C-M-+' produces no ;; further change in the order. ;; ;; For example, consider `icicle-read-color-wysiwyg'. With user ;; option `icicle-WYSIWYG-Completions-flag' non-`nil' (e.g. a string) ;; it lets you see the effect of `C-M-+' in a striking, graphical ;; way. However, to see the effect you will first want to use ;; `S-pause' (`icicle-toggle-highlight-saved-candidates') to turn off ;; highlighting of the saved candidates, since that highlighting ;; obscures the color highlighting. ;; ;; Sorting by color hue shows essentially a single rainbow of ;; candidates in `*Completions*': pinks, followed by magentas, ;; purples, blues, cyans, greens, yellows, browns, reds, and grays. ;; Sorting by color brightness shows a single value gamut, the ;; brightest colors followed by dimmer and dimmer colors, down to the ;; dimmest (black). ;; ;; Try `M-x icicle-read-color-wysiwyg', sorting (`C-u C-,') first by ;; hue. Save the completion candidates (`C-M->'). Now sort by ;; brightness (`C-u C-,' again). Now use `C-M-+' to add/merge the ;; two sort orders. You now see essentially a series of rainbows, ;; from brighter to dimmer and dimmer. ;; ;; Use `C-M-+' again, to give hue more prominence in the merged sort ;; order. And again. Keep hitting `C-M-+' until there is no more ;; apparent change in the sort order - at this point you are back to ;; a pure hue sort. ;; ;; You can also at any time save the candidates again, saving the ;; latest order as the new sort order. Then you can reorder the ;; current candidates using a different sort order (`C-,'). And then ;; use `C-M-+' again to merge in the newly saved order. You can play ;; this way ad infinitem. ;; ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Customization and General Tips") ;; for more about `icicle-buffer-sort' and other buffer-name ;; completion parameters. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Global Filters") for a ;; way to filter and sort the domain of discourse, that is, all ;; possible candidates, prior to any use of completion. ;;(@* "A Propos d'Apropos") ;; ;; A Propos d'Apropos ;; ------------------ ;; ;; The Icicles doc speaks often of apropos this and apropos that. ;; "Apropos" could almost be thought of as another name for Icicles. ;; ;; Somewhat different things are meant by this term. But they all ;; stem from the traditional use in Emacs of the term to mean ;; "about", and the traditional `apropos' commands that accept a ;; regexp and give you information about symbols whose names match ;; that regexp. ;; ;; The most common mention of "apropos" in Icicles is in connection ;; with "apropos completion" - see (@> "Apropos Completions"), which ;; uses regexp matching. It is the regexp matching that inspires the ;; name. ;; ;; This doc section describes ways in which Icicles gives you help ;; apropos (about) something in Emacs. All of these ways let you use ;; regexp matching, but they also work with any other kind of ;; matching. That is, they provide information about things, and you ;; can use them with apropos completion, but you can also use them ;; with other kinds of completion. ;; ;;(@* "Get Help on Completion Candidates") ;; ** Get Help on Completion Candidates ** ;; ;; General Icicles help is available at any time during minibuffer ;; input, by hitting `M-?' (`icicle-minibuffer-help'). This section ;; is instead about specific help for individual completion ;; candidates. ;; ;; When you cycle among completion candidates, help for the current ;; candidate is shown in the mode-line, provided user option ;; `icicle-help-in-mode-line-delay' is greater than zero. This makes ;; it easy to see what each candidate means or does. Similarly, this ;; help is shown whenever your input is completed entirely to one of ;; the candidates. If you use library `lacarte.el', then mode-line ;; candidate help is even available for menu-item candidates. ;; ;; Typically, this candidate mode-line help is the first line of the ;; candidate's doc string, but alternative help sources can be used ;; (and a doc string is not available for some kinds of candidates). ;; ;; For some common object types the mode-line candidate help is a ;; summary of useful information. For a buffer-name candidate, for ;; example, it includes the mode name, buffer size, and associated ;; file or directory, if any. The full directory name can be ;; especially helpful for choosing among Dired buffers. ;; ;; To see more help than what is shown in the mode-line, for each ;; candidate or any given candidate as you cycle, press and hold the ;; Control and Meta keys while using the vertical arrow keys, for ;; prefix completion, or the `prior' and `next' keys (often labeled ;; Page Up and Page Down), for apropos completion. To show help on ;; any individual candidate, navigate to it (by cycling or using ;; completion), and hit `C-M-RET' (`C-M-return') - or press Control ;; and Meta and click it with `mouse-2' (`C-M-mouse-2') in buffer ;; `*Completions*'. ;; ;; For example, if you use standard command `switch-to-buffer' and ;; you cycle among candidate buffer names, the buffer is described in ;; buffer `*Help*' as the buffer name appears in the minibuffer. ;; This includes descriptions of the major and minor modes. If you ;; use library `help-fns+.el' then it also includes the full name of ;; the file or directory associated with the buffer (if any), the ;; buffer size, the time it was last displayed, whether it has been ;; modified, and whether it is read-only. ;; ;; By default, you need not use the Meta key for candidate help; the ;; same bindings work with just the Control key. So, for example, ;; you can click `C-mouse-2' to get help on a candidate or use ;; `C-next' to cycle candidate help information. However, Icicles ;; multi-commands often have a different use for these bindings that ;; do not include Meta. It is only by default, when a multi-command ;; has not bound a more specific action to the plain Control ;; bindings, that you can use the sans-Meta bindings for help on ;; candidates. ;; ;; For example, Icicles binds `M-x', `C-x b', and `C-x C-f' to ;; multi-commands that execute a command, switch to a buffer, and ;; open a file, respectively. If you use only the Control key, ;; without the Meta key, when choosing candidates for these commands, ;; you will not get help on the candidates; instead, you will execute ;; a candidate command, switch to a candidate buffer, and open a ;; candidate file, respectively. For more information, see ;; (@> "Multi-Commands"). ;; ;;(@* "Use Candidate Help Like You Use Emacs Command `apropos'") ;; *** Use Candidate Help Like You Use Emacs Command `apropos' *** ;; ;; You can use this candidate-help functionality as a kind of ;; expanded `apropos' functionality. As an example, type `C-h v ;; out', then type `S-TAB' to display all variables that match "out" ;; (in buffer `*Completions*'). Then use `C-M-next' repeatedly to ;; cycle among those variables, displaying their documentation in the ;; `*Help*' buffer as they appear one by one in the minibuffer. Or ;; click individual variable names with `C-M-mouse-2', to display ;; their documentation. ;; ;; The standard `apropos' commands show only the first doc-string ;; line. Icicles shows that automatically in the mode-line, and it ;; shows the complete doc string on demand when you use `C-M-'. This ;; can be handy, for instance, when you are unsure which of several ;; similarly named candidates to choose. Seeing a candidate's ;; documentation along with its name can help you decide. ;; ;; You can click links in buffer `*Help*' to look up more info, and ;; then resume `C-M-next' where you left off, all without leaving ;; completion. ;; ;; This also works with menu items, if you load library `lacarte.el' ;; as well as Icicles. As you cycle among matching menu items, the ;; corresponding command documentation is displayed in `*Help*'. ;; ;; If you also use library `help-fns+.el' (Emacs 22 or later) or ;; library `help+.el' (or `help+20.el' for Emacs 20), then you can ;; use these Icicles features with additional help commands such as ;; `describe-file' (`C-h M-f'), `describe-keymap' (`C-h M-k'), ;; `describe-command' (`C-h C-c'), `describe-option' (`C-h o'), and ;; `describe-option-of-type'. ;; ;; `C-h C-o', which is bound by those libraries to command ;; `describe-option-of-type', is bound in Icicle mode to ;; `icicle-describe-option-of-type' instead, which is a multi-command ;; that uses multi-completion and is therefore more powerful. See ;; (@> "Multi-Completions"). `C-h C-o' describes a user option that ;; is of a particular custom type: you match the type and the option ;; name at the same time (in parallel). ;; ;; As an example, try `C-h C-o ici C-M-j string S-TAB' (`C-M-j' just ;; separates the option name and type parts). In buffer ;; `*Completions*', you see all options whose name contains `ici' and ;; whose type (or an inherited type) definition contains `string'. ;; That means not only options that are strings, but options that are ;; lists that contain string elements, options that can be a string ;; or something else, and so on. ;; ;; Browse the doc for these options, one after the other, using ;; `C-M-next'. This is a way to see, at the same time, the ;; documentation for individual options (in buffer `*Help*') and the ;; types their values must satisfy (in `*Completions*'). ;; ;; And remember that you can leave the option-name part or the type ;; part empty, to see all options of a certain type or options of all ;; types with a certain name pattern. For example, `C-h C-o .* C-M-j ;; string S-TAB' or `C-h C-o ici S-TAB'. ;; ;; And you can of course use progressive completion as well, to ;; match, say, a type that has a `string' component and an `integer' ;; component - or whatever. The type part of a completion candidate ;; is an entire `defcustom' type, so its `:tag' values are also ;; included. This means that you can also match against the ;; descriptive text (tag) that appears next to a value component in ;; Customize. ;; ;; `C-h C-o' is a powerful way to browse options and their ;; documentation. See the doc string of ;; `icicle-describe-option-of-type' for more possibilities. See ;; also `icicle-customize-apropos-options-of-type' ;; ((@> "Icicles Apropos Commands")), which is similar to ;; `icicle-describe-option-of-type' but which opens a Customize ;; buffer for all of the matching options when you hit `RET'. ;; ;; Candidate help (prefix `C-M-') is available for these types of ;; completion candidates, by default: ;; ;; * menu items ;; * commands and other functions ;; * keymap variables (if `describe-keymap' is defined - see ;; library `help-fns+.el') ;; * user options and other variables ;; * faces ;; * fonts (mode-line help only) ;; * command abbreviations (using `apropos-command' for matches) ;; * property lists ;; * buffers ;; * files ;; * bookmarks ;; ;; Starting with Emacs 22, if you have command-line tool `exiftool' ;; installed and in your `$PATH' or `exec-path', and if the candidate ;; names either an image file or an image-file bookmark (see ;; Bookmark+), then EXIF information (metadata) about the image is ;; included. See standard Emacs library `image-dired.el' for more ;; information about `exiftool'. ;; ;; If the same candidate names a function, a variable, and a face, or ;; any two of these, then all such documentation is shown (Emacs 22 ;; and later). ;; ;; In addition to the candidate types listed above, any command that ;; uses completion can define its own candidate help action function ;; and bind it to `icicle-candidate-help-fn'. ;; ;; A command can also provide its own mode-line and tooltip help for ;; any individual candidate. See ;; (@file :file-name "icicles-doc2.el" :to "Applying Text Properties to a Candidate String"). ;; ;; For more information about the types of candidates and their ;; associated documentation, see the documentation for command ;; `icicle-help-on-candidate'. This command is bound to `C-M-RET' ;; (`C-M-return'), `C-M-mouse-2', `C-help', `C-M-help', `C-f1', and ;; `C-M-f1'. When no specific action is defined for candidates, it ;; is also bound to `C-RET' (`C-return') and `C-mouse-2'. You can ;; use this to get help on any completion candidate during ;; completion. See also the related help-cycling commands, ;; `icicle-next-candidate-per-mode-help', ;; `icicle-help-on-next-apropos-candidate', and so on, bound to ;; `C-M-down', `C-M-up', `C-M-next', `C-M-prior', `C-M-end', and ;; `C-M-home'. ;; ;; (The documentation refers to the keys that provide candidate help ;; as `C-M-RET' etc. Actually, these are only the keys by default. ;; You can customize them, using option ;; `icicle-candidate-help-keys'.) ;; ;; If you use one-buffer-per-frame (`pop-up-frames' non-`nil'), then ;; displaying `*Help*' in one frame might interfere with viewing ;; `*Completions*' in another. For that reason, the `*Completions*' ;; frame is raised to the front. Also, if user option ;; `icicle-move-Completions-frame' is non-`nil' then the ;; `*Completions*' frame is moved to the edge of the display, out of ;; the way, whenever you access help on a candidate. (Default value: ;; `right', meaning move it to the right). ;; ;;(@* "Icicles Apropos Commands") ;; ** Icicles Apropos Commands ** ;; ;; The commands described in this section can generally be thought of ;; as extensions of the traditional Emacs apropos commands. In ;; addition to what each of them does with your chosen completion ;; candidate or the current set of completion candidates, each of ;; them provides the complete documentation for the current ;; completion candidate as its candidate help (`C-M-RET', ;; `C-M-mouse-2', and so on). ;; ;;(@* "Replacements for Standard Apropos Commands") ;; *** Replacements for Standard Apropos Commands *** ;; ;; By default (see option `icicle-top-level-key-bindings'), in Icicle ;; mode the standard Emacs `apropos' commands are remapped to Icicles ;; versions. This section describes most of these commands. ;; See (@> "Value-Aware Variable-Apropos Multi-Commands") for command ;; `icicle-apropos-value', which replaces standard command ;; `apropos-value'. ;; ;; The other Icicles commands that replace standard apropos commands ;; act similarly to the standard commands, but they also let you see ;; the list of regexp matches incrementally (as with all Icicles ;; commands), using `S-TAB'. If you also use my library ;; `apropos-fn+var.el', then these Icicles commands take advantage of ;; the apropos enhancements provided by that library. ;; ;; These are the Icicles apropos commands that standard commands are ;; remapped to: `icicle-apropos', `icicle-apropos-command', ;; `icicle-apropos-function', `icicle-apropos-option', ;; `icicle-apropos-variable', and `icicle-apropos-zippy'. ;; ;; Another feature of these Icicles commands is that when more than ;; one type of object can be a candidate, candidates of a certain ;; type are shown in buffer `*Completions*' using face ;; `icicle-special-candidate'. For example, command `icicle-apropos' ;; shows function names as special candidates, to help you ;; distinguish them from variable names. ;; ;; Starting with Emacs 22, both the standard Emacs apropos commands ;; and the Icicles versions let you input a set of words (really, any ;; strings with no regexp special chars) separated by space chars, as ;; an alternative to inputting a regexp. ;; ;; However, Icicles progressive completion provides a more powerful ;; way to search with multiple words (in fact, multiple regexps) - ;; you can of course use it with the Icicles apropos commands. Also, ;; there are a few problems with the standard Emacs apropos commands, ;; with respect to interpreting your input as either a set of ;; keywords or a regexp. Because they allow two very different ;; syntaxes as input, the standard apropos commands are forced to ;; make some limiting compromises for keyword searching. ;; ;; See Also: (@> "Progressive Completion"). ;; ;;(@* "Documentation-Apropos Multi-Commands") ;; *** Documentation-Apropos Multi-Commands *** ;; ;; Icicles multi-commands `icicle-doc', `icicle-fundoc', and ;; `icicle-vardoc' provide the functionality of standard Emacs ;; command `apropos-documentation', but with additional features - ;; see (@> "Multi-Completions"). In addition, you can use ;; multi-command `icicle-plist' to find symbols with certain ;; property-list keys and values. ;; ;; Each of those multi-commands uses multi-completion candidates. ;; The candidates in each case are multi-part, with the first part ;; being the name of the symbol and the last part being its ;; documentation. For `icicle-doc' there is a middle part, which is ;; the symbol type (`FUNCTION', `VARIABLE', or `FACE'). ;; ;;(@* "Type-Aware Variable-Apropos Multi-Commands") ;; *** Type-Aware Variable-Apropos Multi-Commands *** ;; ;; The following apropos multi-commands for user options are ;; type-aware. Like the documentation-apropos multi-commands, they ;; use multi-completion candidates. In this case the first part is ;; the option name and the second part is its Customize type ;; (`defcustom' type). ;; ;; * `icicle-apropos-options-of-type' ;; * `icicle-customize-apropos-options-of-type' ;; * `icicle-describe-option-of-type' (bound to `C-h C-o') ;; ;; They all work the same way. They do something with all loaded ;; user options of a the type that you specify. The first one ;; describes an individual option, showing its doc string. The ;; second opens an Apropos buffer for all matching options. The ;; third opens a Customize buffer for them. ;; ;; These are very powerful commands, especially if you know a bit ;; about `defcustom' `:type' specifications, but even if you do not. ;; See the doc string of `icicle-describe-option-of-type' for more ;; information, especially about using a prefix argument to determine ;; how the second, `TYPE', part of the completion candidates is ;; handled. ;; ;;(@* "Value-Aware Variable-Apropos Multi-Commands") ;; *** Value-Aware Variable-Apropos Multi-Commands *** ;; ;; The following apropos multi-commands for variables are ;; value-aware. ;; ;; For the commands that follow, you are prompted first for a ;; predicate that restricts completion candidates to variables whose ;; current value satisfies it. For example, if you enter `integerp' ;; as the predicate then candidates are variables whose value is an ;; integer. ;; ;; * `icicle-apropos-vars-w-val-satisfying' ;; * `icicle-customize-apropos-opts-w-val-satisfying' ;; * `icicle-describe-var-w-val-satisfying' ;; ;; The predicate you enter is read as a Lisp sexp, but it is not ;; evaluated. It must be either a function symbol, such as ;; `integerp', or a lambda form, such as `(lambda (val) (and ;; (integerp val) (> val 500)))'. Other than the fact that it must ;; accept at least one argument (the value of a variable), it can be ;; anything you like. Individual candidate help (e.g., `C-M-RET') ;; shows you the doc string and the current value. ;; ;; Multi-command `icicle-apropos-value' is also value-aware. It lets ;; you match variables by name and value at the same time (in ;; parallel): the completion candidates are multi-completions: the ;; variable name plus its current value. ;; ;; With a prefix argument you can use `icicle-apropos-value' to ;; examine other Emacs objects and their associated information: ;; symbols plus their plists, functions plus their definitions. ;;(@* "Multi-Commands") ;; ;; Multi-Commands ;; -------------- ;; ;;(@* "What Is a Multi-Command?") ;; ** What Is a Multi-Command? ** ;; ;; A multi-command is a command that lets you make multiple input ;; choices in a single command execution: a multiple-choice command. ;; You can choose multiple items from a set of choices, using buffer ;; `*Completions*' as a multiple-choice "menu". (It's not necessary ;; to display `*Completions*', however.) Instead of asking you ;; "Which file do you want to delete?", a multi-command asks you, in ;; effect, "Which file(S) do you want to delete?". ;; ;; Nothing especially new here. Any Emacs command could be defined ;; to use an input loop, asking for file names until you do something ;; to signal that you're done inputting. It could provide for ;; file-name completion by calling `read-file-name' to read your ;; input. ;; ;; * But what if you could also filter the domain of discourse on the ;; fly, so that the candidate files were only those matching a ;; regular expression (regexp) that you typed? Then, the command ;; definition would need to provide for that behavior too. ;; ;; * And what if you could then take the complement of that set of ;; candidate file names, with respect to the complete set of files ;; in the directory? Or subtract (exclude) some set of file names ;; from the set of matching names, to get the set of possible ;; choices? ;; ;; * And what if the set of potential candidates at each step (regexp ;; match, complement, set difference) could also be displayed in a ;; multiple-choice menu? ;; ;; For such multi-command functionality you need Icicles. ;; ;; You can tell whether a command is a multi-command when you execute ;; it: if it is a multi-command, then the prompt is prefixed by `+'. ;; For example, multi-command `icicle-file' uses this prompt: ;; ;; + File or directory: ;; ;; Normal, non multi-command `find-file' uses this prompt, which has ;; no `+': ;; ;; Find file: ;; ;; Just remember that `+' means that you can choose any number of ;; inputs. ;; ;;(@* "How Does a Multi-Command Work?") ;; ** How Does a Multi-Command Work? ** ;; ;; When an Icicles multi-command prompts you for input, you can make ;; a single choice and press `RET' to confirm it, as usual, or you ;; can choose any number of completion candidates, using `C-RET' ;; (`C-return') or `C-mouse-2' for each. ;; ;; (The documentation refers to the key that acts on a completion ;; candidate as `C-RET'. Actually, it is this only by default. You ;; can customize it, using option `icicle-candidate-action-keys'.) ;; ;; You can thus act on multiple candidates, or even multiple times on ;; the same candidate, during the same execution of the command. ;; ;; But you do not have to - you can use any multi-command just as if ;; it were a normal, single-choice command. ;; ;; For example, command `icicle-delete-file' lets you delete a single ;; file or a set of files that match your minibuffer input - all in ;; the same command execution. If you type no input, then all files ;; in the current directory match, and you can delete any number of ;; them individually. If you type `~$' and hit `S-TAB' ;; (`icicle-apropos-complete'), then all files that end in `~' match, ;; and you can delete any number of them. Similarly, command ;; `icicle-buffer-other-window' lets you display any number of ;; buffers, and so on. ;; ;; You make multiple choices this way by cycling through the ;; candidate completions, as usual, and hitting `C-RET' whenever you ;; want to choose (act on) the current cycle candidate. Or just ;; press and hold Control while clicking each chosen candidate with ;; `mouse-2'. ;; ;; Similarly, you can use `C-down', `C-up', `C-next', `C-prior', ;; `C-end', or `C-home' to act on successive candidates, forward or ;; backward. You can thus just hold down the Control key while ;; cycling, to act on each candidate in turn, if you want. ;; ;; Instead of, or in addition to, cycling, you can use completion to ;; get to a particular candidate you want. No matter how a candidate ;; is made current, you can choose the current candidate (perform the ;; action on it) using `C-RET' or `C-mouse-2'. ;; ;; For lax (permissive) completion, you can use `C-RET' to act on ;; *any* input text - you need not choose one of the available ;; candidates. This means, for example, that you can create any ;; number of new file buffers with a single `C-x C-f' invocation, as ;; well as open any number of existing files. ;; ;; As always, hitting `RET' (or `S-RET') ends the command. For most ;; multi-commands, hitting `RET' performs the same action as `C-RET', ;; but it is possible to have a command that acts differently for ;; `RET' and `C-RET'. That is the case, for instance, when help is ;; displayed via `C-RET'. ;; ;; You can use `C-RET' or `C-mouse-2' repeatedly to act multiple ;; times on the same candidate. A shortcut is to use `C-u' with ;; `C-RET' or `C-mouse-2'. That will work if the candidate action ;; function is designed to be `C-u' sensitive. This is the case for ;; the Icicles multi-commands that read the name of a command or ;; keyboard macro and execute the command or macro: ;; `icicle-execute-extended-command' (`M-x'), `icicle-kmacro' ;; (`S-f4'), and `icicle-execute-named-keyboard-macro' (`C-x M-e'). ;; ;; So for example, if you use `C-u 10 C-RET' on command ;; `forward-char' during `M-x' command completion, the cursor ;; advances 10 characters. Another example: `C-x M-e C-u 200 C-RET' ;; on a keyboard-macro candidate `foo' executes `foo' 200 times. You ;; can use all of the numeric prefix argument shortcuts, such as ;; `M--', `M-7', and `C-6', with the exception of `C--', which has a ;; different meaning (`icicle-candidate-set-difference') in the ;; Icicles minibuffer. ;; ;; Note that you can supply a prefix argument for both the ;; multi-command and any of its individual actions. The command is ;; free to interpret these differently. For example, a prefix arg ;; for `icicle-kmacro' provides a default repeat factor, which can ;; then be overridden for any individual action by providing a ;; different prefix arg. ;; ;; As another example, a prefix arg used with any completion ;; candidate for command `icicle-find-file-no-search' visits the file ;; in read-only mode. But a prefix arg for the command itself ;; reverses this effect: read-only becomes the default so that a ;; prefix arg for a given candidate means that the visited file ;; buffer is writable. ;; ;; If user option `icicle-use-candidates-only-once-flag' is ;; non-`nil', then, when you act on a candidate, it is removed from ;; the list of available candidates, for clarity. Commands where ;; this behavior is appropriate bind this option to a non-`nil' ;; value. This is a user option, but you normally will not customize ;; it. ;; ;; You can use `C-g' to exit a multi-command at any time, without ;; making a final choice using `RET'. If the actions performed by a ;; multi-command are easily reversible, `C-g' will often restore ;; things to the way they were before performing the actions. ;; ;; Does this `C-RET' stuff sound familiar? Using a multi-command is ;; similar to accessing help on a candidate ;; (see (@> "Get Help on Completion Candidates")). A multi-command ;; is any command that has a special action defined for use with ;; `C-RET' (command `icicle-candidate-action') on the current cycle ;; candidate. If no such special action is defined, then help on the ;; candidate is displayed - displaying help is just the default ;; action for `C-RET', used when no other action is defined. You can ;; always access candidate help using the `C-M-' prefix: `C-M-help', ;; `C-M-f1', `C-M-RET', `C-M-mouse-2', `C-M-down', `C-M-up', ;; `C-M-next', `C-M-prior', `C-M-end', and `C-M-home'. ;; ;; You can also cycle among elements of a set, performing actions, if ;; you use my libraries `doremi.el', `doremi-cmd.el', and ;; `doremi-frm.el'. Like Icicles, Do Re Mi lets you see the effect ;; of a choice immediately, whenever you make changes. Each library ;; has its own advantages and special uses. Advantages of Icicles ;; include: ;; ;; - completion to candidate values ;; - restoration after making changes, letting you preview changes ;; without actually applying them ;; ;; See Also: ;; ;; * (@> "More about Multi-Commands") for more about using ;; multi-commands. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Defining Icicles Commands (Including Multi-Commands)") ;; for how to define your own multi-commands. ;; ;; * (@> "Moving Between the Minibuffer and Other Buffers"). ;;(@* "Multi-Completions") ;; ;; Multi-Completions ;; ----------------- ;; ;; This section is about using completion candidates that are ;; composed of more than one part: strings that you can complete ;; against separately and simultaneously. ;; ;;(@* "Icicles Multi-Completion Commands") ;; ** Icicles Multi-Completion Commands ** ;; ;; Have you ever used standard Emacs command `apropos-documentation'? ;; It searches the doc strings of all Emacs-Lisp symbols for matches ;; to an input regexp, and displays the hits. It can be useful when ;; you do not remember the name of a function or variable but you can ;; guess at terms that might occur in its doc string. Typically, ;; people resort to it only after first trying apropos commands that ;; match against the function or variable name. ;; ;; The idea behind `apropos-documentation' also motivates Icicles ;; command `icicle-doc'. This is a multi-command (see ;; (@> "Multi-Commands")), so you can use `C-RET' and `C-next' to ;; browse the regexp matches, displaying the documentation of each ;; match in turn, and you can change the regexp to get different ;; matches during the same command invocation. ;; ;; Like `apropos-documentation', `icicle-doc' lets you match a regexp ;; against the doc strings of symbols such as functions, variables, ;; and faces. You can of course use progressive completion to match ;; multiple regexps. Here, for example, is a query that shows all ;; doc strings (functions, variables, faces - a lot! of doc strings) ;; that match both `mail' and `mode line', in either order, as ;; completion candidates: ;; ;; M-x icicle-doc RET mail S-SPC mode line ;; ;; You cannot do that with vanilla Emacs `apropos-documentation' or ;; with any other vanilla Emacs `apropos*' command. ;; ;; Commands `icicle-vardoc', `icicle-fundoc', and `icicle-plist' are ;; similar to `icicle-doc' in the kind of functionality they provide. ;; ;; Each of these commands gathers a tremendous amount of information ;; to construct an initial set of completion candidates based on all ;; existing Emacs symbols (in the standard `obarray'). This is ;; time-consuming. Since the set of symbols that have property lists ;; or that name functions, variables, or faces changes little, you ;; can optionally bypass this gathering and reuse the last initial ;; set of candidates for that command. You do this by invoking the ;; command using a prefix argument (non-negative prefix arg, for ;; `icicle-vardoc' and `icicle-plist'). ;; ;; Each of these particular commands also uses Icicles ;; multi-completion. A "multi-completion" is a completion candidate ;; that has multiple parts. A multi-completion command lets your ;; input match any or all parts individually, at the same time (in ;; parallel). ;; ;; With commands that provide multi-completion candidates, you use ;; apropos completion (`S-TAB'), not prefix completion (`TAB'), at ;; least whenever your input pattern tries to match other than just ;; the first multi-completion part. ;; ;; * Commands `icicle-vardoc' and `icicle-fundoc' let you match both ;; the function or variable name and the doc string. ;; ;; * Command `icicle-doc' lets you match any combination of the ;; following: ;; ;; - the function, variable, or face name ;; - the type: FUNCTION, VARIABLE, or FACE (uppercase) ;; - the doc string ;; ;; * Command `icicle-plist' lets you match both a symbol name and its ;; property list. You can use it to find symbols with certain ;; property-list keys or values. By default (for Emacs 22 or ;; later), plists are pretty-printed (in `*Help*' and ;; `*Completions*'), but if you use a negative prefix argument then ;; pretty-printing is skipped, gaining a little time. ;; ;; * Commands `icicle-describe-option-of-type' (bound to `C-h C-o' in ;; Icicle mode), `icicle-apropos-options-of-type', and ;; `icicle-customize-apropos-options-of-type' each let you match ;; both an option name and the option's `defcustom' type ;; definition. There are several ways to match type definitions, ;; controlled by the prefix argument. You can match a type ;; directly or taking type inheritance into account. You can match ;; a type as a sexp or using a regexp. You can match a type ;; expression or match the option's current value against a type. ;; See (@> "Type-Aware Variable-Apropos Multi-Commands"). ;; ;; Icicles file-name commands that use multi-completion include ;; `icicle-locate-file', `icicle-locate-file-other-window', ;; `icicle-recent-file', and `icicle-recent-file-other-window'. ;; These commands let you match against two-part multi-completion ;; candidates that are composed of an absolute file name and the ;; file's last modification date. This means that you can easily ;; find those notes you took sometime last week... ;; ;; The way multi-completion commands work is a bit inelegant perhaps, ;; and it can take a little getting used to, but it is quite powerful ;; and lets you do things with completion that are otherwise ;; impossible. ;; ;; In the case of commands that use two-part multi-completions, you ;; provide two patterns as input, one to match the name of a symbol ;; (e.g. a function or variable) and one to match some associated ;; information (doc string, property list, or type definition). ;; ;; However, since completion candidates are not actually multipart, ;; you in fact type a single pattern that is the concatenation of the ;; two. You join these two regexps using `icicle-list-join-string' ;; (a user option), which, by default, is `^G^J', that is, a ;; control-G character followed by a control-J (newline) character. ;; As always, you can input control characters using `C-q', so to ;; input `^G^J' you can use `C-q C-g C-q C-j'. ;; ;; However, in Icicles, `C-j' (newline) is self-inserting during ;; completion, so you do not need to quote it with `C-q' - you can ;; use just `C-q C-g C-j'. Better yet, you can use `C-M-j' ;; (`icicle-insert-list-join-string') to insert `^G^J'. ;; ;; This has the added benefit (in Emacs 22 or later) of hiding the ;; `^G' - it's there, but you do not see it. This hiding is only ;; cosmetic; you still match the characters `^G' and `^J'. In the ;; same way, Icicles hides the `^G' part of `^G^J' in ;; `*Completions*', so the join string appears as a newline ;; character. ;; ;; This hiding of `^G' happens only when option ;; `icicle-list-join-string' has its (ugly but useful) default value. ;; If not seeing the join string confuses you and you would prefer to ;; distinguish multi-completion part separators from ordinary newline ;; characters, then customize `icicle-list-join-string' - just remove ;; the following from the Lisp sexp that defines the default value: ;; ;; (set-text-properties 0 1 '(display "") strg) ;; ;; As an example of using a multi-completion command, you can use the ;; following to match a function name that contains `dired' and its ;; doc string that contains `file': ;; ;; M-x icicle-fundoc dired^G^Jfile S-TAB ;; ;; That is, you type this: ;; ;; M-x icicle-fundoc dired C-q C-g C-j file S-TAB ;; ;; or this: ;; ;; M-x icicle-fundoc dired C-M-j file S-TAB ;; ;; Well, almost. The way it actually works is that the completion ;; candidates are themselves formed by concatenating symbol names ;; with their doc strings, using `icicle-list-join-string'. Your ;; input regexp is matched against those candidates. This means that ;; the input regexp `dired^G^Jfile' would actually match only ;; function names that *end* with `dired' and doc strings that ;; *begin* with `file'. ;; ;; To match `file' against any part of the doc string, you must ;; explicitly link the two component regexps with a regexp that ;; matches anything. If you want to search only the first lines of ;; doc strings, you can use `.*' to do that: `dired.*^G^J.*file' will ;; match all functions whose names contain `dired' and whose doc ;; strings' first lines contain `file'. ;; ;; Why only the first lines? Because `.' matches any character ;; except a newline - it does not look past the first line. If you ;; want to search the entire doc strings (or property lists, for ;; `icicle-plist'), then you need to use a connecting regexp that ;; matches any character, including a newline. That means a regexp ;; such as `\(.\|\n\)'. Or you can just use the Icicles multi-line ;; dot feature - see (@> "Dot, Dot, Dot"). ;; ;; Without a multi-line dot, you would use something like this to ;; search whole, multi-line doc strings for `file': ;; ;; M-x icicle-fundoc dired.*^G^J\(.\|\n\)*file S-TAB ;; ;; That is, you would type (without the spaces): ;; ;; M-x icicle-fundoc dired.* C-M-j \ ( . \ | C-j \ ) * file S-TAB ;; ;; With a multi-line dot, you would type just this: ;; ;; M-x icicle-fundoc dired.* C-M-j . * file S-TAB ;; ;; What if you want to match, say, `file' in either the function name ;; or the doc string, not necessarily both? Remember that a ;; multi-completion is in fact a single string, with a separator such ;; as `^G^J' in the middle somewhere. Because it is a single string, ;; the simple minibuffer input `file' matches the substring `file' ;; anywhere in the multi-completion. So the answer is just this: ;; ;; M-x icicle-fundoc file S-TAB ;; ;; Even this simple command expression combines the effect of Emacs ;; commands `apropos-function' with that of `apropos-documentation'. ;; ;;(@* "Mode-Line Lighter Indication of Multi-Completion") ;; ** Mode-Line Lighter Indication of Multi-Completion ** ;; ;; Whenever multi-completion candidates are available, the `Icy' ;; minor-mode lighter has the suffix `||' (think "parallel") appended ;; to it. You can see this lighter at the left of the mode line of ;; buffer `*Completions*' or in the minor-mode part of other mode ;; lines. ;; ;;(@* "How Multi-Completions Work") ;; ** How Multi-Completions Work ** ;; ;; These commands that accept a multipart regexp are examples of ;; Icicles multi-completion. Icicles extends standard function ;; `completing-read' so that it will accept, as the set of completion ;; candidates, an alist argument whose candidates are not only ;; individual strings but can also be lists of strings. Each string ;; in the list is one part of a multipart completion candidate, that ;; is, a multi-completion. The strings are joined together pairwise ;; using `icicle-list-join-string' by `completing-read'. Commands ;; `icicle-fundoc' and`icicle-vardoc' each use lists of two strings ;; (name and doc), but a multi-completion can have any number of ;; strings. ;; ;; Why is the default value of `icicle-list-join-string' so odd: ;; `^G^J'? You can use any string you like, but here is the ;; rationale behind the default choice: ;; ;; - ^G does not normally occur in simple strings such as doc strings ;; - a newline (^J) visually separates the multiple component strings ;; - ^G^J is not too difficult to enter: `C-M-j' or `C-q C-g C-j' ;; ;; It is important that the value of `icicle-list-join-string' not be ;; something that is, itself, likely to match any of the candidates. ;; Otherwise, it would not serve its role as separator. ;; ;; I find that it helps a bit (in Emacs 22 or later) to customize ;; face `escape-glyph', which is used for control characters such as ;; `^G', in such a way that it stands out a bit, especially because ;; control characters can be used in regexps that also use `^' as a ;; special character. I use an orange background with a blue ;; foreground for this face. ;; ;;(@* "Multi-Completions Let You Match Multiple Things in Parallel") ;; ** Multi-Completions Let You Match Multiple Things in Parallel ** ;; ;; Consider the command `describe-option-of-type', defined in my ;; library `help-fns+.el' (or `help+.el', for Emacs 20). This lets ;; you first pick a `defcustom' type using completion and then pick ;; an option of that type to describe. There are two separate, ;; sequential acts of completion. For each completion act, your ;; current input defines a set of matches. You can see all option ;; types that match, say, the regexp `.*string', which means all ;; types that contain `string'. After you choose one of those types, ;; you can see all options of that type whose names start with ;; `icicle' and then pick one. ;; ;; You can thus tweak the type regexp to filter types, and you can ;; tweak the name regexp to filter option names. And you can of ;; course use progressive completion to whittle down either set of ;; matches, piecemeal. ;; ;; What you cannot do, however, using `describe-option-of-type' is ;; filter both sets at the same time: narrow down the set of type ;; matches and name matches simultaneously. For that, you need ;; Icicles multi-completion. Without it, you must commit 100% to a ;; type before you can choose among the options of that type. With ;; it, you can change the type (or the name) part of your input ;; regexp on the fly, and see immediately the set of matching names ;; (or types) as well. ;; ;;(@* "Multi-Completions vs `completing-read-multiple'") ;; ** Multi-Completions vs `completing-read-multiple' ** ;; ;; Note that there is (only) a superficial similarity between Icicles ;; multi-completion and the functionality provided by function ;; `completing-read-multiple' of standard Emacs library `crm.el'. ;; The latter lets you complete multiple strings in the minibuffer, ;; one at a time. It involves only vanilla Emacs completion, and it ;; uses the same set of completion candidates for each of the strings ;; in the input. ;; ;; By contrast, Icicles multi-completion completes each part of your ;; input against a different set of completion candidates. For ;; example, when you use `icicle-vardoc', it completes the ;; variable-name part of your input against the names of defined ;; variables, and the variable-description part against the doc ;; strings of defined variables. Standard Emacs command ;; `completing-read-multiple' lets you complete several different ;; variable names at the same minibuffer prompt, but they each ;; complete against the same set of variable names. ;; ;; Multi-completion matches a list of regexps in parallel. See also ;; the descriptions of `M-*' and `S-SPC', which match a list of ;; regexps in series: (@> "Progressive Completion"). You can combine ;; these features, of course. ;; ;;(@* "Sorting Candidates by Their Second Part") ;; ** Sorting Candidates by Their Second Part ** ;; ;; Most multi-completions have two parts. Typically, the first part ;; is the main part, that is, the part that you will most frequently ;; complete against. Many candidate sort orders involve some flavor ;; of alphabetic order, and this means alphabetizing first with ;; respect to the first multi-completion part. ;; ;; However, it can sometimes be convenient to sort instead by the ;; second part first. That is what the Icicles sort order "by 2nd ;; parts alphabetically" is for. You can use it, for example, with ;; command `icicle-locate-file' to sort file-name candidates first by ;; date, and then by file-name for the same date. This gives you an ;; easy way to look up files that you modified during a given time ;; period. For example, your input regexp can limit candidates to ;; those files last modified sometime in July, 2008, and you can then ;; access these chronologically (by cycling or in buffer ;; `*Completions*'). And do not forget that you can always reverse ;; the current sort order, using `C-N C-,' where N is an integer. ;; ;;(@* "Multi-Completions with a Part You Never See") ;; ** Multi-Completions with a Part You Never See ;; ;; Some multi-commands, such as `icicle-buffer' (`C-x b'), and ;; `icicle-file' (`C-x C-f'), `icicle-visit-marked-file-of-content' ;; (`C-F' in Dired), and `icicle-Info-goto-node' (`g' in Info), do ;; not show the second part of multi-completion candidates in ;; `*Completions*', because it would just be distracting. The point ;; of such commands is to access a named container (buffer, file, or ;; node), and the optional second multi-completion part matches the ;; entire container content (the buffer, file, or node text). ;; ;; See (@> "Chapter & Verse: Searching Named Containers") for more ;; about this. ;; ;; See Also: ;; ;; * (@> "Multi-Commands") ;; * (@> "Chapter & Verse: Searching Named Containers") and ;; (@> "Match File Names and File Content Too") for information ;; about commands that find containers such as files, buffers, and ;; Info nodes by name and by content ;; * (@> "Programming Multi-Completions") for information about ;; changing the appearance and behavior of Icicles ;; multi-completions using Emacs-Lisp code. ;; * (@> "Sorting Candidates and Removing Duplicates") ;; * (@> "Progressive Completion") ;;(@* "Chapter & Verse: Searching Named Containers") ;; ;; Chapter & Verse: Searching Named Containers ;; ------------------------------------------- ;; ;; Some Icicles multi-commands, such as `icicle-buffer' (`C-x b'), ;; `icicle-file' (`C-x C-f'), `icicle-visit-marked-file-of-content' ;; (`C-F' in Dired), and `icicle-Info-goto-node' (`g' in Info), ;; access containers of text (buffer, file, or Info node) by name. ;; ;; When this is the case, Icicles provides multi-completion ;; candidates, the first part being the container name and the second ;; part being the entire content of the container with that name (the ;; buffer, file, or node text). ;; ;; You can think of these as "chapter-&-verse" commands: you name a ;; chapter or you search for a verse among chapters. Or you do both ;; at the same time, searching particular chapters for particular ;; verses. ;; ;; The second multi-completion part (the verse, or content) is never ;; shown in `*Completions*', and you can ignore it altogether if you ;; want. If you do not use `C-M-j' and then type a content-matching ;; pattern, then no content-searching occurs, which is of course ;; quicker than searching lots of text. ;; ;; But if the container (chapter) names are not enough to help you ;; locate some information, then you can search the content instead. ;; Or you can match both at the same time: one pattern for the name ;; and another for the content. Each pattern is optional. ;; ;; When you search using a chapter-&-verse command, all you care ;; about is whether the content matches your input. Icicles looks ;; for only one content match in a given container. In other words, ;; the second part of your input just filters candidates, retaining ;; only those containers whose contents match. ;; ;; This is a powerful and unique way to search. Of course there are ;; commands, such as `grep', that act similarly, but they are ;; generally not incremental: letting you change name and/or content ;; pattern on the fly as you see the corresponding matches. ;; ;; Icicles search (e.g., `C-c `') has some similarities. It lets you ;; first choose a set of files or buffers to search, then it shows ;; you the search hits as you change your content-matching pattern. ;; But you cannot change the set of containers to search ;; incrementally: you choose them at the outset once and for all, ;; before you start to search. ;; For Icicles search commands the emphasis is thus on the content ;; search. For Icicles chapter-&-verse commands the emphasis is not ;; on searching; the aim is just to identify and go to a given ;; container. Searching is just one way to find the right container. ;; ;; Chapter-&-verse commands access a container in the same way, ;; whether or not they have search it contents. They do not move to ;; any search-hit location. For instance, `icicle-file' simply ;; visits the chosen file, just as `find-file' would do. ;; ;; But you can search the container once you visit it, using `C-M-s' ;; or `C-M-r' (regexp Isearch). Whenever a content search is ;; successful the search pattern is added to `regexp-search-ring' ;; when you hit `S-TAB'. So when the chapter-&-verse command is ;; finished you can immediately search for content matches ;; incrementally. ;; ;; (You can also work in the other direction, reusing an Isearch ;; regexp as a content-matching regexp. See ;; (@> "Using Completion to Insert Previous Inputs: `M-o'").) ;; ;; This on-the-fly, on-demand content-matching can be quite handy. ;; But as a general rule it is a good idea to first narrow down the ;; set of candidates by matching container names before you set off ;; to also search content. Otherwise, if you have many or large ;; containers with no content matches then you will waste time ;; searching unnecessarily. It is also generally a good idea to ;; temporarily turn off Icicles incremental completion and Icomplete ;; mode when you search container content. ;; ;; See Also: ;; ;; * (@> "Multi-Completions") ;; * (@> "Match File Names and File Content Too") ;; * (@> "Content-Matching Pattern as Isearch Regexp") ;;(@* "Dot, Dot, Dot") ;; ;; Dot, Dot, Dot ;; ------------- ;; ;; This section is about dot, that is, `.', and its role as a regexp ;; special character in apropos completion. ;; ;; Since the inception of regular-expression matching, `.' has ;; matched any character *except* a newline character (aka `^J', aka ;; `C-j'). Recent languages typically have an additional mode in ;; which `.' can match any character, including a newline. See, for ;; example, http://www.regular-expressions.info/dot.html and this ;; language comparison for regexp features: ;; http://www.regular-expressions.info/refflavors.html. ;; ;; It is not unusual to manipulate multi-line completion candidates ;; in Icicles, in which case it can be handy to let `.' match any ;; character, including a newline. For this and more general ;; reasons, I long ago requested such a mode for Emacs, but there was ;; little interest in implementing it. In Emacs, dot never matches a ;; newline. Too bad. ;; ;; The regexp `\(.\|[\n]\)' is good enough, of course: it matches any ;; character: any character any except newline, plus newline. But it ;; is a bit unwieldly, especially when used within a larger regexp, ;; and especially if used more than once in the same regexp. ;; Interactively, you input the `\n' using `C-j', and it appears in ;; the minibuffer as a newline character; that is, it creates another ;; line of input. ;; ;; For convenience in multi-line matching, I added a *multi-line ;; dot*, or dot-matches-newline-too, hack to Icicles. This feature ;; is turned off, by default. You can toggle it on/off, using ;; command `icicle-toggle-dot' (aka `icicle-toggle-.'), which is ;; bound to `C-M-.' in the minibuffer during completion. ;; ;; When this is turned on, `.' is highlighted in the minibuffer ;; (using face `highlight'), and it matches newlines also. In fact, ;; although it appears as just a highlighted dot, the ugly regexp ;; `\(.\|[\n]\)' (the value of constant `icicle-anychar-regexp') is ;; really used, under the covers. Icicles takes care of things so ;; that you can edit normally (delete and transpose characters, ;; etc.): A multi-line `.' acts just like a normal, single character, ;; even though it is really a string of ten characters. ;; ;; If you prefer to see the full regexp, `\(.\|[\n]\)', but ;; highlighted, then set option `icicle-dot-show-regexp-flag' to ;; non-`nil'. (In Emacs 20, the newline-matching dot is always shown ;; as that full regexp.) And remember that you can use multi-command ;; `icicle-toggle-option' anytime to toggle the option. If you ;; prefer to turn on newline matching by default, then just customize ;; option `icicle-dot-string'. ;; ;; This match-anything dot is handy, but sometimes you might want to ;; match anything except a newline, perhaps in the same input pattern ;; where you also want to match any character (possibly a newline) at ;; other positions. How can you get the plain dot behavior, when ;; multi-line dot is turned on? ;; ;; One way is just to use a regexp that matches anything except ;; newline: `[^\n]' (which you input using `[ ^ C-j ]'). Another way ;; is to use a plain prefix argument: `C-u .'. (A numeric prefix ;; argument N inserts N multi-line dots, each of which matches any ;; single character.) ;; ;; `C-u' flips the behavior of `.' when you hit it: If by default `.' ;; enters a multi-line dot, then `C-u .' enters a plain dot. If by ;; default `.' enters a plain dot, then `C-u .' enters a multi-line ;; dot. So `C-u' also gives you a way to enter a one-off multi-line ;; dot, if you prefer to generally have `.' not match a newline. ;; Either way, what you see in the minibuffer is the single character ;; `.', highlighted if it is a multi-line dot, unhighlighted if it is ;; a plain dot. ;; ;; Multi-line dots are converted to plain dots automatically when you ;; use prefix completion. And if you then move back to apropos ;; completion during the same completion operation, you get back any ;; multi-line dots you had before, and any plain dots that you ;; entered before remain plain. ;; ;; So when is a multi-line dot useful? Whenever you want to match ;; against multi-line candidates. Typical use cases include ;; `icicle-search' and the Icicles doc commands, `icicle-vardoc', ;; `icicle-fundoc', and `icicle-doc'. ;; ;; Note that the dot-matching behavior described here applies only to ;; matching minibuffer input against completion candidates. It does ;; not mean that whenever you type `.' in the minibuffer it is ;; interpreted specially. For example, when you input (using `RET') ;; a regexp as the context pattern for Icicles search, a `.' has its ;; usual meaning in Emacs regexps - it does not match newlines. ;; ;; If you want a regexp that you input (using `RET') to match any ;; character including a newline, then you can use `C-u C-= ;; icicle-anychar-regexp' to insert the proper string explicitly. ;; You can shorten this to just `C-=' if you use command ;; `icicle-save-string-to-variable': ;; ;; M-x icicle-save-string-to-variable C-u C-= icicle-anychar-regexp ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Using Regexps with Icicles Search") ;; * (@> "Inserting a Regexp from a Variable or Register") ;;(@* "More about Multi-Commands") ;; ;; More about Multi-Commands ;; ------------------------- ;; ;; A multi-command is any command that uses input completion and lets ;; you perform actions on any number of individual completion ;; candidates without exiting completion. See (@> "Multi-Commands"). ;; ;; The default action is invoked on the current candidate by `C-RET' ;; (`icicle-candidate-action'). There are three other kinds of ;; actions on individual candidates: ;; ;; * alternative actions, invoked by `C-S-RET' (`C-S-return') ;; * deletion actions, invoked by `S-delete' ;; * help actions, invoked by `C-M-RET' (`C-M-return') ;; ;; A given command can define any combination of these four kinds of ;; actions: none of them, any one of them, any two of them, any three ;; of them, or all four kinds. ;; ;; This section provides information about alternative actions and ;; deletion actions. ;; ;; See Also: ;; ;; * (@> "Get Help on Completion Candidates") for information about ;; using candidate help. ;; * (@file :file-name "icicles-doc2.el" :to "Defining Multi-Commands the Hard Way") ;; for information about defining a custom candidate-help action ;; for a command. ;; ;;(@* "Alternative Actions") ;; ** Alternative Actions ** ;; ;; Just as you can use `C-RET', `C-mouse-2', `C-next', and so on to ;; invoke a command's default action on multiple completion ;; candidates individually, so you can use `C-S-RET' ;; (`icicle-candidate-alt-action'), `C-S-mouse-2', `C-S-next', and so ;; on to invoke an alternative action that is associated with the ;; command. If the main action of a command `my-find-file' is to ;; visit a file, and the alternative action is to print a file, then ;; you can use `C-S-RET' to print one or more files on the fly, even ;; as you are completing the name of a file to be visited. ;; ;; Keys `C-|' and `M-|' apply the alternative action defined for a ;; given multi-command to *all* matching candidates at once. (In the ;; same way, `C-!' and `M-!' apply the main action defined for it to ;; all candidates - see (@> "Choose All Completion Candidates").) ;; ;; For example, in Icicles search (e.g. `C-c `'), the alternative ;; action (e.g. `C-S-RET') replaces all or part of the current search ;; hit, and `M-|' does the same for all search hits. ;; ;; It is the particular command that defines its alternative action. ;; Some commands define no such action. Some commands, as their ;; alternative action, prompt you to choose (using completion) a ;; function to be applied to the current completion candidate. In ;; this case, a single alternative action effectively provides a set ;; of possible actions. ;; ;; To achieve this, such commands use the value of user option ;; `icicle-type-actions-alist', which associates lists of possible ;; functions with specific candidate types. For example, for ;; file-name candidates, you can choose among functions that act on ;; file names. ;; ;; Choosing such a function to apply is itself a multi-command ;; operation. You can thus apply any number of functions to any ;; number of candidates. ;; ;; For example, while you are using `C-x C-f', you can, say, print ;; one or more candidate files on the fly, or invoke a shell command ;; on selected files, or byte-compile them... This is a particularly ;; handy feature, especially if you customize ;; `icicle-type-actions-alist' for your own particular use. ;; ;; Some such functions you can choose produce no side effect; they ;; simply return a value. But if you use `C-u' before `C-S-RET', ;; then the result of applying the function is pretty-printed (in the ;; echo area or buffer `*Pp Eval Output*'). For example, if you use ;; `C-x C-f', you hit `C-u C-S-RET' on the candidate file name ;; `icicles-doc1.el', and you choose the function candidate ;; `file-attributes' at the completion prompt `How (action): ', then ;; the properties of the candidate file (`icicles-doc1.el') are ;; displayed. With just `C-S-RET' (no prefix arg), the list of ;; properties is computed, but not displayed. ;; ;; Be aware of this gotcha: The alternative action for commands that ;; use `icicle-type-actions-alist' prompts for a function. If you ;; want to apply that function to all current completion candidates, ;; then you must use `M-|', not `C-|', because `C-|' prompts you for ;; each candidate. `M-|' is designed to do the right thing here: it ;; prompts you once for the function to apply, and then applies it to ;; each of the current candidates. And you can filter the set of ;; current candidates (progressive completion and so on), or retrieve ;; a saved set of candidates to operate on. ;; ;; Note that completion while you choose a function to apply is lax. ;; This means that you can really enter any function, including a ;; lambda expression that you invent on the fly. Of course, the ;; function must accept an object of the appropriate type, (but it ;; need not actually use that argument). ;; ;; Using a lambda expression here is a good way to curry a function ;; that requires multiple arguments, so that it adapts to expect just ;; a single argument of the appropriate object type. For example, ;; (lambda (sym-name) (get (intern sym-name) 'invisible)) transforms ;; function `get', which takes a symbol and a property as arguments, ;; to a function that takes a symbol name and looks up the ;; `invisible' property of the symbol. ;; ;; Option `icicle-type-actions-alist' is predefined with a number of ;; candidate types (buffer, color, command, face, file, frame, ;; function, option, process, variable, and window) and their ;; associated action functions, but you can add new types or modify ;; their associated function lists. Any Emacs-Lisp functions can be ;; used, including lambda expressions. But each function must accept ;; a value of the appropriate type as its sole required argument ;; (additional, optional arguments are OK). ;; ;; Sometimes, you might want to define your own alternative action ;; function for some command. Do this if you always want the same ;; alternative action, and it is not the predefined one. To do this, ;; just customize option `icicle-alternative-actions-alist'. The ;; associations defined by this option always override any predefined ;; alternative actions for the corresponding commands. ;; ;; An alternative to using option `icicle-alternative-actions-alist' ;; is to define a new command, wrapping an existing command with a ;; `let' binding that defines the action you want. I recommend using ;; the option instead, but you might sometimes prefer this approach. ;; For example: ;; ;; (defun my-icicle-find-file (f) ;; "`icicle-find-file', but with `w32-browser' as the alt action." ;; (interactive ;; (let ((icicle-candidate-alt-action-fn 'w32-browser)) ;; (list (read-file-name "File: ")))) ;; (icicle-find-file f)) ;; ;; If you are familiar with Icicles object-action commands (see ;; (@file :file-name "icicles-doc2.el" :to "Icicles OO: Object-Action Interaction")), ;; then this idea of choosing an object (completion candidate) and ;; then choosing a function to act on it will ring a bell. And just ;; as for the object-action commands, here too Icicles exploits any ;; object-action associations ("sources" and "types") defined by ;; library Anything (`anything.el'), if you happen to use that, in ;; addition to the associations defined by ;; `icicle-type-actions-alist'. And when you do use the Icicles ;; object-action commands, the same behavior is available as for ;; alternative actions. ;; ;; You might have noticed, above, that a type/actions association is ;; predefined for type `function'. Since the actions you can choose ;; are themselves functions, you can even use `C-S-RET' on one of ;; them, to apply a function-for-functions (e.g. `find-function' or ;; `symbol-function') to it. This is a curiosity, but it can ;; sometimes be useful. ;; ;; Finally, note that the completion candidate to which you apply an ;; alternative action is in most cases a string. In some cases, the ;; alternative action functions expect a non-string object, and they ;; will raise an error if applied to a string. ;; ;; Icicles takes care of this in the case of buffer-name candidates. ;; It assumes that you really want to operate on a buffer, not its ;; name (a string), so it automatically calls `get-buffer' before ;; applying the alternative action function. ;; ;; See Also: ;; ;; * (@> "Perform Alternative Operations on the Fly") ;; * (@file :file-name "icicles-doc2.el" :to "Icicles OO: Object-Action Interaction") ;; * (@file :file-name "icicles-doc2.el" :to "Search and Replace") ;; * (@> "Choose All Completion Candidates") ;; ;;(@* "Deleting Objects") ;; ** Deleting Objects ** ;; ;; When it is defined for a particular command, minibuffer command ;; `icicle-delete-candidate-object', bound to `S-delete' (that's the ;; `delete' key, Shifted), deletes the object or objects named by the ;; completion candidate on which it operates. (At least that is the ;; default behavior - if you customize `icicle-deletion-action-flag' ;; to `nil', then `S-delete' has no effect.) ;; ;; Which objects are thus targeted by a given candidate (name) is ;; something that must be defined by the particular command. The doc ;; string of a command should always indicate the effect of using ;; `S-delete', if a deletion action is defined. ;; ;; As an example of a deletion action, Icicles command ;; `icicle-buffer-other-window', bound to `C-x 4 b', opens buffers ;; named by the individual candidates you act on, using `C-RET'. But ;; it also lets you kill any buffer that you act on, using ;; `S-delete'. This is not the alternative action for the command ;; (which is bound to `C-S-RET'); it is the deletion action. ;; Similarly, command `icicle-bookmark' jumps to a bookmark, but you ;; can also use `S-delete' with it to delete individual bookmarks. ;; ;; When you use `S-delete' with a command that allows duplicate ;; candidate names that represent different candidate objects, it ;; deletes only the object associated with the current candidate ;; (name). ;; ;; Some multi-commands define a deletion action, so that `S-delete' ;; works; some do not. Consult the doc for any given command to see ;; if it does. Whenever it is defined, the meaning of "delete" ;; depends on the particular command you use. ;; ;; `S-delete' deletes only the objects named by the current ;; completion candidate. However, with a prefix argument, it deletes ;; *ALL* objects named by the current set of completion candidates, ;; after you confirm that this is really what you want to do. This ;; is a quick way to delete things whenever `S-delete' is available: ;; Use input patterns, with progressive completion, chipping away, ;; and so on, to define the candidates to delete, then use `C-u ;; S-delete' and confirm their deletion. Bye-bye. ;; ;; Do not confuse the unshifted `delete' key with `S-delete'. ;; `delete' does not delete any objects; it just removes a completion ;; candidate so that you cannot complete to it. `S-delete' deletes ;; an object and removes its name as a completion candidate. ;; ;; If you are an Emacs-Lisp programmer, then you can define your own ;; multi-commands that provide a deletion action via `S-delete'. ;; There are two ways to do this. Both involve binding ;; `icicle-delete-candidate-object': ;; ;; * Bind it to a deletion function. The function must accept a ;; completion candidate string and perform the deletion. ;; ;; * Bind it to a symbol (variable) whose value is a list of ;; completion-candidate objects. The entries in the list must be ;; completion candidates for the current call to `completing-read', ;; but the list itself need not be the COLLECTION argument to ;; `completing-read'. The list can be an alist, a list of strings, ;; or a list of symbols. The object that corresponds to the ;; current candidate when `S-delete' is invoked is deleted from the ;; list. If, in addition, the list variable is a user option, then ;; the updated list value is saved in the user's `custom-file' (or ;; init file, `~/.emacs'). ;; ;; For more information about using this feature in Emacs-Lisp code, ;; see the doc of function `icicle-delete-current-candidate-object' ;; (`S-delete') and variable `icicle-delete-candidate-object'. ;; ;;(@* "Option `icicle-use-C-for-actions-flag'") ;; ** Option `icicle-use-C-for-actions-flag' ** ;; ;; In some contexts, you end up using `C-next' more than `next', and ;; likewise for the other keys that combine candidate action and ;; cycling. This is especially true for Icicles multi-commands that ;; act like a browser, such as `icicle-search', `icicle-imenu', ;; `icicle-find-tag', `icicle-Info-goto-node', and ;; `icicle-compilation-search'. In these cases, you use the action ;; keys to navigate among the locations indicated by the completion ;; candidates. ;; ;; If you set user option `icicle-use-C-for-actions-flag' to `nil', ;; then the keys that cycle are swapped with the keys that both cycle ;; and act on a candidate. You can then use `down', `up', `next', ;; `prior', `end', and `home' to both cycle and act (e.g. navigate), ;; and `C-down', `C-up', `C-next', `C-prior', `C-end', and `C-home' ;; to merely cycle, without acting. The option has no effect on ;; other keys. ;; ;; You can toggle `icicle-use-C-for-actions-flag' at any time using ;; `M-g' (`icicle-toggle-C-for-actions') in the minibuffer. ;; ;;(@* "Accessing Saved Locations (Bookmarks) on the Fly") ;; ** Accessing Saved Locations (Bookmarks) on the Fly ** ;; ;; When you complete the names of some kinds of objects, you can use ;; `C-x m' to follow bookmarks to objects of that type. This is ;; available only if you use library `bookmark+.el'. ;; ;; For example, when you invoke a command that completes file names, ;; you can use `C-x m' to interrupt that operation and complete ;; against the names of file bookmarks. This is a multi-command, so ;; you can actually visit any number of file bookmarks. When ;; finished, you can continue with non-bookmark file-name completion. ;; ;; The same thing holds for Info bookmarks when you use ;; `icicle-Info-goto-node' (`g' in Info mode); for buffer (non-file) ;; bookmarks when you use `icicle-buffer' (`C-x b'); and for Dired ;; bookmarks when you use `icicle-dired' (`C-x d'). ;; ;; See Also: ;; (@file :file-name "icicles-doc2.el" :to "Icicles Bookmark Enhancements") ;;(@* "Multi-Inputs") ;; ;; Multi-Inputs ;; ------------ ;; ;; Multi-commands, multi-completions, and multi-inputs too. ;; ;; In Icicles, if you hit `RET' in the minibuffer then the entire ;; minibuffer content is entered: sent to Emacs for processing by the ;; current command. In some cases you can also act individually on ;; multiple inputs that together make up the minibuffer contents. ;; ;; Such multi-inputs are read using Lisp function `read' and then ;; acted on individually in order, left to right. That `read' is ;; used means that you must separate multi-inputs the same way that ;; Lisp sexps are separated. Typically this means either putting ;; whitespace between them or wrapping them in "...". ;; ;; It is the value after reading a multi-input that is acted on. You ;; can act on all multi-inputs at once, but each individually, using ;; `M-R' (command `icicle-multi-inputs-act'). (You can also use ;; `M-S' to save them as a set of retrievable completion candidates - ;; see (@> "Saving or Retrieving Additional Candidates").) ;; ;; For example, here are some multi-inputs in a minibuffer: ;; ;; ici*.el "my file.txt" bookmark+.el ;; ;; After reading, these are the multi-inputs that can be acted on: ;; ;; ici*.el ;; my file.txt ;; bookmark+.el ;; ;; With `C-x C-f' (`icicle-file'), `M-R' opens each of those input ;; patterns, just as if you had used `C-x C-f' separately on each ;; one: it visits all Icicles files, file `my file.txt', and file ;; `bookmark+.el'. ;; ;; With this feature you can, for instance, select an existing list ;; of file names, yank it into the minibuffer of a file-processing ;; command such as `C-x C-f', and act on each of the files. ;; ;; `M-R' can be used with any minibuffer, not just one that is used ;; for completion. But the command that reads from the minibuffer ;; needs to provide an action that can be applied to such ;; multi-inputs. ;; ;; This is the case for all multi-commands: the candidate action ;; function - the same function that you apply to individual ;; completion candidates using `C-RET' - is also the action function ;; for individual multi-inputs. For commands other than ;; multi-commands, the command definition just needs to bind the ;; multi-input action function to variable ;; `icicle-multi-inputs-action-fn'. ;; ;; For example, if you had your own command `my-string' that calls ;; `read-string' and shows the string length, then you would do the ;; following - it is the `let' binding that gives `M-R' its action ;; function: ;; ;; (defun my-string () ;; "Read a string and show its length." ;; (interactive) ;; (let ((icicle-multi-inputs-action-fn 'my-string-action)) ;; (my-string-action (read-string "String: ")))) ;; ;; (defun my-string-action (string) ;; "Show length of STRING." ;; (message "`%s' has %d characters" string (length string)) ;; (sleep-for 1)) ;; ;; M-x my-string a bb ccc dddd M-R RET ;; ;; The `M-R' displays the lengths of the multi-inputs `a', `bb', ;; `ccc', and `dddd', in turn. The `RET' then displays the length of ;; the complete input, `a bb ccc dddd'. You can of course end using ;; `C-g' instead of `RET' if you are interested only in the effect of ;; `M-R'. ;; ;; How do you populate the minibuffer with multi-inputs? One way is ;; simply to type them or yank text, as indicated above. But there ;; are also two minibuffer keys that help in this regard. `M-o' ;; (`icicle-insert-history-element') lets you choose multiple ;; previous inputs, inserting them into the minibuffer. `M-r' ;; (`icicle-roundup') lets you choose current completion candidates, ;; inserting them. These are both multi-commands that you use from ;; the minibuffer. ;; ;; Both `M-o' and `M-r' accept a prefix argument that controls ;; candidate insertion: whether the candidate is automatically ;; followed by a space char or wrapped with "...". See ;; (@> "Multi-Input Insertion with a Prefix Arg") for an explanation. ;; ;; See Also: ;; ;; * (@> "History Enhancements") for information about populating the ;; minibuffer with multiple previous inputs using `M-o'. ;; ;; * (@> "Multi-Input Insertion with a Prefix Arg") information about ;; using a prefix arg with `M-o' or `M-r'. ;; ;; * (@> "Saving or Retrieving Additional Candidates") for ;; information about using `M-S' to save multi-inputs as a set of ;; completion candidates for later reuse. ;;(@* "Icicles Tripping") ;; ;; Tripping with Icicles ;; --------------------- ;; ;; Among the more useful multi-commands are those whose actions take ;; you to some location indicated by the completion candidate. This ;; is the way commands such as `icicle-bookmark', `icicle-find-tag', ;; `icicle-Info-goto-node', and `icicle-occur' work - you can use ;; `next' and so on to move among candidates to choose them to act ;; on, but when you do act on them, Icicles takes you to the places ;; they name. ;; ;; So just holding down both the Control key and `next' takes you ;; from one place to the next. And `C-mouse-2' takes you directly to ;; the location you click. Typically, `C-g' aborts the trip and puts ;; you back at your starting point, and `RET' ends the trip at the ;; chosen destination. ;; ;; There are many such Icicles tripping (or navigation or browsing) ;; commands, and they all work similarly. They give you the normal ;; cycling behavior provided by vanilla Emacs commands such as ;; `find-tag' (via `M-.', `C-u M-.', `M-*' etc.) or ;; `set-mark-command' (via `C-u C-SPC'). But unlike the vanilla ;; Emacs commands, the keys for this cycling are always the same. ;; ;; More importantly, you need not cycle through all possibilities. ;; You can go directly to particular locations with `C-RET', ;; `C-mouse-2' or using completion. And your input filters the ;; available candidates, as always. And you can, as always, use ;; progressive completion, chipping away, and so on to define your ;; `C-next' trip itinerary using a process of refinement. ;; ;; Whereas vanilla Emacs gives you some commands that let you use ;; completion to enter a destination and go there, and it gives you ;; other commands that let you cycle among locations, Icicles rolls ;; all of that into one. And you use the same keys, always, to ;; navigate. ;; ;; Here are some of the Icicles tripping commands: ;; ;; * Trips among tagged files (delicious-style tagging - requires ;; library `bookmark+.el'). (The `C-f' is a reminder that the ;; command uses `read-file-name', like `find-file'. The `a' ;; indicates that the command completes an autofile bookmark name.) ;; (Use prefix key `C-x 4 j' for other-window commands.) ;; `icicle-find-file-tagged' (`C-x j t C-f C-f') ;; `icicle-find-file-all-tags' (`C-x j t C-f *') ;; `icicle-find-file-all-tags-regexp' (`C-x j t C-f % *') ;; `icicle-find-file-some-tags' (`C-x j t C-f +') ;; `icicle-find-file-some-tags-regexp' (`C-x j t C-f % +') ;; ;; `icicle-bookmark-autofile-all-tags' (`C-x j t a *') ;; `icicle-bookmark-autofile-all-tags-regexp' (`C-x j t a % *') ;; `icicle-bookmark-autofile-some-tags' (`C-x j t a +') ;; `icicle-bookmark-autofile-some-tags-regexp' (`C-x j t a % +') ;; ;; * `icicle-bookmark-other-window' - (`C-- C-x r m') ;; Trip among bookmarks of all types. (Also bound to `C-x 4 j j' ;; if library `bookmark+.el' is used.) ;; ;; * Type-specific bookmark trips (requires library `bookmark+.el'). ;; (Use prefix key `C-x 4 j' for other-window commands.) ;; `icicle-bookmark-autofile' (`C-x j a') ;; `icicle-bookmark-non-file' (`C-x j b') ;; `icicle-bookmark-bookmark-list' (`C-x j B') ;; `icicle-bookmark-dired' (`C-x j d') ;; `icicle-bookmark-file' (`C-x j f') ;; `icicle-bookmark-file-this-dir' (`C-x j . f') ;; `icicle-bookmark-gnus' (`C-x j g') ;; `icicle-bookmark-info' (`C-x j i') ;; `icicle-bookmark-image' (`C-x j M-i') ;; `icicle-bookmark-desktop' (`C-x j K') ;; `icicle-bookmark-local-file' (`C-x j l') ;; `icicle-bookmark-man' (`C-x j m') ;; `icicle-bookmark-remote-file' (`C-x j n') ;; `icicle-bookmark-region' (`C-x j r', ;; `C-u C-u C-x C-x') ;; `icicle-bookmark-all-tags' (`C-x j t *') ;; `icicle-bookmark-some-tags' (`C-x j t +') ;; `icicle-bookmark-all-tags-regexp' (`C-x j t % *') ;; `icicle-bookmark-some-tags-regexp' (`C-x j t % +') ;; `icicle-bookmark-file-all-tags' (`C-x j t f *') ;; `icicle-bookmark-file-all-tags-regexp' (`C-x j t f % *') ;; `icicle-bookmark-file-some-tags' (`C-x j t f +') ;; `icicle-bookmark-file-some-tags-regexp' (`C-x j t f % +') ;; `icicle-bookmark-url' (`C-x j u') ;; `icicle-bookmark-w3m' (`C-x j w') ;; `icicle-bookmark-temporary' (`C-x j x') ;; `icicle-bookmark-bookmark-file' (`C-x j y') ;; `icicle-bookmark-autonamed' (`C-x j #') ;; `icicle-bookmark-autonamed-this-buffer' (`C-x j , #') ;; `icicle-bookmark-this-buffer' (`C-x j , ,') ;; `icicle-bookmark-specific-buffers' (`C-x j = b') ;; `icicle-bookmark-specific-files' (`C-x j = f') ;; ;; * `icicle-buffer' (`C-x b') - Trip among buffers ;; * `icicle-compilation-search' (`C-c `') - Trip among `grep' hits ;; * `icicle-dired' - Trip among directories ;; * `icicle-file' (`C-x C-f') - Trip among files ;; * `icicle-find-file' (`C-x C-f') - Trip among files ;; * `icicle-find-file-absolute' (`C-u C-x C-f') - Trip among files ;; * `icicle-find-file-in-tags-table' - Trip among files listed in ;; current tags table (project) ;; * `icicle-find-file-read-only' (`C-x C-r') - Visit read-only ;; * `icicle-find-first-tag' (`C-x 4 .') - Trip among tag hits ;; * `icicle-find-tag' (`M-.') - Trip among tag hits ;; * `icicle-goto-global-marker' (`C-- C-x C-SPC') - Trip among ;; global markers ;; * `icicle-goto-marker' (`C-- C-SPC') - Trip among local markers ;; * `icicle-imenu' (`C-c =') - Trip among definitions ;; (`icicle-imenu-full' to search full definitions) ;; ;; * Type-specific Imenu trips (library `imenu+.el' recommended). ;; (And `*-full' versions of each to search full definitions.) ;; `icicle-imenu-command' ;; `icicle-imenu-face' ;; `icicle-imenu-key-explicit-map' ;; `icicle-imenu-key-implicit-map' ;; `icicle-imenu-macro' ;; `icicle-imenu-non-interactive-function' ;; `icicle-imenu-user-option' ;; `icicle-imenu-variable' ;; * `icicle-Info-goto-node' (`g' in Info)- Trip among Info nodes ;; * `icicle-Info-index' (`i' in Info) - Trip among Info nodes ;; * `icicle-Info-menu' (`m' in Info) - Trip among Info nodes ;; * `icicle-locate', `icicle-locate-file' - Trip among files ;; * `icicle-occur' (`C-c '') - Trip among `occur' hits ;; (`icicle-search' among ;; single-line hits) ;; * `icicle-recent-file' - Trip among recent files ;; * `icicle-search' (`C-c `') - Trip among regexp search hits ;; * `icicle-search-bookmarks-together' (`C-u C-c `'), ;; `icicle-search-bookmark', - Search multiple bookmarks ;; * Type-specific bookmark searches ;; `icicle-search-bookmark-list-bookmark' - Search bookmark lists ;; `icicle-search-dired-bookmark' - Search Dired bookmarks ;; `icicle-search-file-bookmark' - Search file bookmarks ;; `icicle-search-gnus-bookmark' - Search Gnus bookmarks ;; `icicle-search-info-bookmark' - Search Info bookmarks ;; `icicle-search-local-file-bookmark'- Search local-file bookmarks ;; `icicle-search-man-bookmark' - Search `man'-page bookmarks ;; `icicle-search-non-file-bookmark' - Search non-file bookmarks ;; `icicle-search-region-bookmark' - Search bookmarked regions ;; `icicle-search-remote-file-bookmark' - Search remote bookmarks ;; `icicle-search-url-bookmark' - Search URL bookmarks ;; * `icicle-search-char-property' - Trip among buffer strings with ;; with a text/overlay property ;; * `icicle-search-dired-marked-recursive' - Search marked in Dired ;; * `icicle-search-file' - Search multiple files ;; * `icicle-search-ibuffer-marked' - Search marked bufs in Ibuffer ;; * `icicle-search-keywords' (`C-c ^') - Trip among keyword search ;; hits. ;; * `icicle-search-overlay-property' - Trip among buffer strings ;; with some overlay property. ;; * `icicle-search-pages' - Search Emacs pages ;; * `icicle-search-paragraphs' - Search Emacs paragraphs ;; * `icicle-search-sentences' - Search sentences as contexts ;; * `icicle-search-text-property' (`C-c "') - Trip among buffer ;; strings with a text property ;; * `icicle-search-thing' - Search thing-at-point things ;; * `icicle-search-word' (`C-c $') - Search whole-word hits ;; * `icicle-search-xml-element' - Search XML elements ;; * `icicle-search-xml-element-text-node' - Search text of XML elts ;; * `icicle-select-frame' (`C-x 5 o') - Trip among frames, by name ;; * `icicle-select-window' (`C-0 C-x o') - Trip among windows, by ;; buffer name ;; ;; (You need library library `Bookmark+' for ;; `icicle-search-bookmark-list-marked'. You need library `Dired+' ;; for `icicle-search-dired-marked-recursive'.) ;; ;;(@* "Highlighting the Destination") ;; ** Highlighting the Destination ** ;; ;; `icicle-bookmark-region-other-window' activates the bookmarked ;; region (highlighting it) when you visit it, if you use Transient ;; Mark mode (or, e.g., Delete Selection mode). ;; ;; Starting with Emacs 22, most Icicles commands that have single ;; positions as their trip visits (e.g. `icicle-bookmark', ;; `icicle-Info-goto-node', `icicle-goto-marker', `icicle-find-tag') ;; highlight those positions temporarily as they are visited. Except ;; for the Icicles search commands, this highlighting is provided by ;; library `crosshairs.el'. If `crosshairs.el' and the libraries it ;; requires are not in your `load-path', then no such highlighting ;; occurs. ;; ;; See Also: ;; ;; * (@> "Icicles Commands that Read File Names") for information ;; about `icicle-find-file', `icicle-find-file-absolute', ;; `icicle-find-file-in-tags-table', `icicle-locate', ;; `icicle-locate-file', and `icicle-recent-file'. ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Enhancements for Emacs Tags") ;; for information about `icicle-find-first-tag' and ;; `icicle-find-tag'. ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Bookmark Enhancements") ;; for information about the bookmark browsing commands. ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Info Enhancements") ;; for information about `icicle-Info-goto-node', ;; `icicle-Info-index', and `icicle-Info-menu'. ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; for information about `icicle-occur' and `icicle-search'. ;; * (@file :file-name "icicles-doc2.el" :to "Other Icicles Search Commands") ;; for information about `icicle-compilation-search', ;; `icicle-imenu*' commands, `icicle-search-char-property', ;; `icicle-search-keywords', `icicle-search-overlay-property', and ;; `icicle-search-text-property'. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Defining Icicles Tripping Commands") ;; for information about defining your own tripping commands. ;;(@* "Key Completion") ;; ;; Key Completion ;; -------------- ;; ;; Here's another weird Icicles feature: completing key sequences ;; instead of commands or other minibuffer input text. (This feature ;; works only for Emacs 22 and later.) ;; ;; What on earth for? Have you ever wanted to use one of those ;; myriad `C-x' key sequences, but forgot just what it was? The ;; standard solution to that is to use `C-x C-h', to display all of ;; the `C-x' bindings together with their commands. ;; ;; OK, but then you have to scroll down the list of bindings, ;; searching for the command you want, and then use its key binding. ;; You can use `C-M-s' to search for a substring of the command name, ;; in case you do not recall the exact name, but why not use Icicles ;; completion for this? Why not match against possible key sequences ;; and commands? ;; ;;(@* "Completing Keys") ;; ** Completing Keys ** ;; ;; To complete keys in Icicles, start the key sequence as usual, and ;; then hit `S-TAB' (command `icicle-complete-keys'). For example, ;; use `C-x' or `C-x 4', and then hit `S-TAB' to complete the prefix ;; `C-x' or `C-x 4' (or whatever). You're then completing against ;; candidates that are composed of two parts, separated by " = ": ;; ;; * a key binding that completes what you've typed so far - ;; e.g. `C-j' (that is, `C-x C-j') ;; ;; * the command it is bound to - e.g. `dired-jump-other-window' ;; ;; So, for example, this is a single completion candidate: ;; ;; C-j = dired-jump-other-window ;; ;; You can match your minibuffer input against the key name, the ;; command name, or both. ;; ;; Suppose, for instance, that you want to use a version-control ;; command, and you remember that all such commands are bound to key ;; sequences that begin with `C-x v'. You enter as much of the key ;; sequence as you remember (`C-x v'), and then you hit `S-TAB'. You ;; can then use completion (either apropos or prefix) against the ;; matching key sequences and command names to invoke the right ;; command. And, as a bonus, you are reminded of its key sequence. ;; You can thus use Icicles key completion to execute a command and, ;; at the same time, learn its key binding. ;; ;; (The documentation always refers to the key that performs key ;; completion as `S-TAB'. Actually, it is `S-TAB' only by default. ;; You can customize it, using option `icicle-key-complete-keys'.) ;; ;;(@* "`S-TAB' Is Everywhere - Start With It") ;; ** `S-TAB' Is Everywhere - Start With It ** ;; ;; In Icicle mode, whenever you are not in the minibuffer or buffer ;; `*Completions*', key `S-TAB' (`S-tab') initiates key completion. ;; That is, you do not need to first type part of a key sequence to ;; use it - you can start with it. Hit `S-TAB' at any time, and ;; you're completing a key sequence, even if you have not yet hit any ;; keys. This lets you see all key sequences that are available in a ;; given context. For example, in Dired, keys special to that mode ;; are included (and are highlighted as local bindings - see (@> ;; "Local Bindings Are Highlighted")). ;; ;; When completing a key sequence, you can type part of a command ;; name, then hit `S-TAB' to apropos-complete against the command ;; name. In this respect, `S-TAB' acts like `M-x', but the key ;; binding is also part of the completion candidate, so you can also ;; match key names. ;; ;;(@* "Completing Keys By Name") ;; ** Completing Keys By Name ** ;; ;; So, just how do you complete input against a set of ;; binding-plus-command completion candidates? You can always cycle ;; among the candidates, of course, and then choose one. But what ;; about completion? Just type text to match candidates, then use ;; `S-TAB' or `TAB' as usual to complete the text. Text? Yes. ;; Completion candidates are always, ultimately, strings. ;; ;; Suppose that you type `C-x S-TAB' to show all key sequences that ;; begin with `C-x'. You might see a candidate that looks like this: ;; ;; C-q = toggle-read-only ;; ;; You can then type "C-q" or "d-onl" or any other substring, and ;; then use `S-TAB' to complete the candidate. (This second use of ;; `S-TAB' invokes the command `icicle-apropos-complete', which has ;; nothing to do with `icicle-complete-keys', which was invoked by ;; the first `S-TAB'. The first was invoked outside the minibuffer; ;; the second was invoked from the minibuffer, during completion.) ;; ;;(@* "Completing Prefix Keys") ;; ** Completing Prefix Keys ** ;; ;; What happens if the completion candidate is itself a prefix key? ;; For example, `C-x S-TAB' shows some candidates whose commands are ;; shown as "...", like this: ;; ;; 4 = ... 5 = ... ;; 6 = ... C-k = ... ;; ESC = ... RET = ... ;; ;; These represent prefix keys (`C-x 4', `C-x C-k', and so on). If ;; you choose such a candidate, then you just continue completing - ;; buffer `*Completions*' is updated to show the completions of the ;; compound prefix: `C-x 4', `C-x RET', or whichever you choose. The ;; minibuffer prompt shows the completion so far; if you choose ;; `RET', for instance, then it shows `C-x RET' while prompting you ;; for the rest of the key sequence. ;; ;; By default, completion candidates are sorted in buffer ;; `*Completions*' with local bindings listed first. You can use ;; `C-M-,' at any time during key completion to toggle between this ;; order and sorting with the prefix-key candidates shown first. You ;; can use `C-,' at any time to change the sort order among these two ;; orders and sorting by command name. ;; ;;(@* "Navigate the Key-Binding Hierarchy") ;; ** Navigate the Key-Binding Hierarchy ** ;; ;; Choosing a completion candidate such as `C-x = ...' effectively ;; navigates down the key-binding hierachy (prefix-key hierarchy), to ;; complete against all keys with prefix `C-x'. Choosing `5 = ...' ;; to complete the prefix `C-x' then navigates down another level, to ;; complete keys that have prefix `C-x 5'. ;; ;; What about navigating back up the hierarchy, say from the `C-x 5' ;; keys to the `C-x' keys, or from the `C-x' keys to the keys with no ;; prefix? The special completion candidate `..' does that. By ;; default, it is always the first candidate in the `*Completions*' ;; list. It is of course not available unless you are completing a ;; prefix; that is, it is not available at the top level. ;; ;; This feature means that you can navigate the key-binding hierachy ;; just as you would navigate the file-system hierarchy (using, say, ;; `C-x C-f') or the menu-bar hierarchy (using library `lacarte.el'). ;; (In fact, since menu-bar bindings are also key bindings, you can ;; also use key completion to navigate the menu-bar hierarchy - just ;; complete the prefix key `menu-bar'! Start with `S-TAB', choose ;; `menu-bar = ...', then choose a menu, and so on.) ;; ;; Icicles key completion thus provides a general browser for key ;; bindings, which you can also use to learn about keys and their ;; associated comands, without necessarily executing them - see ;; (@> "Key and Command Help"). ;; ;; Gotcha: `S-TAB' uses apropos completion, by default, so remember ;; that typing `.' matches any character (except a newline). To ;; match only the literal string `..' (to go up a level), do one of ;; the following: ;; ;; * Turn on escaping of regexp special characters - use `C-`' in the ;; minibuffer to toggle this. ;; ;; * Use prefix completion (`TAB'). ;; ;; * Escape the regexp special character explicitly: `\.\.' (or use ;; `^\.'). ;; ;; * Cycle to candidate `..'. ;; ;;(@* "Local Bindings Are Highlighted") ;; ** Local Bindings Are Highlighted ** ;; ;; Sometimes it helps to know which key sequences are local bindings, ;; that is, bindings that are specific to the current mode. For ;; example, Dired mode defines keys specific to Dired buffer, such as ;; `* %', `% g', and `!'. To help you distinguish local key bindings ;; from others (global and minor-mode bindings), local bindings are ;; highlighted in buffer `*Completions*' using face ;; `icicle-special-candidate'. ;; ;;(@* "Completing Keys By Just Hitting Them") ;; ** Completing Keys By Just Hitting Them ** ;; ;; It may seem odd that you must complete a key sequence by entering ;; the names of keys, rather than just hitting the keys themselves: ;; e.g. typing "C-f" rather than hitting `C-f'. However, if keys ;; themselves were used for completing, then they could not be used ;; normally during key-sequence completion. You could not move the ;; cursor around the minibuffer using `C-f' or `right' (right arrow), ;; because those keys would be treated as input for completion. You ;; could not use `up' or `down' to cycle among completion candidates ;; for the same reason. Likewise, you could not use printing ;; (self-inserting) keys, such as `a' and `$', to match command ;; names. Having to use key names, instead of keys, for completion ;; is a small price to pay for being able to complete key sequences. ;; ;; Nevertheless, Icicles also provides a way for you to type key ;; sequences directly, even if it is something of a workaround: ;; precede each key with `M-q' (`icicle-insert-key-description', ;; during key completion) - think of `q' for "quote". This inserts ;; the key description of whatever key you hit next. This key ;; description (name) can be used to match key-completion candidates. ;; So, for example, instead of typing "C-f", you can hit `M-q' and ;; then hit `C-f'. The key description "C-f" is inserted in the ;; minibuffer. If you use `M-q C-M-right', then "C-M-right" is ;; inserted. Try it: `S-TAB M-q C-M-right' -> "C-M-right". Then hit ;; `TAB' or `S-TAB' to complete the candidate all the way to this: ;; ;; C-M-right = enlarge-frame-horizontally ;; ;; Note: Whether or not angle brackets are used is governed by user ;; option `icicle-key-descriptions-use-<>-flag' (aka ;; `icicle-key-descriptions-use-angle-brackets-flag'). By default, ;; this is `nil', so angle brackets are not used, which I think ;; improves readability. If you set this to non-`nil', then you will ;; see "" instead of "C-M-right", both as a completion ;; candidate and as what is inserted when you use `M-q'. You can ;; also provide a prefix argument to `M-q' to flip the behavior of ;; `icicle-key-descriptions-use-<>-flag' for that occurrence only. ;; See also my library `naked.el', which lets you use the ;; no-angle-brackets style also outside of Icicles. ;; ;;(@* "Key and Command Help") ;; ** Key and Command Help ** ;; ;; That points out another use of key completion, opposite to ;; learning the bindings of commands: learning the commands bound to ;; given keys. In other words, `S-TAB M-q' does both what `C-h w' ;; (`where-is') does and what `C-h c' (`describe-key-briefly') does. ;; It also does what `C-h b' (`describe-bindings') does. ;; ;; The point here is not that `S-TAB M-q' is quicker than `C-h w' or ;; `C-h c' or `C-h b' - it's not. The point is that key completion ;; can be handy in several ways, and it can teach you various things ;; about keys and commands as you use it. ;; ;; In addition to this key-completion help about bindings, you can ;; display help on the commands that are the right sides of the ;; `S-TAB' completion-candidate equations, by using the multi-command ;; help keys (see (@> "Help on Completion Candidates")). That is, ;; while completing, you can use `C-M-mouse-2', `C-M-RET', ;; `C-M-next', and so on to describe the command named in the current ;; completion candidate. ;; ;;(@* "`S-TAB' Is a Multi-Command") ;; ** `S-TAB' Is a Multi-Command ** ;; ;; Yes, `S-TAB' as `icicle-complete-keys' is a multi-command - see ;; (@> "Multi-Commands")). This means that you can, within the same ;; execution of `S-TAB', invoke any number of keys by clicking ;; (`C-mouse-2') their names in buffer `*Completions*' or choosing ;; them any other way (`C-RET', `C-next', and so on). ;; ;; Since you can navigate up and down the key-binding hierarchy, you ;; could even stay within a single `S-TAB' invocation to do nearly ;; everything you want in Emacs (see (@> "Three-Key Emacs"))! ;; ;;(@* "Possible Source of Confusion") ;; ** Possible Source of Confusion ** ;; ;; Keep in mind that `S-TAB' has two different uses in Icicles when ;; you are providing input in the minibuffer: ;; ;; * If input completion is available, then `S-TAB' performs apropos ;; completion (it is, in effect, bound to ;; `icicle-apropos-complete'). ;; ;; * If input completion is not available, then `S-TAB' performs key ;; completion (it is, in effect, bound to `icicle-complete-keys'). ;; ;; In addition, in buffer `*Completions*' `S-TAB' moves backward ;; among the candidate completions. ;; ;; This is by design; it takes advantage of the fact that these ;; contexts are mutually exclusive. However, this economy comes at a ;; risk of potential confusion. It's important that you know whether ;; or not completion is available when you are inputting text. If ;; input completion is not available, but you think it is, then ;; hitting `S-TAB' might give you a surprise by key completing. That ;; behavior is normal - you can use key-completion to input special ;; characters, for instance. But if you think that you are instead ;; completing the original input requested, then you can become ;; confused. ;; ;; Icicles provides completion status indicators so that you can ;; easily tell when completion is available for minibuffer input. ;; There are two indicators: (1) at the beginning of the minibuffer ;; prompt and (2) in the `Icy' minor-mode lighter in the mode line. ;; See (@> "Completion Status Indicators"). If completion is not ;; indicated when you are prompted for input, it means that `S-TAB' ;; is available, not for input completion, but for key completion. ;; Another clue can be found in the prompt text. For key completion, ;; it says "Complete keys: ". ;; ;; If you nevertheless find the overloaded use of `S-TAB' confusing, ;; you can change the bindings of the key `S-TAB' in these different ;; contexts. To do that, you can customize options ;; `icicle-apropos-complete-keys', `icicle-key-complete-keys', and ;; `icicle-completion-list-key-bindings'. ;; ;;(@* "Complete Keys in the Minibuffer Also") ;; ** Complete Keys in the Minibuffer Also ** ;; ;; In the minibuffer, `S-TAB' performs apropos completion of your ;; typed input. So it is not available for key completion. But you ;; can still complete keys in the minibuffer. You just use `M-S-TAB' ;; instead of `S-TAB'. ;; ;; (And just as the actual keys that perform key completion outside ;; the minibuffer are customizable using option ;; `icicle-key-complete-keys', so too for the key-completion keys in ;; the minibuffer: It is actually the keys defined by option ;; `icicle-key-complete-keys-for-minibuffer' that are used - ;; `M-S-TAB' is just the key used by default.) ;; ;;(@* "Three-Key Emacs") ;; ** Three-Key Emacs ** ;; ;; Icicles key completion piles a lot of stuff into `S-TAB'. Just as ;; `M-x' lets you execute any Emacs command, so does `S-TAB'. But ;; `S-TAB' also lets you insert characters. You might say that it ;; gives you all of Emacs in one key binding. ;; ;; Of course, you need a couple other keys, as well. How many? ;; Suppose you had limited accessibility in terms of input devices. ;; Maybe you use Emacs on a cell phone, without voice recognition - ;; or whatever. How many keys, buttons, or whatnot do you need to ;; use Emacs? ;; ;; 1. You need one for `C-g', to interrupt commands. ;; 2. You need one to start telling Emacs what to do. ;; 3. You might need one to choose from a set of possible things to ;; do. ;; 4. You need one to tell Emacs that you're done telling it what to ;; do. ;; ;; (#2 and #3 might be combined somehow.) ;; ;; What does vanilla Emacs offer out of the box in this regard? ;; ;; * You can get by with just `mouse-1' and the menu-bar menus, but ;; they do not cover all of Emacs. You cannot use them to enter ;; text, for instance. Of course, you could add more menus, to be ;; able to do more. ;; ;; * You can use `M-x' plus `RET' to execute any command. But how ;; would you insert text? ;; ;; * Similarly, for `M-:', which lets you evaluate any Emacs-Lisp ;; sexp. You still need a way to type characters. ;; ;; Icicles key completion lets you do almost anything in Emacs with ;; three or four keys, buttons, or whatever: ;; ;; * `S-TAB' - Offers every key sequence as a possible choice to ;; execute. ;; * `next' - Cycles among candidates, for choosing. ;; * `RET' - Chooses the current candidate. ;; * And of course `C-g', to cancel the current operation. ;; ;; `S-TAB' includes key `M-x', which offers all commands (even those ;; not bound) as possible choices. It also includes key `M-:', which ;; lets you execute any Emacs-Lisp expression. That's almost all of ;; Emacs! ;; ;; You could even perhaps get away with only three mouse buttons, and ;; no keyboard: ;; ;; * `mouse-1' - Choose candidates, scroll, and so on (direct access, ;; no cycling). ;; ;; * `mouse-2' - Do what `S-TAB' does (bind it to ;; `icicle-complete-keys' and `icicle-apropos-complete'). ;; ;; * `mouse-3' - Do what `C-g' does (bind it to `keyboard-quit' and ;; `icicle-abort-recursive-edit'). ;; ;; Here, `mouse-2' and `mouse-3' are not even used as mouse (pointer) ;; functions; any keys or buttons would do. You could use just ;; `mouse-1' plus a Shift key and a Control key. ;; ;; Would you want to use Emacs only this way? Of course not, if you ;; had a choice. Typing the character `a' by cycling through every ;; possible key binding/command combination and hitting `RET' when ;; you get to `a = self-insert-command' would be the epitome of ;; tedium. Likewise, doing everything with a single pointer-device ;; button. Using only three or four keys or buttons is definitely ;; not the ideal way to take advantage of Emacs. ;; ;; But you are probably not limited to just 3 or 4 keys or buttons. ;; The real point here is that Icicles `S-TAB' opens the door to ;; almost everything in Emacs. And if you do have a normal keyboard, ;; then you can type letters and such to match command names and key ;; sequences. Key `next' matches substrings (regexps, actually), ;; which makes choice even quicker. ;; ;;(@* "Entering Special and Foreign Characters") ;; ** Entering Special and Foreign Characters ** ;; ;; Command `self-insert-command' is bound to each key that is ;; associated with a character that can be inserted in text. It is ;; the binding of the key `a' and the key `$', for example. It is ;; also the binding of keys that your keyboard might not even have - ;; keys that correspond to special or odd characters and characters ;; in other languages. ;; ;; To Icicles key completion, these keys are like other keys. ;; However, because there are many, MANY keys bound to ;; `self-insert-command', it can be distracting and slow to allow ;; such keys as completion candidates. If option ;; `icicle-complete-keys-self-insert-ranges' is `nil' (the default ;; value), then such keys are excluded as candidates. This is ;; probably what you want. ;; ;; If the option is non-`nil', then you can use key completion to ;; insert the characters whose codes are in the range(s) defined by ;; the option value. This lets you see the candidate characters in ;; `*Completions*' (WYSIWYG), but it is not a terribly convenient or ;; quick way to insert characters. ;; ;; Starting with Emacs 23, vanilla Emacs has Unicode support, and you ;; can insert any Unicode characters using either an input method or ;; `C-x 8 RET'. `C-x 8 RET' is bound by default in Emacs to command ;; `insert-char' (called `ucs-insert' prior to Emacs 24). If you use ;; my library `ucs-cmds.el' then you might want to remap that command ;; to command `ucsc-insert', which is an enhancement. ;; ;; Icicles enhances this by (a) showing the character to be inserted ;; after its name in `*Completions*' (but you complete against only ;; the name), and (b) showing the current character and its code ;; point in the mode line when you cycle. ;; ;; I recommend that you use `insert-char' (or better, `ucsc-insert'), ;; not key completion, to insert Unicode characters. ;; ;; There are thousands of Unicode characters. So if you do use a ;; non-`nil' value for `icicle-complete-keys-self-insert-ranges' then ;; you will likely want to use only small ranges for better ;; performance, e.g., `((0 . 687))' covers Latin characters. For ;; Emacs 22, the option is effectively Boolean: any non-`nil' value ;; allows all self-inserting keys as candidates (there are far fewer ;; available characters in Emacs 22). ;; ;; For each Unicode character, the completion candidate is ;; `CHAR = UNICODE-NAME', where UNICODE-NAME is the name of the ;; Unicode character. This is so that you can complete against the ;; name. But again, I recommend that you use `C-x 8 RET', not key ;; completion, to insert a Unicode character. ;; ;;(@* "Handling Keymaps That Are Inaccessible From the Global Map") ;; ** Handling Keymaps That Are Inaccessible From the Global Map ** ;; ;; Actually, `S-TAB' is not bound to `icicle-complete-keys' in every ;; keymap. That would be inconvenient, in general. By default, it ;; is so bound in each keymap that is accessible from the global ;; keymap, as determined by function `accessible-keymaps'. ;; ;; You've seen, above, how you can navigate through prefix keys, ;; starting with the global map. In Dired, for instance, you can use ;; `S-TAB' at the top level, then choose the prefix key `*' in ;; `*Completions*', then choose a key, such as `/' (to mark ;; directories), in the `*' keymap. ;; ;; However, the act of binding of `S-TAB' in keymaps that are ;; accessible from the global map does not bind it in the `*' prefix ;; keymap itself. To handle this case, Icicles explicitly does for ;; `dired-mode-map' what it does for the global map: it binds `S-TAB' ;; in each keymap that is accessible from `dired-mode-map'. Because ;; of this, you can use `* S-TAB' to show all key completions of `*'. ;; ;; This treatment of `dired-mode-map' is done by default. Similarly ;; for a few other keymaps. But you might have other keymaps that ;; you would like to treat similarly - keymaps that Icicles might be ;; unaware of. You do this by including them in the list value of ;; user option `icicle-keymaps-for-key-completion', along with ;; `dired-mode-map' and the others provided in the default value. ;; The list entries are Emacs-Lisp symbols that are bound to keymaps, ;; each of which should define at least one prefix key. If you add a ;; keymap variable to this list, then `S-TAB' will be bound so that ;; you can use it to complete the prefix keys defined by that map. ;; ;; Notice that there is no keymap variable that corresponds to prefix ;; key `*' in Dired mode. You need only provide a keymap (variable ;; `dired-mode-map') from which the prefix key is accessible; it is ;; not necessary to also provide a variable that corresponds to the ;; prefix keymap itself. ;; ;; If a keymap listed in `icicle-keymaps-for-key-completion' is not ;; defined when Icicle mode is entered, then it is ignored. If you ;; later define that keymap, then just exit and reenter Icicle mode ;; for the `S-TAB' binding to take effect. For example, use `M-x ;; icy-mode' twice after entering Calendar mode, to be able to ;; complete `calendar-mode' prefix keys such as `t' - `t S-TAB'. ;;(@* "Icicles Multi `M-x'") ;; ;; Icicles Multi `M-x' ;; ------------------- ;; ;; How about a multi-command replacement for `M-x'? Instead of ;; executing a single command, it would execute any number of ;; commands. This section describes two such multi-commands, ;; `icicle-execute-extended-command' and `icicle-command-abbrev', ;; which by default are bound in Icicle mode to `M-x' and `C-x SPC', ;; respectively. See Also: ;; (@file :file-name "icicles-doc2.el" :to "Defining Icicles Multi `M-x'"). ;; ;;(@* "Multi `M-x': `icicle-execute-extended-command'") ;; ** Multi `M-x': `icicle-execute-extended-command' ** ;; ;; When you use `M-x' in vanilla Emacs, you are actually executing ;; the standard Emacs command `execute-extended-command'. That ;; command prompts you for the name of another command, which you ;; input. It uses `completing-read' to do this, which is why you can ;; take advantage of Icicles features when you use `M-x'. Nothing ;; new here. ;; ;; Command `icicle-execute-extended-command' is simply a ;; multi-command version of `execute-extended-command'. It does the ;; same thing, except that it also lets you execute multiple ;; commands, one by one, using `C-RET' (or `C-next' and so on), ;; without ever exiting the minibuffer. ;; ;; With the default value of option `icicle-top-level-key-bindings', ;; `M-x' is bound to `icicle-execute-extended-command' whenever you ;; are in Icicle mode. If you never use it as a multi-command, you ;; will not notice any difference from `execute-extended-command'. ;; ;;(@* "Examples of Using Multi `M-x'") ;; *** Examples of Using Multi `M-x' *** ;; ;; Example: Repeat a command multiple times. Yes, `C-x z' does this ;; already (and better) - this is just an illustration. `M-x ;; forward-ch TAB' completes to `forward-char'. Then, use `C-RET' to ;; execute that command. Repeat as many times as you want. Use a ;; prefix arg if you like. ;; ;; To switch to another command in the same `M-x' invocation: Erase ;; the minibuffer (`M-k'), complete the second command, then use ;; `C-RET'. As long as you have not yet used `RET', `S-RET', `C-g' ;; (or, say, `C-]'), you remain within the same invocation of `M-x'. ;; ;; What about executing a command that, itself, reads an input ;; argument? That's OK. And if that command reads its input with ;; completion, then you can use `C-RET' on the completion candidates ;; for that input. ;; ;; Example: `M-x describe-fa TAB C-RET' gives you the prompt for ;; command `describe-face'. ;; ;; 1. Type `ici S-TAB' to see the available Icicles faces. ;; ;; 2. Hit `next' until face `icicle-complete-input' is highlighted. ;; ;; 3. Hit `C-RET' to display its documentation. ;; ;; 4. Type `C-next' a few times to see the doc of other Icicles ;; faces. ;; ;; 5. Use `M-k' to erase the minibuffer, then type `search S-TAB' to ;; see faces about searching. ;; ;; 6. Cycle through them with `next', then use `C-RET' on ;; `icicle-search-main-regexp-current' to show its documentation. ;; ;; 7. Use `C-next' to do the same for face ;; `icicle-search-main-regexp-others'. ;; ;; 8. Use `RET' to finish with command `describe-face' - but you're ;; still in the same invocation of `M-x'. ;; ;; 9. Change the input to `describe-coding-system' and play again, ;; this time with coding-system names... ;; ;; Remember, if you get confused or lost in the minibuffer: `C-]' ;; (`abort-recursive-edit') or `C-M-S-t' (aka `C-M-T', ;; `icicle-top-level') should always straighten you out. ;; ;;(@* "What about describe-variable and describe-function?") ;; *** What about describe-variable and describe-function? *** ;; ;; Sadly, if you try the last example with `describe-variable' or ;; `describe-function', you might be in for a surprise. In Emacs 20, ;; they both work fine. In later Emacs versions, `describe-variable' ;; gives you the message "You did not specify a variable", and ;; `describe-function' displays a `*Help*' buffer that says that each ;; function you choose is really a keyboard macro! ;; ;; Why? It's a bit complex, but worth hearing about if you want to ;; understand multi M-x better. ;; ;; When you choose a command that reads an argument in the minibuffer ;; and you then hit a multi-command key such as `C-RET' to choose an ;; argument, Icicles tries to apply the command you chose to the ;; argument you chose. However, completion candidates are always ;; strings, and the command you chose might expect something other ;; than a string. That is the case for `describe-variable', for ;; instance. The case of `describe-function' is special: it ;; interprets a string argument blindly as a keyboard macro sequence. ;; ;; Icicles is smart enough to pick up a `wrong-type-argument' error, ;; if the command you choose barfs on a string argument. In that ;; case, Icicles converts the string to a symbol (or a number) and ;; tries again, using the symbol (or the number). ;; ;; And that's why `describe-variable' works in Emacs 20 but not in ;; later versions: In Emacs 20, `describe-variable' (sanely) raises a ;; type error if you pass it a string, and Icicles is able to save ;; the day by then passing it the corresponding symbol. In later ;; versions of Emacs, however, instead of raising an error with the ;; message "You did not specify a variable", `describe-variable' just ;; displays the message - no error, so there is no way for Icicles to ;; recuperate. ;; ;; I've reported this design misfeature to the Emacs developers, and ;; I hope it will be fixed in a future Emacs version. Until then, at ;; least you know... The more general lesson is this: Icicles can ;; turn every command into a multi-command, but multi-command actions ;; will not work for every command. ;; ;;(@* "Multi `M-x' Turns Every Command into a Multi-Command") ;; *** Multi `M-x' Turns Every Command into a Multi-Command *** ;; ;; Most of the time, of course, you do not execute commands ;; successively by name; instead, you use key bindings. The point ;; here is that even if you have a binding for a command, Icicles ;; `M-x' lets you use any command as a multi-command, which can ;; sometimes be advantageous. ;; ;; For example, Icicles defines and binds a real multi-command to ;; `C-x 0' in Icicle mode, which lets you delete any number of ;; windows. But, even without such a multi-command, you can get a ;; similar effect by using `M-x delete-windows-on'. In this way, you ;; can turn ordinary Emacs commands that use completion into ;; multi-commands. ;; ;; The other point is that you can move from one command to another ;; within the same execution of `M-x'. This is a different feature ;; from being able to use any command that uses completion as a ;; multi-command. Both features have their uses. ;; ;;(@* "Multi `M-x' with Abbreviations: `icicle-command-abbrev'") ;; ** Multi `M-x' with Abbreviations: `icicle-command-abbrev' ** ;; ;; The second multi-command that you can use in place of ;; `execute-extended-command' is `icicle-command-abbrev', bound in ;; Icicle mode to `C-x SPC'. It is similar to `M-x' ;; (`icicle-execute-extended-command'), with the added twist that it ;; lets you input command abbreviations, as well as commands. ;; ;; If option `icicle-add-proxy-candidates-flag' is non-`nil', then ;; command abbreviations, as well as commands, are available as ;; completion candidates. Otherwise, only commands are available. ;; You can toggle this user option using `C-M-_' in the minibuffer. ;; ;; Emacs partial completion and some other libraries provide ways for ;; you to enter command abbreviations instead of command names at the ;; command prompt (`M-x'). Library `exec-abbrev-cmd.el' by Tassilo ;; Horn is an example. ;; ;; So just what is a command abbreviation? Hyphens (`-') in command ;; names divide them into parts. For example, `find-file' has two ;; parts: `find' and `file'. Each character of a command ;; abbreviation corresponds to one part of each of the commands that ;; match the abbreviation. For example, abbreviation `ff' matches ;; commands `find-file' and `focus-frame', and abbreviation `fg' ;; matches `find-grep'. ;; ;; If user option `icicle-command-abbrev-match-all-parts-flag' is ;; `nil', then an abbreviation need not match all parts of a command ;; name; it need match only a prefix. For example, `nil' means that ;; abbreviation `ff' also matches `find-file-other-window' and `fg' ;; also matches `find-grep-dired'. ;; ;; In Icicles, you can input both abbreviations and commands at the ;; same prompt, and you can take advantage of the multi-command ;; feature to execute multiple commands. You can thus treat command ;; abbreviations just like commands. If an abbreviation matches a ;; single command name, then that command is invoked immediately. If ;; it matches more than one, then you can use completion to choose ;; one. ;; ;; One or more, that is - multi-command completion is available for ;; both abbreviations and commands. That is, you can invoke any ;; number of them within the same use of `C-x SPC'. ;; ;; What happens if your input matches a command name but it is also ;; an abbreviation for other command names? By default, command ;; names take precedence: if your input matches a command name then ;; that command is invoked. So, for example, by default the Emacs ;; command `cd' takes precedence over `cd' as an abbreviation for ;; commands such as `compile-defun' and `cancel-debug-on-entry'. If ;; you instead want abbreviations to take precedence over command ;; names, then set option `icicle-command-abbrev-priority-flag' to ;; `t'. ;; ;; Abbreviations are completed against the (persistent) list of ;; abbreviations you have used in the past. That list is also ;; directly customizable as option `icicle-command-abbrev-alist'. ;; ;; Besides completing against past abbreviations, you can enter new ;; abbreviations (the completion is thus lax). When you exit Emacs, ;; your abbreviations list is updated and saved, along with the ;; number of times you've used each abbreviation. The latter ;; information is used to sort your abbreviations for completion, so ;; that those used most frequently are available first. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Global Filters") for ;; information about the kind of matching that `M-x' ;; (`icicle-execute-extended-command') does. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Fuzzy Completion") for ;; information about fuzzy completion, which is somewhat similar to ;; completing abbreviations but is not limited to inputting ;; commands. ;;(@* "Choose All Completion Candidates") ;; ;; Choose All Completion Candidates ;; -------------------------------- ;; ;; The previous section describes how you can use `C-RET' ;; (`icicle-candidate-action') to choose (act on) multiple completion ;; candidates, individually. If you hold down the Control key while ;; you cycle through the candidates, you can run through each of ;; them, one by one. ;; ;; Command `icicle-all-candidates-action', which is bound to `C-!' in ;; the minibuffer, is a shorthand way of doing that: act on all ;; candidates that match the current input. In many contexts, `C-!' ;; reports on any objects that were not acted upon successfully (in ;; buffer `*Help*'). ;; ;; All multi-commands let you use `C-!' in this way. Whenever a ;; command defines a special action for `C-RET' to perform on the ;; current completion candidate, you can use `C-!' to perform it on ;; all candidates at once. ;; ;; Perhaps you already use `% m' (command `dired-mark-files-regexp') ;; in Dired to mark all files that match a given regular expression, ;; and then operate on all of the marked files in some way (search ;; with `A', query-replace with `Q', open with `F', delete with `D', ;; and so on). When you execute a multi-command, `C-!' lets you do ;; something similar. ;; ;; How does it work? It applies `icicle-candidate-action-fn' to each ;; completion candidate that (apropos- or prefix-) matches the ;; current input in the minibuffer. ;; ;; Most top-level Icicles commands are multi-commands. Command ;; `icicle-delete-file' is an example. Instead of entering a file ;; name at the prompt (e.g. using completion or cycling), you can ;; type a regular expression, use `S-TAB' to see all matching files, ;; and then use `C-!' to delete all of them at once. ;; ;; You get the idea: Use the minibuffer to determine a set of objects ;; by pattern matching, and then act on all elements of the set. ;; ;; In addition to `C-!', keys `M-!', `C-|', and `M-|' act similarly: ;; ;; * `M-!' is like `C-!', but it acts on the list of matching ;; candidates as a whole, rather than acting individually on each ;; candidate. For example, with command `icicle-customize-face', ;; `M-!' opens a single Customize buffer for all of the matching ;; faces, while `C-!' opens a separate Customize buffer for each ;; face. ;; ;; * `C-|' and `M-|' are like `C-!' and `M-!', respectively, but they ;; apply an alternative action, not the main action, whenever one ;; is available. ;; ;; In the definition of a given multi-command, the appropriate action ;; functions are bound to variables: ;; ;; * `icicle-candidate-action-fn' (`C-!') - normal single-candidate ;; action ;; ;; * `icicle-candidate-alt-action-fn' (`C-|') - alternative ;; single-candidate action ;; ;; * `icicle-all-candidates-list-action-fn' (`M-!') - normal ;; list-of-candidates action ;; ;; * `icicle-all-candidates-list-alt-action-fn' (`M-|') - alternative ;; list-of-candidates action ;; ;; For most multi-commands, however, only the normal single-candidate ;; action is defined. In this case, `M-!' duplicates what `C-!' ;; does. If the corresponding function is not available, each of the ;; list-action keys (`M-!', `M-|') behaves the same as the ;; corresponding single-candidate key (`C-!', `C-|), and vice versa. ;; So for instance, if `icicle-all-candidates-list-action-fn' is ;; `nil' when reading some input, then `M-!' acts the same as `C-!'. ;; ;; As a shortcut, if you have saved completion candidates and they ;; all belong to the current set of completion candidates, then `C-!' ;; acts on the saved candidates instead of the complete set of ;; candidates. This means that you need not first do `C-M-<' to ;; retrieve the saved candidates; you can do `C-!' directly to act on ;; them. `C-|', `M-!', and `M-|' work the same way. ;; ;; All of the all-candidates actions inhibit candidate help display ;; in the mode line and minibuffer messages that the individual ;; actions might effect. This is to avoid unnecessary delays. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Dired Enhancements") ;; for an Icicles alternative to both `A' and `Q' (search and ;; replace) in Dired. ;;(@* "Sets of Completion Candidates") ;; ;; Sets of Completion Candidates ;; ----------------------------- ;; ;; Whereas `C-RET' acts on individual objects, `C-!' acts on an ;; entire set of objects at once, via their names: the set of all ;; current completion candidates. There are additional Icicles ;; commands that also act, not on individual completion candidates, ;; but on one or more sets of completion candidates. ;; ;; One of these is `M-*' or `S-SPC', which effectively narrows the ;; set of completion candidates by taking the intersection of the ;; candidate sets defined by various input regexps. ;; ;; This section presents some more Icicles commands that act on sets ;; of completion candidates. The basic idea is that you can perform ;; set operations using the current set of completion candidates, ;; changing it into a different set. You can, then, for example, use ;; `C-!' to act on everything in a custom-defined set. Or you can ;; define a custom set that you want to use often (for example, a ;; list of project files), save it persistently, and then retrieve it ;; later to use for completion. ;; ;; Another way of acting on a set of candidates is to insert them ;; into the minibuffer and then use `M-R' - see (@> "Multi-Inputs"). ;; ;;(@* "Saving and Retrieving Completion Candidates") ;; ** Saving and Retrieving Completion Candidates ** ;; ;; Set operations such as union and difference act on two sets. The ;; current set of completion candidates is always one of these sets. ;; If an operation, such as set complement, acts on a single set, ;; then it acts on the current set. ;; ;; When two sets are involved, the other set is called the "saved ;; set". This just means that at some previous time in your sesssion ;; you saved some completion candidates as the value of variable ;; `icicle-saved-completion-candidates'. ;; ;; In buffer `*Completions*', candidates that have been saved are ;; highlighted using face `icicle-saved-candidate'. ;; ;; By default, the saved set is not persistent; it is saved only ;; until the next save in the same Emacs session overwrites it or ;; adds to it. See (@> "Persistent Sets of Completion Candidates") ;; for ways to save candidates persistently. ;; ;; One way you can save candidates is to use ;; `icicle-candidate-set-save', bound to `C-M->'. This saves all of ;; the current candidates. ;; ;; Gotcha: If you use progressive completion and you have not yet ;; typed anything after `M-*' or `S-SPC', then there is not ;; yet a set of candidates to save. If you use `C-M->' at ;; that point, you will reset the saved candidates to none. ;; To define the current candidates, either type something or ;; use `S-TAB'. ;; ;; Another way to save candidates, besides `C-M->', is to select ;; candidates in buffer `*Completions*' using the (active) region, ;; and then use `icicle-candidate-set-save-selected', bound to ;; `C-M-)'. This saves any candidates that are at least partially in ;; the region. ;; ;; You can also use `C-M-)' to UNsave all candidates: just select no ;; candidates before you hit `C-M-)', to reset the set of saved ;; completions to none. Think of this as replacing the saved set ;; with the empty set (no candidates). And you need not use `TAB' or ;; `S-TAB' first to use this, since the current set of candidates is ;; not used in any way when you reset the saved set. ;; ;; Command `icicle-mouse-candidate-set-save', bound to `M-S-mouse-3' ;; in `*Completions*' combines these two: if the region is active, ;; then the selected candidates become the saved set; otherwise, all ;; candidates are saved. This binding makes it easy to save ;; candidates using the mouse: select them (e.g. drag or double-click ;; `mouse-1', or click `mouse-1' then `mouse-3'), then use ;; `M-S-mouse-3' to save. [*] ;; ;; You can process the list of saved candidates in any way you like ;; using Emacs Lisp. For example, you can save a list of file names ;; that match a regexp, then print the list or process the individual ;; files in some way. Here, for instance, is how to save the set of ;; file names that contain either `dir' or `ici': ;; ;; `C-x C-f \(dir\|ici\) S-TAB C-M-> C-g' ;; ;; You can retrieve a set of saved candidates with command ;; `icicle-candidate-set-retrieve', bound to `C-M-<'. This replaces ;; the current set of candidates with those retrieved. It also acts ;; like `M-*' by entering a recursive minibuffer, which removes any ;; saved-candidates highlighting. Using `TAB' or `S-TAB' restores ;; the highlighting. ;; ;; What if you have defined the saved set and you later decide to ;; narrow it by excluding some of its members? First, if the saved ;; candidates are not current then use `C-M-<' to make them so. Then ;; use progressive completion to narrow the current candidates. Then ;; use `C-M->' to define (only) them as the saved candidates. For ;; example, if you hit `C-M->' after narrowing to the files matching ;; prefix `ici', you can narrow that saved set to only those files ;; that also match `m', by using `S-SPC m C-M->'. ;; ;;(@* "Saving or Retrieving Additional Candidates") ;; ** Saving or Retrieving Additional Candidates ** ;; ;; You can use `C-<' to retrieve a set of saved candidates and add ;; them to the current candidates, instead of replacing those ;; candidates. This way, you can build up the current set of ;; candidates by retrieving (combining) several saved sets. ;; ;; In the other direction, you can save additional candidates, adding ;; them to a set of candidates already saved, in these ways: ;; ;; * `C->' (`icicle-candidate-set-save-more') adds all of the current ;; candidates. ;; ;; * `C-)' (`icicle-candidate-set-save-more-selected') adds any ;; candidates that you have selected using the region in ;; `*Completions*'. ;; ;; * `M-mouse-3' (`icicle-mouse-candidate-set-save-more') acts the ;; same as `C-)' or `C->', depending on whether or not the region ;; is active in `*Completions*': it adds selected or all ;; candidates. ;; ;; * Extending the region with `mouse-3', and then clicking `mouse-3' ;; again in the same place, acts the same as `C-)'. That is, click ;; `mouse-1', then click `mouse-3' twice in another location, to ;; save all candidates between the `mouse-1' and `mouse-3' ;; positions. [*] ;; ;; * The `insert' key (`icicle-save/unsave-candidate') adds just the ;; current completion candidate (e.g. during cycling). Clicking a ;; candidate in `*Completions*' with `M-S-mouse-2' ;; (`icicle-mouse-save/unsave-candidate') does the same thing. If ;; you do this to a candidate that has already been saved, then it ;; is UNsaved (no longer saved). ;; ;; Note that the `insert' key and `M-S-mouse-2' are toggles for a ;; given candidate, saving or unsaving it. In this sense each is its ;; own opposite. In another sense, the opposite operation of saving ;; is simply removing a candidate from the current set of candidates. ;; You do that using the `delete' key or `S-mouse-2'. ;; ;; Another way to add to the list of saved candidates is to use `M-S' ;; (`icicle-multi-inputs-save'). This is available for any ;; minibuffer input, not just during completion. It adds all of the ;; multi-inputs currently in in the minibuffer to the set of saved ;; candidates. So you can, for instance, use `M-S' on a minibuffer ;; containing the following input, to add its three file names to the ;; current saved set of candidates in variable ;; `icicle-saved-completion-candidates'. ;; ;; icicles-mac.el "my file.txt" bookmark+.el ;; ;; Matching, saving, and retrieving candidates is a powerful way to ;; interact with completion. One important use is to prepare a list ;; of candidates on which to act, and then act on them all at once ;; using `C-!'. This is a good way to proceed when you want to ;; double-check what to act on, before you actually act. This is the ;; same idea behind marking files in Dired and then operating on the ;; marked files, using `x'. It corresponds to what is represented in ;; some user interfaces by filling out a checklist followed by ;; clicking `OK'. ;; ;; [* If you click `mouse-1' on a candidate and (starting with Emacs ;; 22) `mouse-1-click-follows-link' is an integer, then you will need ;; to hold the mouse button depressed longer than that many seconds, ;; or else that candidate will simply by chosen. If the value is ;; `t', then this will not work at all. Any other value presents no ;; problem. (Personally, I use `nil'.)] ;; ;;(@* "Different Places for Saving and Retrieving Candidates") ;; ** Different Places for Saving and Retrieving Candidates ** ;; ;; You can save completion candidates to a different variable from ;; `icicle-saved-completion-candidates' by using a numeric prefix ;; argument to command `icicle-candidate-set-save'; that is, use `C-u ;; N C-M->'. Alternatively, use `C-M-}', which is bound to command ;; `icicle-candidate-set-save-to-variable'. You are prompted for the ;; name of the variable, and you can use completion when inputting ;; it. During this completion, the only available candidates are ;; variables that you have used for saved candidates (but completion ;; is lax, so you can type a new variable name). The same behavior ;; works also for `C->', `C-M-)', and `C-)'. ;; ;; To retrieve completion candidates that were previously saved to a ;; variable other than `icicle-saved-completion-candidates', so that ;; they become the current set of candidates, use `C-u N C-M-<', ;; where N is an integer, or `C-M-{' (`icicle-candidate-set-retrieve' ;; or `icicle-candidate-set-retrieve-from-variable'). ;; ;; Using a plain prefix argument (`C-u' without a number) with ;; `C-M->' and `C-M-<' saves or retrieves a candidate set using a ;; cache file, not a variable. Alternatively, as a shortcut you can ;; use `C-}' and `C-{' for this. ;; See (@> "Persistent Sets of Completion Candidates") and ;; (@file :file-name "icicles-doc2.el" :to "Support for Projects"). ;; ;; When you save candidates to a different variable from ;; `icicle-saved-completion-candidates', they are not shown in buffer ;; `*Completions*' using face `icicle-saved-candidate'. When you ;; save candidates to a cache file, they are also saved to ;; `icicle-saved-completion-candidates', so they are shown in ;; `*Completions*' using face `icicle-saved-candidate'. ;; ;; `C->' and `C-<' accept the same prefix arguments as `C-M->' and ;; `C-M-<' , letting you specify the source or destination (variable, ;; cache file) when you save or retrieve additional candidates. ;; ;; Note: Use the right type of saved candidates (persistent or not) ;; for a given command. It is the particular command that determines ;; whether or not a given type of saved candidate is appropriate. ;; For example, you can save search hits when you use ;; `icicle-search-file' (same as `icicle-search' with a negative ;; prefix arg), and those saved search-hit candidates effectively ;; reference files and positions in those files. And you can later ;; retrieve and reuse such saved candidates to visit the search ;; positions. But those candidates are not merely file names, so ;; they cannot be used with a command such as `find-file' or ;; `icicle-file' that expects a file name. Conversely, you cannot ;; use a saved set of file names with a command such as ;; `icicle-search-file' that expects `icicle-search' candidates. ;; ;;(@* "Saving Marked Files and Dirs in Dired") ;; ** Saving Marked Files and Dirs in Dired ** ;; ;; Besides saving file and directory names that are completion ;; candidates on the fly, You can create or add to a saved set of ;; names using the names that are marked in Dired. The same keys ;; (e.g., `C-M->') that save candidates in the minibuffer during ;; completion save the marked names in Dired. ;; ;; If you use library `Dired+' then you can also use the same keys, ;; but with the prefix key `M-+' (e.g. `M-+ C-M->') to save not only ;; the names that are marked in the current Dired buffer but also ;; those that are marked in any marked subdirectories, recursively. ;; See (@file :file-name "icicles-doc2.el" :to "Save Marked Names Here and Below"). ;; ;;(@* "Set Operations") ;; ** Set Operations ** ;; ;; The other available set-operation commands for use with completion ;; candidates, besides saving and retrieving, are these: ;; ;; * `icicle-candidate-set-swap', bound to `C-%'. Swap the saved and ;; current sets of completion candidates. ;; ;; * `icicle-candidate-set-define', bound to `C-:'. Define the ;; current set of completion candidates by evaluating an input ;; sexp. The sexp must evaluate to a list of strings, such as is ;; returned by `all-completions'. You can use this to substitute ;; any list of strings, and then operate on them as completions, ;; using any Icicles functionalities. Keep in mind, however, that ;; the completions must be of the proper type for the context in ;; which they are used. For example, if you are executing a ;; command, they must be command names. ;; ;; * `icicle-candidate-set-complement', bound to `C-~'. Complement ;; the current set of candidates: replace the current candidate set ;; with its set complement. This means all possible completions of ;; the appropriate type that do *not* match the current input. You ;; can combine this with progressive completion (`M-*' or `S-SPC') ;; to progressively eliminate candidates that match different ;; inputs. This process-of-elimination matching is a common ;; Icicles usage idiom. ;; ;; * `icicle-candidate-set-union', bound to `C-+'. Replace the ;; current candidate set by its union with the saved set of ;; candidates. ;; ;; * `icicle-candidate-set-difference', bound to `C--'. Replace the ;; current candidate set by its set difference with the saved set ;; of candidates. That is, the saved candidates are subtracted ;; from the current candidates, and the result becomes the current ;; candidate set. To obtain the opposite set difference, ;; subtracting the current candidates from the saved candidates, ;; just use `icicle-candidate-set-swap' followed by ;; `icicle-candidate-set-difference'. ;; ;; * `icicle-candidate-set-intersection', bound to `C-*'. Replace ;; the current candidate set by its intersection with the saved set ;; of candidates. Unlike the set intersection provided by `M-*' ;; (or `S-SPC'), `C-*' is, in itself, a one-time operation. `M-*' ;; (or `S-SPC') can be repeated, using the previous intersection as ;; one of the sets to be intersected in a new operation. Both ;; `C-*' and `M-*' use the current set of matching candidates as ;; one of the sets being intersected. But `M-*' reads another ;; input regexp to define the other set to be intersected, whereas ;; `C-*' uses the saved candidates set as the other set. `M-*' (or ;; `S-SPC') is useful for chaining, to achieve progressive ;; approximation. `C-*' is useful to perform an intersection on a ;; set from a previous input reading. ;; ;; * `icicle-candidate-set-truncate', bound to `M-$'. Truncate the ;; set of completion candidates, so that it includes only the first ;; N candidates (as displayed in `*Completions*'). You are ;; prompted for N. You can use this when the order of candidates ;; represents priority in some way, so that you are interested only ;; in the topmost candidates. ;; ;; You can operate on or choose from all input values in the set that ;; results from any of these set operations. For example, you can ;; use `C-~' to see the list of objects that do not match the current ;; input, to cycle among those objects, or to operate on any or all ;; of them. Use `C-~' at any time to switch to the complement of the ;; current set of candidates. ;; ;; Example: To cycle through all files whose names do not end in ;; `el', you can do the following: ;; ;; 1. Use `C-f' to read a file name. ;; 2. Type `el$' to match all file names that end in `el'. ;; 3. Use `S-TAB' to show the matching files. ;; 4. Use `C-~' to flip to the complement: files not ending in `el'. ;; 5. Use `next' or `prior' to cycle among the new set of candidates. ;; ;; A minibuffer message briefly confirms each of the set operations. ;; ;; When buffer `*Completions*' is displayed, the union, difference, ;; and intersection commands scroll the buffer when repeated. ;; Repeating `icicle-candidate-set-complement' complements the ;; complement, of course, giving the original set. ;; ;; Once you have established a set of completion candidates using any ;; of the candidate-set commands, you can cycle among the candidates ;; of that set using either prefix or apropos cycling (`down', `up', ;; `next', `prior', `end', or `home'). However, switching from ;; prefix to apropos cycling (or completion), or vice versa, ;; establishes a new completion set of the appropriate type, as ;; usual. Switching completion type signifies that you are finished ;; with the specially defined completion set, and you want to ;; redefine it using apropos or prefix cycling or completion. ;; ;; Note: Prefix icompletion (`icomplete.el' or `icomplete+.el' - see ;; (@> "Icompletion")) does not take into account the candidate ;; set resulting from a set operation: it always displays the ;; normal set of prefix completions in the minibuffer. ;; ;; Note: You might have noticed that, as a mnemonic device, the keys ;; bound to the various set operations use the corresponding ;; binary arithmetic or Boolean operators: `~' (unary negation) ;; for complement (not); `*' (multiplication) for intersection ;; (and); `+' (addition) for union (or); and `-' (subtraction) ;; for difference. Note too that the `C--' and `C-+' bindings ;; mean that you cannot use these key sequences for prefix ;; arguments - you must use `C-u N', or `M-N' instead, where N ;; is a possibly signed integer. ;; ;; See Also: ;; ;; * (@> "Multi-Commands") for information about `C-RET'. ;; ;; * (@> "Choose All Completion Candidates") for information about ;; `C-!'. ;; ;; * (@> "Progressive Completion") for information about `M-*' and ;; `S-SPC'. ;; ;; * (@> "File-Name Input and Locating Files Anywhere") and ;; (@> "Persistent Sets of Completion Candidates"), for information ;; about saving completion candidates persistently and retrieving ;; them later. ;; ;; * (@> "History Enhancements"), (@> "Google Matching"), and ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview") ;; for examples of other set operations on input candidates. ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Dired Enhancements") ;; for information about saving and reusing sets of file-name ;; candidates with Dired. ;;(@* "Google Matching") ;; ;; Google Matching ;; --------------- ;; ;; This section presents nothing new - but you might not want to skip ;; it. It points out something that you might not have picked up ;; yet. You've learned about Icicles regexp matching and candidate ;; set operations, but it can be worthwhile to compare how Icicles ;; matches inputs against completion candidates with how Google ;; matches search strings against Web pages. Summary: You can do ;; pretty much the same things, but the way you accomplish them is ;; different. ;; ;;(@* "Domain of Discourse") ;; ** Domain of Discourse ** ;; ;; In Google, the domain of discourse, that is, the possible set of ;; search hits, is the set of Web pages. There are also search ;; fields that limit the domain of discourse by file type, page ;; number, update date, page position, freedom of use, and even ;; morality ("Safe Search"). ;; ;; In Icicles (Emacs), the domain of discourse changes automatically, ;; depending on the current context. For command-name input, it is ;; the set of all named commands; for variable-name input, it is the ;; set of variable names; and so on. ;; ;;(@* "Global Filtering") ;; ** Global Filtering ** ;; ;; In Google, you can limit searching to specific Web sites, or ;; exclude certain Web sites from searching. ;; ;; In Icicles, you can add extra completion candidates using variable ;; `icicle-extra-candidates', and you can filter out (other) ;; candidates globally using filter variables ;; `icicle-must-match-regexp', `icicle-must-not-match-regexp', ;; `icicle-must-pass-predicate', and ;; `icicle-must-pass-after-match-predicate'. These are internal ;; Icicles variables. Normally, you do not change them directly; ;; instead, a command can use them to limit or extend the effective ;; domain of discourse. ;; See (@file :file-name "icicles-doc2.el" :to "Global Filters"). ;; ;; Variables `icicle-must-pass-predicate' and ;; `icicle-must-pass-after-match-predicate' apply to the textual ;; candidates that can be displayed in buffer `*Completions*'. You ;; can also apply a predicate to the full alist-entry or ;; obarray-symbol candidates that are supplied to `completing-read' ;; or `read-file-name' as its COLLECTION argument. As a programmer, ;; you can of course do that when your code calls these functions. ;; As an Icicles user, you can use `M-&' to define and apply ;; predicates to such alist-entry candidates on the fly, while ;; completing. ;; See (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview"). ;; ;;(@* "Word Matching and String Matching") ;; ** Word Matching and String Matching ** ;; ;; Google matches words, by default, but you can specify an "exact ;; phrase" to get literal string matching. ;; ;; By default, Icicles (apropos-)matches regexps, but you can use ;; `\b' in a regexp to perform word matching, and you can use `C-`' ;; (`icicle-toggle-regexp-quote') to perform exact (literal) ;; matching. See (@> "What About Special-Character Conflicts?"). ;; ;;(@* "AND Matching and OR Matching") ;; ** AND Matching and OR Matching ** ;; ;; Google has search fields for AND matching ("with all of the ;; words") and OR matching ("with at least one of the words"). ;; ;; In Icicles, you can use progressive completion to perform AND ;; matching: use `M-*' or `S-SPC' to introduce each term to match. ;; Alternatively, you can use `C-*' ;; (`icicle-candidate-set-intersection'). You can use `C-+' ;; (`icicle-candidate-set-union') to perform OR matching. Note that, ;; by definition, unordered AND matching is not possible using a ;; single regexp. See (@> "Progressive Completion") and ;; (@> "Sets of Completion Candidates"). ;; ;;(@* "NOT Matching") ;; ** NOT Matching ** ;; ;; Google has a search field for terms that must not occur in search ;; hits: "without the words". ;; ;; In Icicles, you can use `C-~' (`icicle-candidate-set-complement') ;; to exclude matching completion candidates. You can chain this ;; operation, as a form of progressive completion, to exclude any ;; number of terms: `toto S-TAB C-~ titi C-~ foobar C-~' excludes all ;; candidates matching toto, titi, or foobar. Use this ;; process-of-eliminiation technique to progressively pare down the ;; set of possible candidates. Note that such generalized ;; complementing (as opposed to complementing a character set) is not ;; possible using a single regexp - you cannot use a regular ;; expression to say "Show me everything that does *not* match this". ;; See (@> "Sets of Completion Candidates") and ;; (@> "Progressive Completion"). ;;(@* "Buffer-Name Input") ;; ;; Buffer-Name Input ;; ----------------- ;; ;; The Icicles commands that read buffer names are multi-commands ;; (see (@> "Multi-Commands")), so you can act on more than one ;; buffer during a given command invocation. ;; ;; These commands all let you use a prefix argument to control which ;; buffers are completion candidates. It is the numeric value of the ;; prefix arg that matters. Candidates are only the buffers that ;; satisfy these conditions: ;; ;; * Plain `C-u': whose mode is derived from the current buffer mode ;; * `C-u C-u': visible (possibly in an iconified frame) ;; * `C-u C-u C-u': invisible ;; * Zero: whose mode is the same as the current buffer mode ;; * Positive: visiting files ;; * Negative: associated with the selected frame ;; ;; Those are the default behaviors, but you can change them using ;; option `icicle-buffer-prefix-arg-filtering'. ;; ;; `icicle-buffer' (`C-x b' in Icicle mode, by default) is a ;; multi-command that accepts multi-completion input: the first part ;; matches buffer names, and the second part, which is optional, ;; matches buffer content. So for example: ;; ;; C-x b foo ; Match buffer names against `foo' ;; C-x b C-M-j toto ; Match buffer contents against `toto' ;; C-x b foo C-M-j toto ; Match both buffer name and contents ;; ;; You can use option `icicle-buffer-skip-hook' to specify patterns ;; for buffer names to exclude from content-searching when you ;; provide a content-matching pattern to `icicle-buffer'. ;; ;; In addition to the usual Icicles key bindings, during buffer-name ;; completion you can use additional keys, which are defined by ;; option `icicle-buffer-candidate-key-bindings'. These are the keys ;; provided by the default value of the option: ;; ;; * `C-x F' (`icicle-toggle-include-cached-files') Toggle whether ;; `icicle-buffer' includes cached file names as candidates. That ;; is, toggle option `icicle-buffer-include-cached-files-nflag'. ;; A prefix arg sets the option value to the numeric prefix value. ;; ;; * `C-x R' (`icicle-toggle-include-recent-files') Toggle whether ;; `icicle-buffer' includes recent file names as candidates. That ;; is, toggle option `icicle-buffer-include-recent-files-nflag'. ;; A prefix arg sets the option value to the numeric prefix value. ;; ;; * `C-x m' (`icicle-bookmark-non-file-other-window') to visit a ;; bookmarked buffer. This is available only if you use library ;; `bookmark+.el'. This too is a multi-command, so you can ;; actually visit any number of buffer bookmarks with one use of ;; `C-x m'. When finished, you can continue with non-bookmark ;; buffer-name completion. ;; ;; * `C-x C-m -' (`icicle-remove-buffer-cands-for-derived-mode') to ;; remove the buffer-name candidates with a major mode that is ;; derived from a given mode. You are prompted for the mode. You ;; can repeat this key to narrow buffer candidates by mode. (`C-m' ;; is the same key as `RET'.) ;; ;; * `C-x C-m +' (`icicle-keep-only-buffer-cands-for-derived-mode') ;; to keep only the buffer-name candidates with a major mode that ;; is derived from a given mode. You are prompted for the mode. ;; (`C-m' is the same key as `RET'.) ;; ;; * `C-x M -' (`icicle-remove-buffer-cands-for-mode') - same as ;; `C-x C-m -', but excludes ancestor modes. ;; ;; * `C-x M +' (`icicle-keep-only-buffer-cands-for-mode') - same as ;; `C-x C-m +', but excludes ancestor modes. ;; ;; * `C-x v -' (`icicle-remove-buffer-cands-for-visible') to remove ;; the candidate buffers that are visible. This includes buffers ;; that are in iconified frames. ;; ;; * `C-x v +' (`icicle-keep-only-buffer-cands-for-visible') to keep ;; only the candidate buffers that are visible. This includes ;; buffers that are in iconified frames. ;; ;; * `S-delete' to kill the buffer named by the current completion ;; candidate. ;; ;; When cached or recently used file names are included as ;; candidates, option `icicle-find-file-of-content-skip-hook' is used ;; to exclude files from content-searching whose names match its ;; patterns, similarly to what `icicle-buffer-skip-hook' does for ;; buffer names. ;; ;; During completion, candidate sorting is specific to buffer names. ;; `C-,' cycles among the following sort orders: ;; ;; * by last access ;; * `*...*' last: put buffers such as `*Messages*' and `*Help*' last ;; * by buffer size ;; * by major mode name ;; * by mode-line mode name (mode name that appears in the mode line) ;; * by (absolute) file or process name ;; ;; Remember too that the mode-line candidate help for a buffer-name ;; candidate includes the mode name, buffer size, and associated file ;; or directory, if any. The directory name can be especially ;; helpful for Dired buffer candidates, since the buffer name does ;; not tell you the full directory. For example, if you do `C-u C-x ;; b' from Dired, so the candidates are names of Dired buffers only, ;; then cycling shows you the directory for each one. ;; ;; Similarly, the more detailed help available from `C-M-RET' ;; etc. also lists the full name of the file or directory associated ;; with the buffer. ;; ;; The following user options control buffer-name completion. ;; ;; * `icicle-buffer-candidate-key-bindings' ;; * `icicle-buffer-extras' (*) ;; * `icicle-buffer-ignore-space-prefix-flag' ;; * `icicle-buffer-include-cached-files-nflag' ;; * `icicle-buffer-include-recent-files-nflag' ;; * `icicle-buffer-match-regexp' (*) ;; * `icicle-buffer-no-match-regexp' (*) ;; * `icicle-buffer-predicate' (*) ;; * `icicle-buffer-prefix-arg-filtering' ;; * `icicle-buffer-require-match-flag' ;; * `icicle-buffer-skip-hook' ;; * `icicle-buffer-sort' (*) ;; ;; You can use option `icicle-buffer-configs' to define buffer ;; configurations: persistent sets of the option values marked (*). ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Customization and General Tips") and ;; (@file :file-name "icicles-doc2.el" :to "Global Filters") for ;; information about user options affecting buffer-name completion ;; * (@> "Chapter & Verse: Searching Named Containers") about ;; content-searching ;; * (@> "Match File Names and File Content Too") about ;; content-searching of files ;; * (@> "Ido and IswitchB") to use Icicles with a buffer-switching ;; behavior that is similar to Ido and IswitchB ;; * (@> "`M-&': Satisfying Additional Predicates") to filter the ;; buffer candidates on the fly in multiple ways (e.g. size) ;;(@* "File-Name Input and Locating Files Anywhere") ;; ;; File-Name Input and Locating Files Anywhere ;; ------------------------------------------- ;; ;; Emacs offers two main functions for reading minibuffer input with ;; completion: `completing-read' and `read-file-name'. Icicles uses ;; both of these, and it enhances each of them in various ways for ;; use in your own Emacs-Lisp code. These two functions can each be ;; used to read file-name input, but they do so in very different ;; ways. ;; ;; This section provides a reminder description of these two ;; functions, and then it describes the main Icicles commands that ;; read file names. ;; ;; You do not need to use these Icicles commands to get the benefits ;; of Icicles enhancements to `completing-read' and `read-file-name'. ;; What these commands offer are additional benefits, which you might ;; or might not appreciate. ;; ;;(@* "Function `read-file-name'") ;; ** Function `read-file-name' ** ;; ;; Function `read-file-name' uses relative file-name completion. ;; It is specialized for file-name input with completion. It knows ;; about files and file names for your current platform. It knows ;; about Emacs remote file name syntax (Tramp, Ange FTP). And ;; starting with Emacs 23, `TAB' also completes environment variables ;; during `read-file-name' completion. ;; ;; Using `read-file-name' is the most flexible way to read a file ;; name in Emacs, and it is the traditional way. Unless stated ;; otherwise, "file-name completion", even in the Icicles doc, refers ;; to `read-file-name' completion. ;; ;; When `read-file-name' reads input, only the file name itself, not ;; the directory portion, is used for matching. The directory is ;; understood to be the directory that is present in the minibuffer, ;; or the value of variable `default-directory' (which you can change ;; using command `cd', for instance) if there is no directory there. ;; ;; Whether the value of `default-directory' is automatically inserted ;; in the minibuffer is controlled by user option ;; `insert-default-directory'. But if you do not change the ;; directory seen in the minibuffer then the behavior is the same ;; whether or not the `default-directory' name is present in the ;; minibuffer: it is the assumed directory. If you prefer, you can ;; delete the directory name first, using `M-k'. ;; ;; With `read-file-name', you can thus use apropos completion to ;; match a file-name substring, without needing to prefix the ;; substring with `.*' in the minibuffer. For example, to match the ;; file named `favorite-foo-file.bar' in directory ;; `/some/path/to/my/', you need not use `/some/path/to/my/.*foo'; it ;; is sufficient to use either `foo' or `/some/path/to/my/foo'. ;; ;; An additional feature of `read-file-name' in Icicle mode is that ;; candidates that are directory names are highlighted in buffer ;; `*Completions*' using face `icicle-special-candidate'. ;; ;;(@* "Function `completing-read'") ;; ** Function `completing-read' ** ;; ;; Function `completing-read' is a general function for reading input ;; with completion. It is not specially designed for reading file ;; names. It knows nothing about files and file names. It knows ;; nothing about remote file-name syntax. When `completing-read' ;; reads input, it makes no use of `default-directory'. The ;; completion candidates are treated as simple strings; they are not ;; really treated as file names. ;; ;; Icicles commands that use `completing-read' to read a file name ;; typically read an absolute name, that is, a name that includes the ;; directory portion. This means that you can match against any part ;; of the full name, including any directory components. The ;; directory portions of the candidate file names need not be the ;; same - you can thus complete against a set of files in multiple ;; directories. ;; ;;(@* "Remapping Vanilla File Commands to Icicles File Commands") ;; ** Remapping Vanilla File Commands to Icicles File Commands ** ;; ;; By default, that is, if you do not change the value of user option ;; `icicle-top-level-key-bindings', some commonly used Emacs commands ;; for accessing files are remapped to Icicles commands. For ;; example, command `find-file', is by default remapped in Icicle ;; mode to multi-command `icicle-file'. Remapping means that any ;; keys, such as `C-x C-f', that would normally be bound to ;; `find-file' are instead bound to `icicle-file' when you are in ;; Icicle mode. ;; ;; Consult `icicle-top-level-key-bindings' to see how this works. In ;; particular, note that if you normally bind a different command to ;; one of the keys mentioned here then the corresponding remapping in ;; `icicle-top-level-key-bindings' will not have the advertised ;; effect. ;; ;; For example, if you normally use the key bindings provided by ;; library `ffap.el' ("find file at point"), meaning that you invoke ;; command `ffap-bindings', then for you `C-x C-f' is bound to ;; `find-file-at-point', not `find-file'. By default, option ;; `icicle-top-level-key-bindings' does not remap ;; `find-file-at-point' to `icicle-file', so even in Icicle mode `C-x ;; C-f' remains bound to `find-file-at-point'. If you want `C-x C-f' ;; to be bound to `icicle-file', then change the `find-file' entry in ;; `icicle-top-level-key-bindings' (or add another entry for ;; `find-file-at-point'). ;; ;; What has just been pointed out for Icicles file commands applies ;; more generally to all Icicle-mode command remapping provided by ;; option `icicle-top-level-key-bindings'. ;; ;;(@* "Action Keys Bound Dynamically During File-Name Input") ;; ** Action Keys Bound Dynamically During File-Name Input ** ;; ;; In addition to the usual Icicles key bindings, during file-name ;; completion the Icicles commands that read file names bind the ;; following keys dynamically in the minibuffer keymaps, so you can ;; use them while to perform various operations on the fly when you ;; input a file name. These minibuffer bindings are also available ;; for autofile bookmark commands. ;; ;; * `C-backspace' (`icicle-up-directory') to navigate up the ;; directory hierarchy. It removes the last directory component ;; (and any partial file name) from your minibuffer input. ;; ;; (For Emacs versions before Emacs 22, this feature is available ;; only for completion of absolute file names.) ;; ;; * `C-c +' (`icicle-make-directory') to create a directory on the ;; fly. ;; ;; * `S-delete' to delete the file named by the current completion ;; candidate. ;; ;; * `M-|' (`icicle-all-candidates-list-alt-action') to open Dired on ;; the currently matching file names. That is, it opens a special ;; Dired buffer that contains only the matching files. You are ;; prompted for the Dired buffer name. See (@> "Alternative Actions"). ;; * `C-x m' (`icicle-bookmark-file-other-window') to visit a ;; bookmarked file or directory. This is available only if you use ;; library `Bookmark+' (`bookmark+.el'). It is a multi-command, so ;; you can actually visit any number of file bookmarks. When ;; finished, you can continue with non-bookmark file-name ;; completion. ;; ;; * `C-x a +' or `C-x a -' to add or remove tags for a file. These ;; are delicious-style tags - any labels you like. If there is not ;; already an autofile bookmark for the file, then one is created. ;; (The autofile bookmark is where the tags are persisted.) You ;; need library `Bookmark+' for this feature. See also ;; (@file :file-name "icicles-doc2.el" :to "Using Tagged Files"). ;; ;; * `C-x a a' to bookmark a file, that is, to create an autofile ;; bookmark. This is the same as `C-x a +' and `C-x a -', except ;; that it does not prompt you for tags to add or remove. You need ;; library `Bookmark+' for this feature. ;; ;; * `C-x C-t *' to narrow the current file-name completion ;; candidates to those that are tagged with all of the tags you ;; specify. You are prompted for the tags. ;; ;; * `C-x C-t +' - same as `C-x C-t *', except it narrows to the ;; files tagged with any of the specified tags. ;; ;; * `C-x C-t % *' to narrow the candidates to those whose tags all ;; match a specified regexp. You are prompted for the regexp. ;; ;; * `C-x C-t % +' - same as `C-x C-t % *', except it narrows to the ;; files that have any matching tag. ;; ;; In many cases for Icicles multi-commands that read a file name, ;; you can use `M-n' to pick up the file name at point, or if none ;; then the name of the file you are currently visiting. ;; ;; Note: Whether a command supports file-name globbing wildcards such ;; as `*' is independent of whether it uses `read-file-name' or ;; `completing-read'. It is the command itself that offers such ;; support or not. Globbing takes place only after the file name ;; (with wildcards) is read. All Icicles commands that visit files ;; (all of the commands mentioned in this section) let you use ;; globbing wildcards. Remember also that file-name globbing, with ;; its special wildcards, has nothing to do with regexp completion ;; matching. See (@> "What About Special-Character Conflicts?") for ;; more information about file-name globbing. ;; ;;(@* "Icicles Commands that Read File Names") ;; ** Icicles Commands that Read File Names ** ;; ;; Icicles commands that use `read-file-name' include all ;; multi-commands, such as `icicle-find-file', that are defined using ;; `icicle-define-file-command'. Vanilla Emacs command `find-file' ;; is another example of a command that uses `read-file-name'. ;; ;; Icicles commands that use `completing-read' to read file names ;; include the multi-commands `icicle-find-file-absolute', ;; `icicle-find-file-in-tags-table', `icicle-recent-file', ;; `icicle-locate', `icicle-locate-file', and ;; `icicle-locate-file-no-symlinks'. These are defined using ;; `icicle-define-command', not `icicle-define-file-command'. ;; ;; There are also `-other-window' versions of all of the Icicles ;; commands that read file names. ;; ;; The Icicles commands that use `completing-read' to read file names ;; have an additional feature: you can use a prefix argument to tell ;; them to combine the last modification date with the file name, as ;; a multi-completion - see (@> "Multi-Completions"). This means ;; that you can easily look up files whose modification time or date ;; matches some (regexp) criterion, such as being sometime in July ;; 2008. ;; ;; When using a command that reads an absolute file name, remember ;; that, to save space, you can use `C-x .' to toggle hiding of the ;; common match portions of the candidates in `*Completions*'. This ;; portion is often a long directory substring. ;; ;;(@* "`icicle-file', `icicle-find-file', `icicle-find-file-absolute'") ;; *** `icicle-file', `icicle-find-file', `icicle-find-file-absolute' *** ;; ;; Multi-command `icicle-file' is bound, by default, to `C-x C-f' in ;; Icicle mode, thus taking the place of `find-file'. It combines ;; multi-commands `icicle-find-file' and `icicle-find-file-absolute'. ;; With no prefix argument, it matches relative file names; with a ;; prefix argument, it matches absolute names (as ordinary strings). ;; With a negative prefix argument, you can match also the ;; modification date. ;; ;; An additional feature of `icicle-find-file-absolute' (`C-x C-f' ;; with a prefix arg) is that candidates that are directory names are ;; highlighted in buffer `*Completions*' using face ;; `icicle-special-candidate'. ;; ;; An additional feature of command `icicle-find-file' (`C-x C-f' ;; with no prefix arg) is that if you use a prefix arg when acting on ;; an individual file-name candidate then the file is visited in ;; read-only mode. The same invocation of `C-x C-f' can thus open ;; multiple files, some in read-only mode, some not. ;; ;; (There is also multi-command `icicle-find-file-read-only', unbound ;; by default, which is the same as `icicle-find-file' but with the ;; prefix arg behavior flipped: with no prefix arg when you act on a ;; candidate file it is visited read-only.) ;; ;;(@* "Match File Names and File Content Too") ;; *** Match File Names and File Content Too *** ;; ;; Starting with Emacs 23, command `icicle-find-file' (that is, ;; `icicle-file' with no prefix arg) is an alias for command ;; `icicle-find-file-of-content', which lets you optionally provide a ;; regexp pattern to match against file content. In this it is ;; similar to the buffer-switching multi-command `icicle-buffer'. ;; ;; If you provide a pattern to match file content then all files ;; whose names match the file-name part of your input are searched ;; for the content pattern. Icicles looks only for a single ;; content-match within each file it tests. Choose a candidate file ;; just visits it normally - it does not move to that tested match or ;; to any other content-match position. Matching is used only to ;; filter candidate files. ;; ;; However, if your input includes a content-matching part that ;; matches, that part is automatically added to the Isearch regexp ;; history, `regexp-search-ring', whenever you hit `S-TAB' to ;; complete your input. This means that when you visit the file you ;; can immediately search for matches using `C-M-s' or `C-M-r'. ;; ;; (You can also work in the other direction, reusing an Isearch ;; regexp as a content-matching regexp. See ;; (@> "Using Completion to Insert Previous Inputs: `M-o'").) ;; ;; Content-searching is obviously more costly than file-name ;; matching, so clearly if you can provide some information about the ;; file name, that improves performance. IOW, the more you can limit ;; the number of files to search, the better. ;; ;; To search file content, the candidate files are visited, that is, ;; buffers are created for them and searched. By default, after the ;; command is finished these buffers are killed, except for those you ;; actually chose as completion candidate(s) and any that existed ;; prior to invoking the command. ;; ;; This automatic extra-buffers cleanup is controlled by option ;; `icicle-kill-visited-buffers-flag'. But providing a prefix ;; argument to the command flips the behavior specified by that ;; option for the command duration. ;; ;; You can use option `icicle-find-file-of-content-skip-hook' to ;; specify patterns for file names to exclude from content-searching ;; when you provide a content-matching pattern to `icicle-find-file'. ;; ;; In Dired there is a related content-matching multi-command, ;; `icicle-visit-marked-file-of-content' (bound to `C-S-f', aka ;; `C-F', and `C-S-o', aka `C-O' for other-window), which you can use ;; to visit marked files and subdirectories whose content matches a ;; regexp. ;; ;; (Prior to Emacs 23, `icicle-find-file' is an alias for ;; `icicle-find-file-no-search', which does not search file content.) ;; ;; See also (@> "Chapter & Verse: Searching Named Containers"). ;; ;;(@* "Visit Recent Files or Files for Emacs Tags") ;; *** Visit Recent Files or Files for Emacs Tags *** ;; ;; Commands `icicle-find-file-in-tags-table' and ;; `icicle-find-file-in-tags-table-other-window' let you visit files ;; that are listed in the current Emacs tags table. You can think of ;; these potential completion candidates as all of the files in a ;; project defined by the tags table. ;; ;; You can use `icicle-recent-file' to open any file that you have ;; visited recently, perhaps in a previous Emacs session. ;; ;; Because Icicles lets you easily sort and filter candidates, ;; consider customizing option `recentf-max-saved-items' to a large ;; number, such as 1000. The default number (20) is very small ;; because it assumes that you will access the candidates using a ;; menu. ;; ;;(@* "Find Files Anywhere, Without Knowing Where") ;; *** Find Files Anywhere, Without Knowing Where *** ;; ;; You can use `icicle-locate' or `icicle-locate-file' to find a file ;; when you do not know precisely what directory it is in. The ;; former requires GNU/Linux or UNIX command `locate', to work. The ;; latter does not require any external program. ;; ;; Because it takes advantage of `locate' having indexed files on ;; your file system, `icicle-locate' can be much faster than ;; `icicle-locate-file'. Otherwise, these two Icicles commands work ;; similarly. ;; ;; Since it does not use an index, `icicle-locate-file' looks ;; throughout a given directory, including throughout all of its ;; subdirectories. Command `icicle-locate-file-no-symlinks' is the ;; same, except that it does not follow symbolic links. Both of ;; these commands respect option `icicle-ignored-directories', which ;; is a list of directories to ignore - by default, version-control ;; directories. ;; ;; By default, the target directory for `icicle-locate-file' is the ;; current directory, but if you supply a non-negative numeric prefix ;; argument (non-positive means include the date), then you are ;; prompted for the directory to search. ;; ;; If you use a plain prefix arg (`C-u') or a double plain prefix arg ;; (`C-u C-u') then you are prompted to choose a set of directories ;; to use. This choosing uses multi-command `icicle-directory-list'. ;; Icicles searches for file-name matches under each of the ;; directories you choose. For `C-u C-u', the candidate ;; multi-completions include the last file-modification date. ;; ;; In addition, if you turn on the use of proxy candidates (`C-M-_'), ;; `icicle-directory-list' also offers proxy candidates that are ;; variables, such as `load-path', whose values are lists that ;; include directories. Choosing a proxy candidate adds all of its ;; directories to the set to be searched. ;; ;; If you use the root of your file system as the search directory, ;; then the Icicles file-locating commands will match completion ;; candidates anywhere in your file system. ;; ;; This can be quite useful. It gives you much of the power of the ;; Unix `find' command just for completing input. And with ;; incremental completion (see (@> "Icompletion")), you can see what ;; matches your input as you type. ;; ;; Obviously, if you use your entire file system as the set of ;; completion candidates and you use `icicle-locate-file' (because ;; you do not have available the external program `locate'), then ;; gathering and matching such a large set of file names can take ;; some time. ;; ;; On my hard drive, for instance, there are 36 GB full of files, and ;; it takes about 40 seconds to gather all of the file names. In ;; spite of this inconvenience, this functionality can be useful. ;; And of course searching a shallower directory tree presents less ;; of a performance penalty - you pay for what you get. ;; ;; However, even if you do not have command `locate', there is a way ;; of having your cake and eating it too. You can gather all of the ;; file names in your file system once, and save that list of ;; completion candidates to a cache file on disk, as a snapshot. See ;; (@> "Persistent Sets of Completion Candidates"), for how to do ;; this. ;; ;;(@* "Absolute File Names and Different Directories") ;; ** Absolute File Names and Different Directories ** ;; ;; Since `completing-read' has no understanding of file-name syntax, ;; including remote file-name syntax, `icicle-find-file-absolute' ;; (`C-u C-x C-f') and similar commands are similarly ignorant. (You ;; can nevertheless use `C-.' with these Icicles commands, to toggle ;; respect of `completion-ignored-extensions'.) In particular, these ;; commands will not let you complete to a remote file name if the ;; current directory is local. They also will not let you complete ;; to a file name in a different local directory. ;; ;; Because all Icicles commands that read file names use lax ;; completion, you can nevertheless visit a file in a different ;; directory (remote or local) from the current one, even though you ;; cannot complete your input to such a name. That is, you can ;; always use `RET' with any file name as minibuffer input. ;; ;; So how can you complete your input to an absolute file-name in a ;; different directory? By retrieving a saved candidate set that has ;; such absolute names and then completing against that set. For ;; example, you can retrieve a set that represents files on a remote ;; machine and complete to their names even from a local directory. ;; All that counts for `completing-read' is that your input can match ;; candidates, where that matching is ordinary (apropos or prefix) ;; string matching. ;; ;; To create such a saved set of names, you can visit the directory ;; (perhaps remote) that contains the files and then use `C-u C-x ;; C-f' and `C-}' to save the candidates. You can later retrieve ;; this saved set for completion, no matter what the current ;; directory is. As another example, you can use ;; `icicle-locate-file' in a remote directory to create a saved set ;; that includes remote files that are all somewhere under that ;; remote directory. ;; ;; In addition, you can add more file names to an existing saved set ;; using `C->', `C-)', `M-mouse-3', `insert', or `M-S-mouse-2' - see ;; (@> "Sets of Completion Candidates"). The added names can come ;; from a different directory than files already in the saved set. In ;; this way, you can build up a saved set that includes files from ;; any directories, some of which can be local and some remote, some ;; remote from one host, some remote from another, and so on. You can ;; create a saved set with any mix of absolute file names from any ;; locations. ;; ;; Remember this: ;; ;; * To create and add to a saved set of absolute file names, use a ;; command that expects absolute file names, and do this from the ;; directory that contains the files you want to add. ;; ;; * When you retrieve a saved set of file-name candidates for ;; completion, use a command that expects the same kind of file ;; names, relative or absolute, as the saved names. For example, ;; if you save a set of project files that are spread over ;; different directories (and hence are absolute), then retrieve ;; that candidate set using, say, `C-u C-x C-f' (absolute), not ;; `C-x C-f' (relative). ;; ;; Finally, although the commands that read absolute file names are ;; essentially ignorant of directory hierarchies and of file names as ;; such, so that they treat their candidates only as simple strings, ;; a few of these commands nevertheless define their domain of ;; possible file-name candidates relative to some starting directory. ;; ;; This is the case for `icicle-find-file-absolute' and ;; `icicle-locate-file' (and their variants). For these commands, ;; you can use `C-c C-d' (think UNIX command `cd') during completion ;; to change the current working directory (`default-directory') on ;; the fly. You are prompted for the directory. The domain of ;; possible candidates is recomputed relative to the new ;; `default-directory'. ;; ;; Use `C-c C-d' this way as many times as you like. You can use ;; this feature to add file names from different directories to a ;; saved set of candidates. When the command is finished, the ;; original `default-directory' is restored. ;; ;; See Also: ;; ;; * (@> "Persistent Sets of Completion Candidates") for information ;; about saving a set of file names persistently ;; * (@> "Sets of Completion Candidates") for information about ;; creating, saving, and retrieving sets of file names ;; * (@> "Dealing With Large Candidate Sets") for ways to deal with a ;; large number of candidates ;; * (@> "Multi-Completions") ;; * (@file :file-name "icicles-doc2.el" :to "Support for Projects") ;; for more about `icicle-find-file-in-tags-table' ;; * (@> "Completion On Demand") for information about on-demand ;; insertion of file names, using completion, from any minibuffer ;; * (@> "Match Multiple Things Together") about content-searching ;; * (@> "Buffer-Name Input") about visiting recently used files or ;; files whose names have been cached, and about content-searching ;; them ;; * (@file :file-name "icicles-doc2.el" :to "Using Tagged Files") ;; for more information about tagging files ;;(@* "Persistent Sets of Completion Candidates") ;; ;; Persistent Sets of Completion Candidates ;; ---------------------------------------- ;; ;; Section (@> "Sets of Completion Candidates") describes how you can ;; save the current set of completion candidates and reuse it later. ;; This is not a persistent save, however; the candidates are simply ;; saved in variable `icicle-saved-completion-candidates' for the ;; duration of your Emacs session (or until you save candidates ;; again). ;; ;; You can save the current set of completions (whatever it is) ;; persistently by supplying a plain prefix argument (`C-u') when you ;; use `C-M->' (`icicle-candidate-set-save') during completion. ;; Alternatively, you can use `C-}', bound to ;; `icicle-candidate-set-save-persistently', which does the same ;; thing. To retrieve completion candidates that were previously ;; saved to a cache file, so that they become the current set of ;; candidates, use either `C-u C-M-<' or `C-{' ;; (`icicle-candidate-set-retrieve' or ;; `icicle-candidate-set-retrieve-persistent'). ;; ;; Tip: Suppose you have already saved a set of candidates, but not ;; persistently, and you now want to write this saved set to a ;; cache file. Use `C-M-<' followed by `C-}'. That is, ;; retrieve the saved candidates and then save the retrieved ;; candidates persistently. ;; ;; Note that using a numeric prefix argument (`C-u' with a number) ;; with `C-M->' and `C-M-<' saves or retrieves a ;; completion-candidates set using a variable that you name, not a ;; cache file. See (@> "Sets of Completion Candidates"). ;; ;;(@* "Saving Candidates in Cache Files") ;; ** Saving Candidates in Cache Files ** ;; ;; If you have used the Emacs file-name cache (see the Emacs manual, ;; node "File Name Cache"), then you have already used a cache file ;; of (file-name) completion candidates. In vanilla Emacs, you use ;; `C-TAB' (`C-tab') during file-name input to complete to a cached ;; file name. In Icicles, you use `C-{'. ;; ;; In Icicles, the cached candidates are not limited to file names, ;; and you can have any number of cache files, to save different sets ;; of completion candidates. Each cache file saves the set of ;; candidates that was current when you created (saved) the set. ;; ;; The fact that a cache file can contain just those candidates that ;; were current when you saved it is a considerable advantage, when ;; combined with Icicles features for sculpting the current set of ;; matching candidates. As far as I know, Icicles is the only ;; package to offer this feature. You spend a few moments to ;; fine-tune a set of candidates, using, for example, `M-*' or ;; `S-SPC', `C-~', and `delete', and then save it for later use. ;; From then on, you can match against exactly those candidates ;; anytime you want. ;; ;; For example, you might have a software project that involves only ;; certain directories and perhaps only certain kinds of files in ;; those directories are of interest as completion candidates. Those ;; directories and files can even be in disparate locations. ;; ;; Start with command `icicle-locate-file' (or ;; `icicle-locate-file-no-symlinks'). Then use progressive ;; completion to match the directories and files you want and chip ;; away at those you do not want. Once you get just the set you need ;; for your project, save that set using `C-}'. You can have any ;; number of saved sets, for different projects or different purposes ;; in the same project. ;; ;; You name the sets of saved candidates, and these names are ;; associated with the cache files in user option ;; `icicle-saved-completion-sets'. This is an alist of entries, each ;; of which is of the form (SET-NAME . CACHE-FILE-NAME). You can ;; customize this option, or set it in your init file (~/.emacs). ;; ;; You can use command `icicle-add/update-saved-completion-set' to ;; add a new set to `icicle-saved-completion-sets' or update ;; (replace) an existing such set. You can use command ;; `icicle-remove-saved-completion-set' to remove a saved set. ;; ;; As an alternative to customizing `icicle-saved-completion-sets' or ;; using command `icicle-add/update-saved-completion-set', you can ;; simply try to save a set of completion candidates persistently, ;; using `C-u C-M->' or `C-}'. You are then prompted for the names ;; of the candidate set and cache file to use, and the names you ;; enter are automatically entered in option ;; `icicle-saved-completion-sets'. That option is automatically ;; saved to your `custom-file' (or init file, `~/.emacs'), so the ;; next time you use Emacs you can retrieve any saved set of ;; candidates that you like. ;; ;; When you try to retrieve a persistent set of completion ;; candidates, you are similarly prompted for the candidate-set name ;; and the cache-file name. ;; ;; In addition to saving the current set of completion candidates to ;; a cache file, you can add individual strings as future completion ;; candidates to any cache file, and you can remove candidates from a ;; cache file individually. You do this using commands ;; `icicle-add-entry-to-saved-completion-set' and ;; `icicle-remove-entry-from-saved-completion-set'. ;; ;; Adding an individual candidate is similar to using the Emacs ;; file-name cache commands that add file names to the cache, but it ;; adds only a single candidate. For file names, adding a directory ;; name effectively provides completion for all of its files as well, ;; so there is no need to add each file name as well as the directory ;; name. Alternatively, you can always use `C-}' to add all file ;; names that match your current input. ;; ;;(@* "Filesets and Icicles Saved Completion Sets") ;; ** Filesets and Icicles Saved Completion Sets ** ;; ;; Starting with release 22, GNU Emacs includes a filesets feature ;; that lets you create named sets of file names, called "filesets". ;; It is a powerful feature, letting you define such sets by ;; intension, using regexp patterns, as well as by extension, listing ;; file names explicitly. You can easily use a fileset to define a ;; project of files. ;; ;; Icicles lets you use an Emacs fileset any time you can use an ;; Icicles saved completion set, provided that option ;; `icicle-filesets-as-saved-completion-sets-flag' is non-`nil'. ;; ;; That is, you can retrieve fileset file names as the current set of ;; completion candidates or save the current completion candidates to ;; a fileset. Provided ;; `icicle-filesets-as-saved-completion-sets-flag' is non-`nil', you ;; can always choose a fileset as the set to retrieve. To save to a ;; fileset, use a prefix arg with `C-}' or a zero prefix arg with ;; `C-M->'. Saving candidates to a fileset gives you an alternative ;; to customizing option `filesets-data'. ;; ;; Being able to use an Emacs fileset in place of an Icicles saved ;; set lets you use filesets in additional ways. For example, it ;; lets you open Dired on only the files in a fileset, for easy ;; manipulation of the member files. Conversely, you can save all of ;; the marked files in a Dired buffer as a fileset. See ;; (@file :file-name "icicles-doc2.el" :to "Icicles Dired Enhancements"). ;; ;; Beyond letting you use a fileset in place of a persistent Icicles ;; saved completion set, you can include filesets in such saved ;; Icicles sets. That is, you can save one or more filesets of any ;; kind (`:files', `:tree', etc.) in an Icicles persistent saved set ;; (cache file). When you then retrieve such a saved set, all of the ;; file names specified by all of the included filesets become ;; completion candidates. ;; ;; For example, this could be a saved Icicles set that combines a ;; `:tree' fileset with an explicit `:files' fileset and with two ;; additional files: ;; ;; ((:fileset "set1" (:tree "~/my/dir" "^ici.+\\.el$")) ;; (:fileset "set2" (:files "dired+.el" "c:/my/dir/buff-menu+.el")) ;; "c:/some/other/dir/foobar.el" ;; "c:/somewhere/else/toto.el") ;; ;; This is a great way to put together a project of files from ;; different directory trees. And even aside from the use of such a ;; saved set for completion, this combining of filesets is something ;; that you cannot do with Emacs filesets alone, as far as I know - ;; you cannot combine different filesets into super filesets, and a ;; given fileset can specify files in only one way (`:files', ;; `:tree', etc.). Icicles gives you a way to associate related ;; filesets and use them together as a single set. ;; ;; You can use commands ;; `icicle-remove-entry-from-saved-completion-set' and ;; `icicle-add-entry-to-saved-completion-set' to remove a fileset ;; from an Icicles saved set or add a fileset to a saved set. To ;; add, use a prefix arg to tell ;; `icicle-add-entry-to-saved-completion-set' that you are adding a ;; fileset and not a single completion candidate. To add a single ;; file (default: the current buffer's file) to a fileset, use ;; command `icicle-add-file-to-fileset'. ;; ;;(@* "Improving Performance with Persistent Sets") ;; ** Improving Performance with Persistent Sets ** ;; ;; There are two independent reasons that using a persistent set of ;; file names can improve performance: ;; ;; * Avoiding remote file-name completion. You can complete your ;; input against remote file names without using Tramp and thus ;; without accessing the remote file system. (Once you have chosen ;; the file you want, visiting it of course makes a remote access.) ;; ;; * Avoiding generation of a large completion set. Retrieving a ;; list of file names is much, much faster than generating such a ;; list. So generate once and retrieve often, from a cache. ;; ;; These are covered in the next two sections. ;; ;;(@* "Avoid Remote File-Name Completion") ;; *** Avoid Remote File-Name Completion *** ;; ;; When you complete the name of a remote file, Tramp accesses the ;; remote file system to see which matching files exist. This takes ;; time. The completion itself is complicated - it involves parsing ;; the remote file name and calling upon various file handlers. But ;; the greatest time spent is in accessing the remote machine. ;; ;; When you retrieve a (persistently) saved set of file names during ;; completion, you are telling Emacs that these are the candidates ;; you want to complete against. You are not asking Emacs (Tramp) to ;; tell you what the possible candidates are; you are telling it. ;; (Obviously you will want to save the completions in a file on the ;; local machine, so retrieval itself takes no time.) ;; ;; After retrieving the saved candidates as the only possible ones, ;; you might type some input and complete it (`TAB' or `S-TAB') to ;; narrow your choices. Or you might not bother with completion but ;; instead pick one of the candidates using `mouse-2' or by cycling ;; to it and using `RET'. ;; ;; You can use either relative or absolute file-name completion with ;; remote file names. Relative name completion as provided by ;; `read-file-name' (via `C-x C-f', for example) always involves ;; Tramp (or ange-ftp, prior to Emacs 22). When using relative name ;; completion, you can save time in these ways: ;; ;; * Turn off incremental completion (using `C-#'), so that Tramp is ;; used only when you hit `TAB' or `S-TAB', not with each character ;; you type or delete! ;; ;; * Use `mouse-2', or cycle and use `RET', so that you avoid ;; completion altogether. Tramp is then used only to access the ;; chosen file. ;; ;; If you use absolute file-name completion as provided by ;; `completing-read' (via `C-u C-x C-f', for example), then you need ;; not worry about turning off incremental completion or avoiding ;; completion by cycling or using `mouse-2'. This is because ;; completion is entirely local - `completing-read' has no notion of ;; files, let alone remote files. ;; ;; In addition, if you use absolute file-name completion then you ;; need not bother to type the (long) remote file-name prefix to get ;; into the right directory for completion. Again, `completing-read' ;; has no notion of files or directories - it just completes an input ;; pattern against string candidates. Just type a substring or other ;; regexp and then hit `S-TAB'. ;; ;; In general, using absolute file names (`C-u C-x C-f') is the way ;; to go when dealing with remote files. There is no need to forego ;; the advantages of Icicles completion. On the other hand, if you ;; are going to work in a directory on a remote machine for some time ;; using files other than those in some saved completion set, then ;; you might want to use relative file names (`C-x C-f'). ;; ;;(@* "Avoid Generating A Large Completion Set") ;; *** Avoid Generating A Large Completion Set *** ;; ;; Section (@> "File-Name Input and Locating Files Anywhere") tells ;; you how you can locate any file in your file system. If you save ;; the set of all file names persistently, you will increase the ;; performance of using it - it is much faster to retrieve the list ;; of all file names than it is to generate it. ;; ;; With 36 GB of files in my file system, my all-file-system cache ;; file is 20 MB, and retrieving the file-name completions from it ;; takes only a few seconds. With this feature, Icicles essentially ;; gives you the functionality of the Unix `locate' command, but with ;; the addition of real-time regexp matching. Here is all you do: ;; ;; M-x icicle-locate-file RET ;; C-# ; Once or twice: turn off incremental completion. ;; C-{ ; Retrieve all file names from your cache file. ;; ; You are prompted for the set name and file name. ;; foo.*bar ; Regexp to match names with `foo' followed by `bar'. ;; S-TAB ; Update `*Completions*' display (because of `C-#'). ;; ;; Of course, once you have retrieved a set of candidates from your ;; cache file, you can access them again without re-reading the file. ;; When they are retrieved from your cache they are saved in variable ;; `icicle-saved-completion-candidates', so the next time you want to ;; use them, just retrieve them from this variable with `C-M-<'. ;; ;; See Also: ;; ;; * (@> "File-Name Input and Locating Files Anywhere") for ;; information about relative vs absolute file names and about ;; finding files located anywhere in your file system ;; ;; * (@> "Icompletion") for information about `C-#' (toggle ;; incremental completion) ;; ;; * (@> "Sets of Completion Candidates") for information about ;; `C-M->' (save current candidates) ;; ;; * (@> "Dealing With Large Candidate Sets") ;; ;; * (@file :file-name "icicles-doc2.el" :to "Icicles Bookmark Enhancements") ;; for information about using autofile bookmarks, which are ;; another form of persistent file names ;;(@* "Dealing With Large Candidate Sets") ;; ;; Dealing With Large Candidate Sets ;; --------------------------------- ;; ;; One of the advantages Icicles provides is the ability to deal with ;; large sets of completion candidates with ease. There are other ;; libraries that also let you cycle among various choices of ;; different kinds (buffers, files, and so on), but cycling quickly ;; loses its effectiveness as the number of candidates increases. ;; ;; Icicles apropos matching lets you work with a large initial set of ;; candidates by filtering them, quickly reducing the number ;; candidates to cycle through. Filtering by a prefix only (vanilla ;; Emacs) is not very potent. Until you get used to Icicles, you ;; will be surprised at your ability to manipulate even humongous ;; sets of choices. ;; ;; Nevertheless, there can be times when a candidate set is so large ;; that you need to use a few tricks to deal with it efficiently. ;; There are two main things that take time when dealing with a large ;; set: computing the set and displaying it (with highlighting) in ;; buffer `*Completions*'. In particular, incremental completion ;; display is costly because it does both of these, recompute the set ;; and redisplay it, each time you type or delete a character in the ;; minibuffer. ;; ;; Here are some tips to improve performance with a large set of ;; candidates: ;; ;; * Turn off incremental completion display in buffer ;; `*Completions*'. You can do this on the fly at any time by ;; using `C-#' in the minibuffer - use `C-#' again to turn it back ;; on. See (@> "Icompletion"). ;; ;; * Compute a large candidate set only once, cache the result, and ;; reuse it later by reading the cache instead of recomputing. ;; This is useful, for instance, for the candidate set of all files ;; on your file system. You can cache a set of candidates in ;; either a variable (quickest, but not persistent) or a disk file ;; (slower, persistent). ;; See (@> "Persistent Sets of Completion Candidates"). ;; ;; * Compute a large candidate set (and perhaps cache it or filter ;; it) without displaying it in `*Completions*', by using `C-M-TAB' ;; (`C-M-tab') or `C-M-S-TAB' (`C-M-S-tab') instead of `TAB' or ;; `S-TAB', respectively. These are bound to commands ;; `icicle-prefix-complete-no-display' and ;; `icicle-apropos-complete-no-display'. For example, when ;; initially computing the set of all files on your file system for ;; `C-u M-x icicle-locate-file', use `C-M-S-TAB' to compute the ;; set, then use `C-}' to save it to a cache file - you need never ;; display it. ;; ;; (The documentation refers to the keys that do this as ;; `C-M-S-TAB' and `C-M-TAB'. Actually, this is only by default. ;; You can customize this, using options ;; `icicle-apropos-complete-no-display-keys' and ;; `icicle-prefix-complete-no-display-keys'.) ;;(@* "History Enhancements") ;; ;; History Enhancements ;; -------------------- ;; ;; This section is about accessing and reusing previous input that ;; you have typed in the minibuffer. ;; ;;(@* "What Input, What History?") ;; ** What Input, What History? ** ;; ;; First, what is meant by "input" and "input history"? In vanilla ;; Emacs and in this doc, "minibuffer history" and "input history" ;; generally refer to input that you have typed (or cycled or ;; completed) in the minibuffer and then entered using `RET' (or ;; `S-RET'). Emacs provides different history lists for this, ;; depending on the kind of input. The most general such list is the ;; value of variable `minibuffer-history'. ;; ;; But what about input that you type in the minibuffer (e.g. during ;; completion) but that you do not enter with `RET'? That is not ;; recorded in any standard history list, so you cannot recall it ;; using `M-p' and `M-n'. ;; ;; The Icicles doc speaks ambiguously of "minibuffer input". This ;; always refers to something that you type in the minibuffer, but ;; sometimes it means input that you enter with `RET' and sometimes ;; it does not. The context and the use of phrases such as "entered" ;; and "entered with `RET'" should make clear what is meant. Input ;; that you type during completion but that you do not necessarily ;; enter is sometimes referred to in the Icicles doc as "completion ;; input". ;; ;; Icicles also records any input that you type during completion but ;; you do not enter (`RET' or `mouse-2'), because you might need to ;; retrieve it. This can be because you cycled among completion ;; candidates (cycling replaces the input you type) or because ;; Icicles has expanded your input to the common match among all ;; matching candidates (see option ;; `icicle-expand-input-to-common-match'). ;; ;; You can retrieve the last such unentered input during completion ;; using `C-l' (`icicle-retrieve-previous-input') and `C-S-l', that ;; is, `C-L', (`icicle-retrieve-next-input'). Use these commands to ;; cycle among your past completion inputs (backward and forward, ;; respectively). ;; ;; User option `icicle-completion-history-max-length' limits the ;; number of completion inputs to save. ;; ;; If you customize user option `icicle-C-l-uses-completion-flag' to ;; non-`nil', then, instead of cycling, `C-l' lets you use Icicles ;; completion to retrieve a past completion input (`C-L' does the ;; same thing). Using completion to retrieve a past input does not ;; also choose that input as the candidate for the main completion; ;; it just replaces your current minibuffer input with it. Because ;; `C-l' completion uses a recursive minibuffer, you can also use ;; `C-g' to cancel this completion and return to the main completion. ;; ;; You can temporarily reverse the effect of ;; `icicle-C-l-uses-completion-flag' by using a prefix argument ;; (`C-u') with `C-l'. Thus, `C-u C-l' uses completion if ;; `icicle-C-l-uses-completion-flag' is `nil' and cycles if it is ;; non-`nil'. ;; ;; The other sections here describe Icicles enhancements for ;; minibuffer histories. They are thus concerned only with inputs ;; that you enter, not with completion inputs that are not entered. ;; ;;(@* "Overview of Minibuffer History Enhancements") ;; ** Overview of Minibuffer History Enhancements ** ;; ;; Icicles enhances the minibuffer history in these independent ways: ;; ;; 1. Commands invoked using a menu-bar menu are included in the ;; command history for `M-x'. This helps you quickly find again ;; and reuse a (possibly deep) menu item. It lets you use ;; completion to access such commands. And it helps you learn the ;; commands that correspond to menu items that you use, thus ;; providing a missing bridge between menu use and minibuffer use. ;; ;; If you do not want to include menu-item commands in the command ;; history, then set option `icicle-menu-items-to-history-flag' to ;; `nil'. ;; ;; Note: Non-`nil' `icicle-menu-items-to-history-flag' simply ;; makes Emacs handle menu items that you choose the same way that ;; it handles commands that you enter using `RET'. It does not ;; add such menu items to your completion history, which you ;; access using `C-l' (see (@> "What Input, What History?"), ;; above). ;; ;; 2. Minibuffer multi-command `icicle-insert-history-element' (`M-o' ;; in the minibuffer) lets you use completion to insert any number ;; of history elements in the minibuffer. ;; ;; 3. Candidates displayed in `*Completions*' are highlighted using ;; face `icicle-historical-candidate' (blue foreground, by ;; default), when they have been used previously, so you can more ;; easily recognize them. This highlighting is controlled by ;; option `icicle-highlight-historical-candidates-flag'. You can ;; toggle this from the minibuffer at any time using `C-pause'. ;; ;; 4. Command `icicle-toggle-alternative-sorting', (`C-M-,' in the ;; minibuffer) re-sorts completion candidates, placing previously ;; used candidates first. This is a toggle: repeat it to return ;; to the original order. ;; ;; 5. Command `icicle-keep-only-past-inputs' (`M-pause' in the ;; minibuffer) restricts the current set of completion candidates ;; to those that you have used previously. In other words, it ;; keeps only those candidates that are highlighted in blue. To ;; use `M-pause', you must first have used `TAB' or `S-TAB' to ;; establish an explicit candidate set. If you use `C-u M-pause', ;; then the previously used candidates are ordered ;; chronologically, most recent first. Without `C-u', the normal ;; sort order is used (`icicle-sort-comparer'). ;; ;; 6. Command `icicle-history' (`M-h' in the minibuffer) matches the ;; current input against the minibuffer history directly. It can ;; be used during completion. ;; ;; 7. Command `icicle-other-history' (`C-M-pause' in the minibuffer) ;; lets you use a different history for the current minibuffer ;; reading. You can choose the history using completion (even if ;; the main minibuffer reading does not allow completion). ;; ;; You can choose among any variables whose names end in `history' ;; or `ring', which includes the Isearch histories `search-ring' ;; and `regexp-search-ring'. ;; ;; 8. Commands `icicle-clear-history' and ;; `icicle-clear-current-history' (`M-i' in the minibuffer) ;; provide a general way to clean up histories. ;; ;; 9. When you cycle among previously entered inputs using `M-p' and ;; `M-n', you can use `M-k' (command ;; `icicle-erase-minibuffer-or-history-element') to delete the ;; current occurrence from the history list. This is a quick and ;; handy way to clean up list entries that you are no longer ;; interested in. Only the occurrence that you have cycled to is ;; deleted; if there are identical entries elsewhere in the ;; history, they remain. ;; ;; Some of these enhancements are described below in more detail. ;; Each of 1-7 lets you see the complete list of previous inputs that ;; match your current input. ;; ;; In vanilla Emacs, the history lists are never shown as such; you ;; can access previous inputs only one at a time, in order (with ;; `M-p'). In vanilla Emacs, you can use a regexp to search the ;; history list (via `M-r' and `M-s'), but the regexp matching is not ;; dynamic, and the first match found is the only one you get. In ;; Icicle mode, `M-r' and `M-s' are not available for matching a ;; history item - use `M-o' instead (see next). ;; ;; Displaying previous inputs that match the current input sounds ;; like a minor advantage, but it is actually quite helpful in ;; practice. Among other things, it means that you can work with ;; long history lists in a practical way. ;; ;;(@* "Using Completion to Insert Previous Inputs: `M-o'") ;; ** Using Completion to Insert Previous Inputs: `M-o' ** ;; ;; Unlike the other minibuffer history enhancements, described below, ;; which are available only during minibuffer completion, you can use ;; `M-o' (`icicle-insert-history-element') anytime you are asked for ;; minibuffer input. It is thus a form of on-demand completion (see ;; (@> "Completion On Demand"). It provides a recursive minibuffer ;; in which you can match previous inputs using completion. ;; ;; This is a multi-command: you use `C-RET' etc. to choose matching ;; previous inputs as candidates using a recursive minibuffer. Yes, ;; you can even use `C-!' to choose all matching candidates, ;; inserting them in the current sort order. ;; ;; When you are finished choosing candidates, use `C-g' (or `RET') to ;; exit to the previous minibuffer level. All of the previous inputs ;; you chose are inserted into the upper-level minibuffer, in order. ;; ;; This is better than cycling with `M-n' or `M-p', or searching with ;; `M-s' or `M-r' in vanilla Emacs: You can use Icicles completion ;; and cycling to quickly access a previous input, no matter how long ;; ago you entered it. ;; ;; When completion is available for reading input, if you use `M-o' ;; to choose previously entered inputs, this just inserts that text ;; into the minibuffer. What is in the minibuffer after you use ;; `M-o' is not used automatically and immediately for the main ;; completion - you can edit it before entering it using `RET'. ;; ;; Here's an example: Reuse a previous Isearch search string as the ;; content-matching part of your input for `C-x C-f' (`icicle-file') ;; or `C-x b' (`icicle-buffer'): ;; ;; C-x C-f C-M-j C-M-pause ;; ;; Choose `regexp-search-ring' (or `search-ring') as the history to ;; use. ;; ;; M-o S-TAB ;; ;; Choose a previous search string to insert, then complete to find ;; a file whose content matches it. ;; ;; Reminder: ;; ;; `C-M-j' lets you provide a regexp to match file content. ;; `C-M-pause' lets you choose a history. ;; `M-o' lets you insert from the history. ;; ;;(@* "Multi-Input Insertion with a Prefix Arg") ;; *** Multi-Input Insertion with a Prefix Arg *** ;; ;; This section describes the use of a prefix argument with `M-o' ;; (`icicle-insert-history-element'). It also applies to `M-r' ;; (`icicle-roundup'). ;; ;; Because `M-o' lets you insert more than one previous input, there ;; are different ways to separate these insertions, depending on the ;; prefix argument. ;; ;; * With no prefix arg, each inserted candidate you choose is ;; followed by a space character. ;; ;; * With a non-positive prefix arg, no such space char is appended. ;; ;; * With a non-negative prefix arg, each chosen candidate is wrapped ;; with "..." before being inserted. ;; ;; These possibilities provide for different uses of such insertion: ;; ;; * Space separation is useful if you are preparing minibuffer input ;; for a command that interprets the input as multiple arguments. ;; It is also useful for Icicles keys (`M-R', `M-S') that interpret ;; the input as multi-inputs - see (@> "Multi-Inputs"). ;; ;; * Wrapping with "..." is useful in combination with space ;; separation when a candidate contains whitespace. For example, ;; multiple file name, some of which contain whitespace. ;; ;; A prefix argument to `M-o' applies to each of the candidates you ;; choose, by default. If you use a prefix arg then you will ;; typically want to exit using `C-g' (not `RET'), so the prefix arg ;; applies also to the last candidate chosen. ;; ;; You can override the prefix arg for `M-o' or lack thereof, by ;; using a prefix arg for an individual candidate action ;; (e.g. `C-u C-RET'). ;; ;;(@* "Putting Previous Candidates First: `C-M-,'") ;; ** Putting Previous Candidates First: `C-M-,' ** ;; ;; At any time, two of the Icicles sort orders are immediately ;; available. These are the values of user options ;; `icicle-sort-comparer' and `icicle-alternative-sort-comparer'. By ;; default, the former usually sorts alphabetically, and the latter ;; puts all previously used inputs first, before the candidates you ;; have not yet used. Each of these groups, used and unused ;; candidates, is then sorted alphabetically, separately. So, with ;; the default alternative sort, you can see all matching candidates ;; (used and unused), but you privilege those used previously - they ;; are the first listed in `*Completions*' and the first available ;; for cycling. ;; ;; If you prefer, by customizing these user options, you can use ;; `icicle-historical-alphabetic-p' as the main sort function (option ;; `icicle-sort-comparer') and some other sort function ;; (e.g. `icicle-case-string-less-p') as the alternative sort ;; function. ;; ;; You can toggle at any time between normal sorting and alternative ;; sorting, using command `icicle-toggle-alternative-sorting'. ;; During completion, this is bound to `C-M-,'. Together with ;; toggling between normal sorting and not sorting at all, which is a ;; sort-order choice available through `C-,', this gives you quite a ;; lot of flexibility. ;; ;;(@* "Matching Only Historical Candidates: `M-h' and `M-pause'") ;; ** Matching Only Historical Candidates: `M-h' and `M-pause' ** ;; ;; Both `M-h' (`icicle-history') and `M-pause' ;; (`icicle-keep-only-past-inputs') can be used toward the same end. ;; They both work for all input types. They both use the appropriate ;; history list for the current command. They both provide ;; completion and cycling for the minibuffer history. Use them as ;; another way to search through a history list or complete to one of ;; its elements. ;; ;; For example, If you use `C-x C-f' to find a file, and then use ;; `M-h' or `M-pause', the completion candidates will be the names of ;; files that you have previously accessed (file names you have input ;; in the minibuffer), and which match the current minibuffer input. ;; ;; `M-h' lets you complete your input against the minibuffer input ;; history. `M-pause' lets you restrict the current explicit set of ;; completion candidates to those that are also in the minibuffer ;; history. ;; ;; They provide similar functionality in different ways. The ;; difference is that `M-pause' takes the current set of matching ;; candidates into account. It is a completion-candidates set ;; operation, similar to those described in section ;; (@> "Sets of Completion Candidates"). ;; ;; This means, in particular, that with `M-pause' you can first ;; perform set operations on the set of candidates, and then use that ;; result to restrict the history search. For example, you can first ;; complement the candidate set using `C-~', then use `M-pause' to ;; restrict those candidates to matches in the history list. In this ;; way, you avoid including matches from the original match set when ;; searching the history. ;; ;; Example: You are in a directory with lots of files that have the ;; prefix `foo' and lots of C-language source files. You happen to ;; be interested in another file, however. One way to get to that ;; file is to use Dired's ability to mark files by matching a regexp ;; and then use Dired's ability to omit the marked files from view. ;; You can scan through those that remain, and pick the one you want. ;; However, it turns out that even then there are many files to scan. ;; You accessed the one you want now just the other day, but the file ;; date is unfortunately not significant. ;; ;; In Icicles, you use regexp matching and take the set complement of ;; the hits, just like in Dired: `C-x C-f foo.*\.c$' defines the ;; candidate set as all files whose names start with `foo' and have ;; extension `c'. `C-~' then defines the candidate set as all files ;; whose names are not like that. Finally, you use `M-pause' to ;; restrict the file-name candidates to names that you have used ;; before. You've accessed many, many files recently, so just ;; cycling through the history with `M-p' would be tedious. You ;; could match a regexp against the file history, but how can you ;; come up with a regexp that finds anti-matches? ;; ;; A consequence of this difference between `M-h' and `M-pause' is ;; that using `TAB' or `S-TAB' after `M-pause' abandons use of the ;; minibuffer history and starts a new set of completion candidates. ;; It simply completes the current input in the context of the ;; current command; `TAB' and `S-TAB' have nothing to do with the ;; minibuffer history in this case. Using `TAB' or `S-TAB' after ;; `M-h', however, re-completes your input against the current ;; history list. ;; ;; Another consequence is that you can use `down' or `C-down' on the ;; candidates displayed by `M-h', but not on those displayed by ;; `M-pause'. For example, to cycle through the doc for each ;; variable that starts with `icicle-' which you have previously ;; input, you can use `C-h v icicle- M-h', then repeatedly use ;; `C-down'. ;; ;; Also, file-name and directory-name completion works differently in ;; these two commands. By default, the current directory is (as ;; always) inserted into the minibuffer by commands such as ;; `find-file', so either `M-h' or `M-pause' after `C-x C-f' will ;; match previously input file names from the current directory. ;; ;; However, in the case of `M-h', the entire minibuffer input is ;; matched against the history list, which is a list of absolute file ;; names. `M-pause' works only with the current candidate set, ;; which, if you have already used `TAB' or `S-TAB' in the current ;; directory, is a set of relative file names in that directory. ;; ;; This difference has a consequence for apropos (regexp) completion ;; with `M-h'. It means that to match a file name using a substring ;; you must, in the minibuffer, either not specify a directory (erase ;; it) or explicitly use `.*' before the file-name substring. ;; ;; For example, with `M-h', `/foo/bar/lph' will not apropos-match the ;; previously input file name `/foo/bar/alphabet-soup.el'; you should ;; use either `/foo/bar/.*lph' or `lph' (no directory). ;; ;; In the case of `M-pause', however, the input is matched against ;; the history list as restricted by the existing completion list. ;; And, since apropos file-name completion uses only the relative ;; file name, without the directory name, as a regexp, the candidate ;; list that is restricted has already matched the input regexp. The ;; action of `M-pause' is simply to filter the list of candidates, ;; keeping those that are in the history list. This means that, with ;; `M-pause', the input `/foo/bar/lph' will match against the ;; previously input file name `/foo/bar/alphabet-soup.el'. ;; ;; Note that neither `M-h' nor `M-pause' uses a recursive minibuffer; ;; they each simply co-opt the current completion, changing it to ;; completion against the history. This means that whatever ;; completion mode (prefix or apropos) was in effect before you use ;; `M-h' or `M-pause' remains in effect for the history completion as ;; well. ;; ;; If this all sounds confusing, just give it a try; it is much ;; harder to describe than it is to experience. ;; ;;(@* "Using Other Histories; Commands Any Which Way") ;; ** Using Other Histories; Commands Any Which Way ** ;; ;; This section describes how to complete your input against a ;; history other than the default history provided for the current ;; command. A special case of this, starting with Emacs 23, is ;; completing a command, abbrev, or keyboard macro name against all ;; such that were previously executed in any interactive way. This ;; includes commands invoked using a menu. ;; ;;(@* "Completing Against All Interactive Commands") ;; *** Completing Against All Interactive Commands *** ;; ;; When you execute a command using `M-x', it is added to the history ;; `extended-command-history'. Likewise, when you execute a command ;; or abbrev using `icicle-command-abbrev-command'. And when you ;; execute a keyboard macro using `C-x M-e' ;; (`icicle-execute-named-keyboard-macro'), it is added to history ;; `icicle-kmacro-history'. ;; ;; However, when you execute a command, abbrev, or keyboard macro in ;; other ways than these, it is not added to such a history. For ;; example, if you choose a menu item, the associated command is not ;; added to any of these histories. Thus, although `M-o' lets you ;; complete against previously used commands, this does not include ;; commands that were called via a menu item. ;; ;; To remedy this, starting with Emacs 23 Icicles can optionally add ;; all commands that are called using `call-interactively' to the ;; larger command history `icicle-interactive-history'. This ;; includes commands on menus. To enable this feature, you must ;; customize option `icicle-populate-interactive-history-flag', to ;; make it non-`nil'. Thereafter, when you enter Icicle mode, all ;; interactive use of commands records them on this special history. ;; ;; Be aware that use of this feature can slow Emacs down, and the ;; history list can become quite large. ;; ;; During completion, you can then use `C-M-pause' ;; (`icicle-other-history') to complete against this extended set of ;; previously used commands. For example, if you use menu item `Open ;; File', then the corresponding command, `menu-find-file-existing', ;; becomes available as a completion candidate. (Recall too that the ;; command associated with a given menu item is shown in the ;; `*Completions*' mode line whenever you cycle to it.) This is a ;; special case of using `C-M-pause', of which see more below. ;; ;;(@* "Using an Alternative History") ;; *** Using an Alternative History *** ;; ;; Anytime you enter input in the minibuffer, regardless of whether ;; completion is available, `C-M-pause' prompts you for an ;; alternative history to use - any history you like. You can choose ;; the history using completion. ;; ;; That is, you can change which history to use, on the fly, as many ;; times as you like. You can use this before using `M-o', for ;; instance, to complete against different histories for different ;; parts of your overall minibuffer input. If you are inputting a ;; complex shell command with arguments, for example, you can use ;; different histories to compose different parts of the overall ;; command. ;; ;; (If you are completing a command, abbrev, or keyboard macro, then ;; for `C-M-pause' to prompt for an alternative history you must use ;; a prefix argument. Otherwise, you get the special `C-M-pause' ;; behavior described above - see ;; (@> "Completing Against All Interactive Commands"). ;; ;;(@* "Cleaning Up History Lists") ;; ** Cleaning Up History Lists ** ;; ;; Besides the use of `M-k' during history cycling (`M-p', `M-n') to ;; remove individual input occurrences from the current history list, ;; you can use commands `icicle-clear-history' and ;; `icicle-clear-current-history' to clean minibuffer histories ;; entirely of selected entries. Command ;; `icicle-clear-current-history' is bound to `M-i' in the ;; minibuffer. It is `icicle-clear-history' specialized to work on ;; just the current history list. ;; ;; These commands prompt you for a history entry to delete from a ;; history list. These are multi-commands, so you can delete ;; multiple entries. For each entry you choose, all of its ;; occurrences are deleted from the history. ;; ;; Command `icicle-clear-history' first prompts you for a history ;; list to act on. This too is multi-command input, so you can use ;; `icicle-clear-history' to remove entries from multiple histories. ;; ;; If you use a prefix argument with these commands, then the ;; histories are emptied entirely (upon confirmation). Thus, for ;; instance, you can use `C-u M-i' at any time during minibuffer ;; input to completely empty the current history list. ;; ;; See Also: (@> "More about Multi-Commands") for information about ;; using `S-delete' to delete objects associated with completion ;; candidates. ;;(@* "Isearch Enhancements") ;; ;; Isearch Enhancements ;; -------------------- ;; ;; Icicles provides two different enhancements for searching: ;; ;; - Icicles search: Top-level Icicles commands that provide an ;; entirely new and different way for you to search. ;; This is described in section ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview"). ;; ;; - Extensions to standard Emacs incremental search, Isearch. ;; These are described in this section. ;; ;; * Search string completion against previous search strings. ;; * Reuse of the content-matching pattern for `icicle-buffer' and ;; `icicle-file' as the Isearch regexp-search pattern. ;; * Occur mode interface for Isearch hits. ;; * Icicles search (`icicle-search') interface, reusing the ;; Isearch search string (by default). ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc2.el" :to "Support for Projects") ;; for information about using `grep' to search all of the files in ;; a project. ;; ;;(@* "Isearch Completion Against the Search History") ;; ** Isearch Completion Against the Search History ** ;; ;; When you search incrementally (`C-s'), Emacs lets you use `M-TAB' ;; (`M-tab' or `C-M-i', aka `ESC-TAB') to complete your input to a ;; string that you have sought previously, that is, a string in the ;; current search history (`search-ring' or `regexp-search-ring'). ;; In Icicle mode, this feature is enhanced so that you can use all ;; of the completion enhancements provided by Icicles: `M-TAB' is ;; bound to `icicle-isearch-complete' during Isearch. ;; ;; Some operating systems grab `M-TAB' for their own use, making it ;; unavailable for Emacs. They normally do not grab `ESC TAB', which ;; in Emacs is typically the same ase `M-TAB'. For this reason, ;; Icicles also binds `icicle-isearch-complete' to both `ESC TAB' and ;; `C-M-TAB'. (Note: For MS Windows, you can use ;; (w32-register-hot-key (icicle-kbd "M-tab")) to allow Emacs to use ;; `M-TAB'.) ;; ;; Icicles users are in the habit of using `M-o' to complete the ;; current minibuffer input against previously entered inputs. ;; Because of the similarity, you can likewise use `M-o' during ;; Isearch to append previous isearch strings to the current string. ;; During Isearch, `M-o' is bound to minibuffer multi-command ;; `icicle-isearch-history-insert'. ;; ;; The keys bound by default to `icicle-isearch-complete' in ;; `isearch-mode-map' are `M-TAB', `ESC TAB', and `C-M-TAB', and the ;; only key bound by default to `icicle-isearch-history-insert' is ;; `M-o'. But you can change the keys to use for these commands by ;; customizing options `icicle-isearch-complete-keys' and ;; `icicle-isearch-history-insert-keys', respectively. ;; ;; When you use `M-o' (or `M-TAB') while searching, Isearch exits ;; momentarily, giving way to Icicles completion in the minibuffer. ;; You can then use either `S-TAB' or `TAB' to complete your search ;; string. After you finish completing (e.g. by hitting `C-g' or ;; `RET'), Isearch resumes with the new, modified search string. ;; It's pretty seamless, and easier to try than to describe. ;; ;; Reminder: Using `S-TAB' vs `TAB' for regexp vs non-regexp ;; completion against previous search strings has nothing to do with ;; regexp vs non-regexp incremental searching. You can of course use ;; either kind of searching before or after having used either kind ;; of completion. Isearch uses different search histories ("rings") ;; for regexp and non-regexp searching. The kind of search in ;; progress (regexp or not) at the moment you use `M-TAB' or `M-o' ;; determines which search ring provides the candidates for ;; completion. ;; ;;(@* "Content-Matching Pattern as Isearch Regexp") ;; ** Content-Matching Pattern as Isearch Regexp ** ;; ;; When your multi-completion input for commands such as ;; `icicle-buffer' (`C-x b'), `icicle-file' (`C-x C-f'), and ;; `icicle-Info-goto-node' (`g' in Info) provides a content-matching ;; pattern for completion against buffer, file, or Info node content, ;; and at least one candidate matches, the pattern is saved to the ;; Isearch regexp history, `regexp-search-ring'. If you then visit a ;; matching buffer or file, you can immediately search for each match ;; using `C-M-s' or `C-M-r'. ;; ;; This gives you another way to search a set of buffers, files, or ;; Info nodes. You can use progressive completion to narrow down the ;; search hits, either by container (buffer, file, or node name) or ;; by content. ;; ;; (This content-searching behavior is available for `icicle-file' ;; starting with Emacs 23, and for `icicle-Info-goto-node' starting ;; with Emacs 22.) ;; ;; See also (@> "Chapter & Verse: Searching Named Containers"). ;; ;;(@* "Launch Occur using the Isearch Search String") ;; ** Launch Occur using the Isearch Search String ** ;; ;; If you use library `color-moccur.el' or library ;; `occur-schroeder.el', then `C-o' is bound during Isearch to ;; `isearch-moccur', which provides an Occur buffer interface for ;; search hits. This has nothing per se to do with Icicles, but you ;; might find it useful. (Library `color-moccur.el' itself binds ;; `M-o' for this, but `M-o' is used in Icicles for search-string ;; completion.) ;; ;;(@* "Launch Icicles Search using the Isearch Search String") ;; ** Launch Icicles Search using the Isearch Search String ** ;; ;; Icicles search is described in section ;; (@file :file-name "icicles-doc2.el" :to "Icicles Search Commands, Overview"). ;; ;; You can start Icicles search from Isearch: Hit `S-TAB' to choose ;; the Icicles search initial regexp - the default value is the ;; current Isearch search string, but you can edit that. Completion ;; is available for your input - completion against your previous ;; Isearch regexp search strings. ;; ;; For example, use `C-s C-w C-w S-TAB' to pick up the next two words ;; at the cursor, then type `.*' before and after them and hit `RET'. ;; That puts you in Icicles search with the completion candidates ;; being all of the lines in the buffer that contain that two-word ;; phrase. Type some more text to narrow the candidate lines to ;; those that match what you type. Then use `C-next' to visit search ;; hits. ;; ;; With Emacs 22 and later, and provided option ;; `isearch-allow-scroll' (a misnomer) is non-`nil', you can use a ;; prefix argument with `S-TAB' to change the behavior. You still ;; choose an Isearch search string using completion. But in this ;; case the string does not define the Icicles search contexts. ;; Instead, you are prompted for a search-context regexp to do that. ;; The Isearch string is copied to the `kill-ring', so you can yank ;; it into your minibuffer input anytime, to search for it within ;; each of the search contexts. ;; ;; The key to initiate Icicles search from Isearch is `S-TAB' only by ;; default. You can change this key by customizing option ;; `icicle-search-from-isearch-keys'. ;; The Icicles doc is continued in file `icicles-doc2.el'. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;; You need not load this file. It contains only documentation. (provide 'icicles-doc1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-doc1.el ends here icicles-2013.04.23.23400/icicles-doc2.el000066400000000000000000016451661214003072700167710ustar00rootroot00000000000000;;; icicles-doc2.el --- Minibuffer input completion and cycling. ;; ;; Filename: icicles-doc2.el ;; Description: Minibuffer completion and cycling. ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Tue Aug 1 14:21:16 1995 ;; Version: 22.0 ;; Last-Updated: Mon Apr 22 13:27:33 2013 (-0700) ;; By: dradams ;; Update #: 29302 ;; URL: http://www.emacswiki.org/icicles-doc2.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; None ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; Icicles documentation, part 2. ;; ;; Files `icicles-doc1.el' and `icicles-doc2.el' contain the doc for ;; Icicles, including how to install and use Icicles. You can also ;; read the Icicles doc, in formatted form, on the Emacs-Wiki Web ;; site: http://www.emacswiki.org/cgi-bin/wiki/Icicles. Emacs Wiki ;; also has a few addtional pages about Icicles. In particular, if ;; you are new to Emacs, as well as Icicles, see this page: ;; http://www.emacswiki.org/cgi-bin/wiki/EmacsNewbieWithIcicles. ;; ;; This file continues the Icicles documentation, which starts in ;; file `icicles-doc1.el'. ;;(@* "Index") ;; ;; Index ;; ----- ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index and render it more readable. Likewise, for ;; the cross-references and section headings throughout this file. ;; You can get `linkd.el' here: ;; http://www.emacswiki.org/cgi-bin/wiki/linkd.el. ;; ;; (@file :file-name "icicles-doc1.el" :to "Documentation in File `icicles-doc1.el'") ;; ----------------------------------------------------------- ;; ;; (@file :file-name "icicles-doc1.el" :to "Nutshell View of Icicles") ;; (@file :file-name "icicles-doc1.el" :to "README for Non-Readers") ;; (@file :file-name "icicles-doc1.el" :to "Menus") ;; (@file :file-name "icicles-doc1.el" :to "README") ;; (@file :file-name "icicles-doc1.el" :to "Flashy Demo to Pique Your Curiosity") ;; (@file :file-name "icicles-doc1.el" :to "First Example: Multi-Inputs") ;; (@file :file-name "icicles-doc1.el" :to "Second Example: Multi-Completions") ;; (@file :file-name "icicles-doc1.el" :to "Third Example: Narrowing a Manual") ;; (@file :file-name "icicles-doc1.el" :to "Fourth Example: Tagged Files") ;; (@file :file-name "icicles-doc1.el" :to "Top Level to Minibuffer ... and Back Again") ;; (@file :file-name "icicles-doc1.el" :to "Toggle Options on the Fly") ;; (@file :file-name "icicles-doc1.el" :to "Cycle Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Display Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Prefix Completion and Apropos Completion") ;; (@file :file-name "icicles-doc1.el" :to "Chains of Simple Match Patterns - Progressive Completion") ;; (@file :file-name "icicles-doc1.el" :to "Chip Away the Non-Elephant") ;; (@file :file-name "icicles-doc1.el" :to "Choose Before You Act") ;; (@file :file-name "icicles-doc1.el" :to "Help on Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Perform Multiple Operations in One Command") ;; (@file :file-name "icicles-doc1.el" :to "Perform Alternative Operations on the Fly") ;; (@file :file-name "icicles-doc1.el" :to "Completion Status Indicators") ;; (@file :file-name "icicles-doc1.el" :to "Icicles Search") ;; (@file :file-name "icicles-doc1.el" :to "Complete Key Sequences Too") ;; (@file :file-name "icicles-doc1.el" :to "Available for Almost Any Input") ;; (@file :file-name "icicles-doc1.el" :to "Component Icicles Libraries") ;; (@file :file-name "icicles-doc1.el" :to "If You Are an Emacs-Lisp Programmer") ;; ;; (@file :file-name "icicles-doc1.el" :to "Inserting Text Found Near the Cursor") ;; (@file :file-name "icicles-doc1.el" :to "FFAP: Find File At Point") ;; (@file :file-name "icicles-doc1.el" :to "Proxy Candidates, `M-.'") ;; (@file :file-name "icicles-doc1.el" :to "Repeat `M-.' To Grab More or Different") ;; (@file :file-name "icicles-doc1.el" :to "Resolve File Names") ;; (@file :file-name "icicles-doc1.el" :to "Background on Vanilla Emacs Input Completion") ;; (@file :file-name "icicles-doc1.el" :to "Cycling Completions") ;; (@file :file-name "icicles-doc1.el" :to "Traversing Minibuffer Histories") ;; (@file :file-name "icicles-doc1.el" :to "Apropos Completions") ;; (@file :file-name "icicles-doc1.el" :to "Expanded-Common-Match Completion") ;; (@file :file-name "icicles-doc1.el" :to "Progressive Completion") ;; (@file :file-name "icicles-doc1.el" :to "`M-*' and `S-SPC': Matching Additional Regexps") ;; (@file :file-name "icicles-doc1.el" :to "Successive Approximation...") ;; (@file :file-name "icicles-doc1.el" :to "`M-&': Satisfying Additional Predicates") ;; ;; (@file :file-name "icicles-doc1.el" :to "Regressive Completion") ;; (@file :file-name "icicles-doc1.el" :to "Completion On Demand") ;; (@file :file-name "icicles-doc1.el" :to "Moving Between the Minibuffer and Other Buffers") ;; (@file :file-name "icicles-doc1.el" :to "Inserting a Regexp from a Variable or Register") ;; (@file :file-name "icicles-doc1.el" :to "Special Characters in Input Patterns") ;; (@file :file-name "icicles-doc1.el" :to "Alternative Libraries: Other Methods of Choosing Default Values") ;; (@file :file-name "icicles-doc1.el" :to "Exiting the Minibuffer Without Confirmation") ;; (@file :file-name "icicles-doc1.el" :to "*Completions* Display") ;; (@file :file-name "icicles-doc1.el" :to "Icompletion") ;; (@file :file-name "icicles-doc1.el" :to "icomplete+.el Displays the Number of Other Prefix Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Icicles Highlights the Input that Won't Complete") ;; (@file :file-name "icicles-doc1.el" :to "Icompletion in *Completions*: Apropos and Prefix Completion") ;; (@file :file-name "icicles-doc1.el" :to "Incremental Completion (Input Expansion) in the Minibuffer") ;; ;; (@file :file-name "icicles-doc1.el" :to "Sorting Candidates and Removing Duplicates") ;; (@file :file-name "icicles-doc1.el" :to "Changing the Sort Order") ;; (@file :file-name "icicles-doc1.el" :to "Defining New Sort Orders") ;; (@file :file-name "icicles-doc1.el" :to "Different Sorts for Different Sorts of Uses") ;; ;; (@file :file-name "icicles-doc1.el" :to "A Propos d'Apropos") ;; (@file :file-name "icicles-doc1.el" :to "Get Help on Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Use Candidate Help Like You Use Emacs Command `apropos'") ;; (@file :file-name "icicles-doc1.el" :to "Icicles Apropos Commands") ;; (@file :file-name "icicles-doc1.el" :to "Replacements for Standard Apropos Commands") ;; (@file :file-name "icicles-doc1.el" :to "Documentation-Apropos Multi-Commands") ;; (@file :file-name "icicles-doc1.el" :to "Type-Aware Variable-Apropos Multi-Commands") ;; (@file :file-name "icicles-doc1.el" :to "Value-Aware Variable-Apropos Multi-Commands") ;; ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands") ;; (@file :file-name "icicles-doc1.el" :to "What Is a Multi-Command?") ;; (@file :file-name "icicles-doc1.el" :to "How Does a Multi-Command Work?") ;; ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;; (@file :file-name "icicles-doc1.el" :to "Icicles Multi-Completion Commands") ;; (@file :file-name "icicles-doc1.el" :to "Mode-Line Lighter Indication of Multi-Completion") ;; (@file :file-name "icicles-doc1.el" :to "How Multi-Completions Work") ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions vs `completing-read-multiple'") ;; (@file :file-name "icicles-doc1.el" :to "Sorting Candidates by Their Second Part") ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions with a Part You Never See") ;; ;; (@file :file-name "icicles-doc1.el" :to "Chapter & Verse: Searching Named Containers") ;; ;; (@file :file-name "icicles-doc1.el" :to "Dot, Dot, Dot") ;; ;; (@file :file-name "icicles-doc1.el" :to "More about Multi-Commands") ;; (@file :file-name "icicles-doc1.el" :to "Alternative Actions") ;; (@file :file-name "icicles-doc1.el" :to "Deleting Objects") ;; (@file :file-name "icicles-doc1.el" :to "Option `icicle-use-C-for-actions-flag'") ;; (@file :file-name "icicles-doc1.el" :to "Accessing Saved Locations (Bookmarks) on the Fly") ;; ;; (@file :file-name "icicles-doc1.el" :to "Multi-Inputs") ;; ;; (@file :file-name "icicles-doc1.el" :to "Icicles Tripping") ;; (@file :file-name "icicles-doc1.el" :to "Highlighting the Destination") ;; ;; (@file :file-name "icicles-doc1.el" :to "Key Completion") ;; (@file :file-name "icicles-doc1.el" :to "Completing Keys") ;; (@file :file-name "icicles-doc1.el" :to "`S-TAB' Is Everywhere - Start With It") ;; (@file :file-name "icicles-doc1.el" :to "Completing Keys By Name") ;; (@file :file-name "icicles-doc1.el" :to "Completing Prefix Keys") ;; (@file :file-name "icicles-doc1.el" :to "Navigate the Key-Binding Hierarchy") ;; (@file :file-name "icicles-doc1.el" :to "Local Bindings Are Highlighted") ;; (@file :file-name "icicles-doc1.el" :to "Completing Keys By Just Hitting Them") ;; (@file :file-name "icicles-doc1.el" :to "Key and Command Help") ;; (@file :file-name "icicles-doc1.el" :to "`S-TAB' Is a Multi-Command") ;; (@file :file-name "icicles-doc1.el" :to "Possible Source of Confusion") ;; (@file :file-name "icicles-doc1.el" :to "Three-Key Emacs") ;; (@file :file-name "icicles-doc1.el" :to "Entering Special and Foreign Characters") ;; (@file :file-name "icicles-doc1.el" :to "Handling Keymaps That Are Inaccessible From the Global Map") ;; ;; (@file :file-name "icicles-doc1.el" :to "Icicles Multi `M-x'") ;; (@file :file-name "icicles-doc1.el" :to "Examples of Using Multi `M-x'") ;; (@file :file-name "icicles-doc1.el" :to "What about describe-variable and describe-function?") ;; ;; (@file :file-name "icicles-doc1.el" :to "Multi `M-x' Turns Every Command into a Multi-Command") ;; ;; (@file :file-name "icicles-doc1.el" :to "Choose All Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Saving and Retrieving Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Saving or Retrieving Additional Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Different Places for Saving and Retrieving Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Set Operations") ;; ;; (@file :file-name "icicles-doc1.el" :to "Google Matching") ;; (@file :file-name "icicles-doc1.el" :to "Domain of Discourse") ;; (@file :file-name "icicles-doc1.el" :to "Global Filtering") ;; (@file :file-name "icicles-doc1.el" :to "Word Matching and String Matching") ;; (@file :file-name "icicles-doc1.el" :to "AND Matching and OR Matching") ;; (@file :file-name "icicles-doc1.el" :to "NOT Matching") ;; ;; (@file :file-name "icicles-doc1.el" :to "Buffer-Name Input") ;; ;; (@file :file-name "icicles-doc1.el" :to "File-Name Input and Locating Files Anywhere") ;; (@file :file-name "icicles-doc1.el" :to "Function `read-file-name'") ;; (@file :file-name "icicles-doc1.el" :to "Function `completing-read'") ;; (@file :file-name "icicles-doc1.el" :to "Icicles Commands that Read File Names") ;; (@file :file-name "icicles-doc1.el" :to "`icicle-file', `icicle-find-file', `icicle-find-file-absolute'") ;; (@file :file-name "icicles-doc1.el" :to "Match File Names and File Content Too") ;; (@file :file-name "icicles-doc1.el" :to "Visit Recent Files or Files for Emacs Tags") ;; (@file :file-name "icicles-doc1.el" :to "Find Files Anywhere, Without Knowing Where") ;; (@file :file-name "icicles-doc1.el" :to "Absolute File Names and Different Directories") ;; ;; (@file :file-name "icicles-doc1.el" :to "Persistent Sets of Completion Candidates") ;; (@file :file-name "icicles-doc1.el" :to "Saving Candidates in Cache Files") ;; (@file :file-name "icicles-doc1.el" :to "Filesets and Icicles Saved Completion Sets") ;; (@file :file-name "icicles-doc1.el" :to "Improving Performance with Persistent Sets") ;; (@file :file-name "icicles-doc1.el" :to "Avoid Remote File-Name Completion") ;; (@file :file-name "icicles-doc1.el" :to "Avoid Generating A Large Completion Set") ;; ;; (@file :file-name "icicles-doc1.el" :to "Dealing With Large Candidate Sets") ;; (@file :file-name "icicles-doc1.el" :to "History Enhancements") ;; (@file :file-name "icicles-doc1.el" :to "What Input, What History?") ;; (@file :file-name "icicles-doc1.el" :to "Overview of Minibuffer History Enhancements") ;; (@file :file-name "icicles-doc1.el" :to "Using Completion to Insert Previous Inputs: `M-o'") ;; (@file :file-name "icicles-doc1.el" :to "Putting Previous Candidates First: `C-M-,'") ;; (@file :file-name "icicles-doc1.el" :to "Matching Only Historical Candidates: `M-h' and `M-pause'") ;; (@file :file-name "icicles-doc1.el" :to "Using Other Histories; Commands Any Which Way") ;; (@file :file-name "icicles-doc1.el" :to "Completing Against All Interactive Commands") ;; (@file :file-name "icicles-doc1.el" :to "Using an Alternative History") ;; (@file :file-name "icicles-doc1.el" :to "Cleaning Up History Lists") ;; ;; (@file :file-name "icicles-doc1.el" :to "Isearch Enhancements") ;; (@file :file-name "icicles-doc1.el" :to "Content-Matching Pattern as Isearch Regexp") ;; (@file :file-name "icicles-doc1.el" :to "Launch Occur using the Isearch Search String") ;; (@file :file-name "icicles-doc1.el" :to "Launch Icicles Search using the Isearch Search String") ;; ;; (@* "Documentation in File `icicles-doc2.el'") ;; ---------------------------------------------- ;; ;; (@> "Icicles Search Commands, Overview") ;; (@> "Introduction: On Beyond Occur...") ;; (@> "Icicles Search Key Bindings") ;; (@> "How Icicles Search Works") ;; (@> "Why Use 2 Search Patterns?") ;; (@> "Search Outside the Defined Search Contexts") ;; (@> "Search Multiple Buffers, Files, and Bookmarks") ;; (@> "User Options for Icicles Searching") ;; (@> "Using Regexps with Icicles Search") ;; ;; (@> "Search and Replace") ;; (@> "Other Icicles Search Commands") ;; (@> "Icicles Imenu") ;; (@> "Type-Specific Imenu Commands") ;; (@> "Imenu Commands that Search Full Definitions") ;; (@> "Icicles Imenu Combines Benefits of Imenu and Emacs Tags") ;; ;; (@* "Searching Thing-At-Point Things") ;; (@> "Compile/Grep Search") ;; (@> "Input Reuse in Interactive Interpreter Modes") ;; (@> "Define Your Own Icicles Search Commands") ;; ;; (@> "Icicles Bookmark Enhancements") ;; (@> "Using Tagged Files") ;; (@> "`icicle-find-file-tagged'") ;; (@> "Jumping to Tagged Files (Other)") ;; (@> "Saving Regions and Selecting Them") ;; (@> "Setting a Bookmark and Jumping to a Bookmark") ;; (@> "Jumping to a Bookmark") ;; (@> "Searching Bookmarked Objects") ;; ;; (@> "Icicles Enhancements for Emacs Tags") ;; (@> "`icicle-find-tag': Find Tags in All Tags Tables") ;; (@> "`icicle-find-first-tag': Find First Tag in Current Table") ;; (@> "`icicle-tags-search': Search and Replace Using Tags") ;; ;; (@> "Icicles Shell-Command Enhancements") ;; (@> "Shell Command Completion as File-Name Completion") ;; (@> "Gotcha: `$' in Shell Commands") ;; (@> "Known Shell Commands as Proxy Candidates") ;; ;; (@> "Icicles Dired Enhancements") ;; (@> "Search-and-Replace Marked Files") ;; (@> "Save Marked Names as Completion Candidates") ;; (@> "Save Marked Names Here and Below") ;; (@> "Open Dired for a Set of File and Dir Names") ;; (@> "Marked Files and Dirs as a Project") ;; (@> "Shell Commands on Marked Files") ;; ;; (@> "Icicles Info Enhancements") ;; (@> "Icicles Completion for Info") ;; (@> "Virtual Info Books") ;; (@> "Using Icicle-Search With Info") ;; ;; (@> "Using Icicle-Search With Info") ;; ;; (@> "Support for Projects") ;; (@> "Bookmarks for Project Access and Organization") ;; (@> "A Tags File Can Define a Project") ;; (@> "Navigating Among Code Definitions") ;; (@> "Searching Project Files") ;; (@> "Defining and Saving Sets of Files or Buffers") ;; (@> "Retrieving and Reusing a Saved Project") ;; (@> "Semantics? Roll Your Own?") ;; ;; (@> "Using Complex Completion Candidates") ;; (@> "Icicles OO: Object-Action Interaction") ;; (@> "Apropos Completion as OO") ;; (@> "M-RET") ;; (@> "`icicle-object-action' and `icicle-anything'") ;; (@> "Icicles with Anything") ;; ;; (@> "Fuzzy Completion") ;; (@> "Partial Completion") ;; (@> "Scatter-Match Completion") ;; (@> "Swank (Fuzzy Symbol) Completion") ;; (@> "Fuzzy-Match Completion") ;; (@> "Levenshtein Completion") ;; (@> "Jaro-Winkler Completion") ;; ;; (@> "Completion in Other Buffers") ;; (@> "Dynamic Abbreviation") ;; (@> "BBDB Completion") ;; (@> "Thesaurus Lookup and Completion") ;; (@> "Completion in Comint Modes") ;; ;; (@> "Customization and General Tips") ;; (@> "Using Icicles with Delete Selection Mode") ;; (@> "Icicles User Options and Faces") ;; ;; (@> "File-Name and Directory-Name Completion Tips") ;; (@> "Key Bindings") ;; (@> "Global Bindings") ;; (@> "Icicles-Mode Bindings") ;; (@> "Minibuffer Bindings") ;; ;; (@> "Customizing Key Bindings") ;; (@> "Customizing Global Bindings") ;; (@> "Customizing Icicle Mode Bindings") ;; (@> "Customizing Minibuffer Bindings") ;; ;; (@> "Icicles Redefines Some Standard Functions") ;; (@> "Debugging and Reporting Icicles Bugs") ;; (@> "Debugging Tips") ;; (@> "Programming with Fancy Candidates") ;; (@> "Programming Multi-Completions") ;; (@> "Variable icicle-list-use-nth-parts") ;; (@> "Variable icicle-candidate-properties-alist") ;; (@> "What You See Is Not What You Get") ;; ;; (@> "Candidates with Text Properties") ;; (@> "Using Property icicle-special-candidate") ;; (@> "Applying Text Properties to a Candidate String") ;; ;; (@> "Defining Icicles Commands (Including Multi-Commands)") ;; (@> "Nothing To It!") ;; (@> "Multi-Commands Are Easy To Define Too") ;; (@> "Are Users Dependent on Icicles To Use Multi-Commands?") ;; ;; (@> "Defining Icicles Tripping Commands") ;; (@> "Defining Multiple-Choice Menus") ;; (@> "Defining Icicles Multi `M-x'") ;; (@> "How Multi `M-x' is Defined") ;; ;; (@> "Defining Multi-Commands the Hard Way") ;; (@> "Global Filters") ;; (@> "Specifying Match Functions for Commands") ;; (@> "Defining Buffer-Text Completion for Comint Modes") ;; (@> "Note to Programmers") ;; (@> "La Petite Histoire") ;; (@> "Note on Non-`nil' `pop-up-frames' on MS Windows") ;;(@* "Icicles Search Commands, Overview") ;; ;; Icicles Search Commands, Overview ;; --------------------------------- ;; ;; This section provides an overview of Icicles search. ;; ;; See Also: ;; ;; * The doc string (`C-h f') of command `icicle-search'; it provides ;; a boatload of general information about Icicles search. ;; ;; * (@> "Other Icicles Search Commands") for specialized Icicles ;; search commands, including search in particular buffers. ;; ;; * (@> "Icicles Info Enhancements") for information about using ;; Icicles to search in Info mode. ;; ;; * (@> "Icicles Bookmark Enhancements") for information about ;; searching bookmarks. ;; ;; * (@> "Support for Projects") for information about using `grep' ;; to search all of the files in a project. ;; ;;(@* "Introduction: On Beyond Occur...") ;; ** Introduction: On Beyond Occur... ** ;; ;; You've no doubt used standard Emacs command `occur'. It finds all ;; lines in a buffer that match a regexp that you enter. It displays ;; the matching lines as links in buffer `*Occur*' - you can click a ;; link to navigate to the corresponding line in the original buffer. ;; Using buffer `*Occur*' is similar to using the output of the Emacs ;; `grep' command. ;; ;; Command `icicle-occur' is similar to `occur', but instead of ;; entering a regexp (with `RET') you type a regexp and then use ;; `S-TAB' to show the matching lines in buffer `*Completions*'. As ;; usual in Icicles, you can complete to a single candidate, or cycle ;; among candidates to choose one. To navigate to a match in the ;; original buffer, use `C-RET', `C-mouse-2', `C-next', or `C-prior'. ;; One advantage of `icicle-occur' over `occur' is that you can ;; change the regexp on the fly to match different sets of lines. ;; ;; Another, major advantage is that you can use progressive ;; completion to find lines that match multiple regexps. A similar, ;; but less interactive, effect can be had using chained `grep' ;; commands, but it is otherwise not possible with other search ;; methods such as regexp Isearch. A regexp simply cannot express ;; intersection ("and") except in the limited form of "followed by". ;; ;; Command `icicle-search' is a generalization of `icicle-occur'. ;; You enter an initial, search-context regexp (using `RET'), which ;; defines a set of completion candidates: all of the matching ;; strings in the current buffer (by default). These candidates are ;; called "search contexts". ;; ;; Command `icicle-occur' is really `icicle-search' with an implicit ;; initial regexp of `.*' (which you do not enter, however). For ;; `icicle-occur', the search contexts, that is, the initial ;; completion candidates, are all of the lines of the buffer (`.' ;; matches any character except a newline). ;; ;; This means that `icicle-occur' does not, like `grep' and `occur', ;; give you just one chance to filter the lines by providing a regexp ;; to match. It lets you dynamically change the filtering regexp, ;; changing the search hits on the fly. That is the general idea of ;; Icicles search: define search contexts, then filter them ;; dynamically by matching your current minibuffer input. ;; ;; What if you want to start out with only a subset of the buffer ;; lines, and then match those dynamically - in other words, you are ;; sure you want to limit your searching to only some of the lines? ;; In that case, you just use `icicle-search', not `icicle-occur', ;; providing it with a context-defining regexp that matches only the ;; lines you want. ;; ;; For example, you might use `.*for.*', to start with only the lines ;; containing `for' as the contexts to search. Again, `icicle-occur' ;; is just a shortcut version of `icicle-search' for the common case ;; where you want to dynamically match any of the lines. ;; ;; More generally, with `icicle-search' the candidates need not be ;; single, complete lines; they can be any strings in the buffer, ;; including multi-line strings. Your initial regexp is used over ;; and over to find the set of matching strings in the region or ;; buffer that you search. These strings then serve as the ;; completion candidates. ;; ;; For example, you might use a search-context regexp of ;; "[A-Z][^.?!]+[.?!]" to search sentences, "\\(.+\n\\)+" to search ;; paragraphs, or "\\([^\f]*[\f]\\|[^\f]+$\\)" to search pages. ;; (That's in fact how convenience commands ;; `icicles-search-sentences', `icicles-search-paragraphs', and ;; `icicles-search-pages' are defined.) ;; ;; `\f' is the form-feed, or page-separator, character. You input ;; `\f', `\t', and `\n' using `C-q l', `C-q TAB', and `C-j', ;; respectively. See ;; (@file :file-name "icicles-doc1.el" :to "Dot, Dot, Dot") ;; for information about multi-line dot (`.'), which matches also ;; newline. ;; ;; Again, you can use progressive completion (`M-*' or `S-SPC') to ;; match several different regexps within the same page or the same ;; sentence. For example, you could find all sentences that contain ;; `character', `delete', and `backward', in any order, as follows: ;; ;; C-c ` [A-Z][^.?!]+[.?!] RET ;; character S-SPC delete S-SPC backward ;; ;; When you visit a search context, both `icicle-occur' and ;; `icicle-search' highlight that hit. For `icicle-occur', the ;; search context is the current line. For `icicle-search', it is ;; whatever your search-context regexp matches. ;; ;;(@* "Icicles Search Key Bindings") ;; ** Icicles Search Key Bindings ** ;; ;; There are many Icicles search commands, most of which are bound to ;; keys when you are in Icicle minor mode. They are all placed on ;; the same prefix key, `M-s M-s'. Starting with Emacs 23, a single ;; `M-s' is the standard Emacs prefix key for search. Just hit the ;; key twice for Icicles search. ;; ;; The most general Icicles search command is `icicle-search', which ;; is bound to `M-s M-s M-s'. It is also bound to `C-c `'. (In some ;; modes these keys are bound to a mode-specific form of Icicles ;; search.) ;; ;; The Icicles search keys are generally mnemonic. Some of the ;; commands also have an alternative key binding (in parentheses in ;; the list below). ;; ;; Remember too that you can also invoke some of these same commands ;; using a prefix arg with the generic `icicle-search' keys. For ;; example, you can invoke the commands bound to `M-s M-s m' using a ;; zero prefix arg with `icicle-search' - e.g., `C-0 M-s M-s M-s'. ;; ;; Here are the suffix keys on the `M-s M-s' prefix key: ;; ;; `M-s' `icicle-search' - Seach buffer areas that match regexp ;; (`C-c `') ;; `M-s' `icicle-comint-search' - Retrieve a previous shell input ;; (`C-c `') ;; `M-s' `icicle-compilation-search' - Search compilation hits ;; - e.g `grep' hits (`C-c `') ;; ;; `,' `icicle-tags-search' - Search files listed in TAGS table ;; `b' `icicle-search-buffer' (`C-1') - Search selected buffers ;; `c' `icicle-search-char-property' - Search text having a ;; given text or overlay property ;; `d' `icicle-search-defs' (aka `icicle-imenu') (`C-c =') ;; `D' `icicle-search-defs-full' (aka `icicle-imenu-full') ;; full definitions as completion candidates ;; `f' `icicle-search-file' (`C--') - Search selected files ;; `i' `icicle-imenu' (aka `icicle-search-defs') - Navigate ;; among Imenu entries (`C-c =') ;; `I' `icicle-imenu-full' (aka `icicle-search-defs-full') ;; full definitions as completion candidates ;; `icicle-imenu-command' - command definitions ;; `icicle-imenu-face' - face definitions ;; `icicle-imenu-macro' - macro definitions ;; `icicle-imenu-non-interactive-function' - ;; non-interactive function definitions ;; `icicle-imenu-user-option' - user option definitions ;; `icicle-imenu-key-explicit-map' - key definitions ;; `icicle-imenu-key-implicit-map' - key definitions ;; `j' `icicle-search-bookmark' - Search bookmarks ;; `icicle-search-*-bookmark' - Bookmarks of a given type ;; `J' `icicle-search-bookmarks-together' (`C-u'), ;; `k' `icicle-search-keywords' - Search with regexp keywords ;; (`C-c ^') ;; `l' `icicle-search-lines' (aka `icicle-occur') (`C-c '') ;; `C-l' `icicle-search-pages' - Search Emacs pages ;; `m' `icicle-search-bookmark-list-marked' - Marked bookmarks ;; `m' `icicle-search-buff-menu-marked' - Search marked buffers ;; `m' `icicle-search-ibuffer-marked' - Search marked buffers ;; `m' `icicle-search-dired-marked-recursive' - Search Dired ;; marked files ;; `o' `icicle-occur' (aka `icicle-search-lines') - An `occur' ;; with incremental completion (`C-c '') ;; `O' `icicle-search-overlay-property' - Search text having a ;; given overlay property ;; `p' `icicle-search-paragraphs' - Search Emacs paragraphs ;; `s' `icicle-search-sentences' - Search sentences as contexts ;; `t' `icicle-search-thing' - Search thing-at-point things, ;; optionally ignoring comments ;; `T' `icicle-search-text-property' - Search text having a ;; given text property (`C-c "') ["] ;; `w' `icicle-search-word' - Whole words as contexts (`C-c $') ;; `x' `icicle-search-xml-element' - Search XML elements ;; `X' `icicle-search-xml-element-text-node'- Search text nodes ;; ;; (You need library library `Bookmark+' for ;; `icicle-search-bookmark-list-marked'. You need library `Dired+' ;; for `icicle-search-dired-marked-recursive'.) ;; ;; There are many `icicle-search-*-bookmark' commands, for searching ;; within bookmarks of various types. ;; ;; And there are several `icicle-imenu-*' commands for navigating ;; among definitions of different kinds. For each of the ;; `icicle-menu*' commands there is a `-full' version that searches ;; the full text of a definition. ;; ;; When you use one of these full-definition search commands, the ;; completion candidates can be quite large, spanning several lines ;; each. In this context it can be handy to hide, in buffer ;; `*Completions*', the lines that do not match your current ;; minibuffer input. You can do this at any time by using command ;; `icicle-toggle-hiding-non-matching-lines', bound to `C-u C-x .', ;; to toggle user option `icicle-hide-non-matching-lines-flag'. ;; ;; The commands that search zones of text that have a given character ;; (text or overlay) property value work with any kind of property. ;; They work specially for properties `face' (or `font-lock-face') ;; and `mumamo-major-mode'. If you use library MuMaMo, which lets ;; you, in effect, use multiple major modes at the same time in the ;; same buffer, then you can use `M-s M-s c' and `M-s M-s O' to ;; search the zones corresponding to a given major mode. See the doc ;; string for command `icicle-search-char-property' for more ;; information. ;; ;; Command `icicle-search-thing' (`M-s M-s t') searches the text of ;; thing-at-point things. It prompts you for the thing type: `sexp', ;; `sentence', `list', `string', `comment', etc. It ignores comments ;; according to option `icicle-ignore-comments-flag'. You can toggle ;; this ignoring using `C-M-;' at any time. When comments are ;; ignored, the candidate things (e.g. sexps) to be searched are only ;; those outside of comments. ;; ;;(@* "How Icicles Search Works") ;; ** How Icicles Search Works ** ;; ;; All Icicles search commands operate in the same general way: ;; ;; 1. Unlike standard incremental search, Icicles search commands ;; search the entire buffer, not just the part that follows the ;; cursor. If the region is active, however, then the search is ;; confined to the region. Some Icicles search commands let you ;; search across multiple buffers, multiple files, or multiple ;; bookmarks, including region bookmarks. Searching within one or ;; more such regions of text is a first way to limit the context ;; of a search. ;; ;; 2. You limit the search context in a second way, by providing some ;; information, such as a regexp or a character property (text or ;; overlay property), that defines zones of text that you want to ;; search. You can use (lax) completion against previous input to ;; enter the regexp or the character property. In some cases, the ;; information (e.g. regexp) to define the search context is ;; provided automatically by the search command; for example, ;; `icicle-occur' assumes that you want to search lines. ;; ;; 3. If you use a regexp to define the search context, and if that ;; regexp has subgroups, that is, subexpressions of the form ;; `\(...\)', then you are prompted for the subgroup to use to ;; define the search context. 0 means the entire regexp match is ;; used as a context. 1 means that whatever the first subgroup ;; matches is used as a context, and so on. ;; ;; Using a subgroup thus limits the search context in a third way. ;; It lets you find a search match within a larger search-match ;; context. For example, you might choose a Lisp argument list as ;; the search context, specifying that it must follow `(defun ': ;; `(defun [^(]*\(([^(]*)\)'. Subgroup 1 is the argument list. ;; Specifying a subgroup search context helps you become more ;; familiar with regexps. Icicles search highlighting (see below) ;; shows you the subgroup matches instantly. ;; ;; 4. You can limit the set of search contexts in a fourth way, by ;; using `M-&' to provide predicates that search-context ;; candidates must satisfy. Command `icicle-search' and its ;; derivative functions use candidates of the form (CONTEXT ;; . MARKER), where CONTEXT is a string, the search hit (search ;; context), and MARKER is a buffer marker that locates the ;; CONTEXT. Predicates you supply to the `M-&' prompt must expect ;; such candidates. Only contexts that satisfy the predicate are ;; found. For example, if the predicate is (lambda (x) (commandp ;; (intern-soft (car x)))), then only contexts that name Emacs ;; commands are found. Or, if you have a predicate `verbp' that ;; tests whether a word is an English verb form, then you can use ;; that to limit word matches to verbs. In this way, you can ;; combine purely syntactic searching (regexp or text-property ;; match) with more semantic search criteria. After building up a ;; complex predicate by using `M-&', you can save it to a variable ;; with `C-M-&' and then reuse it later with `C-='. ;; See also (@file :file-name "icicles-doc1.el" :to "Progressive Completion"). ;; ;; 5. Icicles finds all of the qualified search contexts, and ;; presents them to you as completion candidates. As always for ;; Icicles completion, the number of search hits (matching ;; candidates), is displayed in the mode-line of buffer ;; `*Completions*' - e.g., `72 candidates'. ;; ;; 6. You can navigate among the source-buffer search contexts, using ;; the multi-command action keys (`C-next', `C-prior', `C-RET', ;; `C-mouse-2'). The contexts are highlighted in the source ;; buffer(s). You can scroll the current search-hits buffer ;; forward and backward using `C-M-v' and `C-M-S-v' (aka `C-M-V'). ;; Whenever the destination would be off-screen, user option ;; `icicle-recenter' is passed to `recenter' to make it visible. ;; ;; 7. As always in Icicles, your current minibuffer input filters the ;; set of current candidates - the search contexts, so that only ;; those that contain matches to your input remain as candidates. ;; This is a second level of matching: looking for a refinement ;; pattern within the search contexts. And this constitutes a ;; fifth way you can limit the set of search contexts. ;; ;; 8. As always in Icicles, this input can be a regexp. This is ;; ordinary apropos completion, applied to searching. You do not ;; type `RET' to enter this regexp, and you can change it on the ;; fly to change the set of search hits. Icicles searching is ;; thus incremental, in the sense that changing your input ;; dynamically changes the set of matching search hits. Icicles ;; searching is not incremental with respect to the initial, ;; context matching, however. ;; ;; 9. As always in Icicles, you can type some input and then hit ;; `C-~' to remove all candidates that match that input. Then ;; type some other input and hit `C-~' again to remove those ;; matches. Or you can use `M-&' to define a predicate, and then ;; hit `C-~' to remove all candidates that satisfy that predicate. ;; And so on. And you can use `S-mouse-2' or the `delete' key to ;; remove individual search hits. These techniques let you chip ;; away at the search set, removing hits that are uninteresting. ;; This is a very powerful technique for both searching and ;; search-and-replace (see next), and it constitutes a sixth way ;; to limit the set of search contexts. See also ;; (@file :file-name "icicles-doc1.el" :to "Chip Away the Non-Elephant"). ;; ;; 10. You can sort the search hits in various ways. This can ;; facilitate navigation and comparison of hits, as well as ;; search-and-replace (see #11). And you can define your own ;; Icicles search commands that provide custom search orders for ;; particular kinds of search. It is likely that you have never ;; considered being able to sort search hits, but if you think ;; about it you will see that this can be handy. If you are ;; searching across multiple buffers, files, or bookmarks, sorting ;; helps you compare, visit, and replace related hits from the ;; different sources, instead of having to handle all of the hits ;; from each source in turn. ;; ;; 11. You can replace text while you search, forward, backward, or ;; randomly. You can replace entire search contexts or just the ;; parts that match your current input. You can use any ;; replacement string that is allowed by `query-replace-regexp'. ;; In Emacs 22 or later, this includes `\,', to substitute the ;; result of a Lisp evaluation. Use the alternative-action keys ;; for replacement: `C-S-RET', `C-S-mouse-2', `C-S-down', ;; `C-S-up', `C-S-next', `C-S-prior', `C-S-end', and `C-S-home'. ;; At the first use, you are prompted for the replacement string; ;; it is used thereafter. You can use `M-|' ;; (`icicle-all-candidates-list-alt-action') to replace all ;; matches. See (@> "Search and Replace"). ;; ;; 12. When you visit a search context (using `C-mouse-2' or ;; `C-down', for example), the part of the candidate that matches ;; your input is highlighted. An entire search context is ;; highlighted in face `icicle-search-main-regexp-current', and ;; the part that matches your input is highlighted in face ;; `icicle-search-current-input'. All other search contexts are ;; also highlighted (in face `icicle-search-main-regexp-others'). ;; The effect is similar to the Emacs 22+ lazy search highlighting ;; of Isearch (except that the highlighting is not in fact lazy). ;; ;; 13. User option `icicle-search-highlight-all-current-flag' ;; controls whether the input matches are highlighted within each ;; search context or only within the current context. Together ;; with `icicle-expand-input-to-common-match', it controls whether ;; the input-match highlighting covers an expanded common match ;; among all matches or just the exact input match. ;; ;; 14. If you do not use a subgroup to define the search context (as ;; in #3, above), that is, if the search context corresponds to ;; the entire search regexp, then up to eight context levels ;; (subgroups) are each highlighted differently, using faces ;; `icicle-search-context-level-1' through ;; `icicle-search-context-level-8'. This context-level ;; highlighting is not done if user option ;; `icicle-search-highlight-context-levels-flag' is `nil'. ;; ;; You might have noticed that out of these 14 search features, 6 ;; constitute independent ways in which you can narrow or limit the ;; set of search hits among which you can navigate. And another one ;; (sorting) further facilitates your observation and selection of ;; search hits. Restricting the search space and making search-hit ;; patterns more evident are in fact what search is all about, and ;; Icicles offers you some unique tools to do this. ;; ;; For several Icicles search commands, including `icicle-search' ;; (`C-c `'), you provide an initial regexp to define the search ;; contexts (step 1, above). Why use two regexps to search (steps 1 ;; and 4, above)? To make things simpler. Regular expressions are ;; powerful for searching, but they can also be cumbersome sometimes. ;; Why not use one simple regexp to set up a set of candidates and ;; then, optionally, use a second simple regexp to filter those ;; candidates? ;; ;; This is the same idea as that behind progressive completion. And ;; speaking of which, how would you find a line that contains a given ;; set of words (each of them), but in an arbitrary (unknown) order? ;; Progressive completion. Which lines in this doc section contain ;; the words `which', `you', and `how', in any order? If you are ;; reading this doc in file `icicles-doc2.el', then just use ;; `icicle-occur' with progressive completion: ;; ;; C-c ' which S-SPC you S-SPC how ;; ;; That narrows things down to four lines that you can then navigate ;; among. Progressive completion gives Icicles search a power boost. ;; ;; Like `icicle-occur', commands `icicle-search-word' (`C-c $') and ;; `icicle-search-keywords' (`C-c ^') are variants of `icicle-search' ;; that differ only in the regexp used. Each accepts your input and ;; converts it to a regexp that does the right thing. ;; `icicle-search-word' just adds `\b' before and after the word you ;; type, so that it matches at word boundaries. ;; ;; `icicle-search-keywords' wraps the keywords you provide as input ;; with regexp grouping (`\(...\)') and alternative (`\|') syntax, so ;; that search looks for any of the keywords. ;; ;; "Keywords" here is an understatement. Each keyword is actually a ;; regexp and is treated as such, unless you use `C-`' to turn on ;; escaping of regexp special characters. In that case, each keyword ;; is matched as a substring. At the `C-c $' prompt, you can use ;; completion to choose keywords that you have already entered, or ;; you can use `C-RET' to enter new keywords. ;; ;; As a shortcut, you can use the search string during incremental ;; search (Isearch) as the initial regexp for `icicle-search'. You ;; do this by hitting `S-TAB' during Isearch. This ends Isearch and ;; passes its search string to `icicle-search'. This can be a handy ;; way to start `icicle-search', picking up its search pattern by ;; using, say, `C-s C-w C-w...'. ;; See (@file :file-name "icicles-doc1.el" :to "Launch Icicles Search using the Isearch Search String") ;; ;;(@* "Search Outside the Defined Search Contexts") ;; ** Search Outside the Defined Search Contexts ** ;; ;; For each of the predefined Icicles search commands, including for ;; `icicle-search' itself, you can alternatively choose to search, ;; not the search contexts as you define them, but the non-contexts, ;; that is, the buffer text that is outside (in between) the search ;; contexts as defined. ;; ;; For example, if you use `icicle-search-thing' and you define sexps ;; as the search contexts, then this feature lets you search the ;; zones of text that are not within a sexp. Or if you use ;; `icicle-search-text-property' (`C-c "'), you can search the zones ;; of text that do not have a text-property value that you specify ;; (e.g., property `face' with faces `font-lock-comment-face' and ;; `font-lock-comment-delimiter-face' - which means all code outside ;; comments). ;; ;; To turn this context-complementing feature on and off, hit `C-M-~' ;; (`icicle-toggle-search-complementing-domain') during completion. ;; This is a toggle, and it affects only future search commands, not ;; the current one. ;; ;;(@* "Search Multiple Buffers, Files, and Bookmarks") ;; ** Search Multiple Buffers, Files, and Bookmarks ** ;; ;; If you provide a prefix argument to most Icicles search functions, ;; then you can search multiple buffers, files, or bookmarks. ;; ;; * Plain prefix argument (`C-u') - Search multiple bookmarks of ;; various kinds. To use this feature, you must also use library ;; `bookmark+.el'. See (@> "Icicles Bookmark Enhancements"). ;; ;; * Positive numeric prefix argument (e.g. `C-9') - Search multiple ;; buffers - you are prompted for the buffers to search. If the ;; prefix argument is 99, then only buffers that are visiting files ;; are candidates. You can use `C-RET' and so on to choose ;; individual buffers with completion. You can use `C-!' to choose ;; all buffers or all buffers that match a regexp. ;; (See (@file :file-name "icicles-doc1.el" :to "Multi-Commands").) ;; ;; * Negative numeric prefix argument (e.g. `C--') - Search multiple ;; files in the current directory - you are prompted for the files ;; to search. As for multiple-buffer searching, you can use ;; `C-RET' and so on. ;; ;; * Zero numeric prefix argument (e.g. `C-0') - Search multiple ;; bookmarks, buffers, or files appropriate for the current major ;; mode. In Dired, this means the marked files. In Ibuffer or ;; Buffer Menu, it means the marked buffers. In the bookmark list, ;; it means the marked bookmarks (you need `Bookmark+' for this). ;; In such modes the same behavior is typically available on ;; another key as well (e.g. `M-s M-s m'), as a separate command. ;; ;; As a convenience, some specialized Icicles commands are defined ;; that correspond to `icicle-search' with the various ;; prefix-argument cases: `icicle-search-bookmarks-together', ;; `icicle-search-buffer', and `icicle-search-file'. If you often ;; use `C-c `' with one of the prefix argument options, then you ;; might want to bind one or more of these commands. These commands ;; are also available in the Icicles menu-bar menu (or the Search ;; menu, if it exists). ;; ;;(@* "User Options for Icicles Searching") ;; ** User Options for Icicles Searching ** ;; ;; You can customize the following user options to control search and ;; replacement behavior. ;; ;; * If `icicle-show-multi-completion-flag' is non-`nil' (the default ;; value), then, whenever you use a prefix argument, Icicles search ;; functions annotate each candidate with the name of the buffer ;; where the search hit occurs, highlighted, to help orient you. ;; The buffer name is actually part of the (multi-completion) ;; candidate, so you can match against it. ;; ;; Note that even when the value of this option is `nil', if option ;; `icicle-help-in-mode-line-delay' is greater than zero then you ;; can see the buffer name in the mode-line (as well as the ;; position and length of the search context in the buffer). ;; ;; * Icicles search functions that use an initial regexp highlight ;; the first `icicle-search-highlight-threshold' matches for that ;; regexp at once (using face `icicle-search-main-regexp-others'). ;; The effect is similar to the Emacs 22+ lazy search highlighting ;; of Isearch (except that the highlighting is not in fact lazy). ;; ;; * If `icicle-search-replace-whole-candidate-flag' is `nil', then ;; whatever matches your current input (expanded, if ;; `icicle-expand-input-to-common-match' causes expansion) is ;; replaced, within the current search context, when you perform ;; replacement (e.g. `C-S-RET'). If the value is non-`nil' (the ;; default value), then the entire search context is replaced, ;; instead. You can use `M-_' at any time during searching and ;; replacing, to toggle the value. ;; ;; * If `icicle-search-highlight-all-current-flag' is non-`nil', then ;; Icicles search functions highlight your current input match ;; within *all* search contexts at once. If it is non-`nil' and ;; `icicle-expand-input-to-common-match' is 3 or 4 (which means ;; your input can be automatically expanded), then what is ;; highlighted for each input match is the expanded common match ;; among all input matches throughout the search area. If either ;; of these conditions does not hold, then only the exact input ;; match is highlighted. ;; ;; For example ;; (see (@file :file-name "icicles-doc1.el" :to "Nutshell View of Icicles")), ;; if the initial regexp defining the search context is ;; `.*recursive.*', and your input is `edit', then searching file ;; `icicles-doc1.el' highlights not `edit' but ;; ``abort-recursive-edit'', which is the longest common match ;; among all input matches. ;; ;; Gotcha: Remember that the expanded common match pertains to the ;; entire completion candidate. In the context of Icicles ;; search, if you are interested in multiple matches of ;; your input within the same search context, and you want ;; to be sure to catch each match, then turn off ;; common-match expansion. ;; ;; Why? The search context as a whole is compared with the ;; other search contexts when looking for the expanded ;; common match. Your input is matched against the entire ;; context (search hit), and the expanded common match is ;; (typically) the longest match that is common to the ;; other search contexts. Do not expect the longest common ;; match of your input against all occurrences in the ;; search contexts. What counts is the longest single ;; match for a given context. ;; ;; For example, if your input is `then' and two of the ;; search hits are `But then X and then Y' and `W and then ;; Z', the expanded common match will be `and then', not ;; `then'. The matches highlighted for your input thus do ;; not include each occurrence of `then' in the search ;; hits, but rather each occurrence of `and then'. ;; ;; When `icicle-search-replace-whole-candidate-flag' is `nil', only ;; the part of the search context that matches your input is ;; replaced. That part corresponds to your expanded input if ;; `icicle-expand-input-to-common-match' implies expansion and if ;; `icicle-search-highlight-all-current-flag' and ;; `icicle-search-replace-common-match-flag' are both non-`nil'. ;; Otherwise, it corresponds to only your exact input. ;; ;; The default value of `icicle-search-highlight-all-current-flag' ;; is `nil', because non-`nil' can impact performance negatively if ;; there are many search contexts - the highlighting is updated ;; with each input change. You can toggle the value at any time ;; using command `icicle-toggle-highlight-all-current', bound to ;; `C-^' in the minibuffer during Icicles search. ;; ;; * If option `icicle-search-cleanup-flag' is non-`nil' (the default ;; value) then search highlighting is removed after the search. If ;; you set this to `nil' then you can remove search highlighting ;; manually later using command `icicle-search-highlight-cleanup'. ;; You can toggle this search highlight removal at any time using ;; command `icicle-toggle-search-cleanup', which is bound to `C-.' ;; in the minibuffer during Icicles search. ;; ;; One use of `nil' `icicle-search-cleanup-flag' is to highlight ;; regexp matches throughout a region or buffer (or multiple files ;; or...). In that capacity, Icicles search functions act like ;; some of the highlighting commands in my library `highlight.el'. ;; Note that when `icicle-search-cleanup-flag' is `nil', *all* ;; Icicles search highlighting remains: last-visited search ;; context, other context matches, current-input matches, and even ;; regexp subgroups. The faces for these are, respectively: ;; ;; - `icicle-search-main-regexp-current' ;; - `icicle-search-main-regexp-others' ;; - `icicle-search-highlight-input-matches-here' (everywhere, if ;; `icicle-search-highlight-all-current-flag' is non-`nil') ;; - `icicle-search-context-level-1' through ;; `icicle-search-context-level-8' ;; ;; * Command `icicle-search-word' (bound to `C-c $') always searches ;; for a whole word: your initial search string is matched only ;; against whole words. Non-`nil' `icicle-search-whole-word-flag' ;; makes other Icicles search commands also perform whole-word ;; searching. You can use `M-q' while searching to toggle this ;; option; the new value takes effect for the next complete search. ;; ;; Whole-word searching here means that matches can contain ;; embedded strings of non word-constituent chars (they are skipped ;; over, when matching, included in the match), and any leading or ;; trailing word-constituent chars in the search string are dropped ;; (ignored for matching, not included in the match). This means, ;; for instance, that you can match `foo-bar' as a word, even in ;; contexts (such as Emacs Lisp) where `-' is not a ;; word-constituent character. Similarly, you can include embedded ;; whitespace in a "word", e.g., `foo bar'. ;; ;; * You can toggle `icicle-use-C-for-actions-flag' at any time using ;; `M-g' in the minibuffer. This is handy for multi-commands that ;; browse, such as Icicles search. It means that you can use ;; `next' and so on instead of `C-next' and so on to navigate among ;; search hits. See ;; (@file :file-name "icicles-doc1.el" :to "Option `icicle-use-C-for-actions-flag'"). ;; ;; * Non-`nil' option `icicle-ignore-comments-flag' means that ;; `icicle-search-thing' and related commands ;; (e.g. `icicle-search-xml-element') ignore comments. That is, ;; they hide comments temporarily while they scan the region or ;; buffer for things of the given type to serve as search contexts ;; (completion candidates). This prevents them, for example, from ;; presenting as a candidate a sexp or a list that is commented ;; out. You can toggle this option anytime using `C-M-;' in the ;; minibuffer, but to see the effect you might need to invoke the ;; current command again. ;; ;; * `icicle-search-hook': Functions run after searching and moving ;; to a match, whether by `RET' or `C-RET' (or `C-next' or ;; `C-prior'). ;; ;; It can sometimes be useful to highlight all regexp matches using a ;; large (or `t') value of `icicle-search-highlight-threshold' and a ;; `nil' value of `icicle-search-cleanup-flag', and then set ;; `icicle-search-highlight-threshold' to zero and use an Icicles ;; search function again with a different regexp to search through ;; the same region or buffer. This lets you see the relation between ;; the two sets of regexp matches. ;; ;;(@* "Using Regexps with Icicles Search") ;; ** Using Regexps with Icicles Search ** ;; ;; You can use Icicles search to find text entities of a certain kind ;; - sentences, paragraphs, file names, URLs, and so on. A ;; convenient way to do this is to use `C-=' ;; (`icicle-insert-string-from-variable') or `C-x r i' ;; (`insert-register') in the minibuffer to insert a predefined ;; regexp that matches a particular kind of text entity. Which of ;; these you use depends on whether the regexp string is saved in a ;; variable (`C-=') or a register (`C-x r i'). ;; ;; For example, suppose you are in a mail client and you want to move ;; between mail headers. If you use a regexp that matches the header ;; field you want (e.g. the sent date or sender) then Icicles search ;; highlights all such occurrences and lets you navigate among them - ;; instant mail browser! Or, suppose you are in a C++ or Perl file ;; and you want to navigate among function definitions or other ;; definitions. If you have a canned regexp that matches the start ;; of a definition, then you can use `C-=' to quickly turn ;; `icicle-search' into a code browser. In a log file, navigate ;; among date or time entries or IP addresses... Of course, most ;; programming modes and mail clients already provide other ways to ;; navigate, but you get the idea - Icicles search provides a general ;; way to navigate among things, as long as you can match them with ;; regexps, and `C-=' lets you quickly access a library of predefined ;; regexps. ;; ;; You can find useful regexps to store in variables in the standard ;; Emacs Lisp libraries. Grep for `font-lock-keywords' or `regexp' ;; in the Emacs `lisp' directory and its subdirectories. ;; ;; See `align.el' for regexps for programming languages. ;; See `url-dav.el' for regexps matching ISO 8601 dates. ;; See `rmail.el', `sendmail.el', and `mh-show.el' for regexps ;; matching mail-header fields. ;; ;; Imenu regexps occurring as parts of different values of ;; `imenu-generic-expression' for different buffer types can be used ;; as variable values for `C-='. They all work fine with ;; `icicle-search', turning it into a navigator for the given mode. ;; See, for example, `generic-x.el' and `lisp-mode.el'. Here is a ;; regexp for Javascript function definitions from `generic-x.el': ;; ;; "^function\\s-+\\([A-Za-z0-9_]+\\)" ;; ;; And `lisp-imenu-generic-expression' (in `lisp-mode.el') provides ;; regexps for Lisp function, variable, and type definitions. Here ;; is the variable-definition regexp: ;; ;; "^\\s-*(\\(def\\(c\\(onst\\(ant\\)?\\|ustom\\)\\|ine-symbol-macro ;; \\|parameter\\|var\\)\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" ;; ;; You certainly do not want to type a regexp like that into the ;; minibuffer (and the function-definition regexp is twice as ;; complex)! Put it into a variable or register once and use `C-=' ;; or `C-x r i' from then on to retrieve it - simple. ;; ;; If it's so simple, then why not let a command do it? This is ;; exactly what command `icicle-imenu' (bound to `C-c =') does. You ;; do not need to bother looking up Imenu regexps and assigning them ;; to variables for use with `C-=' and `icicle-search'- ;; `icicle-imenu' does that for you automatically. ;; See (@> "Other Icicles Search Commands"). ;; ;; In sum: For complete interactivity, type a regexp dynamically as ;; input to `icicle-search'. For isolated special regexps that you ;; use, save them in variables and use `C-=' with `icicle-search'. ;; For well-defined sets of regexps, especially if used frequently, ;; define a command that uses `icicle-search'. There is a spectrum ;; of use cases for `icicle-search'. ;; ;; Command `icicle-search' is very general and very powerful. It ;; might never replace incremental search - either regexp or literal ;; string search, but in some cases it can be quite handy. Think of ;; it as another tool to add to your search-tool belt. Admittedly, ;; it does take a little getting used to. Remember, in particular, ;; that the initial, context regexp you enter (with `RET') cannot be ;; changed without re-executing `icicle-search'. ;; ;; And remember too that `C-l' (`icicle-retrieve-previous-input') is ;; your friend - it clears the minibuffer during cycling, retrieving ;; your last real input. Use it to modify your second and subsequent ;; regexps on the fly - those that filter the initial candidate list ;; further. You can repeat `C-l' to retrieve older completion ;; inputs, and you can use `C-S-l' (that is, `C-L') to cycle previous ;; inputs in the other direction. See ;; (@file :file-name "icicles-doc1.el" :to "History Enhancements"). ;; ;; Oh - And do not forget that you can do things like take the ;; complement of your fine-tuning regexp matches, within the context ;; of your coarse-tuning matches. See ;; (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates"). ;; ;; For example, use `^.*defun.*$' as the main regexp, to find all ;; lines containing `defun'. Then type `icicle' to match only the ;; lines with `defun' that also contain `icicle'. Then complement ;; (`C-~') that set, to see the lines that contain `defun' but not ;; `icicle'. ;; ;; And you can then save that set of matches, and then subtract it ;; from another set of matches in a different search... You get the ;; idea. When performing set operations combined with ;; `icicle-search', keep in mind that the saved set does not include ;; any position information - it is only a set of matching strings. ;; So, in particular, a set-union operation (`C-+') is not useful ;; with `icicle-search' (adding a saved set of strings without ;; positions is useless). Still, you can do things like match lines ;; that contain `defun' followed somewhere by `()', and then subtract ;; the (saved) set of lines in the same region that contain `icicle'. ;; Try it in an Icicles library, using regexps `.*icicle.*$' and ;; `^*.defun.*().*$'. ;; ;; One more reminder: When you save a set of completion candidates ;; (`C-M->'), make sure that you actually have a set of candidates to ;; save! It is not enough to just enter a regexp at the ;; `icicle-search' prompt. You must also use some Icicles command, ;; such as `TAB', `S-TAB', `next', or `down' to tell Icicles how to ;; create the candidate set - how to match the regexp. ;; ;; See Also: ;; ;; * The doc string (`C-h f') of command `icicle-search'; it provides ;; general information about Icicles search. ;; ;; * (@> "Other Icicles Search Commands") for specialized Icicles ;; search commands `icicle-comint-search', ;; `icicle-compilation-search', `icicle-imenu', ;; `icicle-imenu-command', `icicle-imenu-non-interactive-function', ;; `icicle-search-char-property', `icicle-search-keywords', ;; `icicle-search-overlay-property', and ;; `icicle-search-text-property'. ;; ;; * (@> "Search and Replace") for information about replacing search ;; hits or parts of search hits. ;; ;; * (@> "Customization and General Tips") for information about the ;; `icicle-search-*' faces, which control Icicles search. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Progressive Completion") ;; for information about `M-*', `S-SPC' and `M-&'. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Commands") for ;; information about `C-RET', `C-mouse-2', `C-next', and `C-prior'. ;; ;; * (@> "Icicles Bookmark Enhancements") for information about ;; searching bookmarks. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Inserting a Regexp from a Variable or Register") ;; for more about inserting a saved string. ;; ;; * (@> "Icicles Info Enhancements") for information about using ;; Icicles to search in Info mode. ;;(@* "Search and Replace") ;; ;; Search and Replace ;; ------------------ ;; ;; Replacement during Icicles search is something quite different ;; from anything you are used to. There are several different ways ;; to replace search-hit text during Icicles search, and it can be a ;; bit of a challenge to understand all the possibilities. So my ;; advice is to experiment, as well as to read the descriptions here. ;; ;; You can replace the current search match by using any of the ;; alternative action keys: `C-S-RET', `C-S-mouse-2' (in ;; `*Completions*'), `C-S-down', `C-S-up', `C-S-next', `C-S-prior', ;; `C-S-end', or `C-S-home', . You can use `M-|' ;; (`icicle-all-candidates-list-alt-action') to replace all matches ;; of your current input at once, throughout the search space. ;; ;; At the first use of any of these, you are prompted for the ;; replacement pattern; it is used thereafter, or until you use `M-,' ;; (`icicle-search-define-replacement'). You can use `M-,' at any ;; time during searching to change the pattern for subsequent ;; replacements. The replacement pattern can be anything that is ;; allowed as a replacement by `query-replace-regexp'. In Emacs 22 ;; or later, this includes Lisp sexp evaluation via `\,'. ;; ;; Unlike `query-replace', you need not visit each search match - you ;; can visit and replace selected matches in any order. Some other ;; differences from standard `query-replace' and ;; `query-replace-regexp': ;; ;; * Replacing matches of your current input provides a contextual ;; replacement feature: replace `foo' by `fu', but only in zones ;; that match `toto.*titi'. ;; ;; * Icicles search navigation (`C-next', etc.) lets you replace ;; individual search hits without navigating through each search ;; context in turn: direct access. ;; ;; * In Icicles search, replace-all (`M-|') means replace all ;; matches of your current input, throughout the search space, not ;; just all matches that follow the cursor. And remember that you ;; can (a) activate the region to limit the search-and-replace ;; space and (b) use progressive completion etc. to narrow the set ;; of hits. ;; ;; * You can act across multiple buffers, files, or bookmarks - ;; see information about the `icicle-search' prefix arg. ;; ;; * You can also replace matches within text-property search ;; contexts - just use `icicle-search-text-property' (`C-c "') ["] ;; as the search command. ;; ;; Search matches are replaced - but just what is meant by a "search ;; match"? It can be either an entire search context or each match ;; of your current minibuffer input within a search context. ;; ;; Anytime during search and replace: ;; ;; * `M-,' redefines the replacement string. ;; ;; * `C-`' toggles `icicle-toggle-regexp-quote' (as always). This ;; escapes regexp special characters, so that search is literal. ;; ;; * `M-q' toggles `icicle-search-whole-word-flag'. By default, ;; this is `nil', meaning that searching is not for whole words ;; (except for `icicle-search-word', bound to `C-c $'). ;; ;; * `C-M-`' toggles `icicle-search-replace-literally-flag'. By ;; default, this is `nil', which means that `\' character ;; sequences in replacement text are intrepreted as for ;; `query-replace-regexp'. ;; ;; * `M-_' toggles `icicle-search-replace-whole-candidate-flag'. By ;; default, this is non-`nil', which means that the entire current ;; search context is replaced, that is, whatever matches the ;; context regexp that you entered initially using `RET'. ;; However, you can use `M-_' anytime during searching to toggle ;; between this default behavior and replacement of whatever your ;; current minibuffer input matches. ;; ;; * `M-;' toggles `icicle-search-replace-common-match-flag'. ;; Together with other options, it controls whether to replace the ;; expanded common match or just the exact match. See below. ;; ;; REMEMBER THIS: ;; ;; - If `icicle-search-replace-whole-candidate-flag' is true ;; (non-`nil'), then the granularity of replacement is a complete ;; search context. In this case, replacement behaves similarly to ;; `query-replace-regexp' (except that special replacement ;; constructs, such as `\#', are not treated as such). You can ;; still use minibuffer input to filter the set of search contexts, ;; but replacement is on a whole-context basis. ;; ;; - If `icicle-search-replace-whole-candidate-flag' is false ;; (`nil'), then you can replace multiple input matches separately ;; within a search context (using `C-S-RET'). This behavior is ;; unique to Icicles. You cannot, however skip over one input ;; match and replace the next one in the same context - `C-S-RET' ;; always replaces the first available match in the context ;; (repeated use changes which is first). When ;; `icicle-search-replace-whole-candidate-flag' is `nil', you can ;; also use special replacement constructs, such as `\#'. ;; ;; If `icicle-search-replace-whole-candidate-flag' is true, then you ;; can use the navigational alternative action keys, `C-S-down', ;; `C-S-up', `C-S-next', `C-S-prior', `C-S-end', and `C-S-home', ;; repeatedly to replace successive search contexts. At the buffer ;; limits, these commands wrap around to the other buffer limit (last ;; search context to first, and vice versa). ;; ;; Search traversal using these go-to-next-context-and-replace keys ;; is always by search context, not by individual input match. This ;; means that you cannot use these keys to replace input matches ;; within a search context. ;; ;; If `icicle-search-replace-whole-candidate-flag' is false, then you ;; can use these keys to replace the first input match. More ;; importantly, you can use `C-S-RET' to replace that first match, ;; without moving on to the next context. Because `C-S-RET' always ;; acts on the current search hit (context), using it again, after ;; you have used it to replace the first such match, replaces the ;; next one. And so on. ;; ;; Thus, if your input matches multiple parts of a search context and ;; you want to replace these matches, use `C-S-RET' repeatedly. ;; After all of the matches in the current context have been ;; replaced, `C-S-RET' replaces the first match in the next context. ;; (There is a gotcha, however, if the replacement text matches your ;; input - see below.) ;; ;; You can thus traverse all matches of your input, in the current ;; sort order (by default, the order they appear in the source being ;; searched), by just repeating `C-S-RET'. At the buffer limits, ;; repeating `C-S-RET' wraps around. ;; ;; `C-S-RET' always replaces the first input match in the ;; current search context or, if there are no matches, then the first ;; input match in the next context. This behavior has these ;; important consequences: ;; ;; * If you repeat `C-S-RET' and the previous replacement no longer ;; matches your input, then `C-S-RET' moves on to the next input ;; match (which is now the first one) and replaces that. This is ;; why you can usually just repeat `C-S-RET' to successively ;; replaces matches of your input, including from one context to ;; the next. ;; ;; * If, on the other hand, after replacement the text still matches ;; your input, then repeating `C-S-RET' will just replace that ;; match. For example, if you replace the input match `ab' by ;; `abcd', then repeating `C-S-RET' produces `abcd', then `abcdcd', ;; then `abcdcdcd',... ;; ;; * You cannot replace an input match, skip the next match, and then ;; replace the following one, all in the same context. You can, ;; however, replace some matches and then skip (e.g. `C-next') to ;; the next context. ;; ;; What your input matches, hence what gets replaced if ;; `icicle-search-replace-whole-candidate-flag' is `nil', depends on ;; a few Icicles options: ;; ;; - `icicle-regexp-quote-flag' determines whether to use regexp ;; matching or literal matching. ;; ;; - `icicle-expand-input-to-common-match', ;; `icicle-search-highlight-all-current-flag', and ;; `icicle-search-replace-common-match-flag' together determine ;; whether to replace exactly what your input matches in the ;; current search hit or the expanded common match (ECM) of your ;; input among all search hits. If ;; `icicle-expand-input-to-common-match' does not cause your input ;; to be expanded (no ECM), or if either of the other options is ;; `nil', then your exact input match is replaced. Otherwise, the ;; ECM is replaced. ;; ;; The replacement string can be nearly anything that is allowed as a ;; replacement by `query-replace-regexp'. In Emacs 22 or later, this ;; includes Emacs-Lisp sexp evaluation via `\,' and constructs such ;; as `\#' and `\N' (back references). You can also use `\?', but it ;; is not very useful - you might as well use `M-,' instead, to ;; change the replacement text. ;; ;; Finally, let me repeat what I said at the beginning of this page: ;; Icicles search-and-replace is different from what you are used to, ;; and there are several different ways to use it. Experiment to get ;; to know how it works, and reread the description here. ;; ;; It is important to understand the various user options (with their ;; toggle commands) and their effects. They can radically change the ;; behavior of replacement. ;; ;; In particular, to put Icicles search-and-replace to best advantage ;; you need to know what gets replaced, depending on those user ;; options: the whole search hit vs only input matches, an exact ;; input match vs the expanded common match. Experiment with the ;; toggles `M-_', `C-^', `C-"', and `M-;'. And you need to know how ;; repeated `C-S-RET' works vs repeated `C-S-next'. ;; ;; I know it's tricky to learn. Experimenting helps. If something ;; happens that you did not expect, reread this section and try to ;; understand. Have fun. ;; ;; See Also: ;; ;; * (@> "Icicles Search Commands, Overview") and the doc string of ;; `icicle-search' for more information about search-and-replace. ;; ;; * (@> "Compile/Grep Search") for information about using ;; search-and-replace with `grep' buffers and compilation buffers. ;; ;; * (@* "Icicles Dired Enhancements") for information about using ;; search-and-replace on marked files in Dired. ;;(@* "Other Icicles Search Commands") ;; ;; Other Icicles Search Commands ;; ----------------------------- ;; ;; Function `icicle-search' is very general. As is explained in ;; (@> "Icicles Search Commands, Overview"), command `icicle-occur' ;; is defined trivially using `icicle-search' - it is basically ;; `icicle-search' with a regexp of `.*', to match lines. Similarly, ;; `icicle-search-word' (`C-c $') uses a regexp of `\bWORD\b', where ;; `WORD' is the word to look for, and `icicle-search-keywords' ;; (`C-c ^') uses a regexp of `\(KW1\|KW2\|KW2...\|KWn\)', where the ;; `KWm' are the keywords (regexps) to look for. ;; ;; Still other Icicles commands are available that make use of ;; `icicle-search'. And you can define your own, specialized search ;; commands along the same lines. To do that, it is instructive to ;; look at the source code of the commands described in this section; ;; they can serve as a model for defining your own search commands. ;; ;; Two of the commands described here, `icicle-compilation-search' ;; and `icicle-comint-search', are specialized versions of ;; `icicle-search' that work only in particular buffers where there ;; is little need for `icicle-search' itself. For this reason, these ;; commands reuse the key sequence, `C-c `' (backquote), that is ;; normally bound to `icicle-search'. This shadow binding occurs if ;; the current major mode is a compilation mode (for ;; `icicle-compilation-search') or an interactive interpreter mode ;; such as `shell-mode' or Lisp interactive mode (for ;; `icicle-comint-search'). ;; ;; [Programmer Note: Actually, the way this works is that `C-c `' is ;; bound to `icicle-search-generic', which calls the command that is ;; the value of internal variable `icicle-search-command'. You can ;; use this mechanism to provide custom Icicles search commands for ;; particular buffers.] ;; ;; Besides the commands described in this section, there are Icicles ;; search commands for navigating tags-file definitions and searching ;; their associated source files. These are described in section ;; (@> "Icicles Enhancements for Emacs Tags"). ;; ;; If you use `M-g' in the minibuffer to toggle option ;; `icicle-use-C-for-actions-flag', then you can use just `next' ;; instead of `C-next' to navigate when using any Icicles search ;; command. See ;; (@file :file-name "icicles-doc1.el" :to "Option `icicle-use-C-for-actions-flag'"). ;; ;;(@* "Searching Text with Properties") ;; ** Searching Text with Properties ** ;; ;; Instead of providing a context regexp, for commands ;; `icicle-search-char-property', `icicle-search-overlay-property', ;; and `icicle-search-text-property' (`C-c "') ["] you provide a ;; character property (e.g. `face') and its value ;; (e.g. `font-lock-function-name-face'). All zones of text that ;; have that property with that value become the completion ;; candidates (search hits). As always, you can filter this set of ;; candidates by typing input in the minibuffer. ;; ;; By a "character property" is meant either a text property or an ;; overlay property. `icicle-search-char-property' searches both ;; kinds of character property; `icicle-search-overlay-property' ;; searches only overlay properties; and ;; `icicle-search-text-property' (`C-c "' ["]) searches only text ;; properties. ;; ;; For example, if you use `icicle-search-char-property' with a ;; `face' property value `highlight', then the text searched includes ;; text with that overlay value and text with that text-property ;; value. With a `face' property value of `font-lock-string-face', ;; you can browse or search doc strings, and so on. ;; ;; If the property chosen is `face', then you can in fact choose ;; multiple faces, in multi-command fashion (e.g. `C-mouse-2'), and ;; the text that is searched has at least one of the faces you ;; choose. If you choose no face value (empty input), then the ;; target is text that has any face at all. The search hits are ;; zones of text that are distinguished by their `face' values. ;; ;; As with other Icicles search commands, a prefix argument controls ;; whether these character-property commands search the current ;; buffer, selected bookmarks, selected files, or selected buffers. ;; However, keep in mind that, since in this case you are searching ;; character properties, you will find search hits only for buffers ;; that already have such properties, for example, buffers that have ;; been fontified. ;; ;;(@* "Icicles Imenu") ;; ** Icicles Imenu ** ;; ;; Command `icicle-imenu', which is bound to `C-c =', is an Imenu ;; browser. It lets you use Icicles completion to navigate among or ;; search the content of definitions of functions, variables, macros, ;; keys, and so on in a programming language (any language that Imenu ;; handles). As always in Icicles, your current input (e.g. a ;; regexp) filters the set of available candidates. That is, you can ;; match against parts of an Imenu entry - any parts. That's ;; particularly useful if there are many entries in the Imenu menu; ;; you do not need to read/scan the whole list. ;; ;; If you look at the definition of `icicle-imenu' you'll see that it ;; simply lets you choose an Imenu submenu (`Functions', `User ;; Options', and so on) that is appropriate for the current buffer ;; type, and then it calls `icicle-search', passing it the ;; appropriate Imenu regexp. You can similarly define your own ;; specialized search commands using `icicle-search' to browse regexp ;; matches. You get all of the features of `icicle-search' when you ;; do that. For example, `icicle-imenu' gives you these advantages ;; over a standard Imenu menu: ;; ;; * You can restrict navigation (search) to a region. ;; ;; * You can navigate (browse) among multiple entries, instead of ;; choosing them one by one from a menu. ;; ;; * You can restrict the entries to browse using (regexp) pattern ;; matching. ;; ;; * As for `icicle-search', you can search multiple bookmarks, ;; multiple buffers, or multiple files. ;; ;;(@* "Type-Specific Imenu Commands") ;; *** Type-Specific Imenu Commands *** ;; ;; In addition, Icicles provides specializations of `icicle-imenu', ;; to find only definitions of particular types: ;; ;; `icicle-imenu-command', `icicle-imenu-face', ;; `icicle-imenu-key-explicit-map', `icicle-imenu-key-implicit-map', ;; `icicle-imenu-macro', `icicle-imenu-non-interactive-function', ;; `icicle-imenu-user-option', `icicle-imenu-variable' ;; ;; All of these commands use only the Imenu regexps that match ;; entities of different types. Because these regexps were designed ;; (for Imenu) only to locate the start of a definition, they ;; generally do not match full definitions. This makes them OK for ;; use by an Icicles multi-command as a browser, to navigate among ;; definitions. But it does not make them useful for searching the ;; content of definitions. ;; ;;(@* "Imenu Commands that Search Full Definitions") ;; *** Imenu Commands that Search Full Definitions *** ;; ;; Icicles also provides a similar set of commands, with the same ;; names but with suffix `-full', which do use full definitions as ;; the completion candidates, so you can search those bodies. When ;; you only want to navigate, you will generally use the non `-full' ;; commands because the candidates are simpler. When you want to ;; search you will generally use the `-full' commands. ;; ;; Be aware that "full" really means what it says only for ;; definitions in languages like Lisp. These commands in fact first ;; match the Imenu regexp, then use the text between the regexp match ;; beginning and one sexp forward. In the case of Lisp sexps, that ;; means they use the full sexp for the definition. But in the case ;; of other languages, such as C, the "full" definitions can in fact ;; be shorter than the simple regexp matches. ;; ;; ;;(@* "Icicles Imenu Combines Benefits of Imenu and Emacs Tags") ;; *** Icicles Imenu Combines Benefits of Imenu and Emacs Tags *** ;; ;; * Imenu lets you navigate among definitions in a single buffer. ;; ;; * Emacs tags let you navigate among definitions in multiple files, ;; but you must build and update the tags file that identifies the ;; definitions. ;; ;; Like Emacs tags, Icicles Imenu commands let you navigate among ;; definitions in multiple files - and also multiple bookmarks and ;; multiple non-file buffers. Like Imenu, you need not build a tags ;; file. Unlike Imenu, Icicles provides regexp completion that lets ;; you filter Imenu hits that you want to visit. ;; ;; Another difference from Emacs tags, besides the need for a tags ;; file, is that, since Icicles locates definitions using Imenu ;; regexps, you can only navigate among definitions in buffers that ;; you are visiting. This is both an advantage and a disadvantage: ;; you can narrow the search to certain files, but you must know ;; which files to search. And if you want to search all files, then ;; you must open them all (e.g. by matching a project regexp), ;; ;; The differences mean that Icicles Imenu commands do not provide a ;; substitute for Emacs tags; they provide some similar ;; functionality. They add another tool to your tool belt, handier ;; in some situations than using tags, and less useful in some other ;; situations. ;; ;; See Also: (@> "Icicles Enhancements for Emacs Tags") ;; ;;(@* "Searching Thing-At-Point Things") ;; ** Searching Thing-At-Point Things ** ;; ;; Command `icicle-search-thing' lets you search the content of ;; buffer zones whose text represents things of a particular kind: ;; `sexp', `defun', `sentence', and so on. ;; ;; Library `thingatpt+.el' provides many enhancements and some bug ;; fixes for the basic `thing-at-point' functionality provided by ;; vanilla library `thingatpt.el'. I strongly recommend that you use ;; it if you use command `icicle-search-thing'. ;; ;; Be aware that the thing-at-point functions have as their main ;; purpose to let you retrieve a textual thing at point. In many ;; cases they rely on `forward-THING' functions that do not move past ;; the thing if point is already inside it. ;; ;; One result of this is that in some cases the thing returned is ;; composed only of whitespace. That can sometimes be what you want: ;; whitespace text is non-empty text. But in other cases you are not ;; interested in whitespace-only targets. (This is not specific to ;; Icicles search.) ;; ;; Quiz: How would you remove whitespace-only completion candidates? ;; By matching them and then complementing that match. A regexp such ;; as this matches most of them: "\` \n\t]\'". (You could also ;; include \r, \f, and \v.) To get that you would hit these keys: ;; ;; \ ` [ SPC C-q C-j C-q TAB ] + \ ' ;; ;; Then, to match the whitespace-only candidates and remove them you ;; would hit `S-TAB C-~ S-TAB'. ;; ;; (Be aware, BTW, that character class [:space:] does not match ;; newline or carriage-return characters in some common Emacs modes. ;; For example, in Emacs-Lisp mode, a newline character has syntax ;; class `comment ender', and a carriage return character has syntax ;; class `symbol'. Character class [:space:] corresponds only to ;; characters with syntax class `whitespace'.) ;; ;;(@* "Compile/Grep Search") ;; ** Compile/Grep Search ** ;; ;; In a compilation-results buffer, such as `*Compilation*' or ;; `*grep*', you can use command `icicle-compilation-search', bound ;; to `C-c `', to search among the result set (search hits). This is ;; similar to `icicle-search', but when you use `C-RET', `C-mouse-2', ;; `C-down', `C-up', `C-next', `C-prior', `C-end', or `C-home', it ;; visits the source code that corresponds to the current line in the ;; compilation buffer. Just as for `icicle-search', you can narrow ;; the set of search contexts by typing a regexp. ;; ;; Using `icicle-compilation-search' with `grep' gives you two levels ;; of regexp searching: 1) the `grep' regexp and 2) your current ;; input regexp. And you can of course use progressive completion ;; (`M-*' or `S-SPC') to add any number of additional levels. (And, ;; starting with Emacs 22, you can pipe to other `grep' commands in ;; the same `M-x grep'.) ;; ;; In Emacs 22 and later, you can also replace search-hit text. You ;; can replace the entire grep regexp match or just the part of it ;; that matches your current input, depending on the value of option ;; `icicle-search-replace-whole-candidate-flag' (which you can toggle ;; with `M-_'). Replacement acts here just as it does for ;; `icicle-search'. ;; ;; You can also use a non-`grep' compilation buffer to perform search ;; and replace. Use it, for example, to correct errors in source ;; files. ;; ;; Icicles thus gives you several ways to perform search-and-replace ;; throughout multiple files: `grep'/compilation, `icicle-occur', and ;; `icicle-search'. The latter is of course not limited to ;; line-by-line search. ;; ;; See Also: (@> "Search and Replace"). ;; ;;(@* "Input Reuse in Interactive Interpreter Modes") ;; ** Input Reuse in Interactive Interpreter Modes ** ;; ;; In an interactive interpreter mode such as `shell-mode' or ;; interactive Lisp mode, you can search for and reuse a previous ;; input, possibly editing it first. Command `icicle-comint-search', ;; bound to `C-c `', lets you use Icicles completion and cycling to ;; access your previous (shell or Lisp) inputs; it uses ;; `icicle-search', so it highlights your regexp input matches, and ;; so on. You can use `C-$' at any time to toggle removal of ;; duplicate past inputs as completion candidates; by default, ;; duplicates are removed. ;; ;; Being a search command, however, `icicle-comint-search' has access ;; only to the commands that are visible in the buffer. It does not ;; use the `comint-input-ring', so it cannot, for instance, give you ;; access to commands used in a previous session, which might have ;; been recorded in a history file. ;; ;; Another Icicles command, `icicle-comint-command', which is not a ;; search command, does use `comint-input-ring' and does give you ;; completion and cycling against previous inputs that might not have ;; come from the current session. It is bound to `C-c TAB' in ;; `comint-mode' and derived modes. ;; ;;(@* "Define Your Own Icicles Search Commands") ;; ** Define Your Own Icicles Search Commands ** ;; ;; Function `icicle-search' is not only a useful user command; it is ;; also a framework for you to define your own Icicles search ;; commands. Consult the source code for the commands presented ;; above for models. And consult the doc string of `icicle-search' ;; for more information about calling it non-interactively. In ;; particular, note that: ;; ;; * You can pass a functional argument instead of a regexp to ;; `icicle-search', and it will use that function to define the ;; search contexts. The function is passed, as arguments, the ;; buffer to search, the beginning and end of the search region in ;; that buffer, and any additional arguments that you pass to ;; `icicle-search'. ;; ;; * You can pass a predicate argument to `icicle-search', in ;; addition to passing a regexp, and the search contexts will be ;; only those regexp matches that also satisfy the predicate. The ;; predicate takes two arguments, the search-context string and a ;; marker at the end of the search context. For information about ;; this, consult the doc string for function ;; `icicle-search-regexp-scan'. For a model of using this feature, ;; see the code that defines command `icicle-imenu'. ;; ;; By using your own function to define the search contexts, either ;; from scratch or by limiting regexp matches using a predicate, you ;; can perform semantic-based searching. That is, your search ;; command can use information besides syntax to define search hits. ;; For instance, commands `icicle-imenu-command' and ;; `icicle-imenu-non-interactive-function' use the semantic predicate ;; `commandp' to distinguish Emacs-Lisp commands from non-interactive ;; functions. ;; ;; See Also: ;; ;; * (@> "Icicles Search Commands, Overview") for general information ;; about Icicles search and the commands `icicle-search' and ;; `icicle-occur'. ;; ;; * (@> "Search and Replace") for information about replacing search ;; hits or parts of search hits. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Commands") for ;; information about using `C-RET', `C-mouse-2', `C-down', `C-up', ;; `C-next', `C-prior', `C-end', and `C-home'. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Progressive Completion") ;; for information about using any number of search regexps with ;; `M-*' or `S-SPC' and any number of search predicates with `M-&'. ;; ;; * (@> "Icicles Info Enhancements") for information about using ;; Icicles with Info mode. ;;(@* "Icicles Bookmark Enhancements") ;; ;; Icicles Bookmark Enhancements ;; ----------------------------- ;; ;; Many of the enhancements described in this section are available ;; only if you also use library `bookmark+.el' (which I recommend). ;; `Bookmark+' is compatible with vanilla Emacs bookmarks across ;; multiple Emacs versions. It enhances the use of bookmarks in many ;; ways. The explanation here does not attempt to describe the ;; `Bookmark+' enhancements; it describes only the Icicles features ;; that make use of them. ;; ;; One of the main `Bookmark+' enhancements is support for new ;; bookmark types. Icicles provides type-specific bookmark commands ;; and bookmark-candidate filtering. ;; ;; In addition, when you complete the names of some kinds of objects, ;; you can use `C-x m' to choose objects of that type. For example, ;; when you use `icicle-dired' (`C-x d') to complete a directory ;; name, you can use `C-x m' to choose among your Dired bookmarks. ;; See (@file :file-name "icicles-doc1.el" :to "Accessing Saved Locations (Bookmarks) on the Fly"). ;; Regardless of the bookmark type, another `Bookmark+' feature that ;; Icicles takes advantage of is the fact that a bookmark (any ;; bookmark) can save not only a single position but a region, that ;; is, two positions. You can think of this as bookmarking, or ;; saving, regions. When you jump to a region bookmark, the region ;; is activated (if option `bmkp-use-region' is non-`nil'). ;; ;; These are the main Icicles bookmarking features: ;; ;; * Tagging files (a la delicious) and jumping to tagged files ;; * Bookmarking the region and selecting a bookmarked region ;; * Setting a bookmark and jumping to a bookmark ;; * Searching the text of a bookmark's buffer or region ;; ;; Each is described in a little more detail below. More generally, ;; however, the `Bookmark+' doc is your friend. ;; ;;(@* "Using Tagged Files") ;; ** Using Tagged Files ** ;; ;; `Bookmark+' lets you easily tag files with delicious-style tags of ;; your choice. You need not visit the files to do this. Icicles ;; makes this tagging even easier. Tagging a file creates an ;; autofile bookmark that records the tags (metadata). Tags are ;; generally strings, but you can also associate arbitrary Lisp data ;; with them. Besides tagging files, you can add tags to any kind of ;; bookmark. ;; ;; In Icicle mode, the `Bookmark+' keys for tagging and untagging ;; files are bound to multi-commands `icicle-tag-a-file' and ;; `icicle-untag-a-file'. ;; ;; By default, these are on `C-x p t + a' and `C-x p t - a', ;; respectively. The commands are actually bound to `+ a' and `- a' ;; in keymap `bmkp-tags-map', and you can of course bind that keymap ;; to any key besides the default `C-x p t'. If you bind the keymap ;; to `f2', for instance, then `f2 + a' and `f2 - a' are all you ;; need. ;; ;; In addition, all Icicles file commands (and autofile bookmark ;; commands) let you tag or untag files on the fly, during file-name ;; completion, using the keys `C-x a +' and `C-x a -' respectively ;; (`a' for autofile). Similarly, you can use `C-x a a' during ;; file-name completion to create an autofile bookmark for a file ;; without tagging it. ;; ;; All Icicles file commands also let you narrow the set of matching ;; completions to those files that are tagged in certain ways, by ;; using these keys on the fly: ;; ;; * C-x C-t * - files having all of the tags you specify ;; * C-x C-t + - files having some of the tags you specify ;; * C-x C-t % * - files having all of their tags matching a regexp ;; * C-x C-t % + - files having some of their tags matching a regexp ;; ;; For example: ;; ;; C-x 4 f foo TAB C-x C-t + red RET blue RET RET ;; ;; `TAB' narrows the file-name candidates here to those starting with ;; "foo". `C-x C-t +' prompts for one or more tags ("red" and ;; "blue"), then it narrows the candidates to the names of files that ;; are tagged either "red" or "blue" (or both). ;; ;; You can of course use progressive completion, repeating `C-x C-t ;; +' to also require tag "yellow" or "purple", for instance. ;; ;; There are also several Icicles multi-commands for jumping to ;; tagged files. They are all on the `Bookmark+' keymaps ;; `bmkp-jump-map' and `bmkp-jump-other-window-map': prefixes `C-x j ;; a' and `C-x 4 j a' (`a' for autofile). The latter is for the ;; `-other-window' version of each command. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Third Example: Tagged Files") ;; * (@file :file-name "icicles-doc1.el" :to "Action Keys Bound Dynamically During File-Name Input") ;; * (@> "`icicle-find-file-tagged'"), next, for an alternative way ;; to narrow file-name candidates based on tags ;; ;;(@* "`icicle-find-file-tagged'") ;; *** `icicle-find-file-tagged' *** ;; ;; Command `icicle-find-file-tagged' (`C-x j t C-f C-f') matches tags ;; as part of a multi-completion candidate. Each candidate is ;; composed of these fields: an absolute file name plus the file's ;; tags, all separated by `icicle-list-join-string' ("^G^J", by ;; default). As always, you can type `C-M-j' to insert this ;; separator into the minibuffer. ;; ;; For this command, by default `.' in your input matches any ;; character, including a newline. As always, you can use `C-M-.' ;; to toggle this (so `.' does not match newline). ;; ;; You can match your input against the file name or tags or both. ;; E.g., type: ;; ;; `red S-TAB' to match files with the tag `red' ;; `red S-SPC green S-SPC blue' to match files with tags `red', ;; `green', and `blue' (in any order) ;; ;; That assumes that these tags do not also match any file names. ;; ;; If you need to match against a particular field (e.g. the file ;; name or a specific tag position), then use the field separator. ;;;; Otherwise, just use progressive completion, as shown above. ;; ;; E.g., to match only tags and not the filename, start with `C-M-j' ;; to get past the file-name field. To match both file name and ;; tags, type something to match the file name before the `C-M-j'. ;; E.g., type: ;; ;; `2011 C-M-j red S-SPC blue' to match files tagged `red' and ;; `blue' that have `2011' in their ;; names ;; ;;(@* "Jumping to Tagged Files (Other)") ;; *** Jumping to Tagged Files (Other) *** ;; ;; The other Icicles commands for jumping to tagged files let you ;; input a set of tags to match, or regexps, one by one. The ;; commands differ only in how this set of patterns is used. There ;; are commands that use the intersection of the matches and commands ;; that use the union. ;; ;; All of them work the same way: you enter a pattern to match ;; followed by `RET', ending with `RET RET'. Intersection is ;; indicated by `*' in the key binding. Union is indicated by `+'. ;; The regexp-matching commands have `%' in the key binding. And ;; again, there is an `-other-window' version of each, on prefix key ;; `C-x 4 j t C-f' instead of `C-x j t C-f'. ;; ;; `icicle-find-file-all-tags' (`*') - Match each tag exactly ;; `icicle-find-file-all-tags-regexp' (`% *') - Regexp-match each tag ;; `icicle-find-file-some-tags' (`+') - Match some tag (>= 1) exactly ;; `icicle-find-file-some-tags-regexp' (`% *') - Regexp-match some ;; ;; See these sections of the `Bookmark+' doc for more information ;; about bookmark tags: ;; ;; * (@file :file-name "bookmark+-doc.el" :to "Bookmark Tags") ;; * (@file :file-name "bookmark+-doc.el" :to "Autofile Bookmarks") ;; * (@file :file-name "bookmark+-doc.el" :to "Tag Commands and Keys") ;; * (@file :file-name "bookmark+-doc.el" :to "Tags: Sets of Bookmarks") ;; * (@file :file-name "bookmark+-doc.el" :to "Bookmark Tags Can Have Values") ;; ;; ;;(@* "Saving Regions and Selecting Them") ;; ** Saving Regions and Selecting Them ** ;; ;; Saving the region just means bookmarking it. As for any bookmark, ;; it must have a name. When you later jump to a region bookmark, ;; the region is activated (provided option `bmkp-use-region' is ;; non-`nil'). ;; ;; Icicles gives you quick ways to save a region and select ;; (activate) a saved region. You can do both using `C-x C-x'. ;; ;; * With no prefix arg or with a single plain prefix arg (`C-u'), ;; `C-x C-x' acts the same as for vanilla Emacs: it exchanges point ;; and mark, activating the region or not depending on the use of ;; `C-u' and whether you are in transient-mark mode. ;; ;; * With a multiple plain prefix arg (`C-u C-u'), `C-x C-x' jumps to ;; a region bookmark that you choose using completion, and ;; activates it. ;; ;; * With a numeric prefix arg, `C-x C-x' saves the region. If the ;; prefix arg is negative, then you are prompted for the name to ;; use. Otherwise, the bookmark is named automatically using the ;; buffer name plus ": " plus the first ;; `icicle-bookmark-name-length-max' characters of the region text. ;; (Newline characters are changed to spaces for the name.) ;; ;; So if (a) you are visiting buffer `foo', (b) the region text ;; starts with "Arise, you wretched of the earth! For justice ;; thunders condemnation: A better world's in birth!", and (c) the ;; value of option `icicle-bookmark-name-length-max' is 15, then ;; `C-9 C-x C-x' sets the region bookmark named `foo: Arise, you'. ;; ;;(@* "Setting a Bookmark and Jumping to a Bookmark") ;; ** Setting a Bookmark and Jumping to a Bookmark ** ;; ;; Just as `C-x C-x' lets you either set or jump to a region ;; bookmark, so `C-x r m' lets you either set or jump to any ;; bookmark. `C-x r m' is the vanilla Emacs key for setting a ;; bookmark. In Icicle mode it is bound by default to command ;; `icicle-bookmark-cmd'. (By default, whatever keys are normally ;; bound to `bookmark-set' are remapped in Icicle mode to ;; `icicle-bookmark-cmd'.) ;; ;; * With no prefix arg or a plain prefix arg (`C-u'), `C-x r m' acts ;; like `icicle-bookmark-set'. This is similar to `bookmark-set', ;; but if you use `Bookmark+' then you can use (lax) completion, ;; choosing from existing bookmarks for the same buffer. This ;; makes it easy to update a nearby bookmark. ;; ;; The same completion enhancements are available as for bookmark ;; jumping - see (@> "Jumping to a Bookmark"), below. ;; ;; * With a negative prefix arg, `C-x r m' jumps to a bookmark (with ;; completion). See (@> "Jumping to a Bookmark"), below. ;; ;; * With a non-negative prefix arg, `C-x r m' sets a bookmark, ;; automatically naming it. This is like the automatic naming for ;; a region bookmark, except that instead of including a prefix of ;; the region text, the name includes text from the current line ;; that starts at point. ;; ;; So if the cursor in buffer `foo' is on the `y' in a line with ;; the text "Arise, you wretched of the earth!", then the bookmark ;; will automatically be named `foo: you wretch'. ;; ;; If the prefix argument is 0, then the new bookmark does not ;; overwrite any existing bookmark with the same name. ;; ;;(@* "Jumping to a Bookmark") ;; ** Jumping to a Bookmark ** ;; ;; Icicles commands that jump to a bookmark are multi-commands: you ;; can use them to jump to any number of bookmarks in a single ;; invocation. Each jump command acts as a bookmark browser. ;; ;; As with most Icicles tripping commands, after you jump to a ;; (non-region) bookmark, the cursor position is highlighted using ;; cross hairs, if you also use library `crosshairs.el'. ;; ;; Bookmark names are highlighted in buffer `*Completions*' to ;; indicate the bookmark type. The faces used are those defined by ;; `Bookmark+'. ;; ;; If option `icicle-show-multi-completion-flag' is non-`nil', then ;; each completion candidate is a multi-completion, with up to three ;; parts: the bookmark name, the bookmark file or buffer name, and ;; any (del.icio.us-style) tags the bookmark has. You can toggle ;; option `icicle-show-multi-completion-flag' (for the next command) ;; using `M-m' during completion. ;; ;; When using multi-completion candidates, you can match any of the ;; multi-completion parts. For example, you can match all bookmarks ;; that have any tags by typing this when choosing a bookmark: ;; ;; C-M-j . * C-M-j S-TAB ;; ;; Or match all bookmarks whose names match `P42' and whose tags ;; match `blue': ;; ;; P 4 2 . * C-M-j . * C-M-j . * b l u e S-TAB ;; ;; (Each `C-M-j' inserts `^G\n', which is `icicle-list-join-string'.) ;; ;; `C-M-RET' shows detailed info about the current bookmark ;; completion candidate. `C-u C-M-RET' shows the complete, internal ;; info for the bookmark. Likewise, for the other candidate help ;; keys: `C-M-down' etc. And the mode line always shows summary ;; info about the current bookmark. ;; ;; During bookmark completion you can sort the candidates in various ;; bookmark-specific ways: ;; ;; * By the current (latest) `*Bookmark List*' order ;; * By bookmark name ;; * By last access as a bookmark (date + time) ;; * By bookmark visit frequency (number of times visited) ;; * By last buffer or file access (date + time) ;; * With marked bookmarks before unmarked (in `*Bookmark List*') ;; * By file name ;; * By (local) file type ;; * By (local) file size ;; * By last (local) file access (date + time) ;; * By last (local) file update (date + time) ;; * By Info location (manual and node) ;; * By Gnus thread ;; * By URL ;; * By bookmark type ;; ;; The most general Icicles jump commands are `icicle-bookmark' and ;; `icicle-bookmark-other-window'. In Icicle mode these are bound to ;; whatever `bookmark-jump' and `bookmark-jump-other-window' are ;; normally bound to. If you use `Bookmark+', the default bindings ;; are `C-x j j' and `C-x 4 j j', respectively. ;; ;; When you use these commands, you can narrow the completion ;; candidates to bookmarks of a specific type using the following ;; keys. ;; ;; `C-x j b' - non-file (buffer) bookmarks ;; `C-x j B' - bookmark-list bookmarks ;; `C-x j d' - Dired bookmarks ;; `C-x j f' - file bookmarks ;; `C-x j . f' - file bookmarks for the current directory ;; `C-x j g' - Gnus bookmarks ;; `C-x j i' - Info bookmarks ;; `C-x j M-i' - image bookmarks ;; `C-x j K' - desktop bookmarks ;; `C-x j l' - local-file bookmarks ;; `C-x j m' - `man' pages ;; `C-x j n' - remote-file bookmarks ;; `C-x j r' - bookmarks with regions ;; `C-x j u' - URL bookmarks ;; `C-x j w' - W3M (URL) bookmarks ;; `C-x j x' - temporary bookmarks ;; `C-x j y' - bookmark-file bookmarks ;; `C-x j , ,' - bookmarks for the current buffer ;; `C-x j = b' - bookmarks for specific buffers ;; `C-x j = f' - bookmarks for specific files ;; ;; These same keys are used at the top level for individual jump ;; commands for bookmarks of each of each type. For example, ;; `icicle-bookmark-info' is bound to `C-x j i'. Other-window jump ;; commands are the same, but use the prefix key `C-x 4 j' instead of ;; `C-x j'. ;; ;; Commands `icicle-bookmark' and `icicle-bookmark-other-window' can ;; use a cache for the set of available bookmarks. This improves ;; performance, especially if you have a lot of bookmarks. The ;; downside is that the list of completion candidates is not ;; automatically updated when you add new bookmarks. ;; ;; By default, this caching is off, so the set of possible bookmark ;; candidates is always up-to-date. You can turn on this caching by ;; setting option `icicle-bookmark-refresh-cache-flag' to `nil'. ;; ;; Alternatively, you can use a prefix argument to reverse the effect ;; of this option. If you have a lot of bookmarks then I recommend ;; that you customize the option to `nil' and just update it ;; occasionally by using `C-u' for bookmark completion. That will ;; temporarily turn off caching so that the current jump command ;; refreshes (updates) the cache. The default value of the option is ;; `t' only to avoid confusion for new users. ;; ;; The bookmarks cache is also used for searching bookmarks (see ;; next). The type-specific bookmark jump commands ;; (e.g. `icicle-bookmark-info-other-window') do not use the cache, ;; since they typically use a smaller number of candidates. And the ;; cache is automatically updated whenever you use `S-delete' to ;; delete a candidate bookmark. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Icicles Tripping") ;; ;;(@* "Searching Bookmarked Objects") ;; ** Searching Bookmarked Objects ** ;; ;; Icicles search (and replace) lets you search across multiple ;; buffers, files, or bookmarks. This is true for nearly all Icicles ;; search commands. You use a plain prefix argument to specify ;; bookmark searching. For command `icicle-search' itself (`C-u C-c ;; `'), you can alternatively use the specific command ;; `icicle-search-bookmarks-together'. ;; ;; When you do this you first choose the bookmarks to search, using ;; completion. Use `C-RET' and similar multi-command actions to ;; choose (use `RET' for the final choice). Once you have chosen the ;; bookmarks, you type a search pattern to narrow the set of ;; candidates. ;; ;; (Multi-command `icicle-bookmark-list' similarly lets you choose ;; bookmarks (or bookmark names, with a prefix arg). It returns them ;; in a Lisp list.) ;; ;; When you search the text of a region bookmark, the search is ;; limited to the region. ;; ;; If you use library `Bookmark+', then marking bookmarks in buffer ;; `*Bookmark List*' is another way of choosing them for searching. ;; Mode-specific Icicles search, `M-s M-s m' (in this case, ;; `icicle-search-bookmark-list-marked') searches the marked objects, ;; in this case the targets of the marked bookmarks. (You can ;; similarly use `M-s M-s m' in Ibuffer, Buffer Menu, and Dired to ;; search all marked buffers/files using Icicles search.) ;; ;; In addition to using Icicles search on a set of bookmark targets ;; together, you can use the following Icicles search multi-commands ;; that are specific to bookmarks: ;; ;; * icicle-search-bookmark ;; * icicle-search-autofile-bookmark ;; * icicle-search-bookmark-list-bookmark ;; * icicle-search-dired-bookmark ;; * icicle-search-file-bookmark ;; * icicle-search-gnus-bookmark ;; * icicle-search-info-bookmark ;; * icicle-search-local-file-bookmark ;; * icicle-search-man-bookmark ;; * icicle-search-non-file-bookmark ;; * icicle-search-region-bookmark ;; * icicle-search-remote-file-bookmark ;; * icicle-search-specific-buffers-bookmark ;; * icicle-search-specific-files-bookmark ;; * icicle-search-this-buffer-bookmark ;; * icicle-search-url-bookmark ;; * icicle-search-w3m-bookmark ;; * icicle-search-all-tags-bookmark ;; * icicle-search-all-tags-regexp-bookmark ;; * icicle-search-some-tags-bookmark ;; * icicle-search-some-tags-regexp-bookmark ;; ;; `icicle-search-bookmark' is a general command; the others are each ;; specific to a certain kind of bookmark candidate, and they need ;; library `bookmark+.el'. The last four let you search bookmarks ;; that have a certain set of tags. ;; ;; All of these commands act the same way. They are multi-commands, ;; so you can use them to search multiple bookmarks. But unlike ;; `icicle-search-bookmarks-together' (`C-u C-c `') and ;; `icicle-search-bookmark-list-marked' (`M-s M-s m'), you do not ;; first choose the bookmarks and then search them together. ;; Instead, you search them one at a time, choosing each with a ;; multi-command action. ;; ;; `icicle-search-bookmark' is flexible, letting you specify any set ;; of bookmarks to use as candidates. The candidates are the ;; bookmarks last shown in the `*Bookmark List*' display (list ;; `bmkp-sorted-alist', to be precise). ;; ;; You can use the `Bookmark+' features of `*Bookmark List*' to limit ;; the candidates to bookmarks of a certain type (e.g., only ;; autofiles, using `A S'), bookmarks with certain tags (e.g., only ;; those with tags matching a regexp using `T m %' followed by `>'), ;; and so on. Whatever set of bookmarks are shown (or were last ;; shown) in `*Bookmark List*' are the bookmarks to be searched. ;; ;; See Also: ;; ;; * (@> "Icicles Search Commands, Overview") for information about ;; command `icicle-search'. ;; * (@> "Jumping to a Bookmark") for information about bookmark ;; caching. Caching is also used for bookmark searching. ;; * (@> "Support for Projects") ;;(@* "Icicles Enhancements for Emacs Tags") ;; ;; Icicles Enhancements for Emacs Tags ;; ----------------------------------- ;; ;; In Emacs and Icicles, the word "tag" is used in multiple ways. ;; This section is about tags as identifiers of source-code ;; definitions. Emacs uses tags files, typically named `TAGS', to ;; index these definition locations. ;; ;; What constitutes a "definition" is determined by the content of ;; the tags file. Typically, definition recognition is available for ;; programming languages, but in fact a tags table can record any ;; text at all as a definition. That is, if you create your own tags ;; table, you can use the Emacs tags feature to navigate among any ;; "definitions" of your own choosing. ;; ;; If you use `M-g' in the minibuffer to toggle option ;; `icicle-use-C-for-actions-flag', then you can use just `next' ;; instead of `C-next' to navigate when using any of the Icicles tags ;; browsing commands described here. See ;; (@file :file-name "icicles-doc1.el" :to "Option `icicle-use-C-for-actions-flag'"). ;; ;; See Also: ;; ;; * (@> "Support for Projects") ;; * (@file :file-name "icicles-doc1.el" :to "Visit Recent Files or Files for Emacs Tags") ;; ;;(@* "`icicle-find-tag': Find Tags in All Tags Tables") ;; ** `icicle-find-tag': Find Tags in All Tags Tables ** ;; ;; In vanilla Emacs, you use commands such as `find-tag' (`M-.') to ;; find a tag, `tags-loop-continue' (`M-,') to find another matching ;; tag, `tags-apropos' to list all tags that match a regexp, and ;; `list-tags' to show all tags (definitions) in a given source file. ;; ;; In Icicles, you can use multi-command `icicle-find-tag', bound to ;; `M-.' in Icicle mode, to do all of this. It is similar to the ;; Icicles search commands. It is a general tags browser, just as ;; `icicle-imenu' is an Imenu browser. Being a multicommand, you can ;; visit any number of tags, in any order, in a single `M-.' ;; invocation. ;; ;; With `icicle-find-tag', you enter (using `RET') a regexp to match ;; the tags you want to visit. By default, all tags in all tags ;; files are searched, and the matches become completion candidates ;; (which you can of course match further by typing another pattern). ;; As always, you can use progressive completion, chip away the ;; non-elephant, and so on. Just as with Icicles search commands, ;; you use `C-RET', `C-mouse-2', `C-next', and so on, to visit the ;; search hits. You can use `M-*' (`icicle-pop-mark') to return to ;; the place you invoked `M-.'. ;; ;; By default, the completion candidates are multi-completions: the ;; source file name is included. This is an important aid, because ;; there can be similar, or even identical, tags in different source ;; files. Your current input can of course filter the source-file ;; name also, excluding certain files from the search. ;; ;; A prefix argument changes the default behavior, as follows: ;; ;; * If non-negative (>= 0), then only the current tag table is used, ;; instead of all tag tables. ;; ;; * If non-positive (<= 0), then the source file name is not part of ;; the completion candidate; only the tag itself is used. ;; ;; See Also: ;; ;; * (@> "Icicles Search Commands, Overview") for general information ;; about Icicles search commands. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Nutshell View of Icicles") ;; for information about progressive completion and chipping away ;; the non-elephant. ;; ;;(@* "`icicle-find-first-tag': Find First Tag in Current Table") ;; ** `icicle-find-first-tag': Find First Tag in Current Table ** ;; ;; Sometimes you do not need the full power and flexibility of ;; `icicle-find-tag'. If you just want to find the first tag among ;; several duplicates that match your input, and you just want to use ;; the current tags table, then you can use `icicle-find-first-tag' ;; or `icicle-find-first-tag-other-window'. These commands are like ;; vanilla `find-tag', but they are multi-commands, so you can visit ;; any number of tags in one invocation. Unlike `find-tag', however, ;; you cannot follow up to find another tag that matches using `M-,'. ;; ;;(@* "`icicle-tags-search': Search and Replace Using Tags") ;; ** `icicle-tags-search': Search and Replace Using Tags ** ;; ;; In vanilla Emacs, you use commands `tags-search', ;; `tags-query-replace', and `tags-loop-continue' (`M-,') to search ;; and replace text in source files whose definitions are indexed in ;; a tags file. ;; ;; In Icicles, you can use multi-command `icicle-tags-search' to ;; search and replace. It is in fact just command `icicle-search' ;; applied to the relevant source files. ;; ;; See Also (@> "Icicles Search Commands, Overview") for information ;; about `icicle-search. ;; ;;(@* "Trip Among Emacs Tags Using Bookmarks") ;; ** Trip Among Emacs Tags Using Bookmarks ** ;; ;; The idea here is to (a) automatically set (that is, create and ;; update) a bookmark each time you visit an Emacs tag and then (b) ;; use an Icicles bookmark-jump multi-command to navigate among those ;; bookmarks. ;; ;; For (a), just define a function that creates or sets a bookmark ;; that has the same name as an Emacs tag. Then use that function on ;; `find-tag-hook'. That hook is run in function ;; `find-tag-noselect', which accepts the tag name as parameter ;; TAGNAME. This code will do the trick: ;; ;; (defun bookmark-this-emacs-tag () ;; "Bookmark the currently visited tag. ;; Use on `find-tag-hook'. The bookmark name is the tagname, which ;; is the value of (free) variable `tagname'." ;; (bookmark-set tagname)) ;; ;; (add-hook 'find-tag-hook 'bookmark-this-emacs-tag) ;; ;; For (b), remember that with Icicles you can sort candidate ;; bookmarks in various ways on the fly. You can, for example, sort ;; them by last access time or frequency of access. ;; ;; See Also (@> "Jumping to a Bookmark") ;;(@* "Icicles Shell-Command Enhancements") ;; ;; Icicles Shell-Command Enhancements ;; ---------------------------------- ;; ;; Icicles provides completion support for shell commands in these ;; ways: ;; ;; * In Shell mode and related modes, it enhances completion of ;; commands, previous inputs (commands plus their switches and ;; arguments), file names, and environment variables. This is the ;; main shell-related completion enhancement that Icicles offers. ;; It is documented not here but in section ;; (@> "Completion in Comint Modes"). ;; ;; * In any buffer, it provides Icicles completion for `M-!' and ;; `M-|'. This is an optional feature that is not enabled by ;; default. ;; ;; * In Dired mode, it provides Icicles completion for `!', and `&'. ;; See (@> "Shell Commands on Marked Files"). This is an optional ;; feature that is not enabled by default. ;; ;; This section describes the optional Icicles completion available ;; for `M-!' and `M-|'. It applies also to completion for `!', and ;; `&' in Dired (but those have additional enhancements). ;; ;; In vanilla Emacs, when you enter a shell command at the prompt for ;; `M-!' or `M-|', no completion is available for empty input, and ;; non-empty input is completed only to an environment variable or to ;; a shell command that is in your search path. For Emacs releases ;; prior to Emacs 23, vanilla Emacs offers no completion at all. ;; ;; In Icicle mode, `M-!' and `M-|' can, like vanilla Emacs (23 and ;; later), complete using commands in your search path. This depends ;; on the the value of option `icicle-guess-commands-in-path' (see ;; below). ;; ;;(@* "Shell Command Completion as File-Name Completion") ;; ** Shell Command Completion as File-Name Completion ** ;; ;; The most significant thing about Icicles completion for reading a ;; shell command is that it is in fact *file-name* completion. ;; Reading a shell command means, first, reading a file name. This ;; is unexpected, to say the least. ;; ;; Because of this unusual behavior, this feature is optional and is ;; not enabled by default. To enable it, customize option ;; `icicle-functions-to-redefine' to add the shell-related functions ;; `dired-read-shell-command' and `read-shell-command'. If you do ;; that, then Icicle mode will substitute Icicles functions for these ;; standard functions and you will get the Icicles completion ;; described here. ;; ;; A shell command is itself an executable file, either a binary ;; program or a script. That's not so shocking. But since Icicles ;; uses file-name completion for your entire shell-command input, ;; including any switches (options) and command arguments, all of ;; that input is interpreted by `read-file-name' as a file name, ;; before it gets passed on to the shell. ;; ;; The reason for optionally providing file-name completion for a ;; shell command is to let you easily invoke a program no matter ;; where it resides, whether or not its directory is in your search ;; path. You can use completion to navigate to the command's ;; location. ;; ;; Icicles shell-command completion is lax, so you can enter any ;; command you want, not just a file-name completion candidate. And ;; you can edit the completed input before hitting `RET', to add ;; command switches (options) and arguments. The overall input ;; string is taken as a (pseudo) file name, but it is then passed to ;; the shell for execution. ;; ;; One drawback to this approach of using file-name completion is ;; that the history list is the file-name history, not the history of ;; previous shell commands. ;; ;;(@* "Gotcha: `$' in Shell Commands") ;; ** Gotcha: `$' in Shell Commands ** ;; ;; There is a gotcha, however, regarding `$' and file-name input: ;; ;; When you hit `RET' to accept the input, `read-file-name' finishes ;; its job, as always, by trying to expand any environment variables ;; in the string. Usually this is what you want, and it presents no ;; problem. But in the context of a shell another `$' syntax is also ;; used. For example, `$1' typically means the first argument or ;; first field; it does not mean a variable named `1'. ;; ;; `read-file-name' knows nothing about this different `$' syntax, ;; and it systematically calls `substitute-in-file-name' to expand ;; any environment variables in the file name you enter (when you hit ;; `RET'). It interprets `$1' the same way it inteprets `$PATH', ;; treating `1' as an (unknown) environment variable. This is not ;; what you want it to do. If you input `awk '{print $1}' Emacs ;; raises this error: ;; ;; Substituting nonexistent environment variable "1" ;; ;; What can you do about this? Three possible approaches: ;; ;; * Do not use this Icicles feature at all. The feature is turned ;; off, by default. ;; ;; * You can escape a dollar sign by doubling it: use `$$' instead of ;; `$' when you want to pass a `$' to the shell and not let ;; `read-file-name' try to interpret it in terms of an environment ;; variable. ;; ;; * You can turn off Icicle mode temporarily whenever you use a ;; complex command that involves `$': `M-x icy-mode'. ;; ;;(@* "Known Shell Commands as Proxy Candidates") ;; ** Known Shell Commands as Proxy Candidates ** ;; ;; If you do turn on Icicles file-name completion for reading shell ;; commands, then extra, known shell commands are also made available ;; as proxy completion candidates, provided that option ;; `icicle-guess-commands-in-path' is non-`nil' (it is `nil' by ;; default). These extra candidates are the names of all executable ;; files (or of all files, if `shell-completion-execonly' is `nil') ;; in your search path. ;; ;; The fact that these are Icicles proxy candidates means that they ;; are available regardless of the current default-directory - they ;; are not in fact treated as file-name candidates, even though they ;; are available during file-name completion. You can easily ;; recognize Icicles proxy candidates in buffer `*Completions*': they ;; have face `icicle-proxy-candidates'. See ;; (@file :file-name "icicles-doc1.el" :to "*Completions* Display"). ;; ;; If `icicle-guess-commands-in-path' is non-`nil', the list of ;; search-path candidate commands is computed once and cached as the ;; value of `icicle-shell-command-candidates-cache'. The particular ;; non-`nil' value of `icicle-guess-commands-in-path' determines when ;; the cache is filled. ;; ;; If the value of `icicle-guess-commands-in-path' is `first-use', ;; the cache is filled the first time you use it, and each time you ;; turn on Icicle mode it is updated. If the value of ;; `icicle-guess-commands-in-path' is `load', then the cache is ;; instead filled each time you load Icicles. ;; ;; Regardless of the non-`nil' value of ;; `icicle-guess-commands-in-path', if you save ;; `icicle-shell-command-candidates-cache', then that value is used ;; in future sessions (no delay for searching your path). ;; ;; If your environment changes, you can use command ;; `icicle-recompute-shell-command-candidates' to update the cached ;; list at any time. With a prefix argument, the updated value is ;; saved persistently. ;; ;; In addition to the extra candidates computed by searching your ;; search path, in contexts such as Dired where target (e.g. marked) ;; files for the shell command are known, the extra candidates ;; include additional commands (possibly including switches) that ;; Icicles can guess might be appropriate for the target files. ;; See (@> "Shell Commands on Marked Files"). ;; ;; During Icicles shell-command completion, help is available for ;; individual candidates, using `C-M-RET', `C-M-mouse-2', and so on. ;; For an extra candidate, help is provided for the command by the ;; `apropos' shell command (if available). For a file-name ;; candidate, help shows the file's properties. See ;; (@file :file-name "icicles-doc1.el" :to "Get Help on Completion Candidates"). ;; ;;(@* "Using On-Demand Completion with Shell-Command Input") ;; ** Using On-Demand Completion with Shell-Command Input ** ;; ;; Even if you do not choose to turn on the file-name completion ;; feature described above, you can still get file-name completion ;; when you input a shell command. Just do it on the fly, using ;; `C-M-S-f' (aka `C-M-F'). ;; ;; After you have typed or completed the shell command per se (e.g. a ;; file name or a search-path command), you can use `C-M-F' to ;; complete (relative) file names to insert as shell-command ;; arguments as part of the command line to submit to the shell. See ;; (@file :file-name "icicles-doc1.el" :to "Completion On Demand"). ;; ;; In addition, remember that you can use `M-o' anytime in the ;; minibuffer to complete against a previous input. This means that ;; if you have previously entered some complex shell command ;; (e.g. with various switches or arguments), then you can use `M-o' ;; to retrieve it for reuse (possibly editing it). See ;; (@file :file-name "icicles-doc1.el" :to "Using Completion to Insert Previous Inputs: `M-o'") ;; ;; In addition, you can use `C-M-pause' to switch to another history, ;; then use `M-o' to complete against that history. And you can do ;; this as many times as you like during the same overall ;; shell-command input. You can thus use different histories to ;; compose different parts of the overall command. See ;; (@> "Using Other Histories; Commands Any Which Way"). ;; ;; None of this is special to shell-command input. `C-M-F', ;; `C-M-pause', and `M-o' are all available in Icicle mode for any ;; minibuffer input. ;;(@* "Icicles Dired Enhancements") ;; ;; Icicles Dired Enhancements ;; -------------------------- ;; ;; Icicles can help with Dired in these ways: ;; ;; * You can use Icicles search-and-replace on the marked files in ;; the current directory and in marked subdirectories ;; (recursively). ;; ;; * You can save marked file names as completion candidates for ;; reuse later. ;; ;; * You can open Dired on saved file names, that is, names that you ;; previously saved as a completion candidates set or as an Emacs ;; fileset. It does not matter how the file names were saved or ;; which directories the files are in. The set of saved file names ;; can be persistent or just for the current Emacs session. ;; ;; * You can use multi-command `icicle-dired-insert-as-subdir' to ;; insert directories you choose into a Dired ancestor directory ;; listing. If a directory you choose already has its own Dired ;; buffer, then its markings and switches are preserved for the ;; new, subdirectory listing in the ancestor Dired buffer. ;; ;; * You can use file-name completion when you use `!' or `&' to ;; execute a shell command. This is an optional feature that is ;; not enabled by default. See also (@> "Icicles Shell-Command Enhancements"). ;; ;; * You can use the multi-completion multi-commands ;; `icicle-visit-marked-file-of-content' and ;; `icicle-visit-marked-file-of-content-other-window' to visit ;; marked files whose names and/or whose content matches your ;; minibuffer input. See (@file :file-name "icicles-doc1.el" :to "Multi-Completions"). ;; ;;(@* "Search-and-Replace Marked Files") ;; ** Search-and-Replace Marked Files ** ;; ;; If you also use library `Dired+' then `M-s M-s m' ;; (`icicle-search-dired-marked-recursive') in Dired uses Icicles ;; search (and on-demand replace) on the marked files. ;; ;; Each marked subdirectory is handled recursively in the same way: ;; If it has a Dired buffer then its marked files are searched, or ;; all of its files if none are marked. If a marked directory at any ;; level has no Dired buffer then all of its files are searched. ;; With a prefix arg the Dired markings are ignored; all files are ;; searched. ;; ;; Because you might not be aware of existing Dired buffers for some ;; marked directories, you are asked to confirm searching their ;; marked files. If you do not confirm, then all files in marked ;; subdirectories (recursively) are searched, regardless of whether ;; they might have Dired buffers with marked files. That is, Dired ;; buffers are ignored if you do not confirm using them. ;; ;; Command `icicle-search-dired-marked-recursive' runs ;; `icicle-search', so you have available all of its features, ;; including accessing search hits directly, in any order. To skip a ;; whole file, just match its name with your minibuffer input and ;; then use `C-~' to remove all of its occurrences from the set of ;; hits. ;; ;; You can similarly use `M-s M-s m' in Ibuffer or Buffer Menu to ;; search all marked buffers using Icicles search, and in your ;; bookmark list (buffer `*Bookmark List*') to search all marked ;; bookmark targets (you need library `Bookmark+' for this). Also, ;; `C-0 M-s M-s M-s' and `C-0 C-c `' are bound to the same command. ;; (But you cannot pass a separate prefix arg in those cases, since ;; `C-0' is already used.) ;; ;;(@* "Save Marked Names as Completion Candidates") ;; ** Save Marked Names as Completion Candidates ** ;; ;; In Dired with Icicles, you can use `C-M->' ;; (`icicle-dired-save-marked') to save the marked file and ;; subdirectory names as a set of completion candidates, for reuse ;; later (e.g., using `C-M-<'). Similarly, you can use `C->' to add ;; the marked files to an existing saved set of candidates. ;; ;; These bindings act similarly to `C-M->' and `C->' in the ;; minibuffer: a prefix argument controls whether you save candidates ;; to a variable or a cache file. Also, `C-M-}' saves to a variable ;; you name, and `C-}' saves to a cache file - see ;; (@* "Marked Files and Dirs as a Project"), below. ;; ;; You can use such a saved set of file and directory names as ;; candidates during file-name completion. They are saved as ;; absolute names, which means you can use them with, say, `C-u C-x ;; C-f'. See ;; (@file :file-name "icicles-doc1.el" :to "Absolute File Names and Different Directories"). ;; ;;(@* "Save Marked Names Here and Below") ;; *** Save Marked Names Here and Below *** ;; ;; Just as `M-s M-s m' acts on the marked names in not only the ;; current Dired buffer but also those in marked subdirectories, ;; recursively (see (@> "Search-and-Replace Marked Files")), so there ;; are commands to save the marked names at all levels within the ;; current directory. These commands are available only if you use ;; library `Dired+'. ;; ;; They have the same key bindings as the non-recursive commands, ;; except that they are on prefix key `M-+'. For example, `M-+ ;; C-M->' saves the marked names here and below as a set of ;; completion candidates. They are available on Dired menu-bar menu ;; `Multiple' > `Marked Here and Below' > `Icicles'. ;; ;;(@* "Open Dired for a Set of File and Dir Names") ;; ** Open Dired for a Set of File and Dir Names ** ;; ;; In Dired with Icicles you can use `C-M-<' ;; (`icicle-dired-chosen-files-other-window') to open Dired for a set ;; of file or directory names that you choose interactively or that ;; you have previously saved (persistently or not) as completion ;; candidates or as an Emacs fileset. ;; ;; For example, this opens Dired on all files whose names match the ;; regexp `.*foo.*bar' (the initial `.*' is implicit): ;; ;; C-M-< foo.*bar S-TAB C-! C-g ;; ;; The Dired buffer that is created is named `Icy File Set' (suffixed ;; with <1>, <2>, etc. as needed), and it contains only the chosen ;; file names. ;; ;; The file names are checked to be sure they reference existing ;; files. If any of the names are relative names, those files are ;; checked for existence in the Dired directory. If you use a prefix ;; argument, then you are prompted for the directory to use. ;; ;;(@* "Marked Files and Dirs as a Project") ;; ** Marked Files and Dirs as a Project ** ;; ;; Just as `C-}' in the minibuffer is a shortcut for `C-u C-M->', ;; which saves the current set of completion candidates persistently, ;; so `C-}' in Dired saves the marked file names in a cache file or, ;; with a prefix arg, an Emacs fileset. Similarly, just as `C-{' in ;; the minibuffer is a shortcut for `C-u C-M-<', which retrieves ;; candidates from a persistent set, so `C-{' in Dired retrieves a ;; persistent set of file names and opens them in a separate Dired ;; buffer. ;; ;; You can think of such persistent file-name sets as projects. ;; `C-}' is bound to command `icicle-dired-save-marked-as-project' ;; (aka `icicle-dired-save-marked-persistently'). `C-{' is bound to ;; command `icicle-dired-project-other-window'. ;; ;; Again, you can use such a project as a candidate set for file-name ;; completion at any time. In addition, `C-}' and `C-{' can be handy ;; in Dired for working with projects even without using completion. ;; The files in a project can be distributed among any directories ;; anywhere. This gives you an easy way to open Dired on just the ;; files you want and operate on them there. ;; ;; And while in a project in Dired you can use `C-M-<' to mark a ;; project subset to work on, and then use `C-M->' to operate on that ;; subset using Icicles completion. And you can have any number of ;; projects - you access each by its name (with completion) and need ;; not remember its cache file name. ;; ;;(@* "Shell Commands on Marked Files") ;; ** Shell Commands on Marked Files ** ;; ;; This is an optional feature that is not enabled by default. See ;; also (@> "Icicles Shell-Command Enhancements"). ;; ;; In Icicle mode, `!' and `&' in Dired let you complete a shell ;; command. You can optionally use Icicles file-name completion for ;; the shell command, by customizing option ;; `icicle-functions-to-redefine' to add the shell-related functions ;; `dired-read-shell-command' and `read-shell-command'. ;; ;; If you do that, then Icicle mode will substitute Icicles functions ;; for these standard functions and you will get the Icicles ;; completion described here. This is the same optional program-file ;; completion that is available anywhere when a shell command is read ;; (see (@> "Icicles Shell-Command Enhancements")), but in Dired the ;; extra, proxy candidates include commands that Icicles thinks might ;; be particularly appropriate for the marked files. ;; ;; These proxy candidates are not necessarily only command names. ;; They can include switches (options) that specialize a command. ;; For example, if a PDF file (*.pdf) is marked in Dired, the ;; completion candidates might include `gv -safer', `pdftotext ? -', ;; and `xpdf'. The first two of these are not just command names ;; (`-safer' is a command switch). ;; ;; Starting with Emacs 23, Icicles uses both of the following methods ;; to guess extra (proxy) candidates that are file type-specific: ;; ;; * MIME-type associations ;; ;; * The rules defined by user option `dired-guess-shell-alist-user' ;; and variable `dired-guess-shell-alist-default' (provided you use ;; Dired X, that is, standard library `dired-x.el') ;; ;; Prior to Emacs 23, MIME types are not used. In the example of a ;; PDF file, candidates `gv -safer' and `pdftotext ? -' are provided ;; by MIME-type associations, and candidate `xpdf' is provided by the ;; Dired X rules. Note that you can customize the rules. ;; ;; Any candidates that are specific to the marked files are Icicles ;; proxy candidates - see ;; (@file :file-name "icicles-doc1.el" :to "*Completions* Display"). ;; These are available regardless of the current default-directory. ;; They are not treated as file-name candidates, even though they are ;; available during file-name completion. Icicles proxy candidates ;; have face `icicle-proxy-candidates' in buffer `*Completions*'. ;; ;; Again, everything that is true for shell-command completion ;; elsewhere is also true for shell-command completion in Dired. See ;; (@> "Icicles Shell-Command Enhancements"). This includes adding ;; all commands from your search path as proxy candidates if option ;; `icicle-guess-commands-in-path' is non-`nil', and providing help ;; on individual candidates (shell commands or files) during ;; completion. ;; ;; ;; See Also: ;; ;; * (@> "Icicles Shell-Command Enhancements") for more information ;; about shell-command completion ;; ;; * (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates") ;; for information about saved completion candidates ;; ;; * (@file :file-name "icicles-doc1.el" :to "Chip Away the Non-Elephant") ;; for the use of `C-~' to remove matching candidates ;; ;; * (@> "Icicles Search Commands, Overview") for information about ;; `icicle-search' ;; ;; * (@> "Search and Replace") for how to replace selected search hits ;; ;; * (@file :file-name "icicles-doc1.el" :to "Persistent Sets of Completion Candidates") ;; for more information about using persistent sets ;; ;; * (@> "Support for Projects") for more information about working ;; with projects ;; ;; * Library `dired+.el', which has related features such as `C-M-*' ;; to open Dired on just the marked files and `M-g' to `grep' just ;; the marked files. ;;(@* "Icicles Info Enhancements") ;; ;; Icicles Info Enhancements ;; ------------------------- ;; ;; Icicles can help with Info in these ways: ;; ;; * Icicles completion is available for any input. ;; ;; * Index-topic completion highlights candidate topics that ;; reference nodes you have already visited. ;; ;; * You can create virtual Info books composed of an arbitrary set ;; of nodes from any set of manuals. ;; ;; * You can use `icicle-search' on part or all of a manual, if you ;; flatten it first with `Info-merge-subnodes' . ;; ;; These features are described below. ;; ;;(@* "Icicles Completion for Info") ;; ** Icicles Completion for Info ** ;; ;; Whenever completion is available for Info commands, such as `g' ;; (`Info-goto-node'), `i' (`Info-index'), and `m' (`Info-menu'), you ;; can take advantage of Icicles completion. For instance, if you ;; type `g yan', you can use `S-TAB' for apropos completion and ;; choose node `Isearch Yank', whose name contains `yan' but does not ;; start with it. This is an obvious and standard Icicles feature. ;; ;; Although vanilla Emacs also accepts a substring as input for `i', ;; it does not provide substring or regexp completion, and it will ;; not accept a regexp as final input. ;; ;; Icicle mode binds `g', `i', and `m' to multi-commands ;; `icicle-Info-goto-node', `icicle-Info-index', and ;; `icicle-Info-menu', which means that you can also use `g', `i', ;; and `m' with `C-next', `C-RET', `C-mouse-2', and so on, to browse ;; among matching Info nodes. Unlike browsing with repeated use of ;; `,' after `i' in vanilla Emacs, you can continue to see all of the ;; matching candidates, in buffer `*Completions*', and you need not ;; visit the index hits in sequential order. ;; ;; If you use `M-g' in the minibuffer to toggle ;; `icicle-use-C-for-actions-flag', then you can use just `next' ;; instead of `C-next' to navigate. See ;; (@file :file-name "icicles-doc1.el" :to "Option `icicle-use-C-for-actions-flag'"). ;; ;; As usual in Icicles, you can sort completion candidates in various ;; ways, using `C-,' (`icicle-change-sort-order'). For `g', in ;; particular, although the default order is alphabetical, you can ;; choose `in book order', which shows the node candidates in the ;; same order as in the book. In that case, using `g' and then ;; navigating among candidates sequentially using `C-down', `C-up', ;; `C-next', `C-prior', `C-end', or `C-home', visits the nodes in ;; their natural order. ;; ;; As a special case of this, if you use a negative prefix argument ;; (that is, `M-- g'), then not only are the candidate nodes ;; presented `in book order', they are also limited to the nodes that ;; follow your current location in the book - that is, to the ;; remainder of the book. (A non-negative numeric prefix argument ;; has the same meaning as for `Info-goto-node'.) ;; ;; In addition, except when you are at the `Top' node, a pseudo-node ;; `..' is added to the set of completion candidates. Choosing this ;; takes you up to the parent of the current node. You can thus use ;; `g' in Info not only to explore nodes by name, but also as another ;; means to traverse the Info menu hierarchy. ;; ;; Starting with Emacs 22, command `icicle-Info-goto-node' lets you ;; type multi-completion input whose second part (after `C-M-j') is a ;; content-searching pattern (regexp). This means you can search a ;; set of nodes (or an entire manual) and choose from the list of ;; matching nodes. The `*Completions*' candidates you see are just ;; the node names. After you choose one of the matching nodes to ;; visit, you can use `C-M-s' to find each match of the ;; content-search pattern. See ;; (@file :file-name "icicles-doc1.el" :to "Chapter & Verse: Searching Named Containers"). ;; ;;(@* "Highlighting Index Topics for Visited Info Nodes") ;; *** Highlighting Index Topics for Visited Info Nodes *** ;; ;; When you are looking for something in an Info manual, `i' ;; (multi-command `icicle-Info-index') is your friend. It is ;; typically better than brute search (`C-s' or `C-M-s'), because a ;; human has decided what topics to add to the index based on ;; understanding user/reader needs. ;; ;; When you use `i' to look up a topic in the indexes of a manual, ;; you can use completion. In particular, apropos completion and ;; progressive completion can help here. ;; ;; Naturally, a single Info node can be indexed under multiple ;; topics. And some of those index entries might even represent the ;; same topic, using different word order or terminology. ;; ;; Suppose you are looking up information about Emacs fringe, for ;; example. You might type `i fringe S-TAB' to see all indexed ;; topics with the substring `fringe'. But because of double-entry ;; indexing, several of the topics matching your input can take you ;; to the same node. ;; ;; When you are investigating a topic this way you might want to ;; visit different nodes that are pertinent to the same topic. But ;; how can you tell whether you have already visited a node that one ;; of the matching topic candidates takes you to? Icicles ;; highlighting of past inputs does not help here. What matters is ;; not whether you have entered a given topic previously but whether ;; you have already visited a given topic's node. ;; ;; Icicles can also help here, by highlighting the topics whose nodes ;; you have visited. It uses face ;; `icicle-historical-candidate-other' for this (not face ;; `icicle-historical-candidate'). (This feature is not available ;; for Emacs 20 or 21.) ;; ;; But because it takes extra time to track down each of the current ;; topic candidates, this can be costly. You can customize option ;; `icicle-Info-visited-max-candidates' to control the behavior. ;; This extra highlighting is skipped whenever there are more ;; candidates that the option value. It is also skipped if you turn ;; off historical candidate highlighting altogether, by setting ;; option `icicle-highlight-historical-candidates-flag' to `nil'. ;; ;;(@* "Virtual Info Books") ;; ** Virtual Info Books ** ;; ;; You can take advantage of Icicles completion-candidate set ;; operations to create your own virtual Info books. That is, you ;; can define and save sets of Info nodes or Info index entries, and ;; then reuse them later. ;; ;; Both `m' and `g' in Info use nodes as candidates, so you can use ;; `m' or `g' or a combination of `m' and `g' to define a node set, ;; and you can use either `m' or `g' to reuse a node set. A set of ;; index entries is different: You must use `i' to create and reuse ;; such a set. ;; ;; Remember that you can define a candidate set incrementally, adding ;; more elements using `C->', `C-)', `insert', `M-S-mouse-2', ;; `M-mouse-3', or `mouse-1 mouse-3 mouse-3'. And you can save a ;; candidate set persistently. [*] ;; ;; You can even create a virtual book that includes Info nodes from ;; different manuals. For example, you might want to collect ;; together specific nodes that deal with some particular topic, such ;; as faces, from both the Emacs manual and the Elisp manual. ;; ;; You do this using `C-u g' (a plain prefix argument). This ;; prepends the Info file name (book identifier) to each node-name ;; completion candidate. For example, when you are in the Emacs ;; manual, each node candidate is prefixed by `(emacs)', and in the ;; Elisp manual each candidate is prefixed by `(elisp)'. You define ;; a set of candidates in the usual Icicles ways, changing manuals as ;; needed to add additional nodes to the set you save. ;; ;; A node name prefixed by its file name is analogous to an absolute ;; file name, that is, a relative file name prefixed by its ;; directory. Because such a saved candidate has a book prefix, ;; e.g. `(emacs)', it is absolute and unambiguous. You can use it ;; wherever you happen to be in Info, to go directly to that node. ;; This is a feature of `g' even in vanilla Emacs: you can go to a ;; node in a different manual from the one you are currently ;; visiting. ;; ;; When you want to reuse a virtual book, hit `g' again, retrieve the ;; saved set of node candidates that defines the book, and navigate ;; among the saved nodes. ;; ;; If you use library `info+.el', you can also take advantage of its ;; definition of virtual books and saved Info nodes. That library ;; defines command `Info-virtual-book', which opens Info on a Table ;; of Contents of a virtual book of nodes that you have saved either ;; using command `Info-save-current-node' or by customizing user ;; option `Info-saved-nodes'. ;; ;; Icicles command `icicle-Info-virtual-book' extends ;; `Info-virtual-book' by letting you define the virtual book nodes ;; using completion. That is, you can use `g' to save a set of ;; node-name completion candidates (as the value of variable ;; `icicle-saved-completion-candidates'), and then use command ;; `icicle-Info-virtual-book' to open an Info buffer with those nodes ;; as a menu. ;; ;; If you have not saved any node-name candidates, then ;; `icicle-Info-virtual-book' acts the same as `Info-virtual-book': ;; it opens the virtual book that is defined by `Info-saved-nodes'. ;; With `info+.el', the key `.' adds the current node to ;; `Info-saved-nodes', which gives you a convenient way to build up a ;; virtual book as you read. This is like Emacs bookmarking, but it ;; keeps your saved Info nodes separate from your other bookmarks. ;; ;; With a prefix argument, `icicle-Info-virtual-book' lets you choose ;; a persistently saved completion set to use instead of ;; `icicle-saved-completion-candidates' or `Info-saved-nodes'. This ;; means that you can have any number of such saved node sets as ;; virtual books, to use at any time. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates") ;; for information about defining, saving, and reusing sets of ;; completion candidates. ;; ;; * (@> "Icicles Bookmark Enhancements") for information about using ;; Info bookmarks. ;; ;; [* If you click `mouse-1' on a candidate and (starting with Emacs ;; 22) `mouse-1-click-follows-link' is an integer, then you will need ;; to hold the mouse button depressed longer than that many seconds, ;; or else that candidate will simply by chosen. If the value is ;; `t', then this will not work at all. Any other value presents no ;; problem. (Personally, I use `nil'.)] ;; ;;(@* "Using Icicle-Search With Info") ;; ** Using Icicle-Search With Info ** ;; ;; Icicles searching (`icicle-search') is not Isearch. It searches ;; for all matches in the portion of text you tell it to search. ;; This means that you cannot use it to search an entire manual in ;; one operation, unless you have the entire manual available in a ;; single buffer to be searched. ;; ;; So, when you use `icicle-search' (`C-c `') to search with Info, ;; you are limited to a few options: ;; ;; * You can use it normally, to search within a single Info node. ;; ;; * You can widen the visible portion of the Info buffer ;; (`C-x n w'), to use it on an entire Info file. However: ;; ;; 1. It is not obvious how a given Info manual is divided into ;; files. That is, you need to be aware of the point at which ;; the manual moves from one file to the next. ;; ;; 2. Only the nodes in the same file that you have already visited ;; are highlighted, and lots of ugly Info "plumbing" becomes ;; visible in the other nodes. ;; ;; 3. You lose all Info features, such as navigation using links. ;; ;; * There is another way to search across nodes, which addresses #1 ;; and #2, but still does not give you navigable links and such. ;; Think of it as a hack that can sometimes be handy. That is what ;; is described below. ;; ;; The idea is to flatten a subtree of Info nodes - possibly an ;; entire manual, but more typically a node and its children - and ;; then use `icicle-search' (`C-c `') over that flattened document. ;; What is needed is a command that flattens Info subtrees. Library ;; `info+.el' provides such a command, `Info-merge-subnodes', and ;; binds it to `+' in Info. ;; ;; You can control how you want the flattening to occur, by using ;; different values of prefix argument. For searching, you probably ;; want complete flattening of the chosen subtree, in a single ;; buffer, so you use a prefix arg of zero: `C-u 0 +'. ;; ;; This does not replace the `*Info*' buffer that you started with; ;; it creates a new buffer, named after the root node of the subtree ;; you flattened. A principle use of `Info-merge-subnodes' is to ;; print out a manual or a portion of it. Also, I wrote a library ;; (`mkhtml.el', outdated now) that lets you convert the result to ;; HTML. ;; ;; In sum, you can use Icicles search in Info: `C-u 0 +', then ;; `C-c `'. ;; ;; One caveat, however: You will generally want to limit your search ;; to a reasonably small subtree of a manual, instead of flattening ;; and then searching the entire manual. Flattening a large manual ;; can take a while: it took me 10 minutes to flatten the Emacs ;; Manual. Of course, you could flatten a large manual once, and ;; save the result in a file for later searches. ;; ;; Obviously, flattening in order to search is less convenient than ;; using manual-wide incremental search (`C-s') with Info (starting ;; with Emacs 22), and it is often less convenient than using ;; `Info-search' (bound to `s' in Info). Icicles searching is ;; different from both, and it has its advantages and disadvantages. ;; When you want the advantages of Icicles searching in Info, the ;; flattening hack can be useful. When you do not need those ;; advantages, other search methods can sometimes be more ;; appropriate. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Commands") for ;; information on using multi-commands. ;; ;; * (@> "Icicles Search Commands, Overview") for information about ;; command `icicle-search'. ;; ;; * Library `info+.el' for information about `Info-merge-subnodes'. ;;(@* "Support for Projects") ;; ;; Icicles Support for Projects ;; ---------------------------- ;; ;; This section mainly provides pointers to other sections of the ;; Icicles doc that describe features that can help you work with a ;; project that involves multiple files, buffers, or bookmarks. ;; ;; ;;(@* "Bookmarks for Project Access and Organization") ;; ** Bookmarks for Project Access and Organization ** ;; ;; If you use `Bookmark+' (library `bookmark+.el'), then you can use ;; bookmarks of various types, including the following, to help ;; manage software projects: ;; ;; * Dired buffers, with specific sets of files and subdirectories ;; that are marked or omitted, and using specific listing switches. ;; ;; * `*Bookmark List*' buffers, with specific sets of bookmarks that ;; are marked or hidden. ;; ;; * Multiple alternative bookmark files. For example, use a ;; different one for each project. Or use different ones for ;; subprojects and use them together for a full project. ;; ;; * Desktops, which include sets of variables and visited buffers ;; and files. ;; ;; * Composite, or sequence, bookmarks, which combine other ;; bookmarks. ;; ;; You can also associate tags, in the del.icio.us sense, with most ;; types of bookmarks. (Such tags are unrelated to the Emacs ;; source-code tags that use tags files.) A bookmark can have any ;; number of tags, and multiple bookmarks can have the same tag, ;; which means you can use them to organize their target objects. ;; And tags can be more than just names: they can be user-defined ;; attributes, with Emacs-Lisp objects as their values. ;; ;; These and other `Bookmark+' features give you different ways to ;; save, restore, filter, access, and otherwise organize projects, as ;; collections of information about source-code components and ;; related software. ;; ;; Icicles enhances access to such features. ;; See (@> "Icicles Bookmark Enhancements"). ;; ;;(@* "A Tags File Can Define a Project") ;; ** A Tags File Can Define a Project ** ;; ;; One simple kind of a project includes the files that are in or ;; under a single directory. Such a project is limited, but it can ;; often be useful, and it has the advantage of being supported by ;; several existing Emacs features. ;; ;; Another simple kind of project includes the files that are listed ;; in a given Emacs tags file. This is obviously more complex and ;; flexible than a directory listing. ;; ;; Icicles provides multi-commands for visiting one or more files ;; that are listed in the current tags table: ;; `icicle-find-file-in-tags-table' and ;; `icicle-find-file-in-tags-table-other-window'. See also ;; (@file :file-name "icicles-doc1.el" :to "Icicles Commands that Read File Names"). ;; ;;(@* "Navigating Among Code Definitions") ;; ** Navigating Among Code Definitions ** ;; ;; For software projects, you need to be able to navigate among code ;; definitions. Imenu and Emacs tags features are useful for this, ;; as are `grep' and compilation buffers. Icicles improves all of ;; these. (A tags file is just a saved index for project files.) ;; ;; See Also: ;; ;; * (@> "Icicles Imenu") ;; * (@> "Icicles Enhancements for Emacs Tags") ;; * (@> "Compile/Grep Search") ;; ;;(@* "Searching Project Files") ;; ** Searching Project Files ** ;; ;; Searching within your project is another area where Icicles can ;; help. Icicles search is both search and navigation. Navigating ;; among tags definitions that match a regexp is also really ;; searching, and the same is true for Imenu and grep navigation. ;; ;; See also (@> "Icicles Search Commands, Overview") and its ;; subsections for information about the many ways that you can use ;; Icicles search to access parts of your projects. ;; ;; See also (@> "Icicles Dired Enhancements") for an easy way to ;; search marked files in Dired with Icicles search. ;; ;; See also (@> "Searching Bookmarked Objects") for ways to search ;; bookmarked objects, including the files that have a given set of ;; del.icio.us-style tags and the bookmarks that are marked in a ;; given bookmark-list state. ;; ;; And do not forget that all uses of Icicles search also let you do ;; search-and-replace on the fly. This applies to `grep' results, ;; searching marked files in Dired, tags navigation, and Imenu ;; navigation. You can at any time replace the current search hit or ;; just the part of it that matches your current input. ;; ;;(@* "Defining and Saving Sets of Files or Buffers") ;; ** Defining and Saving Sets of Files or Buffers ** ;; ;; Let's assume that you have one or more sets of files or buffers ;; that you use frequently. For each such set of objects, you create ;; an Emacs option whose value is a list of the file or buffer names ;; (strings). ;; ;; Later, you use the option value to refer to those objects by name. ;; This brings you back to the context of working with just those ;; particular files or buffers that belong to your project. You can ;; search such sets or navigate among their objects. Icicles has a ;; number of features that can help with these tasks. ;; ;; Note: Bookmarks are also persistent references to files and ;; buffers, and you can use sets of bookmarks similarly. Bookmarking ;; is a vanilla Emacs feature. Being able to manipulate explicit ;; sets of bookmarks is a `Bookmark+' feature (library ;; `bookmark+.el'). Bookmarking features are described elsewhere, ;; but they work in concert with Icicles to offer very good project ;; support. See (@> "Icicles Bookmark Enhancements"). ;; ;; Before you can name and save a set of file or buffer names, you ;; must define its members: pick the file and buffer names that you ;; want to belong to a given project. Icicles can help with this. ;; ;; For buffers, use commands `icicle-add-buffer-config' and ;; `icicle-remove-buffer-config' to define one or more buffer ;; configurations. These are named sets of buffers, sort functions, ;; and other parameters that control completion of buffer names. ;; Thereafter, you can use command `icicle-buffer-config' to choose a ;; configuration to be current. ;; ;; To define a set of files, you use Icicles completion against file ;; names. You can use progressive completion, chip away the ;; non-elephant, and so on, to get just the file names you want. ;; ;; For this completion, you can use a command that calls ;; `read-file-name', and so matches relative file names using the ;; current `default-directory'. Or you can use a command that calls ;; `completing-read', and so matches file names only as ordinary ;; strings, that is, with no notion that they are file names. In the ;; latter case, the file names are often absolute, which means that ;; you can match not only file names but also directory components. ;; ;; Examples of the former type are `icicle-find-file' and ;; `icicle-find-file-read-only' (`C-x C-r' by default). Examples of ;; the latter type are `icicle-find-file-absolute', ;; `icicle-find-file-in-tags-table', `icicle-recent-file', and ;; `icicle-locate-file'. Command `icicle-file' (bound to `C-x C-f' ;; by default) lets you do both, depending on the prefix argument. ;; ;; You save a set of file and directory names the same way you save ;; any set of completion candidates. You can save all of the names ;; that match your current input. You can add a set of names or ;; individual names to a set of names that you have already saved. ;; ;; In addition, you can save the names of the marked files and ;; subdirectories in Dired persistently as a project. ;; ;; Your project is not only files that are all in the same directory, ;; of course. If you use library `Dired+' then you can also save all ;; of the marked file names in the current directory and in marked ;; subdirectories, recursively - see (@> "Save Marked Names Here and Below"). ;; ;; Even if you do not use `Dired+', with Icicles you can easily save ;; file names from multiple directories in the same set. And you can ;; include directory names as well, for use later with commands that ;; operate on directories. ;; ;; Finally, you can also save file names as Emacs filesets and use ;; those the same way. An Icicles cache-file set of saved file names ;; can include Emacs filesets - see ;; (@file :file-name "icicles-doc1.el" :to "Filesets and Icicles Saved Completion Sets"). ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates") ;; * (@file :file-name "icicles-doc1.el" :to "Persistent Sets of Completion Candidates") ;; * (@> "Icicles Bookmark Enhancements") ;; * (@file :file-name "icicles-doc1.el" :to "Progressive Completion") ;; * (@file :file-name "icicles-doc1.el" :to "Chip Away the Non-Elephant") ;; * (@file :file-name "icicles-doc1.el" :to "Match File Names and File Content Too") ;; * (@> "Save Marked Names as Completion Candidates") (Dired) ;; ;;(@* "Retrieving and Reusing a Saved Project") ;; ** Retrieving and Reusing a Saved Project ** ;; ;; This section could also be called "Using Retrieved Saved Sets". ;; ;; You retrieve a set of saved file names (a project) the same way ;; you retrieve any saved set of completion candidates. That is, you ;; access the files defined for your project by retrieving their ;; names during completion, to serve as the current set of completion ;; candidates. This odd feature is unique to Icicles. ;; ;; There's nothing much more to say about this, except that you ;; should be taking advantage of it now. Define and save a set of ;; project files (or buffers), and later use just those files, ;; staying within the bounds of your project for your navigation, ;; search, compilation, etc. needs. Even if the files you use in a ;; given project are scattered all over your file system, Icicles ;; lets you access them together as a named unit. For more ;; information, see ;; (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates"). ;; ;; If you use library `bookmark+.el' then you can open a project that ;; is defined by a set of bookmarks, by doing one of the following: ;; ;; * Using a project-specific bookmark file. ;; ;; * Using a bookmark-list bookmark (it records a `*Bookmark List*' ;; buffer state, including which bookmarks are marked or omitted). ;; ;; You can also open Dired for a project or for a list of file names ;; saved non-persistently as completion candidates - only those files ;; are listed in the Dired buffer. ;; See (@> "Icicles Dired Enhancements"). ;; ;; You can also run `grep' on a saved list of file names using `M-s ;; M-s g' ( command `icicle-grep-saved-file-candidates'). If you use ;; library `dired+.el', then you can also `grep' the files in a ;; project or saved list of file names by opening it in Dired and ;; then using `M-g' (`diredp-do-grep'). ;; ;; Finally, note that among the sets of completion candidates that ;; you can save are Icicles search hits. That's right. Icicles ;; search lets you search multiple buffers, files, or bookmarks, and ;; you can save selected search hits or all matching hits for later ;; use. When you save search hits, Icicles records the buffer or ;; file names and the hit locations within those buffers or files. ;; When you retrieve such a saved set to access its hits, Icicles ;; automatically takes you to the proper files. ;; ;; A related feature is being able to filter tags definitions and ;; then save the filtered hit list. This works the same way, and it ;; gives you the equivalent of per-project tags files: A saved hit ;; list acts just like a custom tags file when you reuse it. And ;; unlike some of your project files, a tags file does not change ;; often, so saved hit sets stay accurate longer. ;; ;;(@* "Semantics? Roll Your Own?") ;; ** Semantics? Roll Your Own? ** ;; ;; I no longer develop software. I just putz around with Emacs Lisp ;; for my own enjoyment, entertainment, and enlightenment. So I do ;; not use things like ECB (Emacs Code Browser) or Semantic ;; (Bovinator). I do not use any IDE that has knowledge of a ;; particular programming language. The Icicles commands I've ;; written therefore use little or no semantic or language ;; information; they rely upon syntax for the most part, and they are ;; essentially language-agnostic (i.e. ignorant). ;; ;; But you are a different story. If you use, say, Semantic, you ;; could write a little Emacs-Lisp code to take advantage of Icicles ;; in combination with Semantic's parser information. With complete ;; ignorance of Semantic, I dare say it would not be hard. If you ;; can get an alist of completion candidates for something from ;; Semantic in some context, then you can exploit all of the Icicles ;; features: apropos completion, progressive completion, ;; multi-commands, Icicles search, and so on. Likewise for any other ;; IDE that plays well with Emacs and for any other programming ;; language support. Think about it. Others would appreciate your ;; contribution. ;; ;; Icicles provides lots of features for Emacs-Lisp programmers. The ;; end-user commands I've written using some of those features are ;; really just a demonstration of what you can do. Try rolling your ;; own Icicles commands. See Also: (@> "Note to Programmers"). ;;(@* "Using Complex Completion Candidates") ;; ;; Using Complex Completion Candidates ;; ----------------------------------- ;; ;; This section could also be called "Applying a Function ;; Interactively" or "Mapping over Sets". It is about applying a ;; function to members of a set of completion candidates that you ;; select interactively. The candidates can represent arbitrarily ;; complex data, and the function is applied to the associated data ;; as well, not just to the displayed (string) candidate that names ;; the data. ;; ;; You already know that you can manipulate sets of candidates - see ;; (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates"). ;; The elements of those sets are strings; you choose ;; candidate names. Sometimes, however, you need to choose among ;; named items that are themselves complex, containing more ;; information than just the name. That is the idea behind ;; multi-command `icicle-apply', which this section introduces. ;; ;; You (or a command that you use) can obtain the information ;; associated with a name after you choose the name. This is what ;; happens, for instance, when you use `find-file'; the command looks ;; up the file associated with the file name you choose. Icicles ;; multi-commands such as `icicle-file' perform this lookup both when ;; you act on a candidate during completion (e.g. `C-RET') and when ;; you make a final candidate selection (`RET') - see ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands"). ;; ;; Names and their associated information can be available in Emacs ;; Lisp in the form of an association list (alist), that is, a list ;; whose items are conses (cons cells). An alist is often used to ;; represent a function that maps one set of things to another. The ;; conses in the alist represent the tuples (typically pairs) of ;; related items. The car of each cons is called its "key"; the cdr ;; is called its "value". Different alists have different kinds of ;; keys and values. Typical key types include symbols and strings; ;; typical value types include symbols, strings, numbers, and lists. ;; There are quite a few standard Emacs-Lisp variables whose value is ;; an alist. Most are internal variables, but some are user options. ;; See the Emacs-Lisp manual for more about alists. ;; ;; The completion mechanism of Emacs function `completing-read' can ;; take an alist as input: the keys are the completion-candidate ;; strings that you choose from. For Emacs completion, however, the ;; value (cdr) of each alist key/value entry is completely ignored. ;; Icicles uses `completing-read', and it works the same way. If a ;; command needs to access the value associated with a key ;; (candidate), then it must somehow do so independently of ;; completion. ;; ;; Command `icicle-search' offers an example of this. The completion ;; alist contains key/value pairs whose car (key) is a search-hit ;; string that matches your search string and whose cdr (value) is ;; the buffer position for the hit. When you use completion with ;; this command, you work only with the keys, but `icicle-search' ;; also keeps track of the corresponding buffer positions for you. ;; The logic for doing this is coded into the definition of ;; `icicle-search'. ;; ;; It is common to want to do something interesting interactively ;; with the values also, not just the keys, of a completion alist. ;; Why lose the important value information when you choose a key? ;; And instead of requiring the logic of each command to deal with ;; this need individually, why not provide a general mechanism for ;; accessing this information - both by program and interactively? ;; This is what command `icicle-apply' is for. ;; ;; To make use of completion alist values, you need to access the cdr ;; of a key/value cons (pair). Different alists are structured ;; differently: the cdr can itself be complex (structured - a cons). ;; In general, you want to access not just the cdr (value) but the ;; key as well, the key/value pair as a whole, to do what you want ;; with it - that is, to apply some function to it. ;; ;; Emacs-Lisp programmers sometimes map functions over lists to ;; obtain a different list. For example, mapping the function `1+' ;; over the list (3 1 4 1 5 9) gives the list (4 2 5 2 6 10). Or if ;; interested only in the side effects, they apply a function ;; iteratively over a list without bothering to accumulate the ;; results as a new list. The command `icicle-apply' is inspired by ;; these common practices of mapping and iterating over a list, but ;; it applies only to alists. And it lets you choose interactively ;; which alist elements to act on, instead of always acting on all ;; elements. ;; ;; `icicle-apply' lets you apply a function of your choice to any ;; number of key/value entries in an alist. As user of the command, ;; you choose the entries to act on. The alist is used for ;; completion; you choose among the keys. The function is applied to ;; the corresponding key/value pairs, however, not to the keys alone. ;; ;; For example, given the alist `auto-mode-alist' and the function ;; `cdr', you can choose to apply `cdr' to selected alist entries. ;; This acts as a simple lookup function, because `cdr' just returns ;; the value associated with a chosen key. If you choose, for ;; example, the candidate (key) "\.el\'", then the (value) result is ;; the symbol `emacs-lisp-mode'. In this case, the chosen key/value ;; pair is ("\\.el\\'" . emacs-lisp-mode). (A literal backslash must ;; be doubled in an Emacs-Lisp string.) ;; ;; Function `cdr' returns the value, which is `emacs-lisp-mode' here. ;; If instead of `cdr' you use the function (lambda (x) ;; (describe-function (cdr x))), then the result of choosing ;; candidate "\.el\'" is to display the help for function ;; `emacs-lisp-mode'. This function first uses `cdr' to obtain the ;; value (the mode) and then applies `describe-function' to that ;; value. ;; ;; A typical use of `icicle-apply' is to define your own ;; multi-command that you or someone else can use to act on objects ;; selected by name. The definition of command `icicle-goto-marker' ;; provides an example. It uses an alist whose elements are pairs ;; composed of a text line (the key) and the marker (the value) in ;; that line. It applies a function that moves to the marker. ;; ;; If called interactively (as opposed to being used to define ;; another command), `icicle-apply' lets you use completion to choose ;; not only the objects to act on but also the function to apply to ;; them and the alist to choose them from. See the doc string of ;; `icicle-apply' for more information. ;; ;; Note that you can type in a lambda expression when prompted for ;; the function. You can use any function, provided it targets a ;; key/value pair (a cons). This is why you could not simply use ;; `describe-function' itself as the function to apply in the example ;; above: `describe-function' expects a symbol argument, not a cons. ;; ;; So what is `icicle-apply' really for? Anything you want. You can ;; use it to simply browse an alist or to perform actions on complex ;; things. The idea is to let you take advantage of Icicles features ;; to interactively filter and manipulate a set of completion keys, ;; and then apply any function you like to them - not just to the ;; keys, but to the keys or their values, or both. ;; ;; You can use apropos (regexp) matching or prefix matching to filter ;; the alist, as always, during completion. You can use `C-RET' and ;; so on to act on (that is, apply the function to) selected ;; key/value pairs that match your current input. ;; ;; You can also act on *all* such pairs, by using `C-!' or `M-!'. ;; `C-!' corresponds to iterating over the items in a list, applying ;; a function to each. `M-!' applies a function not to each chosen ;; pair, but to the *list* of all chosen pairs. By default, the ;; completion candidates are not sorted, but you can of course sort ;; them in various ways, either interactively or by program. ;; ;; As an Emacs-Lisp programmer, you can use function `icicle-apply' ;; programmatically to let users look things up in alists that you ;; construct or to act on selected alist entries in complex ways. ;; Icicles just provides the interactive completion features. ;; ;; The real value of `icicle-apply' comes from what you do with it. ;; Use it with a database of geographical coordinates to look up ;; location names provided by users and draw corresponding vicinity ;; maps. Use it with a list of hardware configurations to let users ;; perform diagnostic or maintenance operations on selected ;; equipment. You get the idea - use your imagination. ;; ;; Note: Although completion alists normally require string-valued ;; keys, `icicle-apply' is designed to work with any alist. ;;(@* "Icicles OO: Object-Action Interaction") ;; ;; Icicles OO: Object-Action Interaction ;; -------------------------------------- ;; ;; Here's another crazy Icicles feature: Instead of choosing a ;; function (e.g. command) and then the object to apply it to, choose ;; the object first and then the function. ;; ;; The first thing to say about this feature is that Emacs is not ;; really designed for this, so it's not feasible to do this in a ;; entirely satisfactory way. In particular, there is no practical ;; way, given an object, to find all of the functions that apply to ;; it, in order to allow all of those functions, and only those ;; functions, as completion candidates. ;; ;; The second thing to say is that there are several ways that ;; Icicles helps you operate on an object that you have already ;; chosen: ;; ;; * apropos completion - (1) choose an object type by name, (2) ;; choose a function, (3) choose the target object ;; ;; * alternative action by type, during completion - (1) choose a ;; target object, (2) choose a function appropriate for the ;; object's type. ;; ;; * `M-RET' during completion - (1) choose a target object, (2) ;; choose any function ;; ;; * `icicle-object-action' and `icicle-anything' - (1) choose an ;; object type by name, (2) choose the target object, (3) choose a ;; function ;; ;; As a special case, if you use library Anything (`anything.el'), ;; then `icicle-object-action' lets you apply one or more Anything ;; actions defined for the object. See (@> "Icicles with Anything") ;; for more information. ;; ;;(@* "Apropos Completion as OO") ;; ** Apropos Completion as OO ** ;; ;; You can use apropos completion with `M-x' to narrow the set of ;; possible commands to those that have a given object type in their ;; name. You choose the command before the individual object, but ;; you at least choose the object type first (which narrows the set ;; of possible objects). ;; ;; If you use Icicles, you already use apropos completion this way, ;; but you might not have thought about it in these terms. If you ;; want to invoke some command on a buffer, you might start by typing ;; `M-x buffer S-TAB' or `M-x buff S-TAB'. This is simple, but it ;; really does get you most of the way toward object-action ;; interaction. And you can of course then use progressive ;; completion (`M-*' or `S-SPC') to filter the matching commands for ;; additional object-type names; for example `S-SPC window' keeps ;; only those commands whose names contain both `buffer' and ;; `window'. ;; ;; Of course, this approach requires the command name to actually ;; advertise truthfully the object types that it operates on. There ;; are false positives and true negatives, but Emacs is generally ;; quite helpful in this respect. ;; ;;(@* "Alternative Action as OO") ;; ** Alternative Action as OO ** ;; ;; As explained in ;; (@file :file-name "icicles-doc1.el" :to "Alternative Actions"), ;; many Icicles commands, as their alternative action ;; (e.g. `C-S-RET'), prompt you to choose an action to be applied to ;; the current completion candidate. The actions you can choose are ;; all appropriate functions for the current type of object ;; (candidate). If you use library Anything (see below), then any ;; actions defined for the current type by Anything are included. ;; ;; See Also: ;; (@file :file-name "icicles-doc1.el" :to "Alternative Actions"). ;; ;;(@* "M-RET") ;; ** M-RET ** ;; ;; `M-RET' (`M-return'), `icicle-candidate-read-fn-invoke', during ;; completion provides a typeless object-action interaction, which is ;; always available. (You can also use `ESC RET' or `ESC C-m'.) ;; ;; This is similar to the action choice provided for some commands by ;; `C-S-RET', except that there is no notion of the current object ;; type - you can choose from among all Emacs-Lisp functions. ;; ;; Whenever you cycle through completion candidates, `M-RET' enters a ;; recursive edit that prompts you for a function to apply to the ;; current candidate. `M-mouse-2' does the same thing. For example, ;; if the current candidate is a buffer named `foo.el', then `M-RET' ;; prompts you for a function to apply to it. (Actually, the ;; function is applied to the candidate, which is the buffer name in ;; this case, but many functions accept an object name in place of ;; the object.) ;; ;; The function you enter can be anything, including a lambda ;; expression that accepts an argument of the appropriate type. The ;; function is read with (lax) completion. It is up to you to choose ;; a function that is appropriate for the current object type. ;; ;; If you use a prefix argument (`C-u M-RET' or `C-u M-mouse-2'), ;; then the result of the function application is pretty-printed. ;; Otherwise, the function is called for effect only. ;; ;;(@* "`icicle-object-action' and `icicle-anything'") ;; ** `icicle-object-action' and `icicle-anything' ** ;; ;; Another way that Icicles helps with object-action interaction is ;; provided by command `icicle-object-action'. This reads an ;; object-type name ("what"), with completion; then it reads an ;; object of that type ("which"), with completion; then it reads a ;; function (name or lambda expression) to apply to the object ;; ("how"), with (lax) completion. Again, use a prefix argument if ;; you want to pretty-print the result. ;; ;; `what-which-how' is an alias for command `icicle-object-action'. ;; It is easy to remember, taking its name from the successive input ;; prompts: "What?" - a file. "Which?" - icicles.el. "How?" open. ;; Another alias for the same command is `a', because it acts on a ;; file, a buffer, a symbol, a process, and so on. The first thing ;; it does is prompt you for the type of object, so you do `M-x a RET ;; buffer', `M-x a RET symbol', and so on. ;; ;; The aliases `what-which-how' and `a' are just convenience ;; commands. They are defined only if user option ;; `icicle-define-alias-commands-flag' is non-`nil'. Two related ;; commands are also defined only if this option is non-`nil': ;; ;; * `file' - same as `a RET file' ;; * `buffer' - same as `a RET buffer' ;; ;; For example: `M-x file RET'. You are prompted for a file to act ;; on, and then for the action to use. ;; ;; Note: If you use AUCTeX, then be aware of an AUCTeX bug that ;; causes problems if `icicle-define-alias-commands-flag' is ;; non-`nil'. Here is the bug description, filed 2007/10/05 by Bjorn ;; Haagensen: ;; http://lists.gnu.org/archive/html/bug-auctex/2007-10/msg00006.html. ;; The problem is that AUCTeX mistakenly invokes the Icicles `file' ;; command, in an inappropriate context. AUCTeX does not define any ;; function `file' when it is loaded, but it invokes one, if defined. ;; This appears to be a name-capture problem. Since there is no ;; `file' function defined when Icicles is loaded, Icicles defines ;; its command. AUCTeX developers will no doubt fix this bug. Until ;; then, AUCTeX users can avoid the bug by setting ;; `icicle-define-alias-commands-flag' to `nil'. ;; ;; The "type" of an object is one of these: ;; ;; a. A type defining an entry in user option ;; `icicle-predicate-types-alist'. These are type predicates, ;; such as `bufferp', `keywordp', or `atom'. ;; ;; b. The `type' of an Anything source, or its `name' if it has no ;; `type'. This is available only if you use library ;; `anything.el'. ;; ;; c. A type defining an entry in user option ;; `icicle-type-actions-alist'. ;; ;; Icicles completion is available for each prompt: the type, the ;; object, and the action to apply to the object. Types defined by ;; Anything are highlighted in buffer `*Completions*' using face ;; `icicle-special-candidate'. In the case of an Anything type, you ;; can use multi-command features to act on multiple objects in ;; multiple ways, all within a single `a' invocation. See ;; (@> "Icicles with Anything") for more information about using ;; Anything types. ;; ;; The objects of types (b) and (c) are easily named, and their names ;; serve as the completion candidates when you choose them. So, for ;; instance, if you choose type `buffer', then you can act on a ;; buffer by choosing its name. ;; ;; The objects of predicate type (type a, above) are not necessarily ;; named. The completion candidates for these objects are symbols ;; whose values are the objects that are acted upon. The object-type ;; names used for these candidates are really Emacs-Lisp type ;; predicate names, which all end in `p', except for `atom'. ;; ;; So, for instance, if you choose type `bufferp', then you can ;; choose a symbol whose value is a buffer, in order to act on that ;; buffer. A buffer is of course always named, but an object of type ;; `stringp' is not. The value of `emacs-version' is one such string ;; that you can act on. ;; ;; Be aware that the action function you choose must accommodate the ;; object you choose as its only argument. Also, completion of the ;; function candidate itself is lax, so you can enter a lambda ;; expression as the action. ;; ;; Objects that are naturally associated with names are treated ;; differently, depending on the type. Besides Anything types, the ;; following object types are used for named objects: `buffer', ;; `command', `face', `frame', `function', `option', `process', ;; `symbol', `variable', `window'. For all of these except `window', ;; the name of the object is used. For `window', the candidate ;; objects are the names of the buffers that are currently shown in a ;; window (on any frame). ;; ;; You'll note that some types are treated both ways, 1) using named ;; objects and 2) using symbols whose values are objects. An example ;; is `frame' and `framep': the completion candidates (objects) for ;; type `frame' are frame names; the candidates for type `framep' are ;; symbols whose values are frames. ;; ;; See Also: ;; ;; * (@> "Icicles with Anything") ;; * (@file :file-name "icicles-doc1.el" :to "Apropos Completions"). ;; * (@file :file-name "icicles-doc1.el" :to "Progressive Completion"). ;;(@* "Icicles with Anything") ;; ;; Icicles with Anything ;; --------------------- ;; ;; Library Anything (`anything.el') lets you define object types and ;; associate actions with them. It provides command `anything', ;; which you can use to apply an action to an object, choosing the ;; object first by name. All objects (of all types) that have a name ;; that matches your input are candidates. You can use command ;; `anything' while in Icicle mode; it has the same behavior with ;; Icicles as without it. ;; ;; Icicles also integrates some Anything features within its own ;; completion environment, so that you can use Icicles features such ;; as progressive completion at the same time. In particular, you ;; can act on multiple Anything objects in the same command ;; invocation, and you can act on them using multiple Anything ;; actions. ;; ;; Command `icicle-anything' (alias `any') is just command ;; `icicle-object-action' (alias `a') restricted to Anything types - ;; see (@> "Icicles OO: Object-Action Interaction"). It is more ;; convenient than `a' if you know that you want to use an Anything ;; type, because the set of type candidates to choose from is more ;; limited. ;; ;; When you act on an object of an Anything type, you are not ;; prompted for the action ("how"). The default Anything action is ;; applied, or you can choose a different Anything action. ;; ;; Command `any' (or command `a' when applied to an Anything type) is ;; a multi-command (see ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands")): ;; ;; * `C-RET', `C-mouse-2', and so on perform the default Anything ;; action on each chosen object. ;; ;; * `C-S-RET', `C-S-mouse-2', and so on, prompt you, for each chosen ;; object, to choose one or more Anything actions (with ;; completion). ;; ;; You can thus act on any number of Anything objects in any number ;; of Anything ways, all in the same `any' command invocation. And ;; you can of course use Icicles completion and cycling to choose. ;; User option `icicle-anything-transform-candidates-flag' determines ;; whether Anything function `anything-transform-candidates' is ;; applied to displayed Anything candidates in Icicles. ;; ;; Here's an example of using command `any'. Let's assume that you ;; have an `action' entry such as this in `anything-type-attributes' ;; for the Anything type `command': ;; ;; (action ("Call interactively" ;; . (lambda (command-name) ;; (call-interactively (intern command-name)))) ;; ("Describe command" ;; . (lambda (command-name) ;; (describe-function (intern command-name)))) ;; ("Add command to kill ring" . kill-new) ;; ("Go to command's definition" ;; . (lambda (command-name) ;; (find-function (intern command-name))))) ;; ;; This defines four actions for objects of type `command', the ;; default action being the first listed ("Call interactively"). ;; ;; You enter command `any', choose the Anything type `command', and ;; then choose the command `icicle-face-list' to act on: ;; ;; M-x any RET ;; What (type): command RET ;; Which (command): icicle-face-list RET ;; ;; This invokes command `icicle-face-list', because the default ;; Anything action for an object of type `command' is to call it. ;; ;; If you use `C-RET' instead of `RET' when choosing command ;; `icicle-face-list', then you remain within the `any' invocation, ;; and you can do something with another command after ;; `icicle-face-list'. If you use `C-S-RET' when choosing a command, ;; then you are prompted for the action to invoke for that command: ;; ;; Which (command): icicle-face-list C-S-RET ;; How (action): Go to command's definition RET ;; ;; If you choose the Anything action "Go to command's definition", ;; then, well, that's what happens: here, you go to the definition of ;; `icicle-face-list'. Again, you could use `C-RET' instead of ;; `RET', to perform this action on the command and then choose and ;; apply (via `RET' or `C-RET') another action to the same command. ;; ;; After you've stopped (via `RET' or `C-g') acting on command ;; `icicle-face-list', you can clear the minibuffer (using `M-k') and ;; type another command to act on, and so on. Or, you can stop (via ;; `RET' or `C-g') and end the invocation of command `any'. ;; ;; At each prompt, you can use (apropos or prefix) completion or ;; cycling to pick a candidate. So, for instance, using completion, ;; you could simply do this to choose `command', `icicle-face-list', ;; and "Go to command definition": ;; ;; M-x any RET c RET face-l S-TAB C-S-RET g TAB RET ;; ;; Icicles enhances Anything by providing multi-command features, as ;; well as by providing all of the other standard Icicles features: ;; apropos and prefix completion, cycling, progressive completion, ;; help on individual candidates, and so on. On the other hand, ;; Anything by itself provides some features that Icicles does not ;; exploit. The aim of command `any' is to give you the basic ;; Anything features in an Icicles completion context. ;; ;; A significant behavior difference between Anything (that is, ;; command `anything') and Icicles command `any' is that with ;; `anything' only the object name is used for filtering, whereas ;; with Icicles command `any' you first narrow down the potential ;; candidates by type, before the object name is matched (against ;; objects of only that type). ;; ;; That is, with Anything, your input pattern is matched against ;; every possible object of every possible type. You then choose ;; among the matches. If you want, after that wide-net matching you ;; can cycle among only the matches of a given type (e.g. file), but ;; matching against all other types has already taken place. ;; ;; This behavior of starting with typeless matching can be convenient ;; sometimes (you need not specify the object type), but it can also ;; be inconvenient (and unnecessarily slow) to match objects of types ;; totally unrelated to what you're after. In such cases, it can ;; require either a long input pattern or cycling among more ;; candidates, to disambiguate among the hits. ;; ;; With Icicles command `any', you have the inconvenience of needing ;; to specify first the type of object you want, but this has the ;; advantage of eliminating searching among irrelevant types. ;; Finally, remember that you can use both `anything' and `any' - ;; choose whichever is most convenient for the current task. ;;(@* "Fuzzy Completion") ;; ;; Fuzzy Completion ;; ---------------- ;; ;; There are a few different kinds of what might be called "fuzzy" ;; matching used in Icicles completion, in addition to apropos ;; (regexp) matching and prefix matching. And if you have your own ;; method of matching then you can use that as well, by adding it to ;; option `icicle-S-TAB-completion-methods-alist'. ;; ;; The following methods are predefined: ;; ;; * Fuzzy - This method uses a fairly sophisticated matching ;; algorithm that seems to account for various typing mistakes. ;; This algorithm is provided by library `fuzzy-match.el', so I ;; call its use in Icicles `fuzzy' completion. You must have ;; library `fuzzy-match.el' to use this. ;; ;; * Swank - Symbols are completed using the algorithm of ;; `el-swank-fuzzy.el' - see that library for details. ;; ;; * Scatter - This is a simple, poor man's fuzzy matching method ;; that I call `scatter' matching. Ido calls it `flex' matching. ;; The TextMate editor has the same thing for file-name matching ;; (only), without naming it. ;; ;; * Levenshtein - This method checks whether two strings differ by ;; at most a given number of character operations, the so-called ;; "Levenshtein distance". You must have library `levenshtein.el' ;; to use this. ;; ;; * Jaro-Winkler - This method gives matching weight to having both ;; (a) more characters that match in the right positions (Jaro) and ;; (b) a longer exact prefix within the first four characters ;; (Winkler). ;; ;; My opinion about the relative usefulness of the various methods: ;; Basic (prefix) completion and apropos completion are by far the ;; most useful. They are followed, in order of decreasing ;; usefulness, by scatter, fuzzy, Levenshtein, vanilla, Jaro-Winkler, ;; and swank completion. YMMV. ;; ;; Besides these methods, remember that you can get ordinary ;; substring matching with `S-TAB' by using `C-`' to turn off ;; (toggle) escaping of regexp special characters. With special ;; characters escaped, `S-TAB' does literal substring completion. ;; ;; The type of completion matching that is used when you hit `S-TAB' ;; and `TAB' is controlled by user options ;; `icicle-S-TAB-completion-methods-alist' and ;; `icicle-TAB-completion-methods', respectively. The possible ;; methods for `TAB' are predefined, but you can add additional ;; methods for `S-TAB' by customizing ;; `icicle-S-TAB-completion-methods-alist'. ;; ;;(@* "Changing Completion Method") ;; ** Changing Completion Method ** ;; ;; You can use fuzzy or swank completion in place of prefix ;; completion (`TAB'). You can use scatter, Levenshtein, or ;; Jaro-Winkler completion in place of apropos completion (`S-TAB'). ;; You can change completion methods easily at any time, by hitting a ;; key in the minibuffer: ;; ;; * `C-(' (command `icicle-next-TAB-completion-method') to cycle ;; among `TAB' completion methods: `basic', `vanilla', `fuzzy', and ;; `swank' (`vanilla' only for Emacs 23 and later; `fuzzy' only if ;; you have library `fuzzy-match.el'; `swank' only if you have ;; library `el-swank-fuzzy.el'). ;; ;; * `M-(' (command `icicle-next-S-TAB-completion-method') to cycle ;; `S-TAB' completion methods: `apropos', `scatter', `Levenshtein', ;; `Levenshtein strict', and `Jaro-Winkler' (only if you have the ;; Autocomplete library `fuzzy.el'). ;; ;; Repeating `C-(' and `TAB' or `M-(' and `S-TAB' on the fly for the ;; same input can be a good way to learn the differences between the ;; various completion methods. ;; ;; If you provide a prefix argument to `C-(' or `M-(', then the newly ;; chosen method is used only for the current command. More ;; precisely, the previously active method is restored as soon as you ;; return to the top level. ;; ;; The completion methods available for cycling via `C-(' or `M-(' ;; are defined by options `icicle-TAB-completion-methods' and ;; `icicle-S-TAB-completion-methods-alist', respectively. By ;; default, the first method in each list is used for matching. ;; ;; Sometimes you might want to make a different set of completion ;; methods available during input. You can use options ;; `icicle-TAB-completion-methods-per-command' and ;; `icicle-S-TAB-completion-methods-per-command' to do this. These ;; define the methods to be made available during specific commands ;; (that read input with completion). That is, they give you ;; command-specific control over `C-(' and `M-('. ;; ;; The per-command control is provided by advising (`defadvice') the ;; particular commands. You can also do this interactively, using ;; commands `icicle-set-TAB-methods-for-command' and ;; `icicle-set-S-TAB-methods-for-command'. Invoking one of these ;; with a negative prefix argument removes the advice, restoring the ;; default choice of methods for the target command. ;; ;; For example, this sets the available `TAB' methods for command ;; `icicle-read-color-wysiwyg' to fuzzy (the default for this ;; command) and basic: ;; ;; M-x icicle-set-TAB-methods-for-command RET ;; Command: icicle-read-color-wysiwyg RET ;; TAB methods: fuzzy RET ;; TAB methods: basic RET ;; TAB methods: RET ;; ;; And this removes the special treatment for `C-(' during ;; `icicle-read-color-wysiwyg', restoring the default `TAB' methods ;; that are defined by option `icicle-TAB-completion-methods': ;; ;; C-- M-x icicle-set-TAB-methods-for-command RET ;; Command: icicle-read-color-wysiwyg RET ;; ;;(@* "Partial Completion") ;; ** Partial Completion ** ;; ;; This section pertains to Emacs releases starting with Emacs 23. ;; ;; If option `icicle-TAB-completion-methods' includes `vanilla' ;; (which it does, by default), and you choose `vanilla' completion ;; for `TAB' (by cycling using `C-(' or by customizing ;; `icicle-TAB-completion-methods' to use `vanilla' as the default), ;; then Icicles `TAB' completion respects the standard Emacs option ;; `completion-styles', so the behavior of `TAB' is similar to what ;; it is in vanilla Emacs. ;; ;; Emacs includes `partial-completion' in the default value of ;; `completion-styles'. This means that Icicles too will make use of ;; partial completion when you use `TAB' (with `vanilla'). Icicles ;; makes no use of `completion-styles' when you use `S-TAB'. ;; ;; Partial completion is not really a kind of fuzzy completion, but ;; its effect can sometimes be similar. In some ways, it is similar ;; to scatter-match completion (see next), but it requires you to ;; explicitly mark where to skip ahead (using `*', ` ' (space), or ;; `-'). ;; ;; Icicles does not support using the mode `partial-completion-mode', ;; and Emacs itself is in the process of deprecating it, now that the ;; partial-completion style is active by default. ;; ;; I do not necessarily recommend using `vanilla' for `TAB' ;; completion, or, if you do, including `partial-completion' as an ;; entry in `completion-styles', because its effect is often ;; counter-intuitive or confusing. But it is included by default in ;; Emacs, and Icicles supports it. You might find it useful in ;; file-name completion, to be able to complete directory components, ;; for instance. ;; ;;(@* "Scatter-Match Completion") ;; ** Scatter-Match Completion ** ;; ;; The idea behind scatter-match completion is very simple: input ;; characters are matched in order against completion candidates, but ;; possibly with intervening characters. That is, your input ;; scatter-matches a completion candidate if each character is also ;; in the candidate, and the character order is respected. ;; ;; What this really amounts to is matching input `abc' as if it were ;; the regexp `a.*b.*c'. That's all. ;; ;; You can use Icicles scatter matching at any time in place of ;; apropos (regexp) matching. Unlike the cases of swank and fuzzy ;; completion (see below), you can use it to complete file names ;; also. ;; ;;(@* "Swank (Fuzzy Symbol) Completion") ;; ** Swank (Fuzzy Symbol) Completion ** ;; ;; If you choose `swank' completion, what you get in Icicles is fuzzy ;; completion (see next), except regarding symbols. That is, swank ;; completion per se applies only to symbols. Symbols are completed ;; using the algorithm of `el-swank-fuzzy.el' - see that library for ;; details. ;; ;; Icicles options `icicle-swank-timeout' and ;; `icicle-swank-prefix-length' give you some control over the ;; behavior. When the `TAB' completion method is `swank', you can ;; use `C-x 1' (`icicle-doremi-increment-swank-timeout+') and `C-x 2' ;; (`icicle-doremi-increment-swank-prefix-length+') in the minibuffer ;; to increment these options on the fly using the arrow keys `up' ;; and `down'. ;; ;; Swank symbol completion uses heuristics that relate to supposedly ;; typical patterns found in symbol names. It also uses a timeout ;; that can limit the number of matches. It is generally quite a bit ;; slower than fuzzy completion, and it sometimes does not provide ;; all candidates that you might think should match, even when all of ;; your input is a prefix (or even when it is already complete!). ;; ;; If swank completion produces no match when you think it should, ;; remember that you can use `C-(' on the fly to change the ;; completion method. ;; ;; I do not necessarily recommend swank symbol completion, but it is ;; available for those who appreciate it. ;; ;; Like fuzzy completion (see next), swank completion always sorts ;; candidate symbols according to its own scoring, putting what it ;; thinks are the best matches first. This means that using `C-,' in ;; the minibuffer to sort candidates differently has no effect. ;; ;;(@* "Fuzzy-Match Completion") ;; ** Fuzzy-Match Completion ** ;; ;; Fuzzy completion takes more explaining. It is described in detail ;; in the commentary of library `fuzzy-match.el'; please refer to ;; that documentation. Here are some things to keep in mind when you ;; use Icicles fuzzy completion: ;; ;; * File-name completion is never fuzzy. Basic prefix completion is ;; used for file names. ;; * Fuzzy completion is always case-sensitive. This means that ;; `C-A' in the minibuffer has no effect on fuzzy completion. ;; * Fuzzy completion always takes a space prefix in your input into ;; account. This means that `M-_' in the minibuffer has no effect ;; on fuzzy completion. ;; * Fuzzy completion candidates are always sorted by decreasing ;; match strength. This means that using `C-,' in the minibuffer ;; to sort candidates differently has no effect. ;; ;; Fuzzy completion is a form of prefix completion in which some ;; input characters might not be present in a matched candidate. ;; Matching finds the candidates that have the most characters in ;; common with your input, in the same order and with a minimum of ;; non-matching characters. It can skip over non-matching ;; characters, as long as the number of characters skipped in the ;; candidate is less that those following them that match. After the ;; matching candidates are found, they are sorted by skip length and ;; then candidate length. ;; ;; Here are some examples: ;; ;; Input Completion Domain Matches (Candidates) ;; ----- ----------------- -------------------- ;; ;; abc {xxabcxx, xabcxxx, ;; xabx} {xabcxxx, xxabcxx} ;; ;; point-mx Emacs variables {point-max, point-max-marker} ;; ;; begining-of-l Emacs commands {beginning-of-line, ;; beginning-of-line-text, ;; move-beginning-of-line, ;; widget-beginning-of-line} ;; ;; The last example shows that although fuzzy matching is a kind of ;; prefix matching, your input is not necessarily a prefix of each ;; matching candidate. It is prefix matching because it tries to ;; match your input starting at its beginning. This input prefix is ;; matched against candidate substrings, not necessarily candidate ;; prefixes, but the non-matching part (if any) preceding the matched ;; substring must not be longer than the matching part. That is, ;; non-matching substrings can be skipped over, but they must be no ;; longer than the matching substrings that follow them. If an input ;; prefix does not match under these conditions, it is skipped over. ;; ;; After matching an input prefix this way, the same process is ;; repeated, recursively, for input text following that prefix and ;; for match positions following the matches found. That is, after ;; each such prefix match, the process starts again where it left off ;; in both the input and the candidates. The resulting matches ;; contain one or more substrings of your input that are each at ;; least as long as the non-matching parts that immediately precede ;; them. Only matches with the highest number of matching characters ;; are retained. They are sorted by two criteria: (1) nearness of ;; matches to the start of the candidate and (2) candidate length. ;; ;; The fuzzy-match algorithm is detailed in library `fuzzy-match.el'. ;; However, it is easier to get a feel for what it does by trying it ;; than by reading any description. Just give it a try. Do not ;; expect it to rival apropos completion in power or expressivity, ;; however. Instead, think of it as prefix completion for lazy or ;; inaccurate typists! If that sounds like you, then you might find ;; it useful. ;; ;; As an example, here are some command-name candidates for the input ;; `fo' (there are lots more): ;; ;; fortune forms-mode focus-frame ;; follow-mode forward-sexp forward-list ;; forward-word forward-line forward-page ;; ... ;; ifconfig info Info-up ;; ... ;; Info-mouse-follow-nearest-node Info-goto-emacs-key-command-node ;; ;; And here are all the command-name candidates for the input `fol': ;; ;; follow-mode follow-delete-other-windows-and-split ;; Info-last info-lookup-file info-lookup-reset ;; Info-last-preorder info-lookup-symbol Info-last-menu-item ;; nnfolder-generate-active-file mh-folder-mode ;; ;; The first thing to notice is the distribution of candidates for ;; input `fo'. Candidates are in decreasing order of match fit: ;; ;; * The nearer the match to the start of the candidate, the better ;; the fit. ;; ;; * The greater the ratio of matched text to unmatched text, the ;; better the fit. ;; ;; Note too the candidate `ifconfig'. First, note that it has no ;; strict match for substring `fo'. Its match is in fact in two ;; parts: `f', then `o'. Second, note that it is considered a better ;; fuzzy match than the candidate `info'. This is because its match ;; (`f') is nearer to the start of the candidate (second character, ;; versus third). ;; ;; The second thing to notice is that when you type the third input ;; character, `l', the candidates are not a subset of the original ;; set that matches `fo'. The candidates in the second screenshot ;; all match `fol' in a fuzzy way, even though one of them, ;; `mh-folder-mode', does not match `fo' sufficiently well to be ;; included as a candidate. Why? Because in the `fo' case, the ;; match is only two characters long and it starts after three ;; non-matching characters. ;; ;; For both inputs: If all input prefixes are fair game for matching, ;; why doesn't `*Completions*' also include other command names that ;; match only the prefix `f' and nothing else? Because there is at ;; least one match that matches more than that - only the best ;; matches are retained. In this case, the best matches for input ;; `fo' match both the `f' and the `o', and the best matches for ;; input `fol' match all three of those characters. ;; ;; Refer to `fuzzy-match.el' for a precise description of fuzzy ;; matching. It refers to "matchiness" for how many characters match ;; and "closeness" for the ratio of number of characters matched to ;; candidate length. ;; ;; Note: It is not practical to try to highlight the exact candidate ;; portions that match different parts of your input. Because ;; fuzzy-match input does not function as a literal string for ;; matching purposes, it is more akin to substring matching than to ;; plain prefix matching. For this reason, regexp-match highlighting ;; is used for fuzzy matching. That is why you see the input `fo' ;; highlighted in `*Completions*' candidates in other than just the ;; prefix position. It is also why the matching `f' and `o' in ;; candidate `ifconfig' are not highlighted: for highlighting ;; purposes, your input is treated as a regexp. ;; ;; One takeaway here is that fuzzy completion is complicated. Rather ;; than try to understand how it works and think ahead in those ;; terms, you just need to get a feel for it - learn by doing. Have ;; fun! ;; ;;(@* "Levenshtein Completion") ;; ** Levenshtein Completion ** ;; ;; The "Levenshtein distance" is the maximum number of character ;; insertions, deletions, or replacements that are needed to ;; transform one string to another. The more similar two strings ;; are, the smaller their Levenshtein distance. ;; ;; When this kind of completion is used, Icicles considers your input ;; to match a completion candidate if their Levenshtein distance is ;; no greater than the value of option `icicle-levenshtein-distance'. ;; The default value of the option is 1, meaning that the difference ;; is at most one character operation. ;; ;; Using a strict definition of the distance, this also requires the ;; length of your input to be within the Levenshtein distance of the ;; length of a completion candidate, for it to match. That is quite ;; restrictive. ;; ;; It is more flexible to consider your input to match a candidate if ;; it is within `icicle-levenshtein-distance' of some *substring* of ;; the candidate. Because candidate substrings are tested, the ;; length of your input need not be nearly the same as the candidate ;; length. ;; ;; When you cycle among `S-TAB' completion methods using `M-(', there ;; are thus two choices for Levenshtein completion: `Levenshtein' and ;; `Levenshtein strict'. The former is generally more useful. ;; ;; The larger the value of `icicle-levenshtein-distance', the slower ;; Levenshtein completion becomes, since it must test more ;; possibilities. Also, when the value is 1 (except for `Levenshtein ;; strict'), Icicles uses a fast, special-case algorithm, and it ;; highlights the matching parts of candidates in buffer ;; `*Completions*'. 1 is the most useful value. ;; ;; If the value is other than 1 (or if it is 1 with `Levenshtein ;; strict'), then you must also use library `levenshtein.el', and ;; Levenshtein completion can be quite slow. In that case, you will ;; no doubt want to turn off incremental completion (`C-#'). ;; ;;(@* "Jaro-Winkler Completion") ;; ** Jaro-Winkler Completion ** ;; ;; The Jaro-Winkler method was developed for comparing names for the ;; U.S. census. It tends to take into account some typical spelling ;; mistakes, and it is best suited for use with short candidates. ;; ;; When checking whether two strings match, higher matching weight ;; results when there are more characters in each string that are ;; also present in the other, and in approximately the same ;; positions. ;; ;; Looking only at those characters that nearly match in this sense ;; (same character in about the same position), the more exact ;; matches there are (same character in exactly the same position), ;; the higher the matching weight. That is, weight is reduced for ;; characters that nearly match but are not quite in the right ;; position. ;; ;; So far, this describes Jaro matching. The Jaro matching weight is ;; the average of three values; (a) the ratio of the first string's ;; near matches to its length, the same for the second string, and ;; (c) the ratio of exact matches to total matches (near and exact). ;; ;; The Winkler part of the method comes from giving additional weight ;; for prefixes that match exactly. The longer the exact prefix ;; match (up to 4 characters) the greater the weight. ;; ;; Unlike the other matching methods, for Jaro-Winkler to complete ;; your input it must have the same number of characters as the ;; candidate to be matched, plus or minus two (actually ;; `fuzzy-accept-length-difference'). In particular, this means that ;; you cannot hit `S-TAB' with an empty minibuffer to see all of the ;; candidates. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Icicles Multi `M-x'") ;; for completion of command abbreviations ;; ;; * (@file :file-name "icicles-doc1.el" :to "Apropos Completions") ;; for completion with regexp matching ;; ;; * http://en.wikipedia.org/wiki/Jaro-Winkler_distance for ;; information about Jaro-Winkler matching ;;(@* "Completion in Other Buffers") ;; ;; Completion in Other Buffers ;; --------------------------- ;; ;; In addition to input completion, you can use Icicles to complete ;; words and symbols in other buffers, besides the minibuffer. ;; Icicles enhances this completion in these ways: ;; ;; 1. Lisp symbol completion via `M-TAB' (`lisp-complete-symbol'). ;; (This is also `ESC-TAB' and `C-M-i'.) ;; ;; 2. Word completion using the dynamic abbreviation of standard ;; Emacs library `dabbrev.el', via `C-M-/'. ;; ;; 3. Mailing information completion for BBDB (Insidious Big Brother ;; Database). ;; ;; 4. Word completion using the words and phrases in a thesaurus, via ;; `C-c /' (requires library `synonyms.el'). ;; ;; 5. `TAB' completion of the following in Shell mode and ESS modes ;; (and other, similar interpreters): ;; ;; * Commands ;; * Previous inputs - commands plus their arguments ;; * File names ;; * Environment variables ;; ;; Whenever multiple completion candidates are available, you can use ;; Icicles completion, with all of its features: cycling of ;; candidates (`TAB', `down', or `next'), apropos (regexp) completion ;; (`S-TAB'), progressive completion (`S-SPC'), help on individual ;; candidates (`C-M-RET'), and so on. ;; ;;(@* "Dynamic Abbreviation") ;; ** Dynamic Abbreviation ** ;; ;; Library `dabbrev.el' lets you type a few characters in a buffer ;; and then prefix-complete them (in the same buffer) to a full word ;; or symbol name. The completion candidates come from words or ;; symbol names in buffers that you are editing. This functionality ;; is called "dynamic abbreviation", though that is not a very good ;; term for it (words are completed, not abbreviated, dynamically). ;; ;; In Emacs, there are two ways to "dynamically abbreviate" text: ;; ;; a. `M-/' (command `dabbrev-expand') completes to a candidate word. ;; Repeating it replaces the completion with a different one - ;; that is, it cycles candidates in the text buffer (not in the ;; minibuffer). ;; ;; b. `C-M-/' (command `dabbrev-completion') completes to the common ;; prefix of all matching completion candidates. Repeating it ;; displays buffer `*Completions*' for you to choose a candidate. ;; However, in this case, there is no way to cycle among the ;; candidates. ;; ;; If there are many candidate completions, then cycling among them ;; with `M-/' can be tedious. You can use `C-M-/' to complete to a ;; common prefix, thus narrowing the set of candidates, but then you ;; lose the ability to cycle among them. ;; ;; If user option `icicle-top-level-key-bindings' contains an entry ;; for `dabbrev-completion' then Icicles remaps keys normally bound ;; to command `dabbrev-completion' to command ;; `icicle-dabbrev-completion', which uses Icicles completion ;; whenever there are multiple completion candidates. You can then ;; use any Icicles features, such as apropos completion and candidate ;; cycling. In addition, you can complete an empty prefix, starting ;; from scratch with apropos completion. ;; ;;(@* "BBDB Completion") ;; ** BBDB Completion ** ;; ;; Library `bbdb.el' is a rolodex-like database program for GNU ;; Emacs. You can obtain a recent version, such as 3.02, from ;; http://melpa.milkbox.net/, or you can pick up an older version, ;; such as 2.35, from http://bbdb.sourceforge.net/. ;; ;; If user option `icicle-functions-to-redefine' contains an entry ;; for `bbdb-complete-mail' (for BBDB version 3.02) or ;; `bbdb-complete-name' (for BBDB version 2.35), then Icicles ;; redefines that command so that it uses Icicles completion when ;; there are multiple completions. You can use any Icicles features, ;; such as apropos completion and candidate cycling. For this ;; feature to take effect, you must load BBDB before you load ;; Icicles. Option `icicle-functions-to-redefine' includes entries ;; for both `bbdb-complete-mail' and `bbdb-complete-name' by default. ;; ;;(@* "Thesaurus Lookup and Completion") ;; ** Thesaurus Lookup and Completion ** ;; ;; Library `synonyms.el' provides various features for defining a ;; thesaurus and looking up words and phrases in it. Icicles ;; provides a multi-command version (alias `icicle-synonyms') of the ;; command `synonyms', which shows all of the synonyms that match a ;; regular expression (e.g. a word or phrase) and lets you navigate ;; among hyperlinked thesaurus entries. ;; ;; Command `icicle-complete-thesaurus-entry' completes a word in a ;; text buffer to any word or phrase in the thesaurus. With the ;; default value of option `icicle-top-level-key-bindings', this is ;; bound to `C-c /' in Icicle mode. ;; ;; Tip: You can use `icicle-complete-thesaurus-entry' to quickly ;; check the spelling of a word. If it is correctly spelled, then it ;; appears as a complete completion (is highlighted as such in the ;; minibuffer). ;; ;; Another Icicles (multi-)command that uses the thesaurus is ;; `icicle-insert-thesaurus-entry'. It lets you use Icicles ;; completion, cycling, and so on to insert thesaurus words and ;; phrases in any buffer. It does not complete the word at point. ;; Within a single call to it, insert any number of thesaurus ;; entries, in succession. If you wanted to, you could write an ;; entire book using a single call to ;; `icicle-insert-thesaurus-entry'! ;; ;; All of these Icicles commands require that you load library ;; `synonyms.el'. ;; ;;(@* "Completion in Comint Modes") ;; ** Completion in Comint Modes ** ;; ;; `TAB' in a shell or similar buffer provides Icicles completion for ;; command names, file names, and environment variables that are ;; known to the shell (or other interpreter). ;; ;; You can also complete input using your previous inputs as the set ;; of candidates. Just type something at the prompt, hit `C-c `', ;; and pick one or more previous inputs to execute again (this uses ;; `icicle-search', so it is a multi-command). You need not ;; re-execute the exact same shell command; you can edit your ;; previous input before hitting `RET' to enter the command. ;; ;; These features are available for Comint mode and several modes ;; that inherit from it, including Shell mode, Shell Script (SH) ;; mode, various ESS modes (Emacs Speaks Statistics), Inferior ;; Emacs-Lisp mode (IELM), Grand Unified Debugger (GUD) mode, Tcl ;; mode, Rlogin mode, and NS Lookup mode. ;; ;; See Also: ;; ;; * (@> "Icicles Shell-Command Enhancements") for more information ;; about Icicles enhancements for Comint mode and related modes ;; ;; * (@> "Other Icicles Search Commands") for information about other ;; Icicles search enhancements for Comint mode and related modes ;; ;; * (@> "Defining Buffer-Text Completion for Comint Modes") for ;; information about how you can add Icicles completion to other ;; modes that inherit from Comint mode ;;(@* "Customization and General Tips") ;; ;; Customization and General Tips ;; ------------------------------ ;; ;; This section contains some tips on using Icicles and descriptions ;; of Icicles user options. ;; ;; See Also: ;; ;; * (@> "File-Name and Directory-Name Completion Tips") for tips on ;; using Icicles to complete file names. User options related to ;; file-name and directory-name completion are presented there, not ;; here. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Dealing With Large Candidate Sets") ;; for tips on improving performance when dealing with a large ;; number of completion candidates. ;; ;; * (@> "Customizing Key Bindings") for information on customizing ;; Icicles key bindings. ;; ;;(@* "Using Icicles with Delete Selection Mode") ;; ** Using Icicles with Delete Selection Mode ** ;; ;; Icicles works especially well with Delete Selection mode, which I ;; use and recommend. (Likewise, for PC selection mode, which uses ;; Delete Selection mode.) In Delete Selection mode, whenever the ;; region (selection) is active (highlighted), you can simply type to ;; replace text in the region, or hit `DEL' (Backspace) or `C-d' ;; (Delete) to delete the region. ;; ;; However, library `delsel.el', which provides Delete Selection ;; mode, binds keys in minibuffer maps that are also bound by ;; Icicles. For this reason, if you use both Icicles and Delete ;; Selection mode, you must turn on Icicle mode after you turn on ;; Delete Selection mode. If you forget to do this, you will notice ;; that `C-g' does not abort minibuffer input. The remedy is simply ;; to turn Icicle mode off, then on again. ;; ;;(@* "Icicles User Options and Faces") ;; ** Icicles User Options and Faces ** ;; ;; There are many user options (user variables) and several faces ;; that Icicles defines, and you can also use various standard user ;; options, including Icomplete options, that control various aspects ;; of completion. ;; ;; One thing that can be important to understand is that if you ;; customize an option, and if the default value of that option ;; changes later in a more recent Icicles version, then your ;; customization will preclude your taking advantage of any new ;; features represented by that default option value. ;; ;; This is important particularly for complex options such as ;; `icicle-top-level-key-bindings'. Taking that option as an ;; example, if Icicles later adds more commands with default key ;; bindings then you will not see those bindings if you have a ;; customized value of `icicle-top-level-key-bindings'. There is ;; nothing wrong with that; I just want you to be aware of it. ;; ;; In general, it can be a good idea to look at the latest change-log ;; entry for `icicles-opt.el' in `icicles-chg.el', to see what ;; changes have been made. If you then want to take advantage of ;; some change, you can use `M-x customize-option' and visually ;; compare your customized value with the new default value in ;; `icicles-opt.el', then edit your customized value as you like. ;; ;; * User option `icicle-mode-hook' is a normal hook containing ;; functions that are run after entering and exiting Icicle mode. ;; This is `nil', by default. ;; ;; * User option `icicle-minibuffer-setup-hook' is a list of ;; functions to be run at the end of minibuffer setup for Icicle ;; mode. This is `nil', by default. ;; ;; * User option `icicle-update-input-hook' is a list of functions to ;; be run when minibuffer input is updated (typing or deleting). ;; This is `nil', by default. ;; ;; * User option `icicle-no-match-hook' is a list of functions to be ;; run during completion (`TAB' or `S-TAB') when there are no ;; completion candidates that match the current input. This is ;; `nil', by default. ;; ;; * Case sensitivity: The following standard user options control ;; whether completion distinguishes between uppercase and lowercase ;; letters: ;; ;; * `completion-ignore-case' ;; * `read-file-name-completion-ignore-case' (Emacs 22 and later) ;; * `read-buffer-completion-ignore-case' (Emacs 23 and later) ;; ;; In addition, you can toggle case-sensitivity at any time using ;; `C-A' (that is, `C-S-a') in the minibuffer. This toggles ;; `case-fold-search' and `completion-ignore-case'. With a prefix ;; argument, it also toggles ;; `read-file-name-completion-ignore-case' and ;; `read-buffer-completion-ignore-case'. ;; ;; More precisely, it toggles the default value of ;; `case-fold-search', and then it sets the other variables to the ;; value of `case-fold-search'. Because the default value of ;; `case-fold-search' is changed, all buffers are affected. Note ;; that because some Icicles commands bind one or more of these ;; variables, toggling case-sensitivity during command execution ;; will not necessarily toggle their global values. ;; ;; You can tell whether completion is currently case-sensitive by ;; looking at the Icicle minor-mode lighter in the mode line, if ;; `icicle-highlight-lighter-flag' is non-`nil'. If ;; case-sensitive, then the lighter text (with or without the ;; multi-command suffix `+' and the multi-completion suffix `||') ;; is `Icy'; if not, it is `ICY'. ;; ;; * User options `icicle-region-background', ;; `icicle-point-position-in-candidate', ;; `icicle-mark-position-in-candidate', and ;; `icicle-change-region-background-flag' are all used to define ;; the region (the selected text) when cycling completion ;; candidates. They are described below individually. The region ;; is active when cycling, so you can easily delete it or replace ;; it. ;; ;; * User option `icicle-point-position-in-candidate' defines the ;; minibuffer cursor position (point) while cycling candidate ;; completions. By default, the cursor is placed at the end of the ;; root being completed. You can instead place it at the root ;; beginning or at the beginning or end of the complete minibuffer ;; input. For file-name input, the beginning of minibuffer input ;; starts after the directory name (which is inserted ;; automatically). ;; ;; * Similarly, user option `icicle-mark-position-in-candidate' ;; defines the position of the mark; by default, it is at the end ;; of the input. Together, these two options control the size and ;; placement of the region in a flexible way. You can make the ;; region include all of the input, only the root, from beginning ;; to root, or from root to end. You can put the cursor at either ;; end of the region. You can get rid of the region altogether, by ;; making point and mark coincide (at any of the possible ;; positions). ;; ;; * Because the region background color is often quite different ;; from the frame background color (in order to have it stand out), ;; it can be a bit hard to read the completion candidates when the ;; region is highlighted during input cycling. If user option ;; `icicle-change-region-background-flag' is non-`nil', however, ;; then the region background is changed to a color that differs ;; only slightly from the frame background, making it easier to ;; read the completion candidates. The actual background color ;; used is the value of `icicle-region-background', which you can ;; customize. If you make this color the same as the frame ;; background, then the region background is, in effect, invisible. ;; ;; * The default value of `icicle-change-region-background-flag' is ;; determined by the current value of `delete-selection-mode', that ;; is, whether or not Delete Selection mode is enabled, when ;; Icicles is loaded. For this reason, if you use Delete Selection ;; mode and you want the region background to change in the ;; minibuffer, you should either turn on Delete Selection mode ;; before loading `icicles.el' or explicitly customize ;; `icicle-change-region-background-flag' to non-`nil'. ;; ;; * User option `icicle-default-value' controls the treatment of a ;; default value for minibuffer input. When the value is non-`nil' ;; and the INITIAL-INPUT argument of minibuffer-reading functions ;; is `nil' or "", the DEFAULT-VALUE argument can be inserted into ;; the minibuffer as the initial input. For `completing-read', if ;; the option value is `t' then the default value is instead added ;; the prompt as a hint. ;; ;; Adding the default value to the prompt corresponds to the more ;; or less conventional behavior of vanilla Emacs. But vanilla ;; Emacs does not do this systematically for `completing-read' (or ;; for any of the input-reading functions). Instead, it hard-codes ;; default values into prompts in the commands that call these ;; functions. ;; ;; By design, Icicles commands never add the default value to the ;; prompt themselves. This includes Icicles versions of standard ;; commands that might do so. Icicles instead tries to give you ;; the choice, using option `icicle-default-value'. ;; ;; Function `completing-read' is the only input-reading function ;; for which Icicles adds the default value to the prompt (for ;; `icicle-default-value' value `t'). Other such functions, like ;; `(icicle-)read-from-minibuffer' and `(icicle-)read-file-name', ;; treat empty input (just `RET') specially - see their doc for ;; details. ;; ;; Non-`nil' and non-`t' means to automatically insert the default ;; input value into the minibuffer as the initial value. I prefer ;; to have it inserted, as I often use the default value (perhaps ;; editing it). A value of `nil' neither inserts the default value ;; nor adds it to the prompt. ;; ;; If the value is `t' or `nil', remember that you can always ;; insert the default value manually using `M-n'. If the value is ;; neither `t' nor `nil', you can always use `M-p' to remove the ;; default value from the minibuffer. ;; ;; If you often want to use or edit the default value, then ;; consider setting `icicle-default-value' to non-`nil' and ;; non-`t'. If you rarely do so, then consider setting it to `nil' ;; or `t'. ;; ;; A non-`nil', non-`t' value of `icicle-default-value' controls ;; also whether or not the initial value is preselected, and where ;; to leave the cursor: at the beginning or end of the value. ;; Preselecting the value can be useful in Delete Selection mode or ;; PC Selection mode, because it makes it easy to replace that ;; value by typing characters, or delete it by hitting `DEL' ;; (Backspace) or `C-d' (Delete). However, all of the initial ;; input is lost if you type or hit `C-d' or `DEL', which is ;; inconvenient if you want to edit it only slightly. ;; ;; * If you use `t' as the value of `icicle-default-value' then you ;; can use option `icicle-default-in-prompt-format-function' to ;; format the text that shows the (first) default value in the ;; prompt. The option value is a function that accepts the ;; default value (a string) and returns a string that is prepended ;; to the first occurrence of ": " in the prompt. This option has ;; no effect unless `icicle-default-value' is `t'. ;; ;; * User options `icicle-thing-at-point-functions' and ;; `icicle-default-thing-insertion' control the behavior of `M-.' ;; in the minibuffer, which grabs text from the current buffer and ;; yanks it into the minibuffer. ;; See (@file :file-name "icicles-doc1.el" :to "Inserting Text Found Near the Cursor") ;; and the doc string (`C-h v') of ;; `icicle-thing-at-point-functions' for more information. ;; ;; * User option `icicle-comint-dynamic-complete-replacements' ;; specifies a list of function replacements for ;; `icicle-comint-dynamic-complete' to replace the functions in ;; `comint-dynamic-complete-functions'. You can use this to ;; provide Icicles completion for various modes that inherit from ;; Comint mode. By default, it treats Comint mode and Shell mode. ;; ;; * User option `icicle-input-string' is a regexp string that is ;; inserted in the minibuffer when you use `C-='. See ;; (@file :file-name "icicles-doc1.el" :to "Inserting a Regexp from a Variable or Register"). ;; ;; * In buffer `*Completions*', face `icicle-historical-candidate' is ;; used to highlight completion candidates that you have used ;; (entered with `RET') previously. This highlighting is ;; controlled by user option ;; `icicle-highlight-historical-candidates-flag'. You can toggle ;; this option from the minibuffer at any time using `C-pause'. ;; See (@file :file-name "icicles-doc1.el" :to "History Enhancements"). ;; ;; * In buffer `*Completions*' during completion for multi-command ;; `icicle-Info-index' (`i' in Info), face ;; `icicle-historical-candidate-other' is used to highlight index ;; topics that refer to Info nodes that you have already visited. ;; This highlighting is controlled by user option ;; `icicle-Info-visited-max-candidates' as well as option ;; `icicle-highlight-historical-candidates-flag'. ;; See (@> "Highlighting Index Topics for Visited Info Nodes"). ;; ;; * In buffer `*Completions*', face `icicle-saved-candidate' is used ;; to highlight completion candidates that you have saved (e.g., ;; using `C-M->'). This highlighting is controlled by user option ;; `icicle-highlight-saved-candidates-flag'. You can toggle this ;; option from the minibuffer at any time using `S-pause'. ;; See (@file :file-name "icicles-doc1.el" :to "Saving and Retrieving Completion Candidates"). ;; ;; * In buffer `*Completions*', face ;; `icicle-current-candidate-highlight' highlights the current ;; completion candidate, face ;; `icicle-common-match-highlight-Completions' highlights the ;; expanded common match among all completions, and face ;; `icicle-annotation' is used for candidate annotations. Faces ;; `icicle-match-highlight-Completions' and ;; `icicle-match-highlight-minibuffer' highlight whatever your ;; input matches, in buffer `*Completions*' and in the minibuffer, ;; respectively. In the minibuffer, face `icicle-complete-input' ;; highlights your input when it is complete. ;; ;; * Non-`nil' user option `icicle-touche-pas-aux-menus-flag' means ;; that Icicles will not add menu items to menu-bar menus, except ;; for the `Icicles' and `Minibuf' menus. Default value `nil' ;; means that whenever a relevant menu already exists, Icicles ;; items are added to it (when in Icicle mode). Put differently, ;; non-`nil' means consolidate all Icicles menu items in a single ;; `Icicles' menu. ;; ;; For example, if `nil' then item `Delete File' is added to the ;; `File' menu; otherwise it is added to the `Icicles' menu. ;; ;; The value of this option is used only when Icicle mode is ;; initially established, so changing it has no effect after ;; Icicles has been loaded. However, you can change it and save ;; the new value, so it will be used next time. ;; ;; * User option `icicle-functions-to-redefine' controls whether ;; Icicles redefines some standard functions, enhancing them to use ;; Icicles completion. You can specify which functions to ;; redefine. The original function definitions are restored when ;; you exit Icicle mode. ;; ;; * Option `icicle-inhibit-advice-functions' is a list of functions ;; that Icicles redefines, and for which Icicle mode deactivates ;; the advice. The advice for each is reactivated when you leave ;; Icicle mode. Generally, it is a bad idea to use advice with ;; functions that Icicles redefines, in particular minibuffer ;; functions. If you want to allow some such advice or prohibit ;; advice for additional functions, then customize this list. ;; ;; Note: If you or a library you load advises one of these ;; functions while you are in Icicle mode, then toggle Icicle mode ;; twice, so that this option can have the proper effect. ;; ;; * Option `icicle-widgets-to-redefine' is a list of widgets that ;; Icicles redefines for Icicle mode. Widgets are Emacs objects ;; used, in particular, by Customize. The default value is `(color ;; file)', meaning that the `color' and `file' widgets are ;; redefined. They are redefined to allow Icicles completion on ;; color and file-name fields. ;; ;; With these redefinitions, when you edit a color or file-name ;; field in Customize (in Icicle mode) `M-TAB' performs Icicles ;; completion. Initially, prefix completion is used, but you can ;; then use apropos completion, progressive completion, and so on. ;; ;; For file-name completion, the portion of the name before point ;; in the editing field is completed. By default, the rest of the ;; field content, past point, is not deleted. If you use a prefix ;; arg (i.e., `C-u M-TAB') then the rest of the line is deleted. ;; ;; For color completion, a prefix argument means to use the RGB ;; value of the color, not its name, as the option value. ;; ;; For color completion, if `icicle-WYSIWYG-Completions-flag' is ;; non-`nil' then completion is WYSIWYG. You can complete against ;; the color name or its RGB value, or you can enter an RGB value ;; with no name without completing. See function ;; `icicle-widget-color-complete' for more information. ;; ;; * Non-`nil' user option ;; `icicle-top-level-when-sole-completion-flag' means that whenever ;; there is only one completion candidate that matches your input, ;; that candidate is used immediately, without requiring you to hit ;; `RET' or `S-RET'. ;; ;; * When `icicle-top-level-when-sole-completion-flag' is non-`nil', ;; option `icicle-top-level-when-sole-completion-delay' is the ;; number of seconds Icicles waits, before returning to top level ;; with the sole completion. (It has no effect if the flag is ;; `nil'.) The delay gives you a chance to forestall acceptance of ;; the sole completion: editing the completion (typing or deleting ;; a character) before the delay expires prevents its automatic ;; acceptance. The default value is 0 seconds (no delay). ;; ;; * User option `icicle-top-level-key-bindings' specifies top-level ;; commands and their bindings for Icicle mode. By default, this ;; rebinds several standard Emacs keys (in Icicle mode only). For ;; example, it substitutes `icicle-kill-buffer' for `kill-buffer' ;; (binding it to whatever `kill-buffer' is bound to globally). ;; Top-level commands are commands that are not used only in the ;; minibuffer. To change these bindings, customize ;; `icicle-top-level-key-bindings'. If you do that, then you must ;; exit and re-enter Icicle mode to ensure that the change takes ;; effect. This is really necessary only if your changes would ;; undefine a key. ;; ;; * User option `icicle-minibuffer-key-bindings' specifies bindings ;; for keys available during minibuffer input in Icicle mode. ;; These bindings are in effect whether or not completion is ;; available. This does not include keys concerned with ;; completion, cycling, and help, which are covered by other user ;; options. The value has the same form as for option ;; `icicle-top-level-key-bindings'. ;; ;; * User option `icicle-completion-key-bindings' specifies bindings ;; for keys available during minibuffer input with completion. ;; These are generally not commands that complete your minibuffer ;; input, but commands that you use to edit that input or act on it ;; in different ways. The value has the same form as for option ;; `icicle-top-level-key-bindings'. ;; ;; * User option `icicle-buffer-candidate-key-bindings' specifies ;; bindings for additional keys available during completion of ;; buffer-name candidates. The default value of the option ;; provides keys that filter (narrow) the set of available ;; candidates. ;; ;; * User option `icicle-completion-list-key-bindings' specifies key ;; bindings for buffer `*Completions*'. The value has the same ;; form as for option `icicle-top-level-key-bindings'. ;; ;; * User option `icicle-candidate-help-keys' specifies the keys that ;; display help about the current completion candidate. The ;; default values are `C-M-RET' (`C-M-return'), `C-M-help', ;; `C-M-f1', `C-help', and `C-f1'. ;; ;; * User option `icicle-candidate-action-keys' specifies the keys ;; that act on the current completion candidate. The default value ;; is `C-RET' (`C-return'). ;; ;; * The following user options specify the keys to use for ;; mode-specific completion-candidate cycling. The default ;; bindings are in parentheses. ;; ;; `icicle-apropos-cycle-next-keys' (`next') ;; `icicle-apropos-cycle-previous-keys' (`prior') ;; `icicle-prefix-cycle-next-keys' (`end') ;; `icicle-prefix-cycle-previous-keys' (`home') ;; `icicle-apropos-cycle-next-action-keys' (`C-next') ;; `icicle-apropos-cycle-previous-action-keys' (`C-prior') ;; `icicle-prefix-cycle-next-action-keys' (`C-end') ;; `icicle-prefix-cycle-previous-action-keys' (`C-home') ;; `icicle-apropos-cycle-next-alt-action-keys' (`C-S-next') ;; `icicle-apropos-cycle-previous-alt-action-keys' (`C-S-prior') ;; `icicle-prefix-cycle-next-alt-action-keys' (`C-S-end') ;; `icicle-prefix-cycle-previous-alt-action-keys' (`C-S-home') ;; `icicle-apropos-cycle-next-help-keys' (`C-M-next') ;; `icicle-apropos-cycle-previous-help-keys' (`C-M-prior') ;; `icicle-prefix-cycle-next-help-keys' (`C-M-end') ;; `icicle-prefix-cycle-previous-help-keys' (`C-M-home') ;; ;; * The following user options specify the keys to use for cycling ;; candidates according to the current completion mode. The ;; default bindings are in parentheses. ;; ;; `icicle-modal-cycle-down-keys' (`down') ;; `icicle-modal-cycle-up-keys' (`up') ;; `icicle-modal-cycle-down-action-keys' (`C-down') ;; `icicle-modal-cycle-up-action-keys' (`C-up') ;; `icicle-modal-cycle-down-alt-action-keys' (`C-S-down') ;; `icicle-modal-cycle-up-alt-action-keys' (`C-S-up') ;; `icicle-modal-cycle-down-help-keys' (`C-M-down') ;; `icicle-modal-cycle-up-help-keys' (`C-M-up') ;; ;; The completion mode, and hence the behavior of these keys, is ;; changed only when you hit `TAB' or `S-TAB' during completion: ;; the mode is prefix completion after `TAB' and apropos completion ;; after `S-TAB'. ;; ;; Note: If your customizations of the modal and non-modal cycling ;; keys conflict, the non-modal values win. For example, if you ;; define both `icicle-modal-cycle-up-keys' and ;; `icicle-prefix-cycle-previous-keys' as the list `([up])', then ;; the `up' key will perform prefix cycling, not modal cycling. ;; ;; * User option `icicle-default-cycling-mode' determines the ;; completion mode to be used before you hit `TAB' or `S-TAB'. ;; This affects only modal cycling - e.g. using keys such as `down' ;; and `C-down'. Values: ;; ;; - `prefix' (default) means cycle prefix completions ;; - `apropos' means cycle apropos completions ;; - other non-`nil' value means cycle inputs from input history ;; - `nil' means do not cycle: you must first hit a completion key ;; ;; For example, if the value is `apropos' then you can immediately ;; cycle apropos completions without first hitting `S-TAB'. ;; ;; Once you have used `TAB' or `S-TAB', the only way to traverse ;; the input history is to use `M-p' and `M-n'. ;; ;; * User option `icicle-word-completion-keys' is a list of keys to ;; use for word completion. By default, the only such key is ;; `M-SPC'. ;; ;; * User option `icicle-apropos-complete-no-display-keys' is a list ;; of keys to bind to `icicle-apropos-complete-no-display'. By ;; default, these keys are `C-M-S-tab' and `C-M-S-iso-lefttab', ;; which together implement `C-M-S-TAB'. Similarly, ;; `icicle-prefix-complete-no-display-keys' is the list of keys for ;; `icicle-prefix-complete-no-display'. By default, the only such ;; key is `C-M-tab'. ;; ;; * Option `icicle-prefix-complete-keys' is the list of keys for ;; `icicle-prefix-complete'. By default, these keys are `tab' and ;; `C-i', which together implement `TAB'. ;; ;; * Option `icicle-apropos-complete-keys' is the list of keys to ;; bind to `icicle-apropos-complete'. By default, these keys are ;; `S-tab' and `S-iso-lefttab', which together implement `S-TAB'. ;; (In Emacs 22 and later, `backtab' is the canonical key that ;; represents both `S-tab' and `S-iso-lefttab', so that is used in ;; the default value.) ;; ;; * Option `icicle-key-complete-keys' is the list of keys to bind to ;; `icicle-complete-keys'. By default, this is the singleton list ;; ([backtab]). The `backtab' key is the canonical key that ;; represents both `S-tab' and `S-iso-lefttab'. All three of these ;; keys implement `S-TAB'. ;; ;; * Option `icicle-key-complete-keys-for-minibuffer' is the list of ;; keys to bind to `icicle-complete-keys' in the minibuffer ;; keymaps. By default, this is the singleton list ([M-backtab]), ;; which means `M-S-TAB'. `S-TAB' itself is of course used (by ;; default) for apropos completion of your minibuffer input, so it ;; cannot also be used for key completion in the minibuffer. ;; ;; * Option `icicle-isearch-complete-keys' is the list of keys for ;; `icicle-isearch-complete'. By default, these keys are `M-TAB', ;; `ESC TAB', and `C-M-TAB'. ;; ;; * Option `icicle-isearch-history-insert-keys' is the list of keys ;; for `icicle-isearch-history'. By default, the list contains ;; only `M-o'. ;; ;; * Option `icicle-read+insert-file-name-keys' is the list of keys ;; for invoking file-name completion on demand. By default, ;; `C-M-S-f' is the only such key. Option ;; `icicle-completing-read+insert-keys' is the list of keys for ;; invoking non file-name completion on demand. By default, ;; `C-M-S-c' is the only such key. See ;; (@file :file-name "icicles-doc1.el" :to "Completion On Demand"). ;; ;; * User option `icicle-act-before-cycle-flag' `nil' means that keys ;; such as `C-next', which combine candidate action and cycling, ;; cycle to the next (or previous) candidate and act on it. ;; Non-`nil' means they act on the current candidate and then cycle ;; to the next (or previous) candidate. When the value is `nil', ;; you can think of `C-next' as an operation on the next candidate. ;; When the value is non-`nil', you can think of `C-next' as an ;; operation on the current candidate, which ends by making the ;; next candidate current. Similarly for the other cycling keys ;; that act, alternative-act, or show help on a candidate. The ;; default value is `nil'. See also option ;; `icicle-use-C-for-actions-flag', which changes the keys affected ;; by `icicle-act-before-cycle-flag'. ;; ;; * If option `icicle-use-C-for-actions-flag' is `nil', then the ;; keys that cycle candidates are swapped with the keys that both ;; cycle and act on a candidate. You can then use `down', `up', ;; `next', `prior', `end' and `home' to both cycle and act, and ;; `C-down', `C-up', `C-next', `C-prior', `C-end', and `C-home' to ;; merely cycle, without acting (e.g. navigating). The option has ;; no effect on other keys. You can toggle this option at any time ;; using `M-g' (`icicle-toggle-C-for-actions') in the minibuffer. ;; ;; (The keys mentioned here are the default bindings. The actual ;; keys swapped are those defined by these user options: ;; `icicle-prefix-cycle-next-action-keys', ;; `icicle-prefix-cycle-previous-action-keys', ;; `icicle-apropos-cycle-next-action-keys', ;; `icicle-apropos-cycle-previous-action-keys', ;; `icicle-modal-cycle-down-action-keys', ;; `icicle-modal-cycle-up-action-keys', ;; `icicle-prefix-cycle-next-keys', ;; `icicle-prefix-cycle-previous-keys', ;; `icicle-apropos-cycle-next-keys', ;; `icicle-apropos-cycle-previous-keys', ;; `icicle-modal-cycle-down-keys', `icicle-modal-cycle-up-keys'.) ;; ;; * Non-`nil' option `icicle-TAB/S-TAB-only-completes-flag' inhibits ;; `TAB' and `S-TAB' (actually the keys that are the values of ;; options `icicle-prefix-complete-keys' and ;; `icicle-apropos-complete-keys') from also cycling candidates. ;; ;; * Non-`nil' user option `icicle-TAB-shows-candidates-flag' means ;; that hitting `TAB' for prefix completion immediately shows the ;; completion candidates in buffer `*Completions*'. If `nil', then ;; candidates are shown only after `TAB' is hit a second time, ;; which is the standard Emacs behavior. The default value is `t'. ;; (Actually, the concerned keys are those defined by option ;; `icicle-prefix-complete-keys', not necessarily `TAB'.) ;; ;; * Non-`nil' option `icicle-max-candidates' means truncate the list ;; of completion candidates to at most this many. If you use ;; library `doremi.el' then you can use `C-x #' during completion ;; to increment or decrement the option value using the vertical ;; arrow keys or the mouse wheel. A numeric prefix argument for ;; `C-x #' sets the increment size. A plain prefix argument ;; (`C-u') resets `icicle-max-candidates' to `nil', meaning no ;; truncation. ;; ;; * User option `icicle-expand-input-to-common-match' controls ;; whether completion expands your minibuffer input to (typically) ;; the longest substring common to all completion candidates and ;; that matches your input pattern. The option controls whether ;; and when such expansion takes place. The possible values are: ;; ;; 0 - Never expand your typed input, except when you use `C-M-TAB' ;; or `C-M-S-TAB'. ;; ;; 1 - Expand it only when you hit `TAB' or `S-TAB', that is, ;; explicit completion, not incremental completion - no ;; automatic expansion. ;; ;; 2 - Same as 1, but also automatically expand it when it matches ;; only one completion candidate. ;; ;; 3 - Same as 2, but also automatically expand it during ;; incremental prefix completion. ;; ;; 4 - Same as 3, but also automatically expand it during ;; incremental apropos completion. IOW, always expand it. ;; ;; As the value increases there are thus more contexts in which ;; your input can be expanded to the common match. ;; ;; You can toggle the value of this option at any time using `C-"' ;; in the minibuffer. This in fact swaps the values of this option ;; and option `icicle-expand-input-to-common-match-alt'. That is ;; the only purpose of the latter option: to let you go switch ;; `icicle-expand-input-to-common-match' back and forth between two ;; values. ;; ;; You can cycle the value of `icicle-expand-input-to-common-match' ;; among all its possible values using `C-M-"' in the minibuffer. ;; Together with `C-"', this also lets you change the value of ;; `icicle-expand-input-to-common-match-alt': Use `C-M-"' to cycle ;; to the value you want as the alternative, then use `C-"' to ;; swap. Then use `C-M-"' to cycle to the value you want for ;; `icicle-expand-input-to-common-match'. ;; ;; Input expansion replaces your input in the minibuffer. If you ;; want to edit your original, pre-expansion input, use `C-l'. If ;; you are also cycling among candidates then you might need to hit ;; `C-l' twice. One reason you might want to set ;; `icicle-expand-input-to-common-match' to a value other than 4 is ;; if you want to always work with a regexp in the minibuffer when ;; you use apropos completion. (With a value of 4 the regexp is ;; replaced by the match expansion.) ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Expanded-Common-Match Completion") ;; ;; * (@file :file-name "icicles-doc1.el" :to "Incremental Completion (Input Expansion) in the Minibuffer") ;; ;; * Non-`nil' user option ;; `icicle-hide-common-match-in-Completions-flag' hides, in buffer ;; `*Completions*', the common match for your current input from ;; each candidate. You can toggle this anytime during completion ;; using `C-x .' (no prefix arg), which is bound to command ;; `icicle-toggle-hiding-common-match'. The common match used is ;; that governed by option `icicle-expand-input-to-common-match'. ;; ;; * Non-`nil' option `icicle-hide-non-matching-lines-flag' hides, in ;; buffer `*Completions*', all lines in multi-line candidates that ;; do not match your current minibuffer input. In Emacs 22+, ;; consecutive such lines are elided as `...'. You can toggle this ;; option anytime during completion using `C-u C-x .', which is ;; bound to command `icicle-toggle-hiding-non-matching-lines'. ;; ;; Hiding non-matching lines can be especially useful when ;; candidates are large (many lines), such as full function ;; definitions (e.g., from `icicle-imenu-full'). ;; ;; * User option `icicle-show-Completions-initially-flag' controls ;; whether or not buffer `*Completions*' is shown initially, ;; without your needing to hit `TAB' or `S-TAB' to show it. ;; However, if you type something before ;; `icicle-incremental-completion-delay', then display is ;; inhibited. The default value is `nil', meaning that ;; `*Completions*' is not shown until you hit `TAB' or `S-TAB'. ;; More typical than setting this option to non-`nil' globally is ;; to bind it to non-`nil' in Emacs-Lisp code, to display ;; `*Completions*' as a menu. For example, pass a non-`nil' ;; binding to `icicle-define-command' to create a command that ;; displays a multiple-choice menu. ;; ;; For an alternative but similar behavior to using non-`nil' for ;; `icicle-show-Completions-initially-flag', you can set option ;; `icicle-incremental-completion' to a value that is neither `nil' ;; nor `t'. That displays `*Completions*' as soon as you type or ;; delete input, but not initially. ;; ;; * User option `icicle-incremental-completion' controls whether or ;; not `*Completions*' is updated incrementally (icompletion) as ;; you type. You can toggle incremental completion at any time ;; using `C-#'. For more information, see ;; (@file :file-name "icicles-doc1.el" :to "Icompletion"). ;; ;; * User options `icicle-incremental-completion-delay' and ;; `icicle-incremental-completion-threshold' together cause a delay ;; before incremental completion takes effect. ;; See (@file :file-name "icicles-doc1.el" :to "Icompletion"). ;; ;; * User option `icicle-Completions-display-min-input-chars' is the ;; minimum number of input characters that allow buffer ;; `*Completions*' to remain displayed. By default, this is zero ;; (0), meaning that any number of input characters, even none, ;; allows `*Completions*' to remain displayed. If you use ;; incremental completion (see `icicle-incremental-completion-*'), ;; and you are bothered by `*Completions*' being automatically ;; updated when, for instance, you empty the minibuffer, then you ;; might want to set this option to, say, 1 or 2. With a value of ;; 2, for instance, whenever the minibuffer input has less than 2 ;; characters, incremental completion will remove the ;; `*Completions*' window. You can also remove the `*Completions*' ;; window at any time using `C-x 0' in the minibuffer. ;; ;; * Non-`nil' option `icicle-show-Completions-help-flag' means ;; display help (instructions) at the top of the buffer that shows ;; completions (typically `*Completions*'). These instructions are ;; shown in faces `icicle-Completions-instruction-1' and ;; `icicle-Completions-instruction-2'. If `nil', the completion ;; candidates are shown alone (no help text), but if there are no ;; candidates then text stating that fact is printed in the buffer. ;; ;; * Option `icicle-help-in-mode-line-delay' is the number of seconds ;; to display help on individual completion candidates in the ;; mode-line as you cycle or your input is completed. The ;; mode-line that is used is that of buffer `*Completions*', if it ;; is displayed, or the current buffer, otherwise. Typically, this ;; mode-line candidate help is the first line of a doc string, but ;; alternative help is available. ;; ;; Regardless of the option value, a user event (e.g. a key press) ;; always interrupts (terminates) this help display. Note too that ;; `post-command-hook' actions do not take place until this display ;; is finished. ;; ;; * Face `icicle-mode-line-help' is used to highlight Icicles help ;; shown in the mode-line. This includes that controlled by option ;; `icicle-help-in-mode-line-delay' and the indication in ;; `*Completions*' of the total number of matching candidates. ;; ;; * User option `icicle-Completions-mouse-3-menu-entries' defines ;; the contextual menu that is popped up when you click `C-mouse-3' ;; on a candidate in `*Completions*'. As an aid to customizing it, ;; refer to any of the constants `icicle-Completions-*' that define ;; its submenus. The submenu definitions are easier to understand ;; in the source code (`icicles-opt.el'), because Customize does ;; not pretty-print them. ;; ;; * Non-`nil' user option `icicle-move-Completions-frame' means that ;; `icicle-candidate-action' moves the frame showing buffer ;; `*Completions*' to the edge of the display, out of the way of ;; other frames. The possible non-`nil' values are `right' and ;; `left', specifying the display edge to use. ;; ;; This option can be useful if you use one-buffer-per-frame ;; (non-`nil' `pop-up-frames'). In that case, I recommend that you ;; also try my library `oneonone.el'. See ;; (@> "Note on Non-`nil' `pop-up-frames' on MS Windows") for more ;; advice about non-`nil' `pop-up-frames'. ;; ;; * User option `icicle-Completions-window-max-height' is the ;; maximum height of the `*Completions*' window, in lines. The ;; window is fit to the buffer size, with this as maximum height. ;; This is not used if `*Completions*' is a special display buffer ;; with its own frame, and it is not used in Emacs releases prior ;; to 21. ;; ;; * Starting with Emacs 23, you can use option ;; `icicle-Completions-text-scale-decrease' to change the size of ;; the text used in buffer `*Completions*'. ;; ;; * User option `icicle-candidate-width-factor' controls how many ;; columns of completion candidates are displayed in ;; `*Completions*'. The widest current candidate is scaled by this ;; percentage, and the window width is divided by that figure. ;; Other things are taken into account also, but this gives you a ;; way to tweak the number of columns: the larger this number, the ;; fewer the columns. ;; ;; If you use Do Re Mi (library `doremi.el'), then you can modify ;; `icicle-candidate-width-factor' incrementally during completion, ;; seeing the effect as it changes. Use `C-x w' from the ;; minibuffer, then use the `right' and `left' arrow keys or the ;; mouse wheel to increment and decrement the value. You can at ;; the same time use the `up' and `down' keys to adjust the value ;; of `icicle-inter-candidates-min-spaces'. WYSIWYG. ;; ;; * User option `icicle-inter-candidates-min-spaces' is the minimum ;; number of spaces between candidates displayed in ;; `*Completions*'. The default value is one space. ;; ;; If you use Do Re Mi (library `doremi.el'), then you can modify ;; `icicle-inter-candidates-min-spaces' incrementally during ;; completion, seeing the effect as it changes. Use `C-x |' from ;; the minibuffer, then use the `up' and `down' arrow keys or the ;; mouse wheel to increment and decrement the value. You can at ;; the same time use the `left' and `right' keys to adjust the ;; value of `icicle-candidate-width-factor'. WYSIWYG. ;; ;; * Option `icicle-Completions-max-columns' imposes a maximum number ;; of columns for the `*Completions*' display, thus preventing ;; Icicles from automatically calculating the number of columns. ;; It is available in case you really want to do that, but I ;; recommend that you leave the value of this option `nil' and you ;; use only options `icicle-inter-candidates-min-spaces' and ;; `icicle-candidate-width-factor' to control columns and candidate ;; spacing. ;; ;; * Non-`nil' option `icicle-image-files-in-Completions' means that ;; thumbnail images are shown in `*Completions*' for candidates ;; that are either (relative or absolute) names of image files or ;; names of image-file bookmarks (see Bookmark+). The default ;; value is `t'. If the value is `image-only', then only the ;; thumbnail images are shown. If it is otherwise non-`nil' then ;; the file names are also shown. You can cycle the option value ;; using `C-x t' in the minibuffer at any time during completion. ;; This feature is available starting with Emacs 22. ;; ;; * Option `icicle-completions-format' controls whether candidates ;; displayed in `*Completions*' are laid out horizontally (the ;; default) or vertically. Set the value to `vertical' for the ;; latter. Starting with Emacs 23.2, you can just use the vanilla ;; option `completions-format' for this, if you want the same type ;; of layout with Icicle mode turned on or off. ;; ;; Icicles always displays multi-line candidates in a single ;; column, for readability. When this is the case, the completions ;; format (horizontal or vertical) makes no difference - the effect ;; is the same. (Icicles also inserts an empty line after each ;; multi-line candidate, for readability.) ;; ;; You can toggle the completions layout between horizontal and ;; vertical at any time during completion, using `C-M-^'. ;; ;; * If option `icicle-menu-items-to-history-flag' is non-`nil' (the ;; default), then commands that you invoke using the menu-bar menu ;; are included in the command history for `M-x'. ;; ;; * Non-`nil' option `icicle-populate-interactive-history-flag' ;; means that any interactive use of a command causes it to be ;; added to the history `icicle-interactive-history'. You can ;; access this history by using `C-M-pause' during completion. Be ;; aware that addition of all interactive invocations to this ;; history can slow Emacs down. (This option is only available ;; starting with Emacs 23.) ;; ;; * User option `icicle-sort-comparer' controls the order of ;; completion candidates during cycling and in buffer ;; `*Completions*'. If `nil', then no sorting is done. If ;; non-`nil', then the value must be a string-comparison function - ;; the function is passed to the standard function `sort' to do the ;; sorting. The default value for `icicle-sort-comparer' is ;; `icicle-case-string-less-p', which sorts alphabetically, ;; possibly ignoring letter case. During completion, you can ;; toggle sorting using `C-,'. If you are an Emacs-Lisp programmer ;; and you write new commands using Icicles functionalities, you ;; can bind `icicle-sort-comparer' temporarily to any sort function ;; you need. ;; ;; * User option `icicle-alternative-sort-comparer' is an alternative ;; to `icicle-sort-comparer, providing a different sort order. By ;; default, it is `icicle-historical-alphabetic-p', a function that ;; sorts previously used completion candidates before candidates ;; that have not yet been used, and sorts alphabetically within ;; each of these groups of candidates. In other words, it places ;; inputs that you have used previously at the top of buffer ;; `*Completions*' and makes them available for completion first. ;; During completion, you can toggle normal and alternative sorting ;; using `C-M-,'. See (@> "Sorting Candidates") and ;; (@file :file-name "icicles-doc1.el" :to "History Enhancements"). ;; ;; * User option `icicle-change-sort-order-completion-flag' specifies ;; whether `C-,' cycles among available sort orders or lets you ;; choose a sort order using Icicles completion. Non-`nil' means ;; to use completion; `nil' (the default value) means to cycle. ;; You can override the current setting at any time by using `C-u ;; C-,'. See (@> "Sorting Candidates"). ;; ;; * User option `icicle-sort-orders-alist' is an alist of possible ;; sort orders for user to choose from using `C-,' or `M-,'. ;; See (@> "Sorting Candidates"). ;; ;; * The value of user option `icicle-transform-function' is a ;; function that is applied to the list of completion candidates, ;; to transform them before they are presented to the user. If ;; `nil', then no transformation is done. The default ;; transformation is to remove duplicate candidates, when ;; transformation is active, but the default value of this option ;; is `nil'. You can toggle transformation at any time using ;; command `icicle-toggle-transforming', bound to `C-$' in the ;; minibuffer. Although this is a user option, you probably do ;; *NOT* want to change its value by customizing it. Icicles ;; commands already "do the right thing" when it comes to candidate ;; transformation. ;; ;; The value of this option can be changed by program locally, for ;; use in particular contexts. For example, when you use ;; `icicle-search-generic' (`C-c `') in a *shell* buffer, Icicles ;; uses this variable with a value of `icicle-remove-duplicates', ;; to remove duplicate shell commands from your input history list. ;; Lisp programmers can use this variable to transform the list of ;; candidates in any way they like. A typical use is to remove ;; duplicates, by binding it to `icicle-remove-duplicates' or ;; `icicle-remove-dups-if-extras'. ;; ;; * User options `icicle-require-match-flag', ;; `icicle-buffer-require-match-flag', and ;; `icicle-file-require-match-flag' let you override the value of ;; the REQUIRE-MATCH argument provided to `completing-read' or ;; `read-file-name'. They are provided mainly for use (binding) in ;; `icicle-define-command' and `icicle-define-file-command', but ;; you may also use them globally, if you wish. See ;; (@file :file-name "icicles-doc1.el" :to "Exiting the Minibuffer Without Confirmation"). ;; ;; A typical use is made in the definition of command ;; `icicle-buffer': `icicle-buffer-require-match-flag' is used to ;; bind `icicle-require-match-flag', so that you can, for example, ;; match only existing buffers and be able to match on partial ;; input without explicitly completing (hitting `TAB' or `S-TAB'). ;; Simply set the option to `partial-match-ok' to get this ;; behavior. To apropos-complete and exit the minibuffer, use ;; `S-RET' instead of `RET'. See ;; (@file :file-name "icicles-doc1.el" :to "Exiting the Minibuffer Without Confirmation"), ;; for more information. ;; ;; * Non-`nil' user option `icicle-buffer-ignore-space-prefix-flag' ;; means to ignore buffer-name completion candidates that start ;; with a space. ;; ;; However, apart from minibuffer names such as " *Minibuf-0*", ;; such candidates are not ignored if your input also starts with a ;; space or if the names of all buffers start with a space. This ;; option is provided mainly for binding when using ;; `icicle-define-command' (`icicle-buffer' does this). ;; ;; You can toggle `icicle-buffer-ignore-space-prefix-flag' using ;; `M-_' in the minibuffer (except during `icicle-search'). ;; ;; * Non-`nil' user option `icicle-test-for-remote-files-flag' means ;; that Icicles tests for remote file names; `nil' means that it ;; does not. You can toggle this using `C-^' in the minibuffer ;; (except during Icicles search). Turning off remote file-name ;; testing means that you cannot use remote files with Tramp; it ;; disables Tramp's remote file-name handling and completion. This ;; can, for local files, slightly speed up incremental completion ;; and the highlighting of the part of your current input that does ;; not complete (see `icicle-highlight-input-completion-failure'). ;; ;; * Non-`nil' user option `icicle-network-drive-means-remote-flag' ;; means that a file on a mapped MS Windows network drive is ;; considered remote. This has an effect on things like ;; incremental completion. You can toggle this option anytime ;; during completion using `C-x :'. ;; ;; * Non-`nil' user option `icicle-regexp-quote-flag' reduces apropos ;; completion to simple substring completion and Icicles regexp ;; search to literal search. Regexp special characters are no ;; longer recognized as special; they simply match themselves. You ;; probably do not want to customize this option. Instead, you can ;; toggle it at any time using `C-`' in the minibuffer. ;; ;; * User options `icicle-command-abbrev-match-all-parts-flag', ;; `icicle-command-abbrev-priority-flag', and ;; `icicle-command-abbrev-alist' control the behavior of ;; multi-command `icicle-command-abbrev' (`C-x SPC'). The first ;; determines whether an abbreviation must match all parts of a ;; command name. The second controls whether command names or ;; abbreviations take precedence in case of conflict. The third is ;; the persistent list of your command abbreviations. ;; ;; * User options `icicle-S-TAB-completion-methods-alist' and ;; `icicle-TAB-completion-methods' control which completion method ;; is used by `S-TAB' and `TAB', respectively, to complete your ;; input. By default, the first method in each list is used for ;; matching. You can use `M-(' and `C-(' (commands ;; `icicle-next-S-TAB-completion-method' and ;; `icicle-next-TAB-completion-method') in the minibuffer to cycle ;; among the `S-TAB' and `TAB' methods. ;; ;; For fuzzy completion (choice `fuzzy' when cycling with `C-('), ;; `TAB' completes non-filename input using fuzzy prefix matching ;; as defined in library `fuzzy-match.el'. See the Commentary in ;; `fuzzy-match.el' for details about fuzzy matching. ;; ;; Fuzzy completion is not available for file-name completion; it ;; is always case-sensitive; leading spaces are taken into account; ;; and completion candidates are always sorted by decreasing fuzzy ;; match strength. In other words, fuzzy completion is not ;; affected by `C-A', `M-_', or `C-,'. ;; ;; * User options `icicle-S-TAB-completion-methods-per-command' and ;; `icicle-TAB-completion-methods-per-command' provide per-command ;; control of the completion methods available when you cycle using ;; `C-(' and `M-('. Use them if you want to specify which methods ;; are available for particular commands that read input with ;; completion. ;; ;; * User option `icicle-levenshtein-distance' is the Levenshtein ;; distance allowed for strings to be considered as matching during ;; N-off completion. This means that two strings match if they ;; differ by at most this many character operations (insertion, ;; deletion, replacement). This option is used only if you have ;; library `levenshtein.el'. See (@> "Fuzzy Completion"). ;; ;; * Top-level command `icicle-search' uses several faces to ;; highlight found text that matches your input. Faces ;; `icicle-search-main-regexp-current' and ;; `icicle-search-main-regexp-others' highlight what your ;; search-context regexp (entered with `RET') matches. The former ;; highlights the current search context; the latter highlights all ;; other search contexts. ;; ;; Face `icicle-search-current-input' highlights what your current ;; input (typically another regexp) matches; that is, it highlights ;; a match within a search context. Faces ;; `icicle-search-context-level-1' through ;; `icicle-search-context-level-8' highlight the first eight regexp ;; subgroup matches, within a search context. This highlighting is ;; done whenever `icicle-search-highlight-context-levels-flag' is ;; non-`nil' and the search context corresponds to the entire ;; regexp. ;; ;; * User option `icicle-search-highlight-context-levels-flag' ;; controls highlighting of regexp subgroup matches within the ;; search context. Non-`nil' (the default value) means highlight ;; them. ;; ;; * User option `icicle-search-highlight-threshold' controls ;; highlighting with face `icicle-search-main-regexp-others': this ;; many matches, maximum, are highlighted. If `t' then there is no ;; maximum (no limit). If zero, then only the current match is ;; highlighted. ;; ;; * Non-`nil' user option `icicle-search-highlight-all-current-flag' ;; means highlight the current input match in all main search hits ;; at the same time. If `icicle-expand-input-to-common-match' is 3 ;; or 4 (which means your input can be automatically prefix- or ;; apropos-expanded, respectively), then what is highlighted for ;; each input match is the expanded common match among all input ;; matches throughout the search area. Otherwise, only the exact ;; input match is highlighted. ;; ;; The default value of `icicle-search-highlight-all-current-flag' ;; is `nil', because non-`nil' can impact performance negatively if ;; there are many search contexts - the highlighting is updated ;; with each input change. You can toggle the value at any time ;; using command `icicle-toggle-highlight-all-current', bound to ;; `C-^' in the minibuffer (except during file-name completion). ;; ;; * If, in addition to `icicle-expand-input-to-common-match' causing ;; your input to be expanded and ;; `icicle-search-highlight-all-current-flag' being non-`nil', ;; option `icicle-search-replace-common-match-flag' is also ;; non-`nil', then a search replacement replaces the expanded ;; common match. Otherwise, it replaces only the exact match. You ;; can toggle `icicle-search-replace-common-match-flag' at any time ;; using `M-;' in the minibuffer. ;; ;; * Non-`nil' user option `icicle-search-cleanup-flag' means that ;; `icicle-search' highlighting is removed after the search. This ;; is the default behavior. If you set this to `nil' then you can ;; remove search highlighting manually later using command ;; `icicle-search-highlight-cleanup'. You can toggle this search ;; highlight removal at any time using command ;; `icicle-toggle-search-cleanup', which is bound to `C-.' in the ;; minibuffer during Icicles search. ;; ;; One use of `nil' `icicle-search-cleanup-flag' is to highlight ;; regexp matches throughout a region or buffer (or multiple files ;; or...). In that capacity, Icicles search functions act like ;; some of the highlighting commands in my library `highlight.el'. ;; Note that when `icicle-search-cleanup-flag' is `nil', *all* ;; Icicles search highlighting remains: last-visited search ;; context, other context matches, current-input matches, and even ;; regexp subgroups. The faces for these are, respectively: ;; ;; - `icicle-search-main-regexp-current' ;; - `icicle-search-main-regexp-others' ;; - `icicle-search-highlight-input-matches-here' (everywhere, if ;; `icicle-search-highlight-all-current-flag' is non-`nil') ;; - `icicle-search-context-level-1' through ;; `icicle-search-context-level-8' ;; ;; * Non-`nil' user option `icicle-search-whole-word-flag' means that ;; whole-word search is done. You can use `M-q' while searching to ;; toggle this option; the new value takes effect for the next ;; complete search. ;; ;; Whole-word searching here means that matches can contain ;; embedded strings of non word-constituent chars (they are skipped ;; over, when matching, included in the match), and any leading or ;; trailing word-constituent chars in the search string are dropped ;; (ignored for matching, not included in the match). This means, ;; for instance, that you can match `foo-bar' as a word, even in ;; contexts (such as Emacs Lisp) where `-' is not a ;; word-constituent character. Similarly, you can include embedded ;; whitespace in a "word", e.g., `foo bar'. ;; ;; See also (@> "Icicles Search Commands, Overview"). ;; ;; * If user option `icicle-search-replace-whole-candidate-flag' is ;; `nil', then whatever matches your current input is replaced, ;; within the current search context, when you perform replacement ;; during Icicles searching (e.g. `C-S-RET'). If the value is ;; non-`nil' (the default value), then the entire search context is ;; replaced, instead. You can use `M-_' at any time during ;; searching and replacing, to toggle the value. ;; ;; * User option `icicle-search-replace-literally-flag' determines ;; whether Icicles search-and-replace replaces text literally or ;; interprets `\' specially in the replacement text, as in ;; `query-replace-regexp'. Non-`nil' means to treat replacement ;; text literally. The default value is `nil'. You can use ;; `C-M-`' to toggle this at any time during Icicles search. ;; ;; * Non-`nil' option `icicle-ignore-comments-flag' means that ;; `icicle-search-thing' and related commands ;; (e.g. `icicle-search-xml-element') ignore comments. That is, ;; they hide comments temporarily while they scan the region or ;; buffer for things of the given type to serve as search contexts ;; (completion candidates). This prevents them, for example, from ;; presenting as a candidate a sexp or a list that is commented ;; out. You can toggle this option anytime using `C-M-;' in the ;; minibuffer, but to see the effect you might need to invoke the ;; current command again. ;; ;; * User option `icicle-search-hook' is a list of functions to be ;; run after searching and moving to an `icicle-search' match, ;; whether you move there by `RET', `C-RET', `C-next', or ;; `C-prior'. ;; ;; * User option `icicle-recenter' is passed as argument to ;; `recenter' whenever the current navigation destination would be ;; off-screen, to make it visible. ;; ;; * User option `icicle-bookmark-name-length-max' is the maximum ;; number of characters to use when `icicle-bookmark-cmd' (`C-x r ;; m') with a non-negative numeric prefix argument automatically ;; names a bookmark. ;; ;; * User option `icicle-bookmark-refresh-cache-flag' determines ;; whether commands such as `icicle-bookmark' and ;; `icicle-search-bookmark' refresh the bookmark-list cache. The ;; default value of `t', meaning refresh, ensures that the set of ;; bookmark candidates is always up-to-date, but you can improve ;; performance for a large bookmark list if you customize it to ;; `nil'. ;; ;; In any case, a plain prefix argument (`C-u') for these commands ;; overrides the default setting of the option for the duration of ;; the command. Thus if the customized value is `nil', you can use ;; `C-u' occasionally to refresh the list on demand. In addition, ;; the cache is refreshed whenever you use `S-delete' to delete a ;; candidate bookmark. ;; ;; * User options `icicle-buffer-match-regexp', ;; `icicle-buffer-no-match-regexp', `icicle-buffer-predicate', and ;; `icicle-buffer-extras' determine the behavior of Icicles buffer ;; commands, such as `icicle-buffer' and `insert-buffer'. They ;; determine the set of buffer-name candidates available for ;; completion. ;; ;; The first three restrict this set to names that satisfy the ;; properties they specify. Option `icicle-buffer-extras' lets you ;; add additional buffer names to the set of candidates, after ;; restriction by the other options. Extra buffer-name candidates ;; are displayed in buffer `*Completions*' using face ;; `icicle-extra-candidate'. ;; ;; Note that if an extra candidate is already a candidate anyway ;; then it will be present twice in the list of all candidates ;; (that is, unless `icicle-transform-function' removes duplicate ;; candidates). ;; ;; Note that `icicle-buffer-predicate' is applied after matching ;; against user input. It thus corresponds to ;; `icicle-must-pass-after-match-predicate', not to ;; `icicle-must-pass-predicate'. ;; ;; Options `icicle-file-match-regexp', ;; `icicle-file-no-match-regexp', `icicle-file-predicate', and ;; `icicle-file-extras' act similarly for file-name completion. ;; You could use `icicle-file-no-match-regexp' or ;; `icicle-file-predicate', for instance, to exclude files that are ;; in or under the directories in `vc-directory-exclusion-list': ;; ;; (defun my-locate-non-vc-file () ;; "`icicle-locate-file', but excluding stuff in VC directories." ;; (interactive) ;; (let ((icicle-file-predicate 'not-excluded-vc-file-p)) ;; (icicle-locate-file))) ;; ;; (defun not-excluded-vc-file-p (file) ;; "nil if FILE is in a `vc-directory-exclusion-list' directory." ;; (or (not (boundp 'vc-directory-exclusion-list)) ;; (not (consp vc-directory-exclusion-list)) ;; (not (let ((case-fold-search completion-ignore-case)) ;; (catch 'nevfp ;; (dolist (dir vc-directory-exclusion-list) ;; (when (string-match ;; (concat ".*" dir "\\(/.*\\)?") ;; file) ;; (throw 'nevfp t))) ;; nil))))) ;; ;; * Option `icicle-buffer-prefix-arg-filtering' defines the ;; prefix-argument filtering behavior for Icicles buffer commands. ;; It lets you choose what any given prefix argument (including ;; lack of a prefix argument) does to filter buffer-name completion ;; candidates. ;; ;; * Options `icicle-buffer-include-cached-files-nflag' and ;; `icicle-buffer-include-recent-files-nflag' also determine the ;; behavior of commands `icicle-buffer' (`C-x b') ;; and`icicle-buffer-other-window' (`C-x 4 b'). They determine ;; whether the candidates available for completion include not only ;; existing buffer names but also the names of certain files that ;; are not currently visited. ;; ;; For the former, these are the names cached by the Emacs ;; file-name cache. For the latter, these are the names of ;; recently visited files. See the Emacs manual, nodes `File Name ;; Cache' and `File Conveniences', respectively. ;; ;; You can toggle these options using `C-x F' and `C-x R', ;; respectively, during buffer-name completion. ;; ;; The option values are not exactly Boolean, however. They are in ;; fact non-zero integer values. Each option is turned on when ;; positive and off when negative. The absolute value of the ;; option is the maximum number of such candidates to include when ;; turned on. So for example, if the latter option value is 20, ;; then the names of only the twenty most recently visited files ;; are candidates. ;; ;; A prefix argument to `C-x F' or `C-x R' sets the option value to ;; the numeric prefix argument value. ;; ;; * Options `icicle-buffer-skip-hook' and ;; `icicle-find-file-of-content-skip-hook' are lists of hook ;; functions. They are used by commands `icicle-buffer' and ;; `icicle-find-file' (for Emacs 23 and later) to test a candidate ;; buffer name or file name, respectively. You can use them to ;; skip content-searching of certain buffers and files when ;; completing buffer and file names using multi-completion. ;; ;; The functions are passed to `run-hook-with-args-until-success', ;; so they are called in order until one returns non-`nil'. If any ;; function returns non-`nil' then the buffer or file content is ;; not searched. This is relevant only when your multi-completion ;; input has a second, content-matching part. ;; ;; * Option `icicle-ignored-directories' is a list of directories ;; that are ignored by various Icicles commands, including ;; `icicle-locate-file'. By default, this is the value of ;; `vc-directory-exclusion-list'. ;; ;; * User option `icicle-buffer-sort' is a predicate used to sort ;; buffer-name candidates in Icicles buffer commands such as ;; `icicle-buffer' and `icicle-insert-buffer'. Option ;; `icicle-file-sort' acts similarly for file-name completion. The ;; default value of `icicle-buffer-sort' is ;; `icicle-buffer-sort-*...*-last', which sorts names of buffers ;; that begin with `*' after other buffer names. These options ;; affect only the initial sort order used for buffer and file ;; names, respectively, that is, the order used first in an Emacs ;; session. The values are also put first in the list of possible ;; sort orders for cycling. ;; ;; * User option `icicle-buffer-configs' is a list of named ;; configurations of options `icicle-buffer-match-regexp', ;; `icicle-buffer-no-match-regexp', `icicle-buffer-predicate', ;; `icicle-buffer-extras', and `icicle-buffer-sort'. You use ;; command `icicle-buffer-config' to choose one of the ;; configurations to be current. You can use commands ;; `icicle-add-buffer-config' and `icicle-remove-buffer-config' to ;; add and remove configurations from the list. ;; ;; Example: A configuration such as the following, named "Files and ;; Scratch", defines `icicle-buffer-predicate' to display only file ;; buffers, and it defines `icicle-buffer-extras' to include the ;; extra buffer `*scratch*': ;; ;; ("Files and Scratch" nil nil ;; (lambda (bufname) (buffer-file-name (get-buffer bufname))) ;; ("*scratch*") icicle-sort-comparer) ;; ;; The idea of buffer-option configurations was borrowed from ;; library `bs.el', by Olaf Sylvester . ;; ;; * User option `icicle-dot-string' is the regexp string inserted by ;; `icicle-insert-dot-command' (bound to `.' in the minibuffer ;; during completion). You can set it to a regexp that matches any ;; character, including newline. The default value instead matches ;; any character except newline. You can toggle between these two ;; behaviors using command `icicle-toggle-dot', bound to `C-M-.' ;; during completion. ;; ;; * Non-`nil' option `icicle-dot-show-regexp-flag' means show the ;; underlying regexp (value of constant `icicle-anychar-regexp') ;; explicitly for a multi-line dot (`.'). A `nil' value works only ;; for Emacs versions 21 and later. ;; ;; * Non-`nil' user option `icicle-show-annotations-flag' means show ;; annotations, when available, next to candidates in ;; `*Completions*'. You can toggle this option from the minibuffer ;; using `C-x C-a'. ;; ;; * Non-`nil' user option `icicle-show-multi-completion-flag' means ;; that for some commands additional information is shown along ;; with each completion candidate. That is, a multi-completion is ;; used. You can match against any parts of the multi-completion. ;; The default value is `t'. (By contrast, you cannot match the ;; text controlled by option `icicle-show-annotations-flag'.) ;; ;; For example, for command `icicle-search', the name of the buffer ;; associated with each completion candidate is added to the ;; candidate and highlighted. You can match against the buffer ;; name, as well as the search hit within the buffer. ;; ;; Note that even when the value of this option is `nil', you can ;; often see the multi-completion information in the mode-line when ;; you cycle candidates, and you can typically see it in the help ;; that is displayed by `C-M-mouse-2' and so on. ;; ;; You can toggle this option from the minibuffer using `M-m'. The ;; new value takes effect after you exit the minibuffer (i.e., for ;; the next command). ;; ;; * Non-`nil' user option `icicle-kill-visited-buffers-flag' means ;; kill buffers visited temporarily to search files. This applies ;; to commands such as `icicle-find-file', which search files that ;; match your completion input. If non-`nil' then any such buffers ;; for files that you do not actually choose are killed when the ;; command is finished. If `nil' then they are not killed. This ;; option applies only to Emacs 23 and later. ;; ;; * User options `icicle-list-join-string' and ;; `icicle-list-nth-parts-join-string' are described in sections ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;; and (@> "Programming Multi-Completions"). ;; Option `icicle-list-join-string' is the separator string that ;; joins together the parts of a multi-completion. The end string ;; is appended to each multi-completion candidate. Option ;; `icicle-list-nth-parts-join-string' specifies how the ;; multi-completion extracted parts are joined back together when a ;; user chooses a multi-completion. ;; ;; The default value of `icicle-list-join-string' is `^G^J'. With ;; Emacs 22 and later, the `^G' part is hidden when it appears in ;; `*Completions*', and you can hide it in the minibuffer also by ;; using `C-M-j' instead of typing `C-q C-g C-j'. See the doc ;; string for more information. ;; ;; * Face `icicle-candidate-part' highlights one or more parts of a ;; candidate, in buffer `*Completions*'. The candidate is ;; typically a multi-completion. ;; ;; * Face `icicle-special-candidate' highlights candidates, in ;; `*Completions*', that are considered "special". Generally, ;; these are candidates that match user option ;; `icicle-special-candidate-regexp'. ;; ;; * Similarly, face `icicle-proxy-candidate' highlights proxy ;; candidates. These are placeholders for real candidates. ;; Non-`nil' user option `icicle-add-proxy-candidates-flag' means ;; include proxy candidates whenever there are any. You can toggle ;; this option during completion using command ;; `icicle-toggle-proxy-candidates', which is bound to `C-M-_' in ;; the minibuffer. For performance reasons, you will in some cases ;; need to re-invoke the command to make the proxy candidates ;; available. ;; ;; * Face `icicle-extra-candidate' highlights extra candidates, that ;; is, members of `icicle-extra-candidates', `icicle-buffer-extras', ;; or `icicle-file-extras'. ;; ;; * User option `icicle-kmacro-ring-max' acts as `kmacro-ring-max' ;; when you are in Icicle mode. (When you exit Icicle mode, ;; `kmacro-ring-max' is restored.) In Icicles, you will typically ;; want to use a much larger number than the default value in ;; vanilla Emacs. ;; ;; * User options `icicle-regexp-search-ring-max' and ;; `icicle-search-ring-max' act as `regexp-search-ring-max' and ;; `search-ring-max', respectively, when you are in Icicle mode. ;; (When you exit Icicle mode, `regexp-search-ring-max' and ;; `search-ring-max' are restored.) The reason for having these ;; options is that with Icicles you will likely want to use a much ;; longer search history. By default, these are as large as ;; possible (virtually unlimited). ;; ;; Suggestion: If you use library `savehist.el' (recommended), ;; customize `savehist-additional-variables' to include variables ;; `search-ring' and `regexp-search-ring', so that your search ;; histories will be saved between Emacs sessions. ;; ;; Note: You can clear (empty) a given search history with command ;; `clear-option' (aka `icicle-reset-option-to-nil'). For example, ;; to clear the regular-expression search history, do this: ;; ;; `C-u M-x clear-option RET regexp-search-ring RET' ;; ;; (The `C-u' is needed because this variable is not a user ;; option.) If you use my library `misc-cmds.el', you can clear ;; search histories easier, using commands `clear-search-history', ;; `clear-regexp-search-history', and `clear-search-histories'. ;; See (@file :file-name "icicles-doc1.el" :to "Isearch Completion"). ;; ;; * User option `icicle-completion-history-max-length' limits the ;; number of completion inputs to save. If you customize user ;; option `icicle-C-l-uses-completion-flag' to non-`nil', then, ;; instead of cycling, `C-l' lets you use Icicles completion to ;; retrieve a past completion input. (`C-L' does the same thing.) ;; If you use library `savehist.el', then you can save the history ;; of completion inputs persistently by customizing user option ;; `savehist-additional-variables' to include the Icicles internal ;; variables `icicle-previous-raw-file-name-inputs' and ;; `icicle-previous-raw-non-file-name-inputs'. ;; ;; * Faces `icicle-completion', `icicle-multi-command-completion', ;; and `icicle-mustmatch-completion' indicate the status of ;; minibuffer completion. During completion, Icicles uses them for ;; a minibuffer indicator and, if user option ;; `icicle-highlight-lighter-flag' is non-`nil', for the `Icy' ;; mode-line lighter as well. ;; ;; * Non-`nil' option ;; `icicle-highlight-input-initial-whitespace-flag' uses face ;; `icicle-whitespace-highlight' to highlight any whitespace that ;; starts your minibuffer input. This is done to help you ;; recognize accidentally typing such whitespace. Otherwise, you ;; might not understand the set of matching completion candidates ;; (or lack thereof). There is not necessarily anything wrong with ;; input that starts with whitespace - it might be what you want, ;; but without this highlighting it is easy to not notice the ;; whitespace. ;; ;; * The part of your current input that does not complete can be ;; highlighted automatically, and you can then remove that part ;; using `C-M-l'. This highlighting is controlled by options ;; `icicle-incremental-completion', ;; `icicle-test-for-remote-files-flag', ;; `icicle-highlight-input-completion-failure', ;; `icicle-highlight-input-completion-failure-delay', and ;; `icicle-highlight-input-completion-failure-threshold'. The ;; highlighting uses face `icicle-input-completion-fail' (for ;; strict completion) or `icicle-input-completion-fail-lax' (for ;; lax completion). For details, see the option doc strings and ;; (@file :file-name "icicles-doc1.el" :to "Icicles Highlights the Input that Won't Complete"). ;; ;; * Non-`nil' option `icicle-define-alias-commands-flag' defines a ;; few top-level Icicles commands whose names do not begin with ;; `icicle-', for convenience when using `M-x'. For example, ;; command `toggle' is defined as an alias for command ;; `icicle-toggle-option'. In any case, no such command is ever ;; defined by Icicles if a function with the same name is already ;; defined. ;; ;; * User option `icicle-color-themes' is a list of color themes to ;; cycle through when you use command `icicle-color-theme'. ;; ;; * User option `icicle-saved-completion-sets' is a persistent list ;; of named sets of completion candidates. You can switch among ;; such sets at any time. See ;; (@file :file-name "icicles-doc1.el" :to "Persistent Sets of Completion Candidates"). ;; ;; * User option `icicle-filesets-as-saved-completion-sets-flag' ;; non-`nil' means you can use Emacs filesets to save completion ;; candidates persistently. This means that you can save file-name ;; candidates in a persistent Icicles saved completion set (cache ;; file) or in in an Emacs fileset. It also means that an Icicles ;; persistent completion set can contain filesets, in addition to ;; file names: any number of filesets, and filesets of different ;; type. Available only for Emacs 22 and later, and you must load ;; library `filesets.el' (and enable filesets using ;; `(filesets-init)'). ;; ;; * User option `icicle-key-descriptions-use-<>-flag' (aka ;; `icicle-key-descriptions-use-angle-brackets-flag') determines ;; whether angle brackets (`<', `>') are used by Icicles for named ;; keys, such as function keys (`' vs `f9') and pseudo keys ;; (`' vs `mode-line'). Non-`nil' means to use angle ;; brackets. This option does not affect Emacs key descriptions ;; outside of Icicles, and it has no effect for versions of Emacs ;; prior to 21, because they never use angle brackets. The default ;; value is `nil', because I think angle brackets reduce ;; readability. See also my library `naked.el', which lets you use ;; the no-angle-brackets style also outside of Icicles. ;; ;; * User option `icicle-keymaps-for-key-completion' is a list of ;; variables that are bound to keymaps in which you want to bind ;; `S-TAB' (actually, each of the keys in the value of option ;; `icicle-key-complete-keys') to `icicle-complete-keys'. Each ;; such keymap should have at least one prefix key. `S-TAB' is ;; bound in each keymap, so that you can use it to complete the ;; prefix keys. See also `icicle-complete-key-anyway-flag'. ;; ;; * Non-`nil' option `icicle-complete-key-anyway-flag' means bind ;; `S-TAB' (actually, each of the keys in the value of option ;; `icicle-key-complete-keys') to `icicle-complete-keys' in each ;; keymap of option `icicle-keymaps-for-key-completion', regardless ;; of whether `S-TAB' already has a binding in that keymap. A ;; value of `nil' means bind `S-TAB' only if there is not already a ;; binding. ;; ;; * Non-`nil' option `icicle-complete-keys-self-insert-ranges' means ;; that `icicle-complete-keys' includes some self-inserting keys as ;; completion candidates. You will probably want to leave this ;; `nil'. This option has no effect before Emacs 22. ;; See (@file :file-name "icicles-doc1.el" :to "Entering Special and Foreign Characters") ;; ;; * User option `icicle-yank-function' is a function to use to yank ;; text. By default, it is `yank'. Command ;; `icicle-yank-maybe-completing' calls this function, except when ;; it is called from the minibuffer or called with a negative ;; prefix argument. (`C-- C-y' lets you choose yanks (kills) to ;; insert using completion. It is a multi-command. You can of ;; course sort the candidates in various ways.) ;; ;; * Non-`nil' user option `icicle-use-candidates-only-once-flag' ;; means that acting on a candidate removes it from the set of ;; available candidates, so that you do not see that it can be used ;; again. (`TAB' or `S-TAB' makes it available again.) The ;; default value is `nil', and you probably do not want to ;; customize this. However, if you write Emacs-Lisp code that uses ;; completion, then you can bind this to non-`nil' in contexts ;; where that makes sense. ;; ;; * Non-`nil' user option `icicle-deletion-action-flag' means ;; `S-delete' during completion deletes the current object. More ;; precisely, it deletes the object named by the current completion ;; candidate, if a deletion action is defined for the current ;; command. If no deletion action is defined, then the value of ;; this option has no effect for that command. ;; ;; * User option `icicle-alternative-actions-alist' is an alist that ;; associates Emacs commands and alternative action functions. It ;; overrides any alternative actions defined otherwise for the ;; commands. ;; ;; * User option `icicle-type-actions-alist' is an alist that ;; associates Emacs object types, such as buffer, file, and ;; process, with functions that accept an object of the given type ;; as their only required object. This is used by some Emacs ;; commands during completion to prompt for a function to apply to ;; the current completion candidate. Each function can be a symbol ;; or a lambda expression. At runtime, symbols that are not ;; functions (`functionp') are ignored. ;; ;; * User option `icicle-type-actions-alist' is an alist of Emacs ;; object types and associated actions (functions). Each function ;; must accept an object of the specified type as its only required ;; argument. A function here can be a symbol or a lambda ;; expression. Any symbols that do not have function definitions ;; when this option is used are filtered out (not used). ;; ;; * Non-`nil' user option `icicle-use-anything-candidates-flag' ;; means Anything actions are used for candidate alternate actions ;; in some Icicles commands, and Anything types and actions are ;; used by command `icicle-object-action' (aka `what-which-how' and ;; `a'). The default value is `t'. This option has no effect if ;; library `anything.el' cannot be loaded. ;; ;; * Non-`nil' user option ;; `icicle-anything-transform-candidates-flag' means that Anything ;; function `anything-transform-candidates' is applied to displayed ;; Anything candidates in Icicles. ;; ;; The advantage of a `nil' value is that command `icicle-anything' ;; then acts as a multi-command: you can act on multiple ;; candidates, or apply multiple actions for the same candidate, ;; within a single invocation of `icicle-anything' (or related ;; commands). The advantage of a non-`nil' value is that some of ;; the displayed Anything candidates might be more readable. The ;; default value is `nil'. This option has no effect if library ;; `anything.el' cannot be loaded. ;; ;; * User option `icicle-WYSIWYG-Completions-flag' controls how face ;; and color names are displayed as candidates in `*Completions*'. ;; If value is non-`nil', then a WYSIWYG (what you see is what you ;; get) sample of the face or color is shown. If the value is a ;; string, then a face name is accompanied by a separate face ;; swatch with that string text. If the value is `t', then the ;; face name itself is shown using the face it names. You can use ;; command `icicle-toggle-WYSIWYG-Completions' to toggle this ;; option. ;; ;; * Non-`nil' user option ;; `icicle-unpropertize-completion-result-flag' means that ;; `completing-read' and (starting with Emacs 23) `read-file-name' ;; will strip all text properties from the result they return. ;; Regardless of the option value, Icicles strips text properties ;; that it adds for its internal use. See the doc string of ;; function `icicle-unpropertize-completion' for more information ;; about this. ;; ;; The default value of the option is `nil'. It is not likely that ;; you will need to change this, but you might if you use some ;; other library that cannot accept a propertized string as the ;; result of completion. ;; ;; Note: This is the case if you use GNUS - it has a known bug in ;; this regard (reported 2008-06-21). It blindly prints the ;; Emacs-Lisp string that is the result of completion into an MML ;; attribute value: filename=#("~/.gnus/attach.el" 0 25 (face ;; nil)). GNUS should ensure that whatever it uses for an ;; attribute value is valid for MML (has normal "..." string ;; syntax, with acceptable characters). But it simply calls a Lisp ;; print function, which prints #("..."). ;; ;; * User options `icicle-pp-eval-expression-print-length' and ;; `icicle-pp-eval-expression-print-level' control the Lisp sexp ;; print length and print level, respectively, for values printed ;; by `M-:' (`icicle-pp-eval-expression'). ;; ;; * Non-`nil' option `icicle-guess-commands-in-path' means that all ;; executable files (or all files, if option ;; `shell-completion-execonly' is `nil') in your search path are ;; included among the completion candidates whenever a shell ;; command is read. The particular non-`nil' value determines when ;; this list of commands is updated from your current search path. ;; The default value is `nil'. (The computed commands are cached ;; in `icicle-shell-command-candidates-cache'.) ;; See (@> "Icicles Shell-Command Enhancements"). ;; ;; * Non-`nil' option `icicle-quote-shell-file-name-flag' means that ;; `icicle-read-shell-command-completing' double-quotes the file ;; name at the beginning of the shell command it reads. This ;; affects several Emacs commands, such as `M-!' that read a shell ;; command and its arguments. ;; ;; If this is `nil', then such commands will not quote a ;; shell-command file name such as ;; `c:/Program Files/My Dir/mycmd.exe'. In that case, a shell such ;; as `bash' fails for a shell command such as ;; `c:/Program Files/My Dir/mycmd.exe arg1 arg2 &', because it ;; interprets only `c:/Program' as the shell command. That is, it ;; interprets the space (`SPC') characters in the file name as ;; separators. ;; ;; If this is non-`nil' (the default value), then input such as ;; `c:/Program Files/My Dir/mycmd.exe arg1 arg2 &' is passed to the ;; shell as `"c:/Program Files/My Dir/mycmd.exe" arg1 arg2 &' ;; (notice the double-quotes). ;; ;; See the doc string of `icicle-quote-file-name-part-of-cmd' for ;; information about the characters that, like `SPC', lead to ;; file-name quoting. ;; ;; * Non-`nil' user option `icicle-inhibit-ding-flag' means Icicles ;; never uses an audible bell (ding). ;; ;; * Option `icicle-option-type-prefix-arg-list' is a list of symbols ;; that control prefix arguments for command ;; `icicle-describe-option-of-type (bound to `C-h C-o' by ;; default). A list of six symbols taken from this list: ;; ;; `direct' `inherit' `inherit-or-value' ;; `direct-or-value' `inherit-or-regexp' `direct-or-regexp' ;; ;; Choose the order you like. The list members map, in order from ;; left to right, to these prefix argument keys: ;; ;; 1. `C-u C-u' ;; 2. `C-0' ;; 3. `C-u' ;; 4. `C-9' (positive) ;; 5. no prefix arg ;; 6. `C--' (negative) ;; ;; For the meanings of the symbols, see the doc string of ;; `icicle-describe-option-of-type', which describes the default ;; prefix-argument bindings for the command. ;; ;; * Non-`nil' user option `icicle-customize-save-flag' means that ;; Icicles will save the updated value of option ;; `icicle-command-abbrev-alist' when you quit Emacs. This is the ;; normal behavior. If you for some reason do not want your ;; `custom-file' or init file (`~/.emacs') updated in this way, ;; then customize `icicle-customize-save-flag' to `nil'. ;; ;; * If `icicle-buffers-ido-like-flag' is `t' then `icicle-buffer' ;; and similar commands act more Ido-like. Specifically, those ;; commands then bind these options to `t': ;; `icicle-show-Completions-initially-flag', ;; `icicle-top-level-when-sole-completion-flag', and ;; `icicle-default-value'. ;; ;; * If `icicle-files-ido-like-flag' is `t' then `icicle-file' and ;; similar commands act more Ido-like. Specifically, those ;; commands then bind these options to `t': ;; `icicle-show-Completions-initially-flag', ;; `icicle-top-level-when-sole-completion-flag', and ;; `icicle-default-value'. ;; ;; * The value of option `icicle-customize-save-variable-function' is ;; the function Icicles uses to automatically save user option ;; changes made by some commands. I recommend that you do *NOT* ;; change this option value. This is provided only for users who ;; might want to disable such automatic saving of option changes, ;; by setting this to `ignore', or users who might want to manage ;; such option saving using their own function instead of the ;; default value, `customize-save-variable'. ;; ;; * Option `icicle-zap-to-char-candidates' determines which ;; character names are used for `icicle-zap-to-char' (bound to ;; `M-z' by default) when completing. The default value of `nil' ;; means complete against character names that you have already ;; entered. You can instead set the value to `icicle-ucs-names' to ;; complete against all Unicode character names. Or you can set it ;; to any function that returns a value of the same form at that ;; returned by `icicle-ucs-names' (hence `ucs-names'). ;;(@* "File-Name and Directory-Name Completion Tips") ;; ;; File-Name and Directory-Name Completion Tips ;; -------------------------------------------- ;; ;; This section contains some tips about completing file and ;; directory names. ;; ;; See Also: ;; ;; * (@> "Customization and General Tips") for general tips about ;; using Icicles. Many of those tips apply also to file-name and ;; directory-name completion. ;; * (@file :file-name "icicles-doc1.el" :to "File-Name Input and Locating Files Anywhere"). ;; ;; ;; Tips: ;; ;; * Functions `icicle-file-type-less-p', `icicle-dirs-first-p', and ;; `icicle-dirs-last-p' are provided as possible values for user ;; option `icicle-sort-comparer'. When choosing a sort order using ;; `C-,' or `M-,', these are called `by file type', `by directories ;; first', and `by directories last'. They sort directory names ;; (alphabetically) before non-directory names (after, for ;; `icicle-dirs-last-p'). Function `icicle-file-type-less-p' sorts ;; non-directories by file type (extension) alphabetically. For ;; non-file-name input these all act like ;; `icicle-case-string-less-p'. ;; ;; * You can use `..' during completion to access a parent directory, ;; and you can use `/' and `~/' to shadow input to the left. ;; ;; * By default, files on MS Windows mapped network drives are ;; treated by Icicles as remote files, because they can sometimes ;; suffer from performance similar to remote files. This ;; assumption is controlled by user option ;; `icicle-network-drive-means-remote-flag': set it to `nil' if you ;; want such files to be treated as local files. You can toggle ;; this option anytime during completion, using `C-x :'. ;; ;; Other than this, there is no special treatment of MS Windows ;; drive letters (e.g. `C:') - I use Cygwin on Windows. ;; ;; * Non-`nil' user option ;; `icicle-hide-common-match-in-Completions-flag' hides the common ;; match for your current input from each candidate in ;; `*Completions*'. You can toggle this at any time during ;; completion using `C-x .' (`icicle-toggle-hiding-common-match'). ;; This can be especially useful when reading an absolute file name ;; (e.g. `C-u C-x C-f'), by removing any common directory ;; component. ;; ;; * Standard Emacs user option `completion-ignored-extensions' is a ;; list of file-name extensions. File names that match any of ;; these extensions are generally ignored for completion (but see ;; the doc string for particulars). In Icicles, however, the ;; behavior is slightly different: ;; ;; - In vanilla Emacs the option is itself ignored for display in ;; buffer `*Completions*'. That is, even file names that are ;; ignored for completion are shown in `*Completions*' as ;; available completion candidates. ;; ;; - In Icicles this is not the case. When a file name is ignored ;; it is ignored completely; it is not shown in `*Completions*'. ;; But in Icicles you can toggle this ignoring off or on at any ;; time during completion, using `C-.' in the minibuffer. ;; ;; In addition, if you load library `completion-ignored-build.el', ;; by Kevin Ryde, then Icicles automatically takes advantage of ;; that library's dynamic adjustment of ignored extensions. (Just ;; load the library - do not enable its minor mode or advice.) ;; ;; * User option `icicle-use-~-for-home-dir-flag' controls whether ;; your home directory is written in the minibuffer using `~' or in ;; expanded form, during completion. The default value is `t', ;; which means to use `~', saving minibuffer space. You can toggle ;; this option at any time using command ;; `icicle-toggle-~-for-home-dir', bound to `M-~'. ;; ;; * Remember that you can use a regular expression to ;; apropos-complete file names. This is a powerful feature. Do ;; not confuse its use with the ability to use shell wildcards ;; (globbing) to access multiple files at once. For example, if ;; you use `C-x 4 f *.el RET', then all files with suffix `el' will ;; be opened. Regexp matching is used only for apropos (not ;; prefix) completion and cycling. See ;; (@file :file-name "icicles-doc1.el" :to "What About Special-Character Conflicts?"). ;; ;; * You can use `$' for both environment variables and as a regexp ;; special character. For example, you can use a pattern such as ;; `$HOME.*t$' to match the files in your home directory (`$HOME') ;; whose names end in `t'. See ;; (@file :file-name "icicles-doc1.el" :to "What About Special-Character Conflicts?"). ;; ;; * Starting with Emacs 23, you can complete environment variables ;; during file-name completion, using `TAB'. So you can, for ;; example, complete `$HO' to any of the candidates `HOME', ;; `HOMEDRIVE', `HOMEPATH'. This is in addition to the expansion ;; of complete environment variables (e.g. `$HOME' to ;; `/my/home/dir/') when you use `S-TAB' or `RET'. ;; ;; * You can use the idiom `\W$' as input to match only directories, ;; when a command asks for a file or directory name. The `\W' says ;; to match any non word-syntax character. The `$' says to match ;; this at the end of the name. This works because directory names ;; appear as completion candidates with a trailing slash (`/'), and ;; slash (`/') is about the only non word-syntax character that is ;; likely to appear in file-name completions. See ;; (@file :file-name "icicles-doc1.el" :to "What About Special-Character Conflicts?"). ;; ;; * You can use library `ffap.el', if you like, with Icicles, to ;; pick up the file, directory, or URL name under the cursor. All ;; Icicles features are available during file-name and URL ;; completion. If you like `ffap.el', you might also like to try ;; my extension library `ffap-.el'. See also ;; (@file :file-name "icicles-doc1.el" :to "Inserting Text Found Near the Cursor"). ;; ;; * Many Icicles commands that target file or directory names look ;; only in the current directory (`default-directory'). This means ;; that the directory part of the name is ignored for matching ;; purposes. You can thus use apropos completion to match a ;; substring, without needing to prefix the substring with `.*'. ;; For example, to match file `favorite-foo-file.bar' in directory ;; `/some/path/to/my/', it is sufficient to use either `foo' or ;; `/some/path/to/my/foo'. ;; ;; * Some Icicles commands that target file names match your input ;; against file names as ordinary strings, that is, with no notion ;; that they are actually file names. This is the case for ;; `icicle-locate-file', `icicle-recent-file', ;; `icicle-find-file-in-tags-table', and ;; `icicle-find-file-absolute', as well as `icicle-file' with a ;; prefix argument. Such candidates are often absolute file names. ;; In that case, you can regexp-match against any part of the ;; absolute file name, including directory components. See ;; (@file :file-name "icicles-doc1.el" :to "Find Files Anywhere, Without Knowing Where"). ;; ;; * If you have symbolic links that might get in the way of ;; exploring directories while locating files, you can use command ;; `icicle-locate-file-no-symlinks' instead of `icicle-locate-file' ;; - it will not follow symbolic links. ;; ;; This also gives you a way to temporarily avoid descending into a ;; subdirectory you are not interested in: put a symbolic link in ;; its place temporarily. ;; ;; Another, cleaner way to skip certain directories is to customize ;; or `let'-bind option `icicle-ignored-directories'. By default ;; this is the value of `vc-directory-exclusion-list', which means ;; that it ignores version-control directories. ;; ;; * For Emacs 23 and later, if you use commands such as ;; `icicle-find-file' and `icicle-visit-marked-file-of-content', ;; which let you match a file name and/or file content, remember ;; that it is far quicker to match a name than it is to search ;; content. The more you match names to narrow the set of files ;; whose contents need to be searched, the quicker matching will ;; be. Remember too that option `icicle-kill-visited-buffers-flag' ;; controls whether to keep or kill any file buffers that were ;; searched but whose files did not ultimately choose. Keeping ;; them is essentially caching them. ;;(@* "Key Bindings") ;; ;; Key Bindings ;; ------------ ;; ;; You can easily customize any of the key bindings that Icicles uses ;; - see (@> "Customizing Key Bindings"). I recommend that you first ;; try using the default bindings, however. There are many Icicles ;; key bindings (in particular in the minibuffer), but they are ;; grouped into a few natural sets, to help you remember them. And ;; there are user options available for easy key customization. ;; ;;(@* "Global Bindings") ;; ** Global Bindings ** ;; ;; Icicles does not change your global key bindings. It changes some ;; minibuffer bindings, and it adds minor-mode bindings for Icicle ;; mode, but it does not change your global bindings. ;; ;; There are two exceptions: ;; ;; 1. In Icicle mode, various Icicles commands are added to menu-bar ;; menus. File commands are added to the File menu, and so on, under ;; an Icicles submenu. Those items that do not belong naturally to ;; any existing menu-bar menu are added to a new top-level Icicles ;; menu and to the existing Minibuf menu. Whatever the menu they ;; appear in, however, Icicles menu items are visible only when ;; Icicle mode is active. ;; ;; If you do not want Icicles to add items to menus besides Minibuf ;; and Icicles, then set option `icicle-touche-pas-aux-menus' to ;; non-`nil'. See (@> "Customizing Key Bindings"). ;; ;; 2. Icicles adds the key `S-TAB' (bound to `icicle-complete-keys') ;; to each existing keymap. This allows you to complete keys in any ;; keymap. For technical reasons, these bindings are not part of ;; `icicle-mode-map'; other keymaps are enhanced to include this ;; binding. However, this Icicles binding of `S-TAB' never replaces ;; any existing binding of `S-TAB'. See ;; (@file :file-name "icicles-doc1.el" :to "Key Completion") for more ;; information about this use of `S-TAB'. ;; ;; (The documentation always refers to the key that performs key ;; completion as `S-TAB'. Actually, it is `S-TAB' only by default. ;; You can customize it, using option `icicle-key-complete-keys'.) ;; ;;(@* "Icicle-Mode Bindings") ;; ** Icicle-Mode Bindings ** ;; ;; Most top-level Icicle-mode bindings are in the Icicles menu-bar ;; menu. In addition, option `icicle-top-level-key-bindings' causes ;; Icicles to bind some keyboard keys to some top-level Icicles ;; commands. Some of these take the place of similar, global ;; bindings whenever you are in Icicle mode. Typically, these ;; top-level commands are Icicles multi-command versions of vanilla ;; Emacs commands. See (@file :file-name "icicles-doc1.el" :to "Multi-Commands"). ;; ;; You can customize option `icicle-top-level-key-bindings' to ;; specify the top-level commands that you want to bind in Icicle ;; mode, and the keys you want to bind them to. With the default ;; value of `icicle-top-level-key-bindings', Icicles makes the ;; following Icicle-mode bindings: ;; ;; * `C-c '' - `icicle-occur' ;; * `C-c =' - `icicle-imenu' ;; * `C-c ^' - `icicle-search-keywords' ;; * `C-c "' - `icicle-search-text-property' ;; * `C-c $' - `icicle-search-word' ;; * `C-c `' - `icicle-search' ;; * `C-c `' - `icicle-compilation-search' (in *grep* etc.) ;; * `C-c `' - `icicle-comint-search' (in *shell* etc.) ;; * `C-c TAB' - `icicle-comint-command' (in *shell* etc.) ;; * `C-c /' - `icicle-complete-thesaurus-entry' ;; * `C-h C-o' - `icicle-describe-option-of-type' ;; * `ESC M-x' - `lacarte-execute-command' ;; * `M-`', `f10' - `lacarte-execute-menu-command' ;; * `M-x' - `icicle-execute-extended-command' ;; * `C-x SPC' - `icicle-command-abbrev' ;; * `C-x M-e' - `icicle-execute-named-keyboard-macro' ;; * `S-f4' - `icicle-kmacro' ;; * `pause' - `icicle-switch-to/from-minibuffer' ;; * `C-x 5 o' - `icicle-select-frame' ;; ;; `S-TAB' is bound, in effect, to `icicle-complete-keys', which ;; completes a key sequence. Prefix keys followed by `S-TAB' are ;; also bound to `icicle-complete-keys'. (`S-TAB' is effectively ;; bound to other commands in buffer `*Completions*' and in the ;; minibuffer.) ;; ;; (The documentation always refers to the key that performs key ;; completion as `S-TAB'. Actually, it is `S-TAB' only by default. ;; You can customize it, using option `icicle-key-complete-keys'.) ;; ;; When `icicle-top-level-key-bindings' has its default value, ;; Icicles also substitutes all of the key bindings for some standard ;; Emacs commands. For example, Icicles binds `icicle-buffer' to all ;; keys that are globally bound outside Icicle mode to standard ;; command `switch-to-buffer'. By default, the following standard ;; commands have their bindings co-opted this way by Icicles ;; commands: ;; ;; Standard Command Icicles Command ;; ;; `abort-recursive-edit'.............`icicle-abort-recursive-edit' ;; (`C-]') ;; `bookmark-jump'....................`icicle-bookmark' (`C-x r b') ;; `bookmark-jump-other-window'.......`icicle-bookmark-other-window' ;; (`C-x j j') ;; `bookmark-set'.....................`icicle-bookmark-cmd' ;; (`C-x r m'') ;; `dabbrev-completion'...............`icicle-dabbrev-completion' ;; (`C-M-/') ;; `delete-window'....................`icicle-delete-window'(`C-x 0') ;; `dired'............................`icicle-dired' (`C-x d') ;; `dired-other-window'...............`icicle-dired-other-window' ;; (`C-x 4 d') ;; `eval-expression'..................`icicle-pp-eval-expression' ;; (`M-:') ;; `exchange-point-and-mark'.........`icicle-exchange-point-and-mark' ;; (`C-x C-x') ;; `execute-extended-command'.......`icicle-execute-extended-command' ;; (`M-x') ;; `find-file'........................`icicle-file' (`C-x C-f') ;; `find-file-other-window'...........`icicle-file-other-window' ;; (`C-x 4 f') ;; `find-file-read-only'..............`icicle-find-file-read-only' ;; (`C-x C-r') ;; `find-file-read-only-other-window'.`...read-only-other-window' ;; (`C-x 4 r') ;; `find-tag'.........................`icicle-find-tag' (`M-.') ;; `find-tag-other-window'.......`icicle-find-first-tag-other-window' ;; (`C-x 4 .') ;; `Info-goto-node'...................`icicle-Info-goto-node' (`g') ;; `Info-index'.......................`icicle-Info-index' (`i') ;; `Info-menu'........................`icicle-Info-menu' (`m') ;; `insert-buffer'....................`icicle-insert-buffer' ;; (`C-S-insert') ;; `kill-buffer'......................`icicle-kill-buffer' (`C-x k') ;; `lisp-complete-symbol'.............`icicle-lisp-complete-symbol' ;; (`M-TAB') ;; `other-frame'......................`icicle-select-frame' ;; (`C-x 5 o') ;; `other-window'.....................`icicle-other-window-or-frame' ;; (`C-x o') ;; `pop-global-mark'...`icicle-goto-global-marker-or-pop-global-mark' ;; (`C-x C-SPC') ;; `pop-tag-mark'.....................`icicle-pop-tag-mark' (`M-*') ;; `pp-eval-expression'...............`icicle-pp-eval-expression' ;; (`M-:') ;; `set-mark-command'........`icicle-goto-marker-or-set-mark-command' ;; (`C-SPC') ;; `switch-to-buffer'.................`icicle-buffer' (`C-x b') ;; `switch-to-buffer-other-window'....`icicle-buffer-other-window' ;; (`C-x 4 b') ;; `where-is'.........................`icicle-where-is' (`C-h w') ;; `yank'.............................`icicle-yank-maybe-completing' ;; (`C-y') ;; `yank-pop'.........................`icicle-yank-pop-commands' ;; (`M-y') ;; ;; Actually, by default, Icicles binds `icicle-yank-maybe-completing' ;; to whatever the value of option `icicle-yank-function' is. By ;; default, this value is `yank'. ;; ;; Option `icicle-top-level-key-bindings' remaps not only these ;; standard Emacs commands but also some commands provided by other ;; libraries. For example, if you use package `Bookmark+', then ;; type-specific bookmark jump commands such as ;; `bmkp-dired-jump-other-window' are remapped to Icicles ;; multi-command versions. ;; ;; In addition, option `icicle-functions-to-redefine' redefines some ;; vanilla functions to their Icicles versions while in Icicle mode. ;; Any redefined functions that are bound to keys keep those ;; bindings. For example, `Info-index' is by default redefined to ;; `icicle-Info-index' in Icicle mode, so `i' in Info mode is ;; effectively bound to `icicle-Info-index'. Commands listed in ;; option `icicle-functions-to-redefine' are typically bound in ;; keymaps other than the global map. ;; ;; There are many Icicles commands that are not bound to any keys by ;; default. You might want to bind some of them to keys in keymap ;; `icicle-mode-map', i.e., in Icicle mode. For a list of top-level ;; Icicles commands, see the Commentary headers of files ;; `icicles-cmd1.el' and `icicles-cmd2.el'. ;; ;;(@* "Minibuffer Bindings") ;; ** Minibuffer Bindings ** ;; ;; There are many key bindings available while your input is read in ;; the minibuffer, for example, while you are editing it. Some of ;; these keys are available regardless of whether completion is ;; available for your input. ;; ;; Others are available only during completion. Most of those keys ;; are bound in the minibuffer completion keymaps, but some are bound ;; in the `*Completions*' buffer keymap. ;; ;; In addition, clicking `C-mouse-3' on a completion candidate in ;; buffer `*Completions*' pops up a menu of available commands. Some ;; of these menu commands are applicable to the completion you click; ;; others apply to the current state of completion or to the complete ;; set of completion candidates. The associated key bindings are ;; indicated in the menu items, so this can be a good way to learn ;; minibuffer and `*Completions*' bindings. ;; ;; You can easily customize the Icicles minibuffer and ;; `*Completions*' buffer key bindings. There are several user ;; options available for this. This section describes the keys that ;; are bound by default. Section (@> "Customizing Key Bindings") ;; describes the options available for customizing them. The keys ;; described in this section are those bound by default. ;; ;; The following key is helpful during any minibuffer input. It pops ;; up the `*Help*' buffer with information about using the minibuffer ;; in Icicle mode. During completion, this includes information ;; similar to what you are reading now. It also lists toggle ;; commands and the current toggle values. ;; ;; `M-?' - `icicle-minibuffer-help' ;; ;; The following key will always cancel all minibuffer input. No ;; matter whether you have recursive minibuffers, it always returns ;; you directly to the Emacs top level. ;; ;; `C-M-T' (aka `C-M-S-t') - `icicle-top-level' ;; ;; The following key bindings are made for the minibuffer completion ;; keymaps. They are in effect whenever you are using the minibuffer ;; for input with completion (e.g. `completing-read', ;; `read-file-name', `M-x'). ;; ;; The keys mentioned are those that are bound by default and used in ;; the documentation, but you can customize any or all of them using ;; option `icicle-completion-key-bindings'. ;; ;; `down', `wheel-down' - `icicle-next-candidate-per-mode' (modal) ;; `up', `wheel-up' - `icicle-previous-candidate-per-mode' (modal) ;; ;; `next', `prior' - `icicle-next-apropos-candidate', ;; `icicle-previous-apropos-candidate', which ;; cycle candidate apropos completions. ;; ;; `end', `home' - `icicle-next-prefix-candidate', ;; `icicle-previous-prefix-candidate', ;; which cycle candidate prefix completions. ;; ;; Whether a modal cycling key is used for prefix or apropos ;; completion at a given time depends on the current completion ;; mode, which is determined by which of `TAB' and `S-TAB' was ;; used last, or by option `icicle-default-cycling-mode' if ;; neither was used. ;; ;; (The mouse wheel bindings are only for Emacs 22 and later. ;; The documentation refers to the keys that cycle completion ;; candidates as `down', `up', `next', `prior', `end', and ;; `home'. Actually, these are the cycling keys only by default. ;; You can customize them using options ;; `icicle-modal-cycle-down-keys', `icicle-modal-cycle-up-keys', ;; `icicle-apropos-cycle-next-keys', ;; `icicle-apropos-cycle-previous-keys', ;; `icicle-prefix-cycle-next-keys', and ;; `icicle-prefix-cycle-previous-keys'.) ;; ;; Keys bound globally to commands that perform simple text ;; insertion, deletion, and transposition operations - commands ;; such as `self-insert-command' - are bound to Icicles versions of ;; those commands that do the same thing but also provide apropos ;; icompletion. This includes keys such as `C-d', `C-k', and `C-w' ;; (and lots more). See (@file :file-name "icicles-doc1.el" :to "Icompletion"). ;; ;; `pause' - `icicle-switch-to/from-minibuffer': Move cursor to ;; the buffer from which the minibuffer was activated. ;; ;; `C-insert' - `icicle-switch-to-Completions-buf': Move cursor to ;; the current candidate in buffer `*Completions*'. ;; ;; `C-v' - `icicle-scroll-Completions-forward': Scroll the ;; `*Completions*' window forward ;; ;; `M-v' - `icicle-scroll-Completions-backward': Scroll the ;; `*Completions*' window backward ;; ;; `C-M-v' - `icicle-scroll-forward': Scroll the current ;; non-minibuffer window forward ;; ;; `C-M-V' (`C-M-S-v') - `icicle-scroll-backward': Scroll the ;; current non-minibuffer window backward ;; ;; `M-*' - `icicle-narrow-candidates': Narrow the set of ;; completion candidates using another input regexp. ;; ;; `M-+' - `icicle-widen-candidates': Widen the set of ;; completion candidates using another input regexp. ;; ;; `M-SPC' - `icicle-prefix-word-complete': Complete current input ;; in minibuffer, as a prefix, a single word at a time. ;; This replaces `minibuffer-complete-word'. In fact, ;; it is the keys in `icicle-word-completion-keys' that ;; are bound to this command; `M-SPC' is by default. ;; ;; `S-SPC' - `icicle-apropos-complete-and-narrow': Same as ;; `S-TAB' followed by `M-*'. ;; ;; `S-backspace' - `icicle-apropos-complete-and-widen': Same as ;; `S-TAB' followed by `M-+'. ;; ;; `TAB' - `icicle-prefix-complete': Complete current input in ;; minibuffer, as a prefix. If there is more than one ;; prefix-completion candidate, display them in buffer ;; `*Completions*', highlighting the common prefix. ;; This replaces `minibuffer-complete'. ;; ;; (The documentation always refers to the key that does ;; this as `TAB'. Actually, it is only `TAB' by ;; default. You can customize it, using option ;; `icicle-prefix-complete-keys'.) ;; ;; `S-TAB' - In the minibuffer: `icicle-apropos-complete' - like ;; `TAB', but use apropos completion. In buffer ;; `*Completions*': `icicle-move-to-previous-completion' ;; - move backwards among candidates. At top level: ;; `icicle-complete-keys' - complete a key sequence. ;; ;; (The documentation always refers to the keys that do ;; these things as `S-TAB'. Actually, they are only ;; `S-TAB' by default. You can customize the keys using ;; options `icicle-apropos-complete-keys', ;; `icicle-completion-list-key-bindings', and ;; `icicle-key-complete-keys'.) ;; ;; `C-M-TAB' - `icicle-prefix-complete-no-display': Like `TAB', but ;; does not display candidates in `*Completions*'. ;; ;; (The documentation always refers to the key that does ;; this as `C-M-TAB'. Actually, it is only `C-M-TAB' by ;; default. You can customize it, using option ;; `icicle-prefix-complete-no-display-keys'.) ;; ;; During Isearch, `C-M-TAB' and `M-TAB' complete the ;; search string against past search strings. (These ;; are the keys by default. You can customize this ;; using option `icicle-isearch-complete-keys'.) ;; ;; `C-M-S-TAB' - `icicle-apropos-complete-no-display': Like ;; `S-TAB', but does not display candidates. ;; ;; (The documentation always refers to the key that does ;; this as `C-M-S-TAB'. Actually, it is only ;; `C-M-S-TAB' by default. You can customize it, using ;; option `icicle-apropos-complete-no-display-keys'.) ;; ;; `C-M-&' - `icicle-save-predicate-to-variable': Save the current ;; predicate used for completion to a variable. ;; ;; `delete' - `icicle-remove-candidate': Remove the current ;; candidate from consideration. ;; ;; `S-mouse-2' - `icicle-mouse-remove-candidate': Same as `delete'. ;; ;; `M-o' - `icicle-insert-history-element': Invoke completion to ;; insert a previously entered input into the ;; minibuffer. Use this instead of the `M-s' and `M-r' ;; of vanilla Emacs, which are not available in Icicle ;; mode. (`M-o' is the key by default. You can ;; customize this using option ;; `icicle-minibuffer-key-bindings'.) ;; ;; During Isearch, `M-o' completes against the current ;; search ring, and appends the past search string you ;; choose to the current one. (`M-o' is the key by ;; default. You can customize this using option ;; `icicle-isearch-history-insert-keys'.) ;; ;; `M-q' - `icicle-insert-key-description': Insert the textual ;; representation of a key sequence, during key ;; completion. ;; ;; `M-r' - `icicle-roundup': Insert one or more completion ;; candidates in the minibuffer. ;; ;; `M-R' - `icicle-multi-inputs-act': Act on multi-inputs. ;; Parse minibuffer input into a list of candidates, ;; then act on each candidate, in order. ;; ;; `M-S' - `icicle-multi-inputs-save': Add multi-inputs to the ;; current saved candidates set. Parse minibuffer ;; contents into a list of candidates, then add them to ;; those in `icicle-saved-completion-candidates'. ;; ;; `M-%' - Regexp quote current input or its active region, then ;; apropos-complete. Use this to literally match all or ;; some input in the context of regexp matching overall. ;; ;; `C-M-F' (`C-M-S-f') - `icicle-read+insert-file-name': Invoke ;; completion to insert a file name in the minibuffer. ;; ;; `C-M-C' (`C-M-S-c') - `icicle-completing-read+insert': Invoke ;; completion to insert something other than a file name ;; (not always available). ;; ;; (`C-M-F' and `C-M-C' are the default values for ;; the keys that invoke completion on demand. You can ;; customize the keys to use, using options ;; `icicle-read+insert-file-name-keys' and ;; `icicle-completing-read+insert-keys'.) ;; ;; By default, `TAB' and `S-TAB' also perform modal candidate cycling ;; when you repeat them. You can inhibit this feature by customizing ;; option `icicle-TAB/S-TAB-only-completes-flag'. ;; ;; In Icicles, multi-line completion candidates are not uncommon. ;; You can move up and down minibuffer lines with `C-p' and `C-n', ;; and you can use the following keys to move among line beginnings ;; and ends: ;; ;; `C-a', `C-e' - `icicle-beginning-of-line+', ;; `icicle-end-of-line+': Like normal `C-a', `C-e', but ;; repeating goes to the previous or next line. ;; ;; If you use libraries `fit-frame.el' and `oneonone.el' with a ;; standalone minibuffer frame (non-`nil' ;; `1on1-minibuffer-frame-flag'), and if option ;; `1on1-fit-minibuffer-frame-flag' is non-`nil', then the minibuffer ;; frame is automatically resized to fit its content as you edit that ;; content. (Options `1on1-fit-minibuffer-frame-max-height' and ;; `1on1-fit-minibuffer-frame-max-height-percent' define the maximum ;; height for this.) ;; ;; If, in addition, you bind `1on1-fit-minibuffer-frame' to a key, ;; then you can use that key repeatedly to increase the height by one ;; line, even beyond the maximum. Library `setup-keys.el' binds this ;; to `C-o'. ;; ;; (If you do not use a separate minibuffer frame, then you will ;; likely want to set standard option `resize-mini-windows' to `t', ;; not to `grow-only', at least while in Icicle mode.) ;; ;; `C-M-j' - `icicle-insert-list-join-string': Insert ;; `icicle-list-join-string'. See also ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;; ;; You can insert a single Icicles multi-line dot using `C-u .', or ;; by turning on this dot magic generally, using `C-M-.': ;; ;; `.' - `icicle-insert-dot-command' ;; `C-M-.' - `icicle-toggle-dot' ;; ;; In vanilla Emacs, the following keys have a special purpose during ;; input completion, but in Icicles they simply insert the character ;; typed - they are self-inserting. This is because (1) there are ;; better ways to do what vanilla Emacs uses these keys for and (2) ;; it is useful to be able to insert these characters without first ;; typing `C-q' to quote them. ;; ;; `?' - see also ;; (@file :file-name "icicles-doc1.el" :to "What About Special-Character Conflicts?") ;; ;; `SPC' (space) ;; ;; `C-j' (newline) - see also `C-o', above, and ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;; ;; The following minibuffer bindings are made to clear minibuffer ;; input, making them handy for editing and removing completions ;; (e.g. default or initial values) in the minibuffer. ;; ;; `M-k' - `icicle-erase-minibuffer-or-history-element' ;; `M-S-backspace', `M-S-delete' - `icicle-erase-minibuffer' ;; ;; `M-k' has an alternative behavior when you are cycling minibuffer ;; history items: it deletes the current item from the history. ;; ;; The following key is bound during completion to control the ;; display of thumbnail images in `*Completions*' for candidates that ;; name image files or image-file bookmarks (see Bookmark+). It ;; cycles the value of option `icicle-image-files-in-Completions' to ;; show images and names (the default), show only names, or show only ;; images. ;; ;; `C-x t' - `icicle-cycle-image-file-thumbnail' ;; ;; During (absolute or relative) file-name completion, the following ;; minibuffer bindings are also in effect: ;; ;; `C-backspace' - `icicle-up-directory': ;; Navigate up the directory hierarchy. ;; `C-c +' - `icicle-make-directory': Create a directory. ;; `C-x m' - `icicle-bookmark-file-other-window': ;; Visit a file or directory (Dired) bookmark. ;; See also ;; (@file :file-name "icicles-doc1.el" :to "Accessing Saved Locations (Bookmarks) on the Fly"). ;; (Available only if you use `bookmark+.el'.) ;; ;; During some absolute file-name completion, you can use `C-c C-d' ;; to change the current directory on the fly (think UNIX command ;; `cd'). See also ;; (@file :file-name "icicles-doc1.el" :to "Absolute File Names and Different Directories"). ;; ;; During buffer-name completion, additional minibuffer bindings are ;; defined by user option `icicle-buffer-candidate-key-bindings'. By ;; default, they are the following: ;; ;; `C-x m' - `icicle-bookmark-non-file-other-window': ;; Visit a buffer (non-file) bookmark. See also ;; (@file :file-name "icicles-doc1.el" :to "Accessing Saved Locations (Bookmarks) on the Fly"). ;; (Available only if you use `bookmark+.el'.) ;; ;; `C-x C-m -' - `icicle-remove-buffer-cands-for-derived-mode': ;; Remove buffer-name candidates with a major ;; mode that is derived from a given mode. ;; Repeat to filter progressively. ;; (`C-m' is the same key as `RET'.) ;; ;; `C-x C-m +' - `icicle-keep-only-buffer-cands-for-derived-mode': ;; Keep only buffer-name candidates with a major ;; mode that is derived from a given mode. ;; ;; `C-x M -' - `icicle-remove-buffer-cands-for-mode': Same as ;; `C-x C-m -', but excludes ancestor modes. ;; ;; `C-x M +' - `icicle-keep-only-buffer-cands-for-mode': Same ;; as `C-x C-m +', but excludes ancestor modes. ;; ;; `C-x v -' - `icicle-remove-buffer-cands-for-visible': ;; Remove buffers that are visible. Includes ;; buffers in iconified frames. ;; ;; `C-x v +' - `icicle-keep-only-buffer-cands-for-visible': ;; Keep only buffers that are visible. Includes ;; buffers in iconified frames. ;; ;; `C-x F' - Toggle whether to include cached files (i.e., ;; toggle option ;; `icicle-buffer-include-cached-files-nflag') ;; ;; `C-x R' - Toggle whether to include recent files (i.e., ;; toggle option ;; `icicle-buffer-include-recent-files-nflag') ;; ;; The following minibuffer binding moves the cursor to the start of ;; the part of your input, if any, that is highlighted because it ;; does not match any completion candidate (see option ;; `icicle-highlight-input-completion-failure'). Repeating this ;; command kills the rest of the line, removing the highlighted ;; mismatched input. ;; ;; `C-M-l' - `icicle-goto/kill-failed-input' ;; ;; The remaining input matches at least one candidate. ;; ;; The following minibuffer bindings can be used to get rid of a ;; completion inserted during cycling, and retrieve what you last ;; typed during completion or any previous completion inputs: ;; ;; `C-l' - `icicle-retrieve-previous-input' ;; `C-S-l' (`C-L') - `icicle-retrieve-next-input' ;; ;; You can use these to cycle among and reuse inputs that you typed ;; during completion but did not enter. This completion input is not ;; recorded in the standard input histories - they record only input ;; that you have entered with `RET'. ;; See (@file :file-name "icicles-doc1.el" :to "History Enhancements"). ;; ;; For example, suppose that you used `C-h v hook' to examine various ;; hook variables, and you did this using`C-next' to display their ;; documentation. If you finished the command by just typing `C-g', ;; then your input (`hook') was never really entered, so it is not ;; available via the minibuffer history (`M-p'). You can retrieve it ;; with `C-l', to use it again, in your next command. User option ;; `icicle-C-l-uses-completion-flag' controls the behavior of `C-l' ;; and `C-L'; if non-`nil', then, instead of cycling inputs, these ;; commands let you access previous inputs using completion. ;; ;; You can insert minibuffer history items using the cycle keys `M-p' ;; and `M-n', as usual. But in Icicle mode, `M-s' and `M-r' are not ;; available. Instead, use `M-o' to insert any history item using ;; completion (including regexp completion, of course). ;; ;; The following minibuffer bindings also let you use apropos ;; completion on the current minibuffer history list. For ;; explanation, see (@file :file-name "icicles-doc1.el" :to "History Enhancements"). ;; ;; `M-h' - `icicle-history' ;; `M-pause' - `icicle-keep-only-past-inputs' ;; ;; Minibuffer binding `C-M-pause' lets you use a different minibuffer ;; history during the current input reading with completion. ;; Normally, you are prompted for the history to use. Starting with ;; Emacs 23, if option `icicle-populate-interactive-history-flag' is ;; non-`nil', then during command, abbrev, and keyboard-macro ;; completion, `C-M-pause' completes your input against the history ;; of all commands that were invoked interactively in any way, ;; `icicle-interactive-history'. ;; ;; The following minibuffer bindings let you act on candidate ;; completions. For explanation, see ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands"), ;; (@file :file-name "icicles-doc1.el" :to "More about Multi-Commands"), ;; (@file :file-name "icicles-doc1.el" :to "Choose All Completion Candidates"), ;; and (@> "OO: Object-Action Interaction"). ;; ;; `C-RET' - `icicle-candidate-action': current candidate ;; `C-mouse-2' - `icicle-mouse-candidate-action': clicked candidate ;; `C-down', `C-wheel-down' ;; - `icicle-next-candidate-per-mode-action' (modal) ;; `C-up', `C-wheel-up' ;; - `icicle-previous-candidate-per-mode-action'(modal) ;; `C-next' - `icicle-next-apropos-candidate-action' ;; `C-prior' - `icicle-previous-apropos-candidate-action' ;; `C-end' - `icicle-next-prefix-candidate-action' ;; `C-home' - `icicle-previous-prefix-candidate-action' ;; `C-!' - `icicle-all-candidates-action': each candidate ;; `M-!' - `icicle-all-candidates-list-action': all, as list ;; `M-RET' - `icicle-candidate-read-fn-invoke': apply function ;; `M-mouse-2' - `icicle-mouse-yank-secondary' (in minibuffer) ;; `M-mouse-2' - `icicle-mouse-candidate-read-fn-invoke': apply fn ;; `S-delete' - `icicle-delete-candidate-object': delete object ;; ;; (Some of these are only default key bindings. You can customize ;; the keys to use for candidate actions, for instance. The ;; mouse-wheel bindings are only for Emacs 22 and later. The ;; notation used here for the wheel bindings is that for Emacs on ;; Windows; on other platforms different key notations are used for ;; the wheel. This same note applies to corresponding keys used with ;; modifiers `C-M-' and `C-S-' - see below.) ;; ;; Except as noted, the bindings for `icicle-mouse-*' are actually in ;; the `*Completions*' buffer. ;; ;; The following minibuffer bindings provide help on candidate ;; completions. For explanation, see ;; (@file :file-name "icicles-doc1.el" :to "Get Help on Completion Candidates") ;; and (@file :file-name "icicles-doc1.el" :to "Multi-Commands"). ;; ;; `C-M-RET' - `icicle-help-on-candidate': current candidate ;; `C-M-mouse-2' - `icicle-mouse-help-on-candidate': clicked ;; `C-M-down', `C-M-wheel-down' ;; - `icicle-next-candidate-per-mode-help' (modal) ;; `C-M-up', `C-M-wheel-up' ;; - `icicle-previous-candidate-per-mode-help' (modal) ;; `C-M-next' - `icicle-help-on-next-apropos-candidate' ;; `C-M-prior' - `icicle-help-on-previous-apropos-candidate' ;; `C-M-end' - `icicle-help-on-next-prefix-candidate' ;; `C-M-home' - `icicle-help-on-previous-prefix-candidate' ;; ;; (Again, these are only default key bindings. ;; See (@> "Customizing Key Bindings").) ;; ;; The following minibuffer bindings provide an alternative action ;; for individual candidates. The alternative action is specific to ;; the given command. Most commands define no alternative action. ;; ;; `C-S-RET' - `icicle-candidate-alt-action': current candidate ;; `C-S-mouse-2' - `icicle-mouse-candidate-alt-action': clicked ;; `C-S-down', `C-S-wheel-down' ;; - `icicle-next-candidate-per-mode-alt-action' ;; (modal) ;; `C-S-up', `C-S-wheel-up' ;; - `icicle-previous-candidate-per-mode-alt-action' ;; (modal) ;; `C-S-next' - `icicle-next-apropos-candidate-alt-action' ;; `C-S-prior' - `icicle-previous-apropos-candidate-alt-action' ;; `C-S-end' - `icicle-next-prefix-candidate-alt-action' ;; `C-S-home' - `icicle-previous-prefix-candidate-alt-action' ;; `C-|' - `icicle-all-candidates-alt-action': each ;; `M-|' - `icicle-all-candidates-list-alt-action': list ;; ;; The following minibuffer bindings let you perform set operations ;; on sets of completion candidates. For explanation, see ;; (@file :file-name "icicles-doc1.el" :to "Sets of Completion Candidates"). ;; ;; `C-~' - `icicle-candidate-set-complement' ;; `C--' - `icicle-candidate-set-difference' ;; `C-+' - `icicle-candidate-set-union' ;; `C-*' - `icicle-candidate-set-intersection' ;; `C-M-<' - `icicle-candidate-set-retrieve': retrieve saved set ;; `C-M->' - `icicle-candidate-set-save': save current set ;; `C-M-)' - `icicle-candidate-set-save-selected': save selected ;; `C-<' - `icicle-candidate-set-retrieve-more': add from saved ;; `C->' - `icicle-candidate-set-save-more': add to saved set ;; `C-)' - `icicle-candidate-set-save-more-selected': selected ;; `insert' - `icicle-save/unsave-candidate': save current cand ;; `C-%' - `icicle-candidate-set-swap': swap saved and current ;; `C-:' - `icicle-candidate-set-define': define current (Lisp) ;; `M-S-mouse-2' - `icicle-mouse-save/unsave-candidate': (un)save ;; `M-S-mouse-3' - `icicle-mouse-candidate-set-save': save selected ;; `M-mouse-3' - `icicle-mouse-candidate-set-save-more' ;; ;; The following minibuffer bindings insert text in the minibuffer. ;; ;; `M-.' - `icicle-insert-string-at-point' ;; `C-=' - `icicle-insert-string-from-variable' ;; `M-:' - `icicle-pp-eval-expression-in-minibuffer' ;; (with a prefix arg) ;; ;; The following minibuffer bindings let you toggle Icicles options ;; or cycle among alternative Icicles behaviors. ;; ;; `C-A' (that is, `C-S-a') - `icicle-toggle-case-sensitivity' ;; `C-.' - `icicle-toggle-ignored-extensions' (file completion) ;; `C-.' - `icicle-toggle-search-cleanup' (search) ;; `C-M-.' - `icicle-toggle-dot' ;; `C-x .' - `icicle-toggle-hiding-common-match' ;; `C-u C-x .' - `icicle-toggle-hiding-non-matching-lines' ;; `C-"' - `icicle-toggle-expand-to-common-match' ;; `C-M-"' - `icicle-cycle-expand-to-common-match' ;; `M-;' - `icicle-toggle-search-replace-common-match' ;; `C-M-;' - `icicle-toggle-icicle-toggle-ignoring-comments' ;; `C-,' - `icicle-change-sort-order' ;; `M-,' - `icicle-change-alternative-sort-order' ;; `C-M-,' - `icicle-toggle-alternative-sorting' ;; `C-^' - `icicle-toggle-remote-file-testing' ;; `C-^' - `icicle-toggle-highlight-all-current' (search) ;; `C-M-^' - `icicle-toggle-completions-format' ;; `C-#' - `icicle-cycle-incremental-completion' ;; `C-(' - `icicle-next-TAB-completion-method' ;; `C-`' - `icicle-toggle-regexp-quote' ;; `C-M-`' - `icicle-toggle-literal-replacement' (search) ;; `C-$' - `icicle-toggle-transforming' (removal of duplicates) ;; `C-pause' - `icicle-toggle-highlight-historical-candidates' ;; `S-pause' - `icicle-toggle-highlight-saved-candidates' ;; `M-g' - `icicle-toggle-C-for-actions' ;; `M-q' - `icicle-toggle-search-whole-word' (search) ;; `M-(' - `icicle-next-S-TAB-completion-method' ;; `M-~' - `icicle-toggle-~-for-home-dir' ;; `M-_' - `icicle-toggle-ignored-space-prefix' ;; `M-_' - `icicle-toggle-search-replace-whole' (search) ;; `C-M-_' - `icicle-toggle-proxy-candidates' ;; ;; The following minibuffer bindings let you incrementally change ;; options that affect the `*Completions*' display columns and text ;; size. To take advantage of these, you must also use Do Re Mi ;; (libraries `doremi.el' and `doremi-frm.el'). `C-x -' requires ;; Emacs 23 or later. ;; ;; `C-x w' - `icicle-doremi-candidate-width-factor+' ;; `C-x |' - `icicle-doremi-inter-candidates-min-spaces+' ;; `C-x -' - `icicle-doremi-zoom-Completions+' ;; `C-x #' - increment/decrement option `icicle-max-candidates' ;; ;; When used in the minibuffer, the following Icicles global binding ;; lets you remove the `*Completions*' window. ;; ;; `C-x 0' - `icicle-delete-window' ;; ;; The following minibuffer bindings are in effect during Icicles ;; search: ;; ;; `C-.' - `icicle-toggle-search-cleanup' ;; `C-,' - `icicle-change-sort-order' ;; `M-_' - `icicle-toggle-search-replace-whole' ;; `M-,' - `icicle-search-define-replacement' ;; `M-;' - `icicle-toggle-search-replace-common-match' ;; `M-q' - `icicle-toggle-search-whole-word' ;; `C-^' - `icicle-toggle-highlight-all-current' ;; `C-M-`' - `icicle-toggle-literal-replacement' ;; ;; The following minibuffer binding lets you evaluate an Emacs-Lisp ;; sexp at any time, using a recursive minibuffer. It displays the ;; result of evaluation in the echo area or in a pop-up buffer, `*Pp ;; Eval Output*'. With a prefix arg (`C-u M-:'), it inserts the ;; result into the minibuffer at point. ;; ;; `M-:' - `icicle-pp-eval-expression-in-minibuffer' ;; ;; Some additional bindings are made available in the minibuffer for ;; the duration of specific commands: ;; ;; * During completion of names of some kinds of objects (files, ;; buffers, directories, Info nodes), `C-x m' lets you complete ;; against bookmarks that have the same type as those objects (file ;; bookmarks, buffer bookmarks, Dired bookmarks, Info bookmarks). ;; This feature requires use of package `Bookmark+'. ;; ;; * During completion of file names, `C-backspace' is bound to ;; `icicle-up-directory', which navigates to the parent directory ;; and completes there instead. ;; ;; * During completion of bookmark names, various keys with the ;; prefix `C-M-' are bound to commands that narrow the available ;; candidates to bookmarks of a specific type. For example, ;; `C-M-d' narrows the choices to Dired bookmarks. ;; ;; The following bindings are made for `completion-list-mode', that ;; is, for buffer `*Completions*', which shows the list of candidate ;; completions: ;; ;; `left', `right' (`TAB') ;; - `icicle-move-to-previous-completion', ;; `icicle-move-to-next-completion': Navigate ;; backward & forward among candidates ;; `up', `down' - `icicle-previous-line', `icicle-next-line': ;; Navigate up & down among candidates ;; `C-insert' - `icicle-insert-completion': Move cursor to the ;; minibuffer, with the current `*Completions*' ;; candidate as input ;; `C-a', `C-e' - `icicle-beginning-of-line+', ;; `icicle-end-of-line+' (repeatable) ;; `C-g', `q' - `icicle-abort-recursive-edit' ;; `C-M-T' - `icicle-top-level' ;; `mouse-2' - `icicle-mouse-choose-completion' (Emacs <23.2) ;; `C-mouse-2' - `icicle-mouse-candidate-action' ;; `M-mouse-2' - `icicle-mouse-candidate-read-fn-invoke' ;; `C-M-mouse-2' - `icicle-mouse-help-on-candidate' ;; `M-S-mouse-2' - `icicle-mouse-save/unsave-candidate' ;; `C-mouse-3' - `icicle-Completions-mouse-3-menu' ;; `M-mouse-3' - `icicle-mouse-candidate-set-save-more' ;; `M-S-mouse-3' - `icicle-mouse-candidate-set-save' ;; `wheel-down' - `icicle-scroll-Completions-backward' ;; `wheel-up' - `icicle-scroll-Completions-forward' ;;(@* "Customizing Key Bindings") ;; ;; Customizing Key Bindings ;; ------------------------ ;; ;; See (@> "Key Bindings") for a description of the default key ;; bindings defined by Icicles. The options mentioned here are also ;; presented there, in context. You can customize all of the ;; key-binding user options (there are over 50 of them!) using this ;; command: ;; ;; M-x customize-group RET Icicles-Key-Bindings ;; ;; Key bindings are very personal choices, and reflect preferences ;; and habits, as well as keyboard and other configurations. You ;; might want to change some of the bindings that Icicles creates. ;; This section tells you how to do that. ;; ;; However, before doing so, unless the default bindings present a ;; hardware or OS configuration problem for you, please try using the ;; default bindings for a while, before deciding that you want to ;; change them. Habit is a powerful persuader, but its advice is not ;; always the best ;-). ;; ;; These are the main kinds of Icicles key bindings. They are ;; described in the sections below. ;; ;; * Global bindings ;; . Additions to menu-bar menus ;; . Key completion keys (`S-TAB' by default) ;; * Icicle mode bindings ;; * Minibuffer bindings ;; * `*Completions*' buffer bindings ;; ;; The Icicles user options for binding keys take two forms. In most ;; cases, the option name ends with `-keys', and the option value is ;; simply a list of keys that act the same. ;; ;; In the following cases, however, the option name ends with ;; `-key-bindings' and the option value is a list of possibly ;; conditional key bindings. ;; ;; * `icicle-top-level-key-bindings' - top-level key bindings. ;; ;; * `icicle-minibuffer-key-bindings' - minibuffer key bindings ;; defined regardless of whether completion is available. This ;; does not include keys concerned with completion, cycling, and ;; help, which are covered by other options (below). ;; ;; * `icicle-completion-key-bindings' - minibuffer key bindings ;; available during completion. ;; ;; * `icicle-completion-list-key-bindings' - key bindings for buffer ;; `*Completions*'. ;; ;; Each of these `*-key-bindings' options has the same form, a list ;; of elements which each have the form (KEY COMMAND CONDITION). KEY ;; is either a key sequence (string or vector) to bind COMMAND to or ;; a command to remap to COMMAND. COMMAND is bound according to the ;; value of KEY, unless the result of evaluating CONDITION is `nil'. ;; ;; The following options, with names ending in `-keys', cover keys ;; available during completion and which provide completion, cycling, ;; or help. ;; ;; * `icicle-modal-cycle-down-keys' (`down', `wheel-down') ;; Cycle to the next candidate (modal). ;; * `icicle-modal-cycle-up-keys' (`up', `wheel-up') ;; Cycle to the previous candidate (modal). ;; * `icicle-apropos-cycle-next-keys' (`next') ;; Cycle to the next apropos-completion candidate. ;; * `icicle-apropos-cycle-previous-keys' (`prior') ;; Cycle to the previous apropos-completion candidate. ;; * `icicle-prefix-cycle-next-keys' (`end') ;; Cycle to the next prefix-completion candidate. ;; * `icicle-prefix-cycle-previous-keys' (`home') ;; Cycle to the previous prefix-completion candidate. ;; * `icicle-candidate-action-keys' (`C-RET') ;; Act on the current completion candidate. ;; * `icicle-modal-cycle-down-action-keys' (`C-down', `C-wheel-down) ;; Cycle to next candidate and act on it (modal). ;; * `icicle-modal-cycle-up-action-keys' (`C-up', `C-wheel-up) ;; Cycle to previous candidate and act on it (modal). ;; * `icicle-apropos-cycle-next-action-keys' (`C-next') ;; Cycle to next apropos-completion candidate and act on it. ;; * `icicle-apropos-cycle-previous-action-keys' (`C-prior') ;; Cycle to previous apropos-completion candidate and act on it. ;; * `icicle-prefix-cycle-next-action-keys' (`C-end') ;; Cycle to next prefix-completion candidate and act on it. ;; * `icicle-prefix-cycle-previous-action-keys' (`C-home') ;; Cycle to previous prefix-completion candidate and act on it. ;; * `icicle-modal-cycle-down-alt-action-keys' (`C-S-down') ;; Cycle to next candidate and alternative-act on it (modal). ;; * `icicle-modal-cycle-up-alt-action-keys' (`C-S-up') ;; Cycle to previous candidate and alternative-act on it (modal). ;; * `icicle-apropos-cycle-next-alt-action-keys' (`C-S-next') ;; Cycle to next apropos-completion candidate and alternative-act ;; on it. ;; * `icicle-apropos-cycle-previous-alt-action-keys' (`C-S-prior') ;; Cycle to previous apropos-completion candidate and ;; alternative-act on it. ;; * `icicle-prefix-cycle-next-alt-action-keys' (`C-S-end') ;; Cycle to next prefix-completion candidate and alternative-act ;; on it. ;; * `icicle-prefix-cycle-previous-alt-action-keys' (`C-S-home') ;; Cycle to previous prefix-completion candidate and ;; alternative-act on it. ;; * `icicle-candidate-help-keys' (`C-M-RET' etc.) ;; Display help for the current completion candidate. ;; * `icicle-modal-cycle-down-help-keys' (`C-M-down') ;; Cycle to next candidate and show help for it (modal). ;; * `icicle-modal-cycle-up-help-keys' (`C-M-up') ;; Cycle to previous candidate and show help for it (modal). ;; * `icicle-apropos-cycle-next-help-keys' (`C-M-next') ;; Cycle to next apropos-completion candidate and show help for it. ;; * `icicle-apropos-cycle-previous-help-keys' (`C-M-prior') ;; Cycle to previous apropos-completion candidate and show help. ;; * `icicle-prefix-cycle-next-help-keys' (`C-M-end') ;; Cycle to next prefix-completion candidate and show help for it. ;; * `icicle-prefix-cycle-previous-help-keys' (`C-M-home') ;; Cycle to previous prefix-completion candidate and show help. ;; * `icicle-prefix-complete-keys' (`TAB') ;; Prefix-complete your input. ;; * `icicle-apropos-complete-keys' (`S-TAB') ;; Apropos-complete your input. ;; * `icicle-prefix-complete-no-display-keys' (`C-M-TAB') ;; Prefix-complete without showing `*Completions*'. ;; * `icicle-apropos-complete-no-display-keys' (`C-M-S-TAB') ;; Apropos-complete without showing `*Completions*'. ;; * `icicle-word-completion-keys' (`M-SPC') ;; Prefix-complete your input a word at a time. ;; ;; The following options, with names ending in `-keys', cover ;; miscellaneous actions that make use of the minibuffer in some way. ;; ;; * `icicle-key-complete-keys' (`S-TAB') ;; Complete key sequences. ;; * `icicle-completing-read+insert-keys' (`C-M-S-c') ;; Completion on demand. ;; * `icicle-read+insert-file-name-keys' (`C-M-S-f') ;; Completion on demand for file names. ;; * `icicle-search-from-isearch-keys' (`S-TAB') ;; Start `icicle-search' from Isearch. ;; * `icicle-isearch-complete-keys' (`M-TAB', `C-M-TAB') ;; Complete Isearch string using search ring. ;; * `icicle-isearch-history-insert-keys' (`M-o') ;; Append past Isearch strings, using completion with search ring. ;; ;; Whenever you customize an Icicles key binding, whether via a user ;; option value or using `define-key' or `global-set-key', you can ;; use function `icicle-kbd' to express the key sequence in a ;; user-friendly way. ;; ;; It is the same as vanilla Emacs `kbd', except that (by default) it ;; does not require you to use angle brackets (`<', `>') around ;; function keys (and it does not expect you to). ;; ;; So you can write, e.g., (icicle-kbd "C-delete") instead of one of ;; these: (kbd "C-"), [C-delete], or [(control delete)]. ;; There are plenty of examples of the use of `icicle-kbd' in the ;; Icicles source files. ;; ;; In addition to the options listed above, whose values are keys or ;; lists of keys, option `icicle-TAB/S-TAB-only-completes-flag' ;; controls whether repeating `TAB' or `S-TAB' causes (modal) ;; candidate cycling. The default value of `nil' means that it does. ;; If you prefer that these keys (actually the keys that are the ;; values of options `icicle-prefix-complete-keys' and ;; `icicle-apropos-complete-keys') perform only completion and you ;; use other keys for cycling, then set the value to non-`nil'. ;; ;;(@* "Customizing Global Bindings") ;; ** Customizing Global Bindings ** ;; ;; Icicles normally adds items to appropriate existing menu-bar ;; menus, such as File and Options, as well as to menu-bar menus ;; Minibuf and Icicles. These items are placed in an Icicles submenu ;; (e.g. Files > Icicles). If you do not want to add an Icicles ;; submenu, then set option `icicle-touche-pas-aux-menus-flag' to ;; non-`nil' before loading Icicles. The menu items are then added ;; to the Icicles menu. ;; ;; Icicles binds key completion (`icicle-complete-keys') to the keys ;; defined in option `icicle-key-complete-keys'. See ;; (@> "Key Bindings") for more information about this. ;; ;;(@* "Customizing Icicle Mode Bindings") ;; ** Customizing Icicle Mode Bindings ** ;; ;; In the Icicle mode keymap, several top-level commands are bound by ;; default. You can use option `icicle-top-level-key-bindings' to ;; customize the keys that are used for these commands, or to remove ;; any such bindings. ;; ;;(@* "Customizing Minibuffer Bindings") ;; ** Customizing Minibuffer Bindings ** ;; ;; There are user options for most Icicles minibuffer bindings that ;; you might want to change - see above for the list. This section ;; tells you how to change additional bindings. ;; ;; To understand how you can modify Icicles minibuffer bindings, it ;; helps to know how Icicles creates the default bindings. For that, ;; the best advice is to consult the Emacs-Lisp code in library ;; `icicle-mode.el'. Even if you are not very familiar with ;; Emacs-Lisp, however, you should be able to do what you want by ;; adapting the example in this section. ;; ;; Suppose that you want to bind `f11' and `f12' to traverse the ;; input history up and down whenever you are in Icicle mode. There ;; are no user options for this, but you can do it by inserting this ;; code into your init file (~/.emacs), before the code that requires ;; (loads) library `icicles.el': ;; ;; (add-hook 'icicle-mode-hook 'bind-my-icicles-keys) ;; (defun bind-my-icicles-keys () ;; "Replace some default Icicles minibuffer bindings with others." ;; (dolist ;; (map ;; (append ;; (list minibuffer-local-completion-map ;; minibuffer-local-must-match-map) ;; (and (fboundp ;; 'minibuffer-local-filename-completion-map) ;; (list minibuffer-local-filename-completion-map)))) ;; (when icicle-mode ;; (define-key map (icicle-kbd "f11") ;; 'previous-history-element) ;; (define-key map (icicle-kbd "f12") ;; 'next-history-element)))) ;; ;; See Also: ;; ;; * (@> "Key Bindings") ;; * (@> "Customization and General Tips") for information ;; about other customizations, besides key bindings. ;;(@* "Icicles Redefines Some Standard Functions") ;; ;; Icicles Redefines Some Standard Functions ;; ----------------------------------------- ;; ;; User option `icicle-functions-to-redefine' is a list of functions ;; (typically commands) that are automatically redefined in Icicle ;; mode to enhance them for Icicles completion. The original ;; definitions are restored when you exit Icicle mode. The default ;; value of `icicle-functions-to-redefine' contains the following ;; functions: ;; ;; `bbdb-complete-mail' (from BBDB 3.02), `bbdb-complete-name' ;; (from BBDB 2.35), `comint-completion-at-point' (or ;; `comint-dynamic-complete', prior to Emacs 24), ;; `comint-dynamic-complete-filename', ;; `comint-replace-by-expanded-filename', ;; `ess-complete-object-name' (from ESS), ;; `gud-gdb-complete-command', `Info-goto-node', `Info-index', ;; `Info-menu', `lisp-complete-symbol', `lisp-completion-at-point', ;; `minibuffer-default-add-completions', `read-char-by-name', ;; `read-color', `read-from-minibuffer', `read-string', ;; `recentf-make-menu-items'. ;; ;; Icicles redefines these standard Emacs functions while in Icicle ;; mode: ;; ;; `choose-completion', `choose-completion-string', ;; `completing-read', `completing-read-multiple', ;; `completion-setup-function', `dired-smart-shell-command', ;; `display-completion-list', `exit-minibuffer', ;; `face-valid-attribute-values', `minibuffer-complete-and-exit', ;; `mouse-choose-completion' (Emacs < 23.2), ;; `next-history-element', `read-face-name', `read-file-name', ;; `read-number', `shell-command', `shell-command-on-region', ;; `sit-for', `switch-to-completions'. ;; ;; When you exit Icicle mode, the standard definitions are restored. ;;(@* "Debugging and Reporting Icicles Bugs") ;; ;; Debugging and Reporting Icicles Bugs ;; ------------------------------------ ;; ;; You can report a problem you experience with Icicles on the Emacs ;; Wiki, here: http://www.emacswiki.org/emacs/IciclesIssuesOpen. ;; ;; But the best way to report an Icicles issue or pass along a ;; suggestion is by email. Do one of the following: ;; ;; * Choose item `Send Bug Report' from menu-bar menu `Icicles'. ;; ;; * Use `M-x icicle-send-bug-report'. ;; ;; * Use `M-?' from the minibuffer. Then click button `Icicles ;; Options and Faces' in buffer `*Help*'. Then click the link ;; `Send Bug Report' in buffer `*Customize Group: icicles*'. ;; ;; When you report a problem, please always mention your Emacs ;; version and platform (e.g. Windows, GNU/Linux). If you are not ;; using the latest Icicles files, mention which ones you are using. ;; Icicles files each have an `Update #' field in the header, which ;; identifies the file exactly. ;; ;; If you can include a debugger backtrace in your email, that helps ;; - see the next section. ;; ;;(@* "Debugging Tips") ;; ** Debugging Tips ** ;; ;; 1. If you use the debugger to report a backtrace, first delete (or ;; move out of your `load-path') all Icicles byte-compiled files, ;; so that you use only the source files (`icicles*.el') for ;; debugging. ;; ;; 2. Set `debug-on-error' to `t', so that if an error is raised you ;; get a debugger backtrace. ;; ;; 3. If you want to enter the debugger at a particular point and ;; step through the execution, you can either use `M-x ;; debug-on-entry' (to enter the debugger whenever you enter a ;; given function) or temporarily place breakpoint calls to the ;; debugger - `(debug)' - in the source code and reevaluate the ;; enclosing function definition. ;; ;; 4. When in the debugger, use `d' to step through the execution or ;; `c' to skip over a particular step (execute it to completion, ;; skipping over the details). Use `q' to exit the debugger. An ;; alternative to using the regular debugger is to use `edebug' - ;; some people prefer that. ;; ;; Remember to load only the source files - a backtrace from ;; byte-compiled code is not very useful. Include the backtrace in ;; your bug report. ;;(@* "Programming with Fancy Candidates") ;; ;; Programming with Fancy Candidates ;; --------------------------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;; Icicles lets you program with several kinds of candidates that are ;; not supported by vanilla Emacs. For lack of a better word, I call ;; them all "fancy candidates". Multi-completions are fancy ;; candidates. So are ordinary string candidates that have text ;; properties such as `face'. And there are other kinds of fancy ;; candidates. ;; ;; Because they are not supported by vanilla Emacs, and because ;; Icicles uses Emacs functions such as `all-completions' to perform ;; the primitive completion operations, fancy candidates require some ;; extra processing. ;; ;; All fancy candidates must first be converted to a form that such ;; primitives can understand. During completion, fancy candidates ;; must sometimes be displayed specially, for example using ;; particular faces. And after completion, the completion result ;; must sometimes be converted back again to retrieve some or all of ;; the original candidate information. ;; ;; This conversion (encoding and decoding) can be costly, especially ;; when there are many candidates. For this reason, it is turned ;; off, by default, so it that does not represent overhead during ;; completion of non-fancy candidates. ;; ;; In order to use `completing-read' with fancy candidates, you must ;; do one of the following in your code: ;; ;; 1. Propertize at least the first character of the ;; `completing-read' PROMPT argument string with a non-`nil' text ;; property `icicle-fancy-candidates'. This turns on processing ;; of fancy candidates for the duration of the `completing-read' ;; call. ;; ;; 2. Bind variable `icicle-fancy-candidates-p' to non-`nil'. ;; ;; 3. Bind variable `icicle-whole-candidate-as-text-prop-p' to ;; non-`nil'. ;; ;; You use method 1 or 2 to handle multi-completion candidates or ;; candidates that have text properties or are otherwise to be ;; displayed specially. I recommend that you generally use text ;; property `icicle-fancy-candidates', not variable ;; `icicle-fancy-candidates-p'. The variable is provided so that you ;; can widen the scope of this feature beyond a given call to ;; `completing-read'. You will need to do that only rarely. ;; ;; A use case for variable `icicle-fancy-candidates-p' would be, for ;; instance, if your code calls other code that calls ;; `completing-read', so you have no direct access to the ;; `completing-read' PROMPT argument in order to propertize it. If ;; you nevertheless want to use some fancy candidates, then you can ;; bind `icicle-fancy-candidates-p' with the scope you want. ;; ;; You use method 3, `icicle-whole-candidate-as-text-prop-p', when ;; you need to save and later retrieve all of the information ;; contained in an alist COLLECTION entry. Completion returns only a ;; string. If the COLLECTION alist has only one entry with a given ;; string as its car, then you can simply use `assoc' to retrieve the ;; whole entry. ;; ;; But if you use an alist that allows entries with different cdrs ;; for the same car, then you need some way to encode an entire alist ;; entry in a display string. When you have this need, set variable ;; `icicle-candidates-alist' to the alist, and bind ;; `icicle-whole-candidate-as-text-prop-p' to non-`nil'. ;; ;; This has the effect of encoding, as a text property on the ;; candidate display string, the entire corresponding original alist ;; entry. You can then use `icicle-get-alist-candidate' to recover ;; that information. ;;(@* "Programming Multi-Completions") ;; ;; Programming Multi-Completions ;; ----------------------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;; Multi-completions are completion candidates that are composed of ;; parts separated by `icicle-list-join-string'. See ;; (@file :file-name "icicles-doc1.el" :to "Multi-Completions") for ;; information about how users interact with multi-completions. ;; ;; Multi-completions are examples of fancy candidates. ;; See (@> "Programming with Fancy Candidates"). ;; ;; You can define your own Icicles commands that use ;; multi-completions. You can bind `icicle-list-join-string' to any ;; string you like, depending on your needs. See ;; (@file :file-name "icicles-doc1.el" :to "Key Completion") for an ;; example where it is bound to " = ". This section describes two ;; additional variables that you can bind to affect the appearance ;; and behavior of multi-completions. ;; ;;(@* "Variable icicle-list-use-nth-parts") ;; ** Variable icicle-list-use-nth-parts ** ;; ;; Variable `icicle-list-use-nth-parts' affects the minibuffer ;; behavior of multi-completions. If you bind this to a list of ;; whole numbers, then multi-completion candidates are transformed ;; using those numbers as indexes. During completion and cycling, ;; whenever a sole candidate matches the user input, if that ;; candidate is a multi-completion, then it is transformed by ;; extracting and possibly reordering its parts according to ;; `icicle-list-use-nth-parts'. ;; ;; The actual candidate to match is still the original candidate; the ;; transformation takes place after matching, for final insertion in ;; the minibuffer. This means that you must use this feature only ;; with lax (permissive) completion, since strict completion requires ;; an exact match against the original completion candidate, and the ;; transformed candidate will normally not match the original. ;; ;; Variable `icicle-list-use-nth-parts' works as follows. The ;; matching candidate is split at each `icicle-list-join-string' into ;; its component parts. The indexes in `icicle-list-use-nth-parts' ;; are then used to extract parts, in the same order as the indexes ;; appear. The extracted parts are joined back together in an order ;; that you specify, separated by the value of user option ;; `icicle-list-nth-parts-join-string'. An index greater than the ;; number of parts means to use the last part. ;; ;; For example: If the value of `icicle-list-use-nth-parts' is (1), ;; then only the first part of the multi-completion is used as the ;; completion candidate. If the value is (2 1), then the resulting ;; candidate is the second part followed by the first part, the two ;; parts being joined by `icicle-list-nth-parts-join-string'. If the ;; value is (1 99) and the multi-completion has fewer than 99 parts, ;; then the first and last parts are used. If the value is (2 1 2), ;; then the resulting candidate is composed of the second part ;; followed by the first part followed by the second part again. ;; ;; Thus, you can use a given part any number of times. You can also ;; mix multi-completions and single-string completions, and you can ;; mix multi-completions composed of different numbers of strings. ;; For example, a set of completions might be: ;; ;; ((("cmd1" "description of cmd1")) ;; (("cmd2" "description of cmd" "more")) ;; (("cmd3"))) ;; ;; If you use multi-completions with `icicle-list-use-nth-parts' in ;; your own commands, please make sure that their doc strings let ;; users know what to expect, and remind them of the behavior of ;; option `icicle-list-nth-parts-join-string'. Let them know, in ;; particular, that: ;; ;; * They can match any part of a candidate as it is displayed in ;; buffer `*Completions*'. ;; ;; * The candidate choice they make will in fact have the form that ;; you define in your command. ;; ;; * They can control how the parts are joined, using option ;; `icicle-list-nth-parts-join-string'. ;; ;;(@* "Variable icicle-candidate-properties-alist") ;; ** Variable icicle-candidate-properties-alist ** ;; ;; Whereas variable `icicle-list-nth-parts-join-string' affects the ;; appearance of multi-completions in the minibuffer, variable ;; `icicle-candidate-properties-alist' affects their appearance in ;; buffer `*Completions*'. You use it to apply text properties to ;; individual parts of a multi-completion, where the parts are ;; defined in the same way as for `icicle-list-use-nth-parts'. ;; ;; This feature affects all candidates the same way. See also ;; (@> "Candidates with Text Properties") for ways to apply text ;; properties to individual candidates (which need not be ;; multi-completions). ;; ;; The value of `icicle-candidate-properties-alist' is an alist whose ;; entries have either of these forms: ;; ;; (NTH PROPERTIES) or (NTH PROPERTIES JOIN-TOO) ;; ;; NTH is the number of the target multi-completion part. ;; ;; PROPERTIES is a list of text properties to apply to the NTH part. ;; ;; JOIN-TOO is optional. If it is present and non-`nil', then the ;; text properties are also applied to the join string that follows ;; the target part. ;; ;; You can use any text properties, including `invisible', `keymap', ;; `display', and properties that you define yourself and that have ;; meaning to only your code. ;; ;; As an example of its use, commands `icicle-fundoc', ;; `icicle-vardoc', `icicle-doc', and `icicle-plist' bind ;; `icicle-candidate-properties-alist' to ;; ((1 (face 'icicle-candidate-part))), so that the first part of ;; each multi-completion candidate is highlighted using face ;; `icicle-candidate-part'. ;; ;; Here is another example value of ;; `icicle-candidate-properties-alist': ;; ;; ((3 (face 'underline)) ;; (2 (invisible t) t)) ;; ;; The first entry underlines the third multi-completion part. The ;; second entry makes both the second part and the join string that ;; follows it invisible. ;; ;; One use of making a completion part invisible is so that you can ;; sort candidates using it, and let users match input against it, ;; but not have it appear explicitly. ;; ;; Recall that `completing-read' displays only the car of each ;; element present in its COLLECTION (alist) argument. For example, ;; if you pass `completing-read' an alist such as (("foo" . 2) ("bar" ;; . 3)), then only `foo' and `bar' are displayed as candidates. ;; However, the PREDICATE argument to `completing-read' applies to ;; the entire alist element, and your command that calls ;; `completing-read' might well use the chosen candidate (e.g. `foo') ;; to look up the entire element (e.g. ("foo" . 2)) for further ;; processing. Several Icicles commands, including `icicle-search', ;; do that. ;; ;; However, sometimes you might want the user to be able to match ;; against the additional information (e.g. 2 and 3), and you might ;; want to use it to sort candidates. In that case, you can use the ;; alist (("foo 2") ("bar 3")). In cases where the additional ;; information can be distracting, you can use multi-completion with ;; `icicle-candidate-properties-alist' to hide it: Pass the alist ;; ((("foo "2")) (("bar" 3"))) and use ((2 (invisible t))) for ;; `icicle-candidate-properties-alist'. ;; ;; Keep in mind that hiding completion parts can be confusing to ;; users. Do so with care, and let your users know what to expect. ;; Inform them that there are invisible parts that are nevertheless ;; taken into account for input matching and candidate sorting. When ;; you hide parts, you will often want to omit them from the ;; minibuffer as well, using `icicle-list-use-nth-parts', to avoid ;; confusion. ;; ;; Consider also the position of a hidden part: In some cases you ;; might want to place it first among the multi-completion parts, but ;; in many cases you will want to place it last, to minimize ;; interference with prefix-completion matching. ;; ;; Similar considerations apply to other text properties, such as ;; `display' and `keymap', that change the appearance or behavior of ;; a completion candidate. ;; ;;(@* "What You See Is Not What You Get") ;; ** What You See Is Not What You Get ** ;; ;; While on the subject of confusing users, let me point out a ;; general drawback that is common to both ;; `icicle-list-use-nth-parts' and ;; `icicle-candidate-properties-alist': *not* WYSIWYG. Keep this in ;; mind if you decide to take advantage of these variables. Users ;; see one thing, choose it, and they get something different as a ;; result. That promotes confusion that you will need to weigh ;; against the possible benefits. ;; ;; Users are confused, because what they choose is not exactly what ;; they get. What's more, a user's completion choice is not ;; reflected in the input history, leading to further confusion. For ;; example, Icicles highlighting of previously used inputs in buffer ;; `*Completions*' does not apply to such a candidate, even though it ;; was previously entered using `RET'. It is the transformed ;; candidate that was entered, not the candidate as it was proposed ;; for choosing, so when that candidate is proposed again, it is not ;; recognized as having been previously chosen. ;; ;; The bottom line here is this: variables ;; `icicle-list-use-nth-parts' and ;; `icicle-candidate-properties-alist' are useful in certain ;; contexts, but be aware of the downside: confusing your users. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;; * (@> "Programming with Fancy Candidates") ;; * (@> "Candidates with Text Properties") ;;(@* "Candidates with Text Properties") ;; ;; Candidates with Text Properties ;; ------------------------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;; Section (@> "Programming Multi-Completions") explains how to apply ;; text properties to specific parts of all multi-completion ;; candidates in buffer `*Completions*' at the same time. This ;; section tells you how to apply text properties to specific ;; candidates in `*Completions*'. The candidates need not be ;; multi-completions, but in some cases they can be. ;; ;; When you use candidates with text properties such as `face' that ;; are visible, the display candidates in `*Completions*' show those ;; properties. In addition, the candidate string that the user ;; finally chooses can also be propertized. ;; ;; There are four different methods for providing candidates with ;; text properties, in addition to the way presented in section ;; (@> "Programming Multi-Completions"): ;; ;; 1. Apply face `icicle-special-candidate' to all candidates that ;; match a given regexp. ;; ;; 2. Use a set of text properties as the `icicle-special-candidate' ;; property of the symbol that represents the candidate. The text ;; properties are transferred to the string candidate that is ;; displayed (and returned). ;; ;; 3. Use a propertized string as the `icicle-display-string' ;; property of the symbol that represents the candidate. That ;; string replaces the candidate that would otherwise have been ;; displayed, completed against, and returned. ;; ;; 4. Start with a propertized string in the COLLECTION argument ;; that you pass to `completing-read'. ;; ;; All four methods use fancy candidates, in the sense that they go ;; beyond what vanilla Emacs offers. For methods 1-3, you must turn ;; on fancy-candidate handling. See ;; (@> "Programming with Fancy Candidates"). ;; ;; But method 4 does not require any costly fancy-candidate encoding ;; or decoding, because the Icicles implementation of ;; `completing-read' handles propertized string candidates, and they ;; are transparent to the Emacs primitive completion operations. ;; ;; The following sections explain methods 1-4 individually. ;; ;;(@* "Using Regexp `icicle-special-candidate-regexp'") ;; ** Using Regexp `icicle-special-candidate-regexp' ** ;; ;; If you just want several candidates to have face ;; `icicle-special-candidate' in `*Completions', you can simply ;; define (e.g. bind) option `icicle-special-candidate-regexp' to a ;; regexp that matches those candidates. The original candidates can ;; be strings or symbols. Unlike the other methods described here, ;; this one affects only the display in `*Completions'; the ;; completion return string does not have face ;; `icicle-special-candidate'. ;; ;; The highlighting applies only to the part of a candidate that ;; matches the regexp. This selectivity is particularly useful when ;; dealing with multi-completions. Function `icicle-read-file-name' ;; provides an example: file names that match ".+/$", that is, ;; directory names, are highlighted as special candidates. Function ;; `icicle-read-color-wysiwyg' provides another example (using the ;; similar, but internal, variable `icicle-proxy-candidate-regexp'): ;; proxy color-name candidates such as `*point foreground*' and ;; `'icicle-region-background'' are highlighted, but not their color ;; swatches. ;; ;;(@* "Using Property icicle-special-candidate") ;; ** Using Property icicle-special-candidate ** ;; ;; In this approach, you use the desired list of text properties as ;; the value of property `icicle-special-candidate' for the symbol ;; that represents the candidate. This method affects the candidates ;; that are used during completion, as well as the completion return ;; value. ;; ;; If the candidate is a string, not a symbol, then `intern' it and ;; put the property on the resulting symbol. If you want the effect ;; to be temporary, then set property `icicle-special-candidate' for ;; the candidate to `nil' when completion is finished. ;; ;; As a shortcut, if you use the value `t' instead of a property list ;; for property `icicle-special-candidate', then face ;; `icicle-special-candidate' will be used as the `face' property of ;; the candidate. Using a value of `t' is thus equivalent to using a ;; value of (face icicle-special-candidate). This approach is used, ;; for instance, in the definition of command `icicle-complete-keys' ;; (`S-TAB'). ;; ;;(@* "Using Property `icicle-display-string'") ;; ** Using Property `icicle-display-string' ** ;; ;; This method is similar to that of using property ;; `icicle-special-candidate'. The use case for both is ;; propertizing, in a general way, candidates that are symbols. Both ;; can be useful when you have an obarray as the COLLECTION argument ;; for `completing-read'. ;; ;; In this method the symbol name is not used at all; the candidate ;; is entirely replaced by another string, which is typically ;; propertized. ;; ;; You use a propertized string as the value of property ;; `icicle-display-string' for the candidate symbol. The propertized ;; string is displayed in `*Completions*' and returned as the final ;; completion choice. ;; ;; Note that multi-completion is not available when you use an ;; obarray. Using property `icicle-special-candidate' or ;; `icicle-display-string' you can propertize candidates and parts of ;; candidates, but you cannot manipulate multi-completion parts and ;; there are no join or end strings. ;; ;;(@* "Applying Text Properties to a Candidate String") ;; ** Applying Text Properties to a Candidate String ** ;; ;; This is the most flexible approach, and it is explained in a bit ;; more detail. It can be used with multi-completions, and it ;; affects the `*Completions*' display and the completion return ;; value. However, it is limited to using an alist or list of ;; strings, not an obarray, as the COLLECTION argument to ;; `completing-read'. ;; ;; In this approach, you simply apply the text properties to the ;; string(s) that represent the candidate, which you then pass to ;; `completing-read' in its COLLECTION parameter. ;; ;; As with the other methods, you can use any text properties you ;; like, including these: ;; ;; * `face' - to make some completion candidates stand out in ;; particular ways ;; ;; * `icicle-mode-line-help' - candidate help shown in the mode-line ;; when the candidate is current, provided option ;; `icicle-help-in-mode-line-delay' is greater than zero (only the ;; first character of a candidate string is tested for this text ;; property). ;; ;; If the property value is not a string then it should be a ;; function, which is applied to the candidate string to obtain the ;; help string. ;; ;; * `help-echo': ;; - same as `icicle-mode-line-help', if that property is `nil' ;; - candidate help shown in a mouseover tooltip, provided ;; `tooltip-mode' is on ;; ;; * `keymap' and `pointer' - for individualized mouse treatment of ;; candidates ;; ;; * `display' - to include images in candidates ;; ;; * `invisible' - to hide part or all of particular candidates ;; (which are nevertheless available for completion) ;; ;; As a convenience, you can use function ;; `icicle-candidate-short-help' to apply both ;; `icicle-mode-line-help' and `help-echo' text properties to a ;; candidate string. ;; ;; How does this work? Icicles redefines the standard Emacs function ;; `display-completion-list' so that it retains text properties. ;; Emacs should do the same, but it does not (yet). ;; ;; Icicles command `icicle-read-color-wysiwyg' presents an ;; illustration, using the `face' property. (It also uses properties ;; `icicle-mode-line-help' and `help-echo', to provide RGB and HSV ;; information in the mode-line and via tooltip.) ;; ;; In `icicle-read-color-wysiwyg', a multi-completion candidate is ;; used, composed of an unpropertized string that names a color and a ;; propertized string that names its RGB (red, green, blue) value. ;; The RGB string, by default, has a background of the same color - ;; each completion candidate is thus accompanied by its own color ;; swatch. ;; ;; The code that does this is function `icicle-make-color-candidate', ;; which is used by `icicle-read-color-wysiwyg' and other Icicles ;; commands that read colors. Here is a simplified definition: ;; ;; (defun icicle-make-color-candidate (color-name) ;; "Return candidate of COLOR-NAME and its hex RGB string. ;; If `icicle-WYSIWYG-Completions-flag' is non-nil, then the hex RGB ;; string has the color as its background text property." ;; (let ((rgb-string (hexrgb-color-name-to-hex color-name))) ;; (when icicle-WYSIWYG-Completions-flag ;; (put-text-property ;; 0 (length rgb-string) 'face ;; (cons 'background-color rgb-string) rgb-string)) ;; (list (list color-name rgb-string)))) ;; ;; You'll notice that the face property is added only when option ;; `icicle-WYSIWYG-Completions-flag' is non-`nil'. You can toggle ;; this option at any time during completion to change the behavior. ;; (The new value takes effect for the next act of completion.) ;; ;; You can match any part of the multi-completion: color name or RGB ;; value. Command `icicle-read-color-wysiwyg' defines a set of sort ;; orders that are pertinent to the color candidates. ;; ;; You can use `C-,' to sort by color name, amount of red, blue, ;; green, all RGB components (in order), RGB distance from a base ;; color, hue, saturation, value, all HSV components (in order), or ;; HSV distance from a base color. ;; ;; If option `icicle-add-proxy-candidates-flag' is non-`nil', then ;; command `icicle-read-color-wysiwyg' includes proxy completion ;; candidates that are not color-name-and-RGB pairs. As always, you ;; can toggle the use of proxy candidates using `C-M-_' in the ;; minibuffer. ;; ;; The proxy candidates for colors include the single-quoted names of ;; user options (variables) whose custom type is `color'. So, for ;; example, option `icicle-region-background' appears as proxy color ;; candidate `'icicle-region-background''. Color proxies also include ;; the following: ;; ;; * `*copied foreground*' - last copied foreground, if available ;; * `*copied background*' - last copied background, if available ;; * `*mouse-2 foreground*' - foreground where you click `mouse-2' ;; * `*mouse-2 background*' - background where you click `mouse-2' ;; * `*point foreground*' - foreground under the text cursor ;; * `*point background*' - background under the text cursor ;; ;; When you choose a proxy color candidates, the color referred to is ;; used. For example, `*point foreground*' means to use the ;; foreground color at the cursor position (point), whatever it might ;; be. Choosing a `mouse-2' candidate lets you then click `mouse-2' ;; to pick up a color somewhere. If you use library `palette.el' or ;; `eyedropper.el', and you have already copied a color, then you can ;; choose `*copied foreground*' (or background) to use that color. ;; ;; Icicles treats reading face names similarly to reading colors, by ;; redefining standard function `read-face-name' when you are in ;; Icicle mode. In this case, multi-completions are not used. The ;; pertinent function is `icicle-make-face-candidate', which provides ;; a WYSIWYG face sample whenever `icicle-WYSIWYG-Completions-flag' ;; is non-`nil'. ;; ;; A string value for `icicle-WYSIWYG-Completions-flag' presents the ;; face name accompanied by that string as a separate sample swatch. ;; A value of `t' presents the face name itself in the face it names. ;; ;; (defun icicle-make-face-candidate (face) ;; "Return a completion candidate for FACE. ;; The value of option `icicle-WYSIWYG-Completions-flag' determines ;; the kind of candidate to use. ;; If nil, then the face name is used (a string). ;; ;; If a string, then a multi-completion candidate is used, with the ;; face name followed by a sample swatch using FACE on the string's ;; text. ;; ;; If `t', then the candidate is the face name itself, propertized ;; with FACE." ;; (if (stringp icicle-WYSIWYG-Completions-flag) ;; (let ((swatch (copy-sequence ;; icicle-WYSIWYG-Completions-flag))) ;; (put-text-property ;; 0 (length icicle-WYSIWYG-Completions-flag) ;; 'face face swatch) ;; (list (list (symbol-name face) swatch))) ;; (let ((face-name (copy-sequence (symbol-name face)))) ;; (when icicle-WYSIWYG-Completions-flag ;; (put-text-property 0 (length face-name) ;; 'face face face-name)) ;; (list face-name)))) ;; ;; See Also: ;; ;; * (@> "Programming with Fancy Candidates") ;; * (@> "Programming Multi-Completions") ;; * (@file :file-name "icicles-doc1.el" :to "Sorting Candidates and Removing Duplicates") ;; for information about changing sort orders. ;; ;; * (@file :file-name "icicles-doc1.el" :to "*Completions* Display") for ;; more about proxy candidates. ;;(@* "Defining Icicles Commands (Including Multi-Commands)") ;; ;; Defining Icicles Commands (Including Multi-Commands) ;; ---------------------------------------------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;;(@* "Nothing To It!") ;; ** Nothing To It! ** ;; ;; Defining a command that uses Icicles completion and cycling is ;; simple: just call `completing-read' or `read-file-name' to read ;; input, then act on that input. ;; ;; Nothing could be simpler - just use `completing-read'or ;; `read-file-name'! Icicles does the rest. This is the most ;; important thing to learn about defining Icicles commands: you do ;; not need to do anything except call `completing-read' or ;; `read-file-name' as you would normally anyway. ;; ;; Or at least as I HOPE you would normally. I fear that many ;; Emacs-Lisp programmers do not take sufficient advantage of ;; `completing-read' when they could, using instead a function such ;; as (quel horreur !) `read-string' to read user input. ;; ;;(@* "Multi-Commands Are Easy To Define Too") ;; ** Multi-Commands Are Easy To Define Too ** ;; ;; If defining an Icicles command is trivial, so is defining an ;; Icicles multi-command. For the same effort it takes to define a ;; command that acts on a single input choice, you can have a command ;; that acts on any number of input choices. A multi-command takes ;; advantage of one or more action functions when cycling candidates, ;; as described in sections ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands"), ;; (@> "More about Multi-Commands"), and ;; (@file :file-name "icicles-doc1.el" :to "Choose All Completion Candidates"). ;; ;; In fact, there is no reason NOT to define your commands as ;; multi-commands - you lose nothing, and you gain a lot. Whenever ;; it is appropriate for a user to possibly want to act on multiple ;; objects, define a multi-command that does that. ;; ;; An anecdote, to make the point. An Icicles user sent me an email ;; saying how much he appreciated Icicles multi-commands, and asking ;; if I would add a multi-command version of `insert-buffer'. I did ;; so, but I replied to him that the definition is trivial: it is ;; identical to the definition of `icicle-buffer', except that the ;; action function is `insert-buffer' instead of `switch-to-buffer'. ;; ;; The point is to not be afraid of defining multi-commands yourself. ;; You do not really need to have me add a multi-command to Icicles ;; in most cases; you can easily define it yourself. Here is a ;; simple definition of `icicle-insert-buffer'. You will understand ;; it in detail after reading the next section. ;; ;; (icicle-define-command icicle-insert-buffer ;; "Multi-command version of `insert-buffer'." ; Doc string ;; insert-buffer ; Action function ;; "Buffer: " ; `completing-read' args ;; (mapcar #'(lambda (buf) (list (buffer-name buf))) (buffer-list)) ;; nil t nil 'buffer-name-history ;; (icicle-default-buffer-names current-prefix-arg) nil) ;; ;; Macros `icicle-define-command' and `icicle-define-file-command' ;; make it easy to define a multi-command. Without them, it is ;; sometimes not so easy, depending on the complexity of your action ;; functions. See (@> "Defining Multi-Commands the Hard Way") for a ;; taste of what is involved. If you read that section first, make ;; sure you come back here to see how easy things can be. ;; ;; Here is how you might define a multi-command to delete one or more ;; files or directories: ;; ;; 1. Define the multi-command, `my-delete-file': ;; ;; (icicle-define-file-command ;; my-delete-file ; Command name ;; "Delete a file or directory." ; Doc string ;; my-delete-file-or-directory ; Function to perform the action ;; "Delete file or directory: " ; `read-file-name' arguments... ;; default-directory nil t) ;; ;; 2. Define the action function that deletes a single file: ;; ;; (defun my-delete-file-or-directory (file) ;; "Delete file (or directory) FILE." ;; (condition-case i-delete-file ;; (if (eq t (car (file-attributes file))) ;; (delete-directory file) ;; (delete-file file)) ;; (error (message "%s" (error-message-string i-delete-file)) ;; (error "%s" (error-message-string i-delete-file))))) ;; ;; There are two parts to the definition of `my-delete-file': ;; ;; 1. The definition of the command itself, using ;; `icicle-define-file-command'. ;; ;; 2. The definition of an action function, ;; `my-delete-file-or-directory', which deletes a single file (or ;; directory), given its name. ;; ;; It is #1 that is of interest here, because that is essentially ;; what you do to define any multi-command. ;; ;; The details of #2 are less interesting, even if more complex in ;; this case: `my-delete-file-or-directory' checks whether its ;; argument is a file or directory, and then tries to delete it. If ;; an error occurs, it prints the error message and then returns the ;; message, so that the calling command can report on all deletion ;; errors. ;; ;; In #1, the arguments to `icicle-define-file-command' are ;; straightforward: ;; ;; * The name of the command being defined `my-delete-file'. ;; ;; * Its doc string. ;; ;; * The function that actually performs the action on the input file ;; name - `my-delete-file-or-directory'. ;; ;; * The arguments that you would supply anyway to `read-file-name' ;; to read a single file name. ;; ;; These are the SAME things you would need if you were defining a ;; simple command to delete a SINGLE file or directory. The only ;; differences here are that you: ;; ;; * Use `icicle-define-file-command' instead of `defun' with an ;; `interactive' spec. ;; ;; * Separate the action code into a separate function (here, ;; `my-delete-file-or-directory') that acts on a single object ;; (here, a file). ;; ;; When you use `icicle-define-file-command', the action function is ;; called on the result of `read-file-name', and it is also bound to ;; `icicle-candidate-action-fn', so that it will be applied to the ;; current candidate via `C-RET' or `C-mouse-2'. ;; ;; Command `icicle-all-candidates-action' (`C-!' -- see ;; (@file :file-name "icicles-doc1.el" :to "Choose All Completion Candidates")) ;; can report in buffer `*Help*' on the objects that it did not act ;; upon successfully. For this reporting to work, the function bound ;; to `icicle-candidate-action-fn' ;; (e.g. `my-delete-file-or-directory', above) should return `nil' ;; for "success" and non-`nil' (for example, an error message) for ;; "failure", whatever "success" and "failure" might mean in the ;; particular context of use. This is not a requirement, except if ;; you want to take advantage of such reporting. For a command that ;; deletes files, it is important to let the user know which ;; deletions failed when s?he tries to delete all matching candidates ;; at once. ;; ;; If the command you want to define acts on objects other than ;; files, then use `icicle-define-command' instead of ;; `icicle-define-file-command' - the only difference is that you ;; then supply the arguments for `completing-read' instead of those ;; for `read-file-name'. ;; ;; To let users know that a command is a multi-command, and how to ;; use it as such, `icicle-define-command' and ;; `icicle-define-file-command' automatically add this explanation to ;; the doc string you provide for the multi-command: ;; ;; --- ;; Read input, then call `' to act on it. ;; ;; Input-candidate completion and cycling are available. While ;; cycling, these keys with prefix `C-' are active: ;; ;; `C-mouse-2', `C-RET' - Act on current completion candidate only ;; `C-down', `C-wheel-down'-Move to next completion candidate and act ;; `C-up', `C-wheel-up'-Move to previous completion candidate and act ;; `C-next' - Move to next apropos-completion candidate and act ;; `C-prior' - Move to previous apropos-completion candidate and act ;; `C-end' - Move to next prefix-completion candidate and act ;; `C-home' - Move to previous prefix-completion candidate and act ;; `C-!' - Act on *all* candidates, successively (careful!) ;; ;; When candidate action and cycling are combined (e.g. `C-next'), user ;; option `icicle-act-before-cycle-flag' determines which occurs first. ;; ;; With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', ;; `C-M-RET', `C-M-down', and so on) provide help about candidates. ;; ;; Use `mouse-2', `RET' or `S-RET' to finally choose a candidate, or ;; `C-g' to quit. ;; ;; This is an Icicles command - see `icicle-mode'. ;; --- ;; ;; Notice that the doc string of your new multi-command references ;; your action function (e.g. `my-delete-file-or-directory'). The ;; doc string you provide for the multi-command can thus be a little ;; more abstract, leaving any detailed explanation of the action to ;; the doc string of your action function. ;; ;; To provide more flexibility, `icicle-define-command' and ;; `icicle-define-file-command' provide some predefined key bindings ;; and allow for additional arguments. ;; ;; Here is a definition of a multi-command, `change-font', that reads ;; a font name and changes the selected frame to use that font. ;; ;; 1 (icicle-define-command ;; 2 change-font "Change font of current frame." ;; 3 (lambda (font) ;; 4 (modify-frame-parameters orig-frame ;; 5 (list (cons 'font font)))) ;; 6 "Font: " (mapcar #'list (x-list-fonts "*")) ;; 7 nil t nil nil nil nil ;; 8 ((orig-frame (selected-frame)) ;; 9 (orig-font (frame-parameter nil 'font))) ;; 10 nil ;; 11 (modify-frame-parameters orig-frame ;; 12 (list (cons 'font orig-font))) ;; 13 nil) ;; ;; The arguments to `icicle-define-command' here are as follows: ;; ;; Command name (line 2) ;; Doc string (line 2) ;; Action function (lines 3-5) ;; Args passed to `completing-read' (lines 6-7) ;; Additional bindings (lines 8-9) ;; Additional initialization code (line 10) ;; "Undo" code to run in case of error or user quit (lines 11-12) ;; Additional code to run at the end (line 13) ;; ;; The following bindings are predefined - you can refer to them in ;; the command body: ;; ;; `icicle-orig-buff' is bound to (current-buffer) ;; `icicle-orig-window' is bound to (selected-window) ;; ;; Before running any "undo" code that you supply, the original ;; buffer is restored, in case of error or user quit (`C-g'). ;; ;; Most of the arguments to `icicle-define-command' are optional. In ;; this case, optional arguments were provided to save (lines 8-9) ;; and then restore (lines 11-12) the original font and frame. ;; ;; Several top-level Icicles commands have been defined using ;; `icicle-define-command' and `icicle-define-file-command'. You can ;; use their definitions as models for your own multi-commands. ;; ;; `clear-option' (alias) - Set value of binary option to `nil' ;; `icicle-add-buffer-candidate' - Add buffer to those always shown ;; `icicle-add-buffer-config' - Add to `icicle-buffer-configs' ;; `icicle-bookmark' - Jump to a bookmark ;; `icicle-bookmark-all-tags' - Jump: bookmark with all matching tags ;; `icicle-bookmark-all-tags-regexp' - ... matching a regexp ;; `icicle-bookmark-bookmark-list-' - Jump: bookmark-list bookmark ;; `icicle-bookmark-desktop' - Jump: bookmarked desktop ;; `icicle-bookmark-dired' - Jump: bookmarked Dired state ;; `icicle-bookmark-file' - Jump: bookmarked file ;; `icicle-bookmark-gnus' - Jump: bookmarked Gnus message ;; `icicle-bookmark-info' - Jump: bookmarked Info node ;; `icicle-bookmark-list' - Choose a list of bookmarks or their names ;; `icicle-bookmark-local-file' - Jump: bookmarked local file ;; `icicle-bookmark-man' - Jump: bookmarked `man' page ;; `icicle-bookmark-non-file' - Jump: bookmarked non-file buffer ;; `icicle-bookmark-region' - Jump: bookmarked region ;; `icicle-bookmark-remote-file' - Jump: bookmarked remote file ;; `icicle-bookmark-some-tags'- Jump: bookmark with some matching tag ;; `icicle-bookmark-some-tags-regexp'- matching a regexp ;; `icicle-bookmark-specific-buffers'- Jump: specific-buffer bookmark ;; `icicle-bookmark-specific-files' - Jump: specific-file bookmark ;; `icicle-bookmark-this-buffer' - Jump: bookmark for this buffer ;; `icicle-bookmark-url' - Jump: bookmarked URL ;; `icicle-bookmark-w3m' - Jump: W3M bookmark ;; `icicle-buffer' - Switch to another buffer ;; `icicle-buffer-config' - Choose a config for buffer commands ;; `icicle-buffer-list' - Choose a list of buffer names ;; `icicle-choose-faces' - Choose a list of face names ;; `icicle-choose-invisible-faces' - Choose list of invisible faces ;; `icicle-choose-visible-faces' - Choose list of visible faces ;; `icicle-clear-history' - Clear entries from minibuffer histories ;; `icicle-clear-current-history' - Clear current history entries ;; `icicle-color-theme' - Change color theme ;; `icicle-comint-command' - Reuse a previous command in comint mode ;; `icicle-command-abbrev' - Execute command or command abbreviation ;; `icicle-command-abbrev-command' - Execute command from abbrev ;; `icicle-completing-yank' - Yank text using completion ;; `icicle-delete-file' - Delete a file or directory ;; `icicle-delete-windows' - Delete windows showing a buffer anywhere ;; `icicle-describe-option-of-type' - Describe option of a given type ;; `icicle-directory-list' - Choose a list of directory names ;; `icicle-dired' - Visit a directory in Dired mode ;; `icicle-doc' - Display doc of function, variable, or face ;; `icicle-execute-extended-command' - ;; A multi-command version of `M-x' ;; `icicle-execute-named-keyboard-macro' - Execute named kbd macro ;; `icicle-face-list' - Choose a list of face names ;; `icicle-file-list' - Choose a list of file names ;; `icicle-file' - Visit a file or directory ;; `icicle-find-file' - Visit a file or directory (relative) ;; `icicle-find-file-absolute' - Visit a file (absolute) ;; `icicle-find-file-all-tags' - Visit a file with all matching tags ;; `icicle-find-file-all-tags-regexp' - ... matching a regexp ;; `icicle-find-file-in-tags-table' - Visit a file in a tags table ;; `icicle-find-file-read-only' - Visit a file in read-only mode ;; `icicle-find-file-some-tags'- Visit a file with some matching tags ;; `icicle-find-file-some-tags-regexp' - ... matching a regexp ;; `icicle-find-file-tagged' - Visit a file with matching tags ;; `icicle-find-first-tag' - Visit source-code definition with tag ;; `icicle-font' - Change the frame font ;; `icicle-frame-bg' - Change the frame background color ;; `icicle-frame-fg' - Change the frame foreground color ;; `icicle-fundoc' - Display the doc of a function ;; `icicle-Info-menu' - Go to an Info menu node ;; `icicle-increment-option' - Increment option value using arrows ;; `icicle-increment-variable' - Increment variable value ;; `icicle-insert-buffer'- Insert a buffer ;; `icicle-insert-thesaurus-entry' - Insert an entry from a thesaurus ;; `icicle-keyword-list' - Choose a list of keywords (regexps) ;; `icicle-kill-buffer' - Kill a buffer ;; `icicle-kmacro' - Execute a keyboard macro (Emacs 22+) ;; `icicle-locate-file' - Open a file located anywhere ;; `icicle-pick-color-by-name' - Set current highlighting color ;; `icicle-plist' - Choose a symbol and its property list ;; `icicle-recent-file' - Open a recently used file ;; `icicle-remove-buffer-candidate' - ;; Remove buffer from those always shown ;; `icicle-remove-buffer-config' - ;; Remove from `icicle-buffer-configs' ;; `icicle-remove-file-from-recentf-list' - Remove from recent files ;; `icicle-remove-saved-completion-set' - Remove a set from ;; `icicle-saved-completion-sets' ;; `icicle-reset-option-to-nil' - ;; Set value of binary option to `nil' ;; `icicle-search-all-tags-bookmark'- Search bookmark with given tags ;; `icicle-search-all-tags-regexp-bookmark'- ... tags matching regexp ;; `icicle-search-autofile-bookmark' - Search an autofile bookmark ;; `icicle-search-bookmark' - Search a bookmark ;; `icicle-search-bookmark-list-bookmark' - Search bookmark-list bmk ;; `icicle-search-dired-bookmark' - Search a Dired bookmark ;; `icicle-search-file-bookmark' - Search a bookmarked file ;; `icicle-search-gnus-bookmark' - Search a bookmarked Gnus message ;; `icicle-search-info-bookmark' - Search a bookmarked Info node ;; `icicle-search-local-file-bookmark' - Search a local-file bookmark ;; `icicle-search-man-bookmark' - Search a bookmarked `man' page ;; `icicle-search-non-file-bookmark' - Search a bookmarked buffer ;; `icicle-search-region-bookmark' - Search a bookmarked region ;; `icicle-search-remote-file-bookmark' - Search a remote bookmark ;; `icicle-search-some-tags-bookmark'- Search bookmark with some tags ;; `icicle-search-some-tags-regexp-bookmark'- ... matching regexp ;; `icicle-search-specific-buffers-bookmark'- ...specific-buffers bmk ;; `icicle-search-specific-files-bookmark' - ... specific-files bmk ;; `icicle-search-this-buffer-bookmark' - ...bookmark for this buffer ;; `icicle-search-url-bookmark' - Search a bookmarked URL ;; `icicle-search-w3m-bookmark' - Search a W3M bookmark ;; `icicle-select-frame' - Select frame by name and raise it ;; `icicle-select-window' - Select window by its buffer name ;; `icicle-send-signal-to-process' - Send a signal to a process ;; `icicle-set-option-to-t' - Set the value of a binary option to `t' ;; `icicle-synonyms' - Show synonyms that match a regexp ;; `icicle-tag-a-file' - Add one or more tags to a file ;; `icicle-toggle-option' - Toggle the value of a binary option ;; `icicle-untag-a-file' - Remove one or more tags from a file ;; `icicle-vardoc' - Display the doc of a variable ;; `icicle-where-is' - Show key sequences that invoke a command ;; ;; For simplicity, the descriptions of most of these commands are ;; singular actions (e.g. "kill a buffer"), but each of them can be ;; used to act on any number of items any number of times (e.g. kill ;; one or more buffers). I recommend that you follow a similar ;; naming convention - remember that the doc string will let users ;; know that the command can be used on multiple objects. ;; ;; Macros `icicle-define-command' and `icicle-define-file-command' ;; define a multi-command in a simple way. Sometimes you will need a ;; little more flexibility. In that case, you can use higher-order ;; functions `icicle-explore' and `icicle-apply' to define a ;; multi-command. See (@> "Defining Icicles Tripping Commands"). ;; ;;(@* "Are Users Dependent on Icicles To Use Multi-Commands?") ;; ** Are Users Dependent on Icicles To Use Multi-Commands? ** ;; ;; For users to be able to take advantage of the Icicles features ;; that your multi-command provides, they must load Icicles. You can ;; do this for them, by adding (require 'icicles nil t) to your code. ;; The last two arguments mean that no error will be raised if for ;; some reason Icicles cannot be found or successfully loaded. ;; ;; But that brings up another question: What happens to your ;; multi-command if Icicles is not available for a user, or s?he does ;; not want to load it? No problem - your multi-command then ;; automatically turns into a normal, single-choice command - ;; graceful degradation. ;; ;; Similarly, users can always turn off `icicle-mode' at any time, to ;; return to the standard Emacs behavior. ;; ;; Users will, in any case, need to load Icicles at compile time, in ;; order to byte-compile your library that calls macro ;; `icicle-define-command' or `icicle-define-file-command' - either ;; that, or you can duplicate the definition of the macro in your ;; library. To let users load Icicles at (only) compile time, add ;; this to your library that defines multi-commands: ;; ;; (eval-when-compile '(require icicles)) ;; ;; See Also: ;; ;; * (@> "Defining Icicles Tripping Commands") for how to use ;; `icicle-apply' and `icicle-explore' to define browsing commands. ;; ;; * (@> "Defining Multiple-Choice Menus"). ;; ;; * (@> "Note to Programmers") for further programming guidelines. ;; ;; * Library `synonyms.el', which uses `icicle-define-command' to ;; define command `synonyms'. This command lets you use Icicles ;; completion on input regexps when you search a thesaurus. ;;(@* "Defining Icicles Tripping Commands") ;; ;; Defining Icicles Tripping Commands ;; ---------------------------------- ;; ;; Section (@file :file-name "icicles-doc1.el" :to "Icicles Tripping") ;; describes the use of Icicles tripping (aka navigation or browsing) ;; multi-commands. This section tells you how to define your own ;; such commands for custom trips - it is thus for Emacs-Lisp ;; programmers. ;; ;; The best way to learn how to do this is to look at how the ;; existing tripping commands are defined. Some of them use macro ;; `icicle-define-command'; others do not. Some use the ;; building-block functions `icicle-explore' or `icicle-apply'; ;; others do not. Several use `icicle-search' as a building block. ;; ;;(@* "Using `icicle-define-command'") ;; ** Using `icicle-define-command' ** ;; ;; Those that use `icicle-define-command' take advantage of some ;; extraneous way to obtain trip location information from a display ;; candidate, which is just a string. For example, `icicle-bookmark' ;; ultimately uses the display string to look up location information ;; in a bookmarks file. Those that use `icicle-explore' or ;; `icicle-apply' make use of location information stored in the ;; alist COLLECTION argument to `completing-read'. ;; ;; You can also use `icicle-define-command', `icicle-explore', and ;; `icicle-apply' to define multi-commands other than browsing ;; commands - the action function can do anything you like. ;; ;;(@* "Using `icicle-explore'") ;; ** Using `icicle-explore' ** ;; ;; `icicle-explore' is a higher-order function that takes as ;; arguments the following functions, in addition to accepting ;; the optional `completing-read' arguments. ;; ;; * A function to build a candidates alist (COLLECTION) for ;; completion. It fills `icicle-candidates-alist' with the ;; candidates, each of which is a cons with a display candidate ;; string as car and (typically) location information as cdr. For ;; example, `icicle-find-tag' uses the tag text as display ;; candidate and the standard tag-locating information as the cdr: ;; tag info, file path, and goto function. ;; ;; * A function that acts on the candidate finally chosen (`RET'), ;; when completion is finished. ;; ;; * A function to call if the user hits `C-g' during completion. ;; ;; * A function to call if an error is raised during completion. ;; ;; * A function to call after completion is finished, to clean things ;; up. ;; ;; If you also bind `icicle-candidate-action-fn' to a function that ;; takes a display candidate (string) as argument and navigates to ;; the corresponding location, then `icicle-explore' does everything ;; you need for an Icicles trip. You can use function ;; `icicle-get-alist-candidate' to get the location information for a ;; given display candidate. ;; ;;(@* "Using `icicle-apply'") ;; ** Using `icicle-apply' ** ;; ;; `icicle-apply' binds `icicle-candidate-action-fn' appropriately ;; and calls `icicle-explore'. It applies its function argument to ;; completion candidates the user acts on (using `C-RET' etc.). It ;; applies the function to the full alist entry, that is, the display ;; candidate car plus any additional information in the cdr. For a ;; tripping command, the additional information provides a location ;; and the function applied takes you there. ;; ;; This use of an alist that stores location information in the cdrs ;; is what makes `icicle-apply' and `icicle-explore' particularly ;; suitable for defining navigation multi-commands. The Icicles ;; macros `icicle-define-command' and `icicle-define-file-command' ;; make no such provision, but with suitable arguments you can use ;; them too to define tripping commands. ;; ;;(@* "Using `icicle-search'") ;; ** Using `icicle-search' ** ;; ;; `icicle-search' is another high-level function for defining ;; tripping commands. Like `icicle-apply', it calls ;; `icicle-explore', but it also provides features for searching ;; bookmarks, buffers, and files. It takes as arguments the search ;; limits (region), if any, and either a regexp or a function that ;; determines the unfiltered search hits. It does everything else ;; needed to define a trip command that uses search hits as ;; completion candidates. Several predefined Icicles tripping ;; commands were defined using `icicle-search'. ;; ;;(@* "Tripping on Foot") ;; ** Tripping on Foot ** ;; ;; You should be able to define any tripping commands you need using ;; `icicle-explore', `icicle-apply', or `icicle-search'. ;; ;; If, however, for some reason you decide to define one at a lower, ;; pedestrian level (that is, without using any of those building ;; blocks), then bind `icicle-whole-candidate-as-text-prop-p' to `t' ;; around the call to `completing-read'. You can then use ;; `icicle-get-alist-candidate' to retrieve the candidate cdr ;; (e.g. location) information from the completion result. ;; ;; However, if the action or alternate action function that you need ;; modifies the existing set of completion candidates on the fly, as ;; a side effect, then bind `icicle-whole-candidate-as-text-prop-p' ;; to `nil' in the action function. Then modify both ;; `minibuffer-completion-table' and `icicle-candidates-alist' as ;; needed to perform the side effect. ;; ;; Icicles search-and-replace provides an example of this. When you ;; replace text, the original domain of search-hit candidates (with ;; their associated location information) is altered, so that you can ;; continue replacing coherently. (See the code for ;; `icicle-search-action' and ;; `icicle-search-highlight-and-maybe-replace'.) ;; ;; Because such side effects can change the meaning of cycling state ;; information such as the current candidate number, Icicles does not ;; automatically save such state information before a candidate ;; action and then restore it afterward. ;; ;; For example, search-and-replace removes a search-hit candidate, as ;; a side effect, if the replacement text no longer matches your ;; input. In that case, a current candidate number recorded before ;; the action would no longer correspond to the same candidate. ;; ;; For this reason, if your action function does not perform any such ;; side effects on the candidates, and you want to restore the ;; cycling state as it was before a candidate action, then you might ;; want your action function to save and then restore the values of ;; Icicles variables such as `icicle-candidate-nb', ;; `icicle-last-completion-candidate', and ;; `icicle-completion-candidates'. ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Icicles Tripping") ;; for information about using Icicles Trip commands ;; ;; * (@> "Defining Icicles Commands (Including Multi-Commands)") ;; for general information about defining multi-commands ;; ;; * (@> "Programming with Fancy Candidates") for information about ;; `icicle-whole-candidate-as-text-prop-p' ;;(@* "Defining Multiple-Choice Menus") ;; ;; Defining Multiple-Choice Menus ;; ------------------------------ ;; ;; By "multiple-choice" here I do not mean simply a menu of choices, ;; where you pick one, or even a menu where you can pick more than ;; one item, but a menu where you can choose any menu items (actions) ;; any number of times. ;; ;; Icicles multi-commands (see ;; (@file :file-name "icicles-doc1.el" :to "Multi-Commands")) can be ;; used provide users with such multiple-choice menus. While the ;; possible choices can be accessed by minibuffer completion or ;; cycling, a user can also display them in buffer `*Completions*' ;; using `TAB' or `S-TAB', and click them there to choose them. ;; ;; That is, buffer `*Completions*' can act as a multiple-choice menu. ;; ;; Simple use case: Suppose that you use special characters (Greek ;; letters, math symbols, accented letters in another language...), ;; but only occasionally - you do not want to take the trouble to ;; learn a special input method for them or flip to a different soft ;; keyboard. One simple way to handle this is to create a menu of ;; such special characters - Greek letters, for instance. You only ;; need to create the menu once, providing the necessary completions ;; as, say, Unicode characters. When you need to input such a ;; character, just use your command that pops up buffer ;; `*Completions*' with the available special characters. Even if ;; you do not know how to type them on your keyboard, you can cycle ;; through them or use `mouse-2' to choose them. ;; ;; Here's a simple example of defining a command that uses a ;; multiple-choice menu. (Other examples given above, such as ;; `my-delete-file-or-directory' are also examples, but this one uses ;; menu items that look more like menu items.) ;; ;; (icicle-define-command my-menu-command ;; "Display menu and act on choice(s)." ;; my-menu-action ;; "`TAB' for menu. `C-mouse-2' to choose. " ;; my-menu-items nil t) ;; ;; (defvar my-menu-items ;; '(("Foobar" . foobar-fn) ("Toto" . toto-fn) ("Titi" . titi-fn)) ;; "Alist of menu items and their associated commands.") ;; ;; (defun my-menu-action (item) ;; "Call function associated with menu-item ITEM." ;; (funcall (cdr (assoc item my-menu-items)))) ;; ;; (defun foobar-fn () (message "Foobar chosen")) ;; (defun toto-fn () (message "Toto chosen")) ;; (defun titi-fn () (message "Titi chosen")) ;; ;; A user does `M-x my-menu-command' and hits `TAB' to display this ;; menu in the `*Completions*' buffer: ;; ;; Click mouse-2 on a completion to select it. (C-h: help) ;; ;; Possible completions are: ;; Foobar Titi ;; Toto ;; ;; The user presses and holds the Control key. S?he clicks `Foobar' ;; - message "Foobar chosen" appears. S?he clicks `Toto - message ;; "Toto chosen" appears. ;; ;; And so on - all while holding Control pressed. Any number of menu ;; items can be chosen, any number of times. The command is finally ;; exited with `RET' or `C-g'. ;; ;; The COLLECTION argument passed to `completing-read' here is ;; `my-menu-items', an alist of key-value pairs, where the key is a ;; menu-item name and the value is the function that implements the ;; menu item. For example, menu item `Foobar' is implemented by ;; function `foobar-fn', and the alist element is therefore ("Foobar" ;; . foobar-fn). ;; ;; Function `my-menu-action' is executed when a user clicks ;; `C-mouse-2' on a menu item. It just looks up the menu item's ;; function in alist `my-menu-items', and then calls that function. ;; ;; What? You think it's odd that the user must hit `TAB' to display ;; the menu? Then just use this code instead: ;; ;; (icicle-define-command ;; my-menu-command ;; "Display menu and act on choice(s)." ;; my-menu-action ;; "`C-mouse-2' or `C-RET' to choose menu items" ;; my-menu-items nil t nil nil nil nil ;; ((icicle-show-Completions-initially-flag t))) ;; ;; This just adds a binding for ;; `icicle-show-Completions-initially-flag', so that `*Completions*' ;; is displayed initially. ;; ;; Granted, the `*Completions*' display does not exactly look like ;; your average menu. And the header line does not mention the ;; multiple-choice possibility (holding Control while clicking). But ;; the header does say to use `C-h' for help, and that help does ;; mention `C-mouse-2' (as does the prompt). And the menu does act ;; like a menu. And the doc string of `my-menu-command' can provide ;; more help, as needed. ;; ;; There are also some freebie advantages of using such menus, ;; besides the feature of multiple-choice. These include choosing ;; menu items from the keyboard, with completion, and cycling among ;; menu items. The additional features are all explained when the ;; user hits `M-?'. ;; ;; One common use of a multiple-choice menu is letting the user ;; select a list of items from a larger list of candidates. The list ;; is returned, with the items in the order selected. Examples of ;; this include these multi-commands: ;; ;; * `icicle-bookmark-list' - bookmarks (bookmark names, with `C-u') ;; ;; * `icicle-buffer-list' - buffer names, selected from `buffer-list' ;; (possibly after filtering) ;; ;; * `icicle-directory-list' - directory names, selected from ;; subdirectories in the current directory and any directories you ;; navigate to (and values of directory-list variables) ;; ;; * `icicle-face-list' - face names, selected from `face-list' ;; ;; * `icicle-file-list' - file names, selected from files in the ;; current directory and any directories you navigate to ;; ;; * `icicle-keyword-list' - keywords (regexps), selected from those ;; you have previously entered ;; ;; * `icicle-choose-faces', `icicle-choose-visible-faces', ;; `icicle-choose-invisible-faces' - face names, selected from the ;; (visible/invisible) highlighting faces in the buffer ;; ;; Such commands can be used on their own, or they can be used in the ;; `interactive' specs of other commands that act on an entire list ;; of selected items. And do not forget that the set of "menu items" ;; (completion candidates) is susceptible to sorting in various ways, ;; as well as filtering in the usual ways: progressive completion, ;; chipping away the non-elephant, and so on. ;; ;; Here as an example definition is `icicle-file-list': ;; ;; (icicle-define-command icicle-file-list ;; "Choose a list of file names. ;; The list of names (strings) is returned." ;; (lambda (name) (push name file-names)) ;; "Choose file (`RET' when done): " ;; (mapcar #'list (directory-files default-directory nil ;; icicle-re-no-dot)) ;; nil nil nil 'file-name-history nil nil ;; ((file-names ())) ; Additional bindings ;; nil nil ;; (prog1 (setq file-names (delete "" file-names)) ; Return list ;; (when (interactive-p) (message "Files: %S" file-names)))) ;; ;; See (@file :file-name "icicles-doc1.el" :to "Nutshell View of Icicles") ;; for information about progressive completion and chipping away. ;;(@* "Defining Icicles Multi `M-x'") ;; ;; Defining Icicles Multi `M-x' ;; ---------------------------- ;; ;; This section is for Emacs-Lisp programmers. It explains how the ;; Icicles Multi `M-x' feature is implemented, providing an advanced ;; illustration of using macro `icicle-define-command'. ;; ;;(@* "How Multi `M-x' is Defined") ;; ** How Multi `M-x' is Defined ** ;; ;; The definition of `icicle-execute-extended-command' provides an ;; interesting illustration of using `icicle-define-command'. The ;; candidate action function itself binds a candidate action ;; function, in case the candidate is a command that reads input with ;; completion. Here is a simplified version of the definition. ;; ;; (icicle-define-command ;; icicle-execute-extended-command ; `M-x' in Icicle mode. ;; "Read command name, then read its arguments and call it." ;; icicle-execute-extended-command-1 ; Action function ;; (format "Execute command%s: " ; `completing-read' args ;; (if current-prefix-arg ;; (format " (prefix %d)" ;; (prefix-numeric-value current-prefix-arg)) ;; "")) ;; obarray 'commandp t nil 'extended-command-history nil nil ;; ((last-command last-command)) ; Save & restore `last-command' ;; (use-file-dialog nil) ; For mouse-2 in *Completions* ;; icicle-new-last-cmd) ; Set in `i-e-e-c-1' ;; nil nil ; First code, undo code ;; (setq this-command icicle-new-last-cmd)) ; Restore last command ;; ;; (defun icicle-execute-extended-command-1 (cmd-name) ;; "Action function for `icicle-execute-extended-command'." ;; (when (get-buffer icicle-orig-buff) ;; (set-buffer icicle-orig-buff)) ;; (when (window-live-p icicle-orig-window) ;; (select-window icicle-orig-window)) ;; (when (string= "" cmd-name) (error "No command name")) ;; (let* ((cmd (intern cmd-name)) ;; (icicle-candidate-action-fn ;; (and icicle-candidate-action-fn ; nil after CMD is read ;; `(lambda (x) ;; (setq x (icicle-transform-multi-completion x)) ;; (funcall ',cmd x)))) ;; (run-hooks 'post-command-hook) ;; (run-hooks 'pre-command-hook) ;; (let ((enable-recursive-minibuffers t) ;; (this-command cmd)) ;; (call-interactively cmd 'record-it)) ;; (setq icicle-new-last-cmd cmd))) ;; ;; Variables `icicle-orig-buff' and `icicle-orig-window' are bound ;; automatically by macro `icicle-define-command' to the buffer and ;; window where the multi-command (`icicle-execute-extended-command' ;; in this case) was invoked. ;; ;; The last several lines of this action function rebind ;; `icicle-candidate-action-fn' to a function that calls the ;; candidate command on a single argument that it reads. This is ;; useful if that command itself reads an input argument with ;; completion. When that is the case, you can use completion on that ;; input, and if you do that, you can use `C-RET' to use the ;; candidate command `as a multi-command. In other words, this ;; binding allows for two levels of multi-commands. ;; ;; There are a few things wrong with this definition, however. In ;; the action function, the candidate command is applied to a ;; candidate that is a string. What if it is a command, such as ;; `describe-variable', that expects a symbol argument? Or a number ;; argument? There is no way to know what kind of command will be ;; used, and what kind of argument it will need. The solution is to ;; first try a string candidate argument, then convert the string to ;; a symbol or number. That is, bind this to ;; `icicle-candidate-action-fn': ;; ;; (lambda (x) ;; (setq x (icicle-transform-multi-completion x)) ;; (condition-case nil ;; (funcall ',cmd x) ; Try to use a string candidate. If that ;; (wrong-type-argument ; did not work, use a symbol or number. ;; (funcall ',cmd (car (read-from-string x)))))) ;; ;; A similar problem occurs if the action function called does not ;; accept a (single) argument. The best thing to do in this case is ;; punt - call `icicle-help-on-candidate' to display help on the ;; candidate. To the code above, we add another error handler: ;; ;; (wrong-number-of-arguments (funcall #'icicle-help-on-candidate)) ;; ;; And what if the command does something that changes the focus away ;; from the minibuffer's frame? That's the case for ;; `describe-variable', for instance: it selects buffer `*Help*'. To ;; fix this potential problem, the action function resets the focus ;; back to the minibuffer and its frame: ;; ;; (lambda (x) ;; (setq x (icicle-transform-multi-completion x)) ;; (condition-case nil ;; (funcall ',cmd x) ;; (wrong-type-argument ;; (funcall ',cmd (car (read-from-string x)))) ;; (wrong-number-of-arguments ;; (funcall #'icicle-help-on-candidate))) ;; (select-window (minibuffer-window)) ;; (select-frame-set-input-focus ;; (window-frame (minibuffer-window)))) ;; ;; The actual definitions of the action function and the main command ;; are even more complex. They need to take into account various ;; subtleties, including those associated with recursive minibuffers ;; and multiple invocations of `completing-read'. Evaluate ;; (symbol-function 'icicle-execute-extended-command) to see the real ;; definition. ;; ;; See Also: ;; ;; (@file :file-name "icicles-doc1.el" :to "Icicles Multi `M-x'"). ;;(@* "Defining Multi-Commands the Hard Way") ;; ;; Defining Multi-Commands the Hard Way ;; ------------------------------------ ;; ;; This section is for Emacs-Lisp programmers. It gives you a taste ;; of what is involved behind the scene when you effortlessly use ;; `icicle-define-command' or `icicle-define-file-command' to define ;; a multi-command. ;; See (@> "Defining Icicles Commands (Including Multi-Commands)"). ;; ;; It can be good to know this, if only for the case where you need ;; to define a multi-command that has special behavior not provided ;; by `icicle-define(-file)-command' out of the box. For example, if ;; you want the normal, single-choice `RET' behavior to be different ;; from the multiple-choice `C-RET' behavior, then you might want to ;; roll your own. Likewise, if you want to define your own help on ;; individual candidates, to be invoked when users use `C-M-RET' and ;; so on. ;; ;; To write your own multi-command, you must make the command do ;; this: ;; ;; 1. Call `completing-read' or `read-file-name', and perform some ;; action on the completed input. ;; ;; 2. Bind one or more of these variables to action functions, which ;; each take a completion candidate as argument: ;; ;; a. `icicle-candidate-action-fn' - a function that performs an ;; action on a completion candidate - often the same action as ;; #1. ;; ;; b. `icicle-candidates-list-action-fn' - a function that ;; performs an action on the list of all completion candidates. ;; ;; c. `icicle-candidate-alt-action-fn' - a function that performs ;; an alternative action on a completion candidate. ;; ;; d. `icicle-candidates-list-alt-action-fn' - a function that ;; performs an alternative action on the list of candidates. ;; ;; e. `icicle-candidate-help-fn' - a function that displays ;; specialized help for a completion candidate. ;; ;; (You can also provide mode-line help and tooltip help for ;; individual candidates. ;; See "Candidates with Text Properties".) ;; ;; f. `icicle-delete-candidate-object' - a function that deletes ;; an object associated with (e.g. named by) a completion ;; candidate. ;; ;; #1 just lets people use the command normally, to perform the #1 ;; action on a completion candidate entered with `RET'. Because of ;; #2, people can perform the #2 action(s) on any completion ;; candidates, while still continuing to cycle or complete ;; candidates. `icicle-candidate-action-fn' is often the same as the ;; action for #1, but nothing prevents you from using different ;; actions. ;; ;; When internal variable `icicle-candidate-action-fn' is not bound, ;; the default action is performed: display help on the current ;; completion candidate. When `icicle-candidate-help-fn' is not ;; bound, the default help display is used. ;; ;; Instead of binding `icicle-delete-candidate-object' to a deletion ;; action function, you can bind it to a symbol (variable) whose ;; value is a list of completion-candidate objects. ;; See (@> "More about Multi-Commands") for more information. ;; ;; Here is a definition of a simple (not multi-) command that reads a ;; font name and then changes the selected frame to use that font. ;; By virtue of calling `completing-read', Icicles completion and ;; cycling are available, using all available font names as the pool ;; of candidates. ;; ;; (defun change-font () ;; "Change font of selected frame." ;; (modify-frame-parameters ;; (selected-frame) ;; (list (cons 'font (completing-read ;; "Font: " (mapcar #'list (x-list-fonts "*")) ;; nil t))))) ;; ;; Here's a definition of a multi-command `change-font' that takes ;; advantage of an action function when cycling candidates: ;; ;; 1 (defun change-font () ;; 2 "Change font of current frame." ;; 3 (interactive) ;; 4 (let* ((orig-frame (selected-frame)) ;; 5 (orig-font (frame-parameter nil 'font)) ;; 6 (icicle-candidate-action-fn ;; 7 ;; Perform the action on a candidate, without leaving ;; 8 ;; `completing-read'. You can do this over and over. ;; 9 (lambda (font) ;; 10 (modify-frame-parameters orig-frame ;; 11 (list (cons 'font font)))))) ;; 12 (condition-case nil ;; 13 (modify-frame-parameters ;; 14 orig-frame ;; 15 (list ;; 16 (cons 'font ;; 17 ;; Perform the action on your final choice. ;; 18 (completing-read ;; 19 "Font: " ;; 20 (mapcar #'list (x-list-fonts "*")) nil t)))) ;; 21 ((quit error) ;; 22 (modify-frame-parameters ;; 23 orig-frame ;; 24 (list (cons 'font orig-font))))))) ;; ;; As you can see, there is a lot more going on here than in the ;; simple-command version. These are the points to keep in mind, ;; when defining a multi-command by hand: ;; ;; 1. Save anything you need to restore, so you can, in effect, undo ;; the action in case of `C-g' (lines 4-5). ;; ;; 2. Bind `icicle-candidate-action-fn' to the action to perform ;; (lines 6-11). ;; ;; 3. Perform the action, using `completing-read' to provide the ;; target candidate (lines 13-20). Do this in the body of a ;; `condition-case' (lines 12-24). ;; ;; 4. Restore the original context in the error-handling part of the ;; `condition-case' (lines 22-24). Include `quit' in the ;; error-type list. ;; ;; The above definition is not quite complete, in fact. To let ;; `icicle-all-candidates' be able to report on failures, the ;; `icicle-candidate-action-fn' code should also trap errors and ;; return `nil' as a success indicator. ;; ;; In fact, things can get even hairier (much hairier) still, if the ;; function at the core of your command does things like create a new ;; frame - especially on MS Windows, with its click-to-focus window ;; manager. The action of `change-font' does not do that, but if it ;; did, you would need to redirect the focus back to the minibuffer ;; frame, using `select-frame-set-input-focus'. As an illustration ;; of what's involved, here's a definition that would deal with such ;; problems. It also traps `icicle-candidate-action-fn' errors, ;; returning `nil' to report success and the error message to report ;; failure. ;; ;; (defun change-font () ;; "Change font of current frame." ;; (interactive) ;; (let* ((icicle-orig-buff (current-buffer)) ;; (icicle-orig-window (selected-window)) ;; (orig-frame (selected-frame)) ;; (orig-font (frame-parameter nil 'font)) ;; (icicle-candidate-action-fn ;; (lambda (candidate) ;; (condition-case action-fn-return ;; (progn ;; (modify-frame-parameters ;; orig-frame (list (cons 'font candidate))) ;; (select-frame-set-input-focus ;; (window-frame (minibuffer-window))) ;; nil) ; Return nil to report success. ;; ;; Return error message to report error. ;; (error (error-message-string action-fn-return)))))) ;; (condition-case act-on-choice ;; (modify-frame-parameters ;; orig-frame ;; (list (cons 'font ;; (completing-read ;; "Font: " (mapcar #'list (x-list-fonts "*")) ;; nil t nil nil nil nil)))) ;; (quit (switch-to-buffer icicle-orig-buff) ;; (modify-frame-parameters ;; orig-frame ;; (list (cons 'font orig-font)))) ;; (error (switch-to-buffer icicle-orig-buff) ;; (modify-frame-parameters ;; orig-frame (list (cons 'font orig-font))) ;; (error "%s" (error-message-string act-on-choice)))))) ;; ;; That's a lot of (error-prone) work! You obviously do not want to ;; be doing that a lot. Whenever you can, you should use macro ;; `icicle-define-command' or `icicle-define-file-command' to define ;; your multi-commands. ;; ;; See Also: ;; ;; * (@> "Defining Icicles Commands (Including Multi-Commands)") for ;; the easy way to define `change-font'. ;; ;; * (@file :file-name "icicles-doc1.el" :to "Icicles Tripping") ;; for information about defining action functions that perform ;; side effects on candidates. ;;(@* "Global Filters") ;; ;; Global Filters ;; -------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;; Which completion candidates get displayed? To review: ;; ;; 1. The domain of discourse, that is, all possible candidates, is ;; determined by the arguments to `completing-read', ;; `read-file-name', or `M-x'. ;; ;; 2. A user types something in the minibuffer. This narrows the ;; possible candidates to those that match the input. Matching ;; can be prefix-matching or apropos-matching. ;; ;; Wouldn't it sometimes be useful to filter #1 in a global way, ;; before filtering it with the user input (#2)? Functions ;; `completing-read' and `read-file-name' take a predicate argument, ;; so that can be used for global filtering. However, those ;; functions are usually called from some command, and it would also ;; be useful to give end users, not just programmers, some way to ;; globally filter candidates. ;; ;; For example, if you have a command, such as `icicle-buffer', that ;; reads a buffer name and displays the buffer, some users might ;; always be interested only in buffers that are associated with ;; files. They do not want to see possible candidates such as ;; `*scratch*' and `*Messages*'. What they need is a way to apply a ;; global predicate that limits candidates to file-buffer names - but ;; they do not have access to the call to `completing-read' that is ;; inside the command definition. ;; ;; For this reason, some global filtering variables are provided by ;; Icicles: ;; ;; `icicle-must-match-regexp', `icicle-must-not-match-regexp', ;; `icicle-must-pass-predicate', ;; `icicle-must-pass-after-match-predicate', ;; `icicle-extra-candidates'. ;; ;; The first and second of these are regexps that candidates must ;; match and must not match, respectively, in order for them to be ;; displayed. The third and fourth are predicates that candidates ;; must satisfy. The fifth is a list of extra candidates to display. ;; Any of the filters can be `nil', in which case it has no effect. ;; ;; Each of these except `icicle-extra-candidates' filters not only ;; completion candidates but also the default values passed to ;; `completing-read' and `read-file-name'. ;; ;; Variable `icicle-must-match-regexp' is similar to the standard ;; variable `completion-regexp-list', except: ;; ;; * `completion-regexp-list' is a list of regexps, not just one. ;; * `icicle-must-match-regexp' is used after filtering using option ;; `icicle-transform-function'. ;; ;; Variables `icicle-must-pass-predicate' and ;; `icicle-must-pass-after-match-predicate' act the same: they filter ;; display candidates. The former filters before the current user ;; input is matched. The latter filters after matching - it is ;; applied only to candidates that match. ;; ;; Neither is like the PREDICATE argument to `completing-read' in ;; that they do not act on full candidates (e.g. alist entries) - ;; they apply only to display candidates (strings). ;; ;; For apropos completion, the `completing-read' PREDICATE is applied ;; to all COLLECTION entries before matching those entries that ;; satisfy it against the user input. If the PREDICATE argument uses ;; only the candidate name (it does not make any use of the full ;; candidate) then it can sometimes be more efficient to pass `nil' ;; as the PREDICATE and use `icicle-must-pass-after-match-predicate' ;; instead. ;; ;; Here is something to keep in mind about ;; `icicle-must-pass-after-match-predicate': ;; ;; It is often a good idea to use this predicate rather than pass a ;; PREDICATE argument to `completing-read' or `read-file-name', ;; especially when the initial domain of candidates is large and the ;; predicate is complex (costly). It makes little sense to test each ;; such candidate using the predicate, rather than test only those ;; that match the current minibuffer input. ;; ;; However, sometimes the PREDICATE argument to `completing-read' or ;; `read-file-name', is also used for something else, and in such a ;; context you will need to provide it. In particular, Icomplete ;; mode uses it to compute the completions it displays. ;; ;; For this reason, the Icicles predefined functions that use ;; `icicle-must-pass-after-match-predicate' also test for ;; `icomplete-mode'. When that is turned on they use a PREDICATE ;; argument instead of `icicle-must-pass-after-match-predicate'. You ;; might want to do the same in your code. Just look at the Icicles ;; code for examples. ;; ;; An example of this is `M-x', which by default in Icicle mode is ;; `icicle-execute-extended-command'. If Icomplete mode is turned on ;; then the predicate `commandp' first filters all of the available ;; symbols, before you type any input to be matched. If Icomplete ;; mode is off, then this predicate is used as ;; `icicle-must-pass-after-match-predicate': ;; ;; (lambda (c) ;; (unless (symbolp c) (setq c (intern-soft c))) ;; (commandp c)) ;; ;; That does about the same thing as `commandp', but its argument is ;; a completion candidate as displayed, that is, a string, not a ;; symbol in the `obarray'. ;; ;; Now suppose you type `M-x forw TAB'. If Icomplete mode is on then ;; your input is expanded to the common match `forward-'. If off it ;; is expanded to only `forward'. Why? Because when it is off your ;; input is matched against all symbol names, before checking those ;; that match to see if they name commands. The common match among ;; all symbol names is `forward', not `forward-'. See ;; (@file :file-name "icicles-doc1.el" :to "Expanded-Common-Match Completion") ;; ;; And here's a gotcha to keep in mind if you use either ;; `icicle-must-pass-predicate' or ;; `icicle-must-pass-after-match-predicate' with (non-absolute) ;; file-name candidates: Since the candidate file names have no ;; directory part, in many cases you will want to test the candidate ;; expanded relative to the directory shown in the minibuffer. One ;; way to do this is as follows: ;; ;; (setq file (expand-file-name file ;; (icicle-file-name-directory-w-default ;; (icicle-input-from-minibuffer)))) ;; ;; This gotcha is nothing new - the same applies for standard Emacs ;; function `read-file-name', but it is still worth pointing out. ;; ;; Variable `icicle-extra-candidates' is not really a "filter". It ;; does not restrict the set of possible candidates - rather, it ;; extends that set. The other filters do not act on the candidates ;; in `icicle-extra-candidates' - they are always added. Extra ;; candidates are displayed in buffer `*Completions*' using face ;; `icicle-extra-candidate'. ;; ;; Note that an extra candidate need not have anything in common with ;; the normal (non-extra) candidates. In particular, because it is ;; provided explicitly, it does not follow the restrictions implied ;; by the current candidate-generation method. ;; ;; In this, extra candidates are similar to proxy candidates. For ;; example, when option `icicle-guess-commands-in-path' is non-`nil', ;; the proxy shell-command candidates provided have no connection ;; with the file-name completion that is used to generate the other ;; candidates (see (@* "Icicles Shell-Command Enhancements")). ;; ;; Note too that if an extra candidate is already a candidate anyway ;; then it will be present twice in the list of all candidates (that ;; is, unless `icicle-transform-function' removes duplicate ;; candidates). ;; ;; These global variables are internal variables, even though they ;; are defined as user options - they are not really meant to be ;; customized. If you are not an Emacs-Lisp programmer, you will not ;; use these variables, but some commands that you use might provide ;; corresponding global-filter user options. Icicles provides ;; customizable user options for Icicles buffer commands, such as ;; `icicle-buffer'. For example: ;; ;; `icicle-buffer-match-regexp' - Regexp buffer names must match ;; `icicle-buffer-no-match-regexp' - Regexp buffers must not match ;; `icicle-buffer-predicate' - Predicate buffers must satisfy ;; `icicle-buffer-extras' - Extra buffer names to display ;; ;; You might, for instance, customize `icicle-buffer-no-match-regexp' ;; to not display file-buffers whose names end in `.elc', and ;; customize `icicle-buffer-predicate' to show only buffers that are ;; associated with files. The former would use a value of "\\.elc$", ;; and the latter would use a value such as this: ;; ;; (lambda (bufname) (buffer-file-name (get-buffer bufname))) ;; ;; Similarly, Icicles provides user options for filtering and sorting ;; file names during completion: ;; ;; `icicle-file-match-regexp' - Regexp file names must match ;; `icicle-file-no-match-regexp' - Regexp file names must not match ;; `icicle-file-predicate' - Predicate files must satisfy ;; `icicle-file-extras' - Extra file names to display ;; ;; Note that `icicle-buffer-predicate' and `icicle-file-predicate' ;; correspond to `icicle-must-pass-after-match-predicate', not to ;; `icicle-must-pass-predicate'. They are applied after your current ;; input filters the candidates. ;; ;; If you as a programmer write a command, and you want to expose ;; global filters to users of the command, you should: ;; ;; 1. Create corresponding user options that can be customized. ;; 2. Bind the user options to the corresponding filtering variables. ;; ;; If you use `icicle-define-command' or `icicle-define-file-command' ;; to define a command (recommended), then you can simply pass the ;; filter-variable bindings as part of the BINDINGS argument. ;; ;; For convenience you can use macros `icicle-buffer-bindings' and ;; `icicle-file-bindings' to provide bindings that are appropriate ;; for buffer-name and file-name completion, respectively. For ;; example, macro `icicle-buffer-bindings' expands to include these ;; bindings, among others: ;; ;; (icicle-must-match-regexp icicle-buffer-match-regexp) ;; (icicle-must-not-match-regexp icicle-buffer-no-match-regexp) ;; (icicle-must-pass-after-match-predicate icicle-buffer-predicate) ;; (icicle-require-match-flag icicle-buffer-require-match-flag) ;; (icicle-extra-candidates icicle-buffer-extras) ;; (icicle-delete-candidate-object 'icicle-kill-a-buffer) ;; ;; As an example of using this macro, here is the core definition of ;; `icicle-buffer': ;; ;; (icicle-define-command ;; icicle-buffer ; Command name ;; "Switch to a different buffer." ; Doc string ;; switch-to-buffer ; Action function ;; "Switch to buffer: " ; `completing-read' args ;; (mapcar (lambda (buf) (list (buffer-name buf))) (buffer-list)) ;; nil nil nil 'buffer-name-history ;; (icicle-default-buffer-names current-prefix-arg) nil ;; ;; Filter bindings ;; (icicle-buffer-bindings)) ; Macro provides buffer bindings ;; ;; If you define a command that uses completion, but you do not use ;; `icicle-define-command' or `icicle-define-file-command', then you ;; can just bind appropriate variables individually around a call to ;; `completing-read' or `read-file-name'. ;; ;; Another way that users can apply predicates to completion ;; candidates is to use `M-&' while completing. These predicates ;; apply to the full alist-entry candidates that are supplied to ;; `completing-read' or `read-file-name', not just to the textual ;; candidates that are displayed in buffer `*Completions*'. ;; See (@file :file-name "icicles-doc1.el" :to "Progressive Completion"). ;;(@* "Specifying Match Functions for Commands") ;; ;; Defining Commands that Use Specific Match Functions ;; --------------------------------------------------- ;; ;; This section is for Emacs-Lisp programmers. ;; ;; By default, Icicles lets users use basic prefix completion (with ;; `TAB') or apropos completion (with `S-TAB'). They can ;; alternatively use other completion methods with `TAB' and `S-TAB': ;; ;; * They can use `C-(' during completion to cycle among `TAB' ;; completion methods. ;; ;; * They can use `M-(' to cycle among `S-TAB' completion ;; methods. ;; ;; * They can customize options `icicle-TAB-completion-methods-alist' ;; and `icicle-S-TAB-completion-methods-alist', to define the ;; completion methods among which they can cycle. ;; ;; When you define an Icicles command, you can specify which ;; string-matching functions the command uses during completion: ;; ;; * If you want the command to use fuzzy completion for `TAB' by ;; default, then bind `icicle-fuzzy-completion-flag' to ;; non-`nil'. Users can still use `C-(' to toggle fuzzy completion ;; off. ;; ;; * If you want the command to use a particular string-matching ;; function for `S-TAB' completion by default, then bind variable ;; `icicle-apropos-complete-match-fn' to that function. Users can ;; still use `M-(' to cycle among the other matching functions for ;; `S-TAB'. ;; ;; You can bind `icicle-apropos-complete-match-fn' to any function ;; that matches strings. You will probably also want to ensure that ;; it is available for `M-(' cycling, by adding it to ;; `icicle-S-TAB-completion-methods-alist' in a `let' binding. For ;; example, to use matching function `my-match' in `my-cmd', you ;; might do this: ;; ;; (defun my-cmd () ;; "..." ;; (interactive) ;; (let ((icicle-apropos-complete-match-fn 'my-match) ;; (icicle-S-TAB-completion-methods-alist ;; (cons (cons "mine" 'my-match) ;; icicle-S-TAB-completion-methods-alist))) ;; (do-something (completing-read "Choose: " ...) ...))) ;;(@* "Defining Buffer-Text Completion for Comint Modes") ;; ;; Defining Buffer-Text Completion for Comint Modes ;; ------------------------------------------------ ;; ;; This section is for Emacs-Lisp programmers. ;; ;; Out of the box, Icicles provides completion for buffer text in ;; some contexts. This includes Shell mode, for example. Whenever ;; there are two or more candidate completions, you can use Icicles ;; completion, with all of its features (cycling, progressive ;; completion, apropos completion, and so on). ;; See (@> "Completion in Comint Modes"). ;; ;; Shell mode is an example of a mode that inherits from Comint mode. ;; Other libraries sometimes define modes that also extend Comint ;; mode in different ways. Library ESS does so, for example. ;; ;; In such modes, the top-level completion command used is typically ;; `comint-dynamic-complete', and it is typically bound to `TAB'. In ;; Icicle mode, `TAB' in such a buffer is instead bound to the ;; Icicles version of this command, `icicle-comint-dynamic-complete'. ;; ;; Icicles provides the infrastructure for you to take advantage of ;; Icicles completion with your own modes that inherit from Comint ;; mode. For that, just do the following: ;; ;; 1. Define replacement functions for the functions that perform the ;; completion. The functions to be replaced themselves typically ;; call a Comint completion function, such as ;; `comint-dynamic-complete-filename'. You can typically use the ;; same definitions as the original functions, except replace the ;; call to a function that displays multiple matching candidates ;; by a call to a corresponding Icicles function that performs ;; completion. ;; ;; 2. Customize option `icicle-comint-dynamic-complete-replacements', ;; adding the mappings that specify which standard functions to ;; replace with your completion functions (from #1). Take a look ;; at the default value of this option to see what I mean. ;; ;; 3. Use `eval-after-load' to toggle Icicle mode when the vanilla ;; code for your mode is loaded, to ensure that the original ;; definitions are picked up. See the end of `icicles-mode.el' ;; for an example of this. ;; ;; If you are interested in trying this, take a look at the Icicles ;; code for, say, `icicle-shell-dynamic-complete-command', comparing ;; it with the original code for `shell-dynamic-complete-command'. ;; You will see that the only change is to substitute a call to ;; `icicle-shell-dynamic-complete-as-command' for a call to ;; `shell-dynamic-complete-as-command'. Likewise, ;; `icicle-shell-dynamic-complete-as-command' is a trivial alteration ;; of `shell-dynamic-complete-as-command'. ;; ;; The key is to ultimately call an Icicles completion command, such ;; as `icicle-comint-dynamic-simple-complete', whenever there are ;; multiple completion candidates. This has the effect of using ;; Icicles minibuffer completion instead of simply displaying the ;; alternatives in buffer `*Completions*'. ;; ;; Icicles uses this same technique, of substituting Icicles ;; completion for simple display of alternatives, for all buffer-text ;; completion that it supports out of the box, even when there is no ;; relation with Comint mode. ;;(@* "Note to Programmers") ;; ;; Note to Programmers ;; ------------------- ;; ;; Here are some simple guidelines for using Icicles in Emacs-Lisp ;; programming: ;; ;; 1. *Use it*! Even if you do not do anything else, include this in ;; your library: ;; ;; (require 'icicles nil t) ;; ;; That has absolutely no consequences if Icicles is not present ;; in the user's `load-path' (there is no load error). If Icicles ;; is present, however, then users can take advantage of each use ;; you make of `completing-read' and `read-file-name' in your ;; code. ;; ;; 2. Use an input-completion read function, such as ;; `completing-read' or `read-file-name', when you read input! ;; There is almost never a reason not to use an input-completion ;; function when reading user input - especially considering that ;; you need not always provide a REQUIRE-MATCH argument. ;; ;; Try also to find an appropriate PREDICATE argument, and a good ;; set of default values to pass to `completing-read' as its ;; COLLECTION argument. Too often, I think, we use an overly ;; general COLLECTION argument, such as the `obarray', and we do ;; not provide a (good) PREDICATE. Using an input-completion ;; function with an appropriate candidate completion list and ;; predicate can help users considerably. ;; ;; If you want to also give users a way to customize a (different) ;; predicate that applies only to the textual candidates that are ;; displayed in buffer `*Completions*', as opposed to the full ;; alist-entry candidates that are supplied to `completing-read' ;; or `read-file-name', then you can define a new user option and ;; then bind internal variable `icicle-must-pass-predicate' to the ;; value of that option. See (@> "Global Filters"). ;; ;; 3. Avoid using a literal-string `interactive' spec (e.g. ;; (interactive "fFile: ")) that reads input with completion. ;; Instead, call `completing-read' or `read-file-name' within the ;; `interactive' spec. This saves Icicles users of progressive ;; completion the need to hit `RET' multiple times to pass their ;; input up through multiple levels of recursive minibuffers to ;; the top level. See ;; (@file :file-name "icicles-doc1.el" :to "Progressive Completion"). ;; ;; 4. In many cases, it makes sense to define a multi-command, rather ;; than a simple command. People can always use a multi-command ;; as a simple command, but not vice versa. ;; See (@file :file-name "icicles-doc1.el" :to "Multi-Commands"), ;; (@> "Defining Icicles Commands (Including Multi-Commands)"), ;; and (@> "Defining Multi-Commands the Hard Way"). ;; ;; 5. Consider using `icicle-completing-read-history' instead of ;; `read-from-minibuffer' or `read-string' for most purposes. ;; This lets users complete their input against previously entered ;; input. Completion is lax, so they can also enter new input. ;; ;; 6. You can bind `icicle-sort-comparer' temporarily to any sort ;; function you need. ;; ;; 7. Function `icicle-next-candidate' is a general framework for ;; letting users cycle completions of partial input strings. I ;; use it to define the cycling behavior for both prefix and ;; apropos completions. You can use it to easily define other, ;; application-specific input matching/completion/cycling ;; behavior. Just supply it with a function that takes the ;; current partial user input (a string) and returns a list of ;; candidate completions, however those might be defined. ;; ;; 8. If the potential number of completion candidates is enormous, ;; then icompletion display in `*Completions*' can be slow. In ;; that case, consider turning it off for the duration of the ;; command, by binding `icicle-incremental-completion' to `nil'. ;; An alternative to turning it off is the approach taken in ;; Icicles (e.g. `icicle-vardoc' and ;; `icicle-insert-thesaurus-entry'): Just add a reminder to the ;; doc string to tell users that they can cycle ;; `icicle-incremental-completion' using `C-#'. ;; ;; 9. Another of my libraries that can help programmers provide ;; default values is `thingatpt+.el'. It provides functions for ;; picking up symbols, sexps, numbers, words, and other sorts of ;; thing near the text cursor (`point'). ;; ;; See Also: ;; ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Commands") ;; * (@> "Defining Icicles Commands (Including Multi-Commands)") ;; * (@> "Defining Multi-Commands the Hard Way") ;; * (@> "Defining Multiple-Choice Menus") ;; * (@> "Global Filters") ;; * (@> "Specifying Match Functions for Commands") ;; * (@file :file-name "icicles-doc1.el" :to "Multi-Completions") ;;(@* "La Petite Histoire") ;; ;; La Petite Histoire ;; ------------------ ;; ;; 1. This library started life as `elect-mbuf.el', by Hans Koomen. ;; ;; Original posting: ;; From koomen@cs.rochester.edu Mon Jun 19 19:27:58 1989 ;; To: info-gnu-emacs@prep.ai.mit.edu ;; Cc: Hans ;; Subject: elect-mbuf.el ;; Date: Tue, 13 Jun 89 15:17:07 -0400 ;; ;; 2. I hacked and enhanced the library in various relatively minor ;; ways over the years, maintaining it as `elect-mbuf.el' - see ;; details in file `icicles-chg.el'. ;; ;; I did not change the main functionality of the library during this ;; period: it always cycled the COMPLETE list of (prefix) completion ;; candidates passed to `completing-read'; it did not update the ;; candidate list based on the current minibuffer contents. ;; ;; So, for instance, if you had `M-x for' in the minibuffer, `down' ;; would cycle among ALL Emacs commands, not just those that start ;; with "for". I used the library this way for fifteen years without ;; thinking much about this behavior or the code behind it. ;; ;; 3. In July 2005, Lennart Borgman gave `elect-mbuf.el' a quick try, ;; and intuitively expected to see behavior along the lines that you ;; see now for Icicles prefix completion: ;; ;; a. `down' should cycle completions relative to the current input, ;; not all completions supplied to `completing-read'. ;; b. If buffer `*Completions*' is displayed, `down' should highlight ;; the current candidate there. ;; ;; Good idea Lennart (). So I ;; implemented that behavior, and renamed the library "Icicles" (for, ;; I suppose, "input cycles" or some such - or because it's "cool"). ;; ;; 4. The code changes I made to implement #3 (completion cycling ;; relative to current input) made me realize that other completion ;; matchings could be implemented in a similar way. Prefix ;; completion (the completion provided by Emacs) is handy, but it is ;; also sometimes a bit limited. The idea of apropos completion ;; occurred to me, and I implemented that as well. ;; ;; 5. I extended the library quite a bit more, in terms of ;; convenience (highlighting, treatment of buffer ;; `*Completions*',..., but also in terms of functionality. In ;; particular, it now treats file names too. And, because Emacs 21 ;; and later versions use `read-file-name' for `find-file' and so on, ;; Icicles now treats `read-file-name' the same as `completing-read'. ;; ;; 6. On another suggestion from LennartBorgman, I made Icicles take ;; advantage of Delete Selection mode. And I implemented it as a ;; minor mode. ;; ;; 7, 8, 9,... One thing has led to another, and I've just kept ;; adding features. Feature creep, I guess. But the more I play ;; with Icicles, the more I imagine new ways it might be made more ;; useful. ;;(@* "Note on Non-`nil' `pop-up-frames' on MS Windows") ;; ;; Note on Non-`nil' `pop-up-frames' on MS Windows ;; ----------------------------------------------- ;; ;; If you use `pop-up-frames' = `t', like I do, you might have ;; noticed that Emacs completion does not play well with using ;; separate frames for each buffer. In particular, it does not play ;; well with having a separate frame for buffer `*Completions*'. ;; When you try to complete input using `TAB', a new frame is created ;; for buffer `*Completions*', and, at least on MS Windows, it is ;; selected, taking the input focus away from the original frame's ;; minibuffer! ;; ;; This means that, once the `*Completions*' buffer has been ;; displayed in a separate frame, you cannot, for instance, cycle ;; completion candidates, without first reselecting the original ;; frame manually. You cannot even use normal completion - you ;; cannot add text in the minibuffer, or delete text there, because ;; the minibuffer in the original frame no longer has the input ;; focus. Bummer. ;; ;; In general, Emacs does not play too well with one-buffer-per-frame ;; (`pop-up-frames' = `t'), and this is a good example of that ;; general problem. ;; ;; I reported this Emacs bug. I've been hoping it will be corrected ;; since Emacs 21... ;; ;; I do not have this problem of loss of frame input focus in my own ;; setup, even though I use `pop-up-frames' = `t', because I use my ;; library `oneonone.el'. (Try it!) If you need a solution while ;; waiting for the Emacs fix, you can try doing something similar to ;; what I do in `oneonone.el': ;; ;; 1. Use dedicated frames for both `*Completions*' and the ;; minibuffer. ;; ;; 2. Display buffer `*Completions*' using a special-display function ;; that explicitly redirects the input focus from the ;; `*Completions*' frame back to the minibuffer frame. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;; You need not load this file. It contains only documentation. (provide 'icicles-doc2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-doc2.el ends here icicles-2013.04.23.23400/icicles-face.el000066400000000000000000000707111214003072700170230ustar00rootroot00000000000000;;; icicles-face.el --- Faces for Icicles ;; ;; Filename: icicles-face.el ;; Description: Faces for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:19:43 2006 ;; Version: 22.0 ;; Last-Updated: Mon Feb 4 14:02:51 2013 (-0800) ;; By: dradams ;; Update #: 686 ;; URL: http://www.emacswiki.org/icicles-face.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; None ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; customization groups and faces. For Icicles documentation, see ;; `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Groups defined here: ;; ;; `Icicles', `Icicles-Buffers', `Icicles-Completions-Display', ;; `Icicles-Files', `Icicles-Key-Bindings', ;; `Icicles-Key-Completion', `Icicles-Matching', ;; `Icicles-Minibuffer-Display', `Icicles-Miscellaneous', ;; `Icicles-Searching'. ;; ;; Faces defined here: ;; ;; `icicle-annotation', `icicle-candidate-part', ;; `icicle-common-match-highlight-Completions', ;; `icicle-complete-input', `icicle-completion', ;; `icicle-Completions-instruction-1', ;; `icicle-Completions-instruction-2', ;; `icicle-current-candidate-highlight', `icicle-extra-candidate', ;; `icicle-historical-candidate', ;; `icicle-historical-candidate-other', ;; `icicle-input-completion-fail', ;; `icicle-input-completion-fail-lax', ;; `icicle-match-highlight-Completions', ;; `icicle-match-highlight-minibuffer', `icicle-mode-line-help', ;; `icicle-msg-emphasis', `icicle-multi-command-completion', ;; `icicle-mustmatch-completion', `icicle-proxy-candidate', ;; `icicle-saved-candidate', `icicle-search-context-level-1', ;; `icicle-search-context-level-2', ;; `icicle-search-context-level-3', ;; `icicle-search-context-level-4', ;; `icicle-search-context-level-5', ;; `icicle-search-context-level-6', ;; `icicle-search-context-level-7', ;; `icicle-search-context-level-8', `icicle-search-current-input', ;; `icicle-search-main-regexp-current', ;; `icicle-search-main-regexp-others', `icicle-special-candidate', ;; `icicle-whitespace-highlight', `minibuffer-prompt'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Icicles Commands for Other Packages") ;; (@> "Groups, Organized Alphabetically") ;; (@> "Faces, Organized Alphabetically") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Groups, Organized Alphabetically") ;;; Groups, Organized Alphabetically --------------------------------- (defgroup Icicles nil "Minibuffer input completion and cycling of completion candidates." :prefix "icicle-" :group 'completion :group 'convenience :group 'help :group 'apropos :group 'dabbrev :group 'matching :group 'minibuffer :group 'recentf :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Buffers nil "Icicles preferences related to buffers." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Files nil "Icicles preferences related to files." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Completions-Display nil "Icicles preferences related to display of completion candidates." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Key-Bindings nil "Icicles preferences related to key bindings." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Key-Completion nil "Icicles preferences related to key completion (`icicle-complete-keys')." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Matching nil "Icicles preferences related to matching input for completion." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Minibuffer-Display nil "Icicles preferences related to minibuffer display during completion." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Miscellaneous nil "Miscellaneous Icicles preferences." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) (defgroup Icicles-Searching nil "Icicles preferences related to searching." :prefix "icicle-" :group 'Icicles :link `(url-link :tag "Send Bug Report" ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=icicles.el bug: \ &body=Describe bug here, starting with `emacs -q'. \ Don't forget to mention your Emacs and Icicles library versions.")) :link '(url-link :tag "Other Libraries by Drew" "http://www.emacswiki.org/DrewsElispLibraries") :link '(url-link :tag "Download" "http://www.emacswiki.org/icicles.el") :link '(url-link :tag "Description" "http://www.emacswiki.org/Icicles") :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2") :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1") ) ;;(@* "Faces, Organized Alphabetically") ;;; Faces, Organized Alphabetically ---------------------------------- (defface icicle-annotation ; Same grays as for `shadow'. '((((background dark)) (:foreground "gray70")) (t (:foreground "gray50"))) "*Face used to highlight a candidate annotation in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-candidate-part '((((background dark)) (:background "#451700143197")) ; a very dark magenta (t (:background "#EF84FFEAF427"))) ; A light green. "*Face used to highlight part(s) of a candidate in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-common-match-highlight-Completions '((((background dark)) (:foreground "#2017A71F2017")) ; a dark green (t (:foreground "magenta3"))) "*Face used to highlight candidates common match, in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-complete-input '((((background dark)) (:foreground "#B19E6A64B19E")) ; a dark magenta (t (:foreground "DarkGreen"))) "*Face used to highlight input when it is complete." :group 'Icicles-Minibuffer-Display :group 'faces) (defface icicle-completion '((((background dark)) (:foreground "#0000D53CD53C")) ; a dark cyan (t (:foreground "Red"))) ; red "*Face used to indicate minibuffer completion. It highlights the minibuffer indicator and the `Icy' minor-mode lighter during completion. Not used for versions of Emacs before version 21." :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces) (defface icicle-Completions-instruction-1 '((((background dark)) (:foreground "#AC4AAC4A0000")) ; a dark yellow (t (:foreground "Blue"))) "*Face used to highlight first line of `*Completions*' buffer." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-Completions-instruction-2 '((((background dark)) (:foreground "#0000D53CD53C")) ; a dark cyan (t (:foreground "Red"))) "*Face used to highlight second line of `*Completions*' buffer." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-current-candidate-highlight '((((background dark)) (:background "#69D40A460000")) ; a red brown (t (:background "CadetBlue1"))) "*Face used to highlight the current candidate, in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-extra-candidate '((((background dark)) (:background "#4517305D0000")) ; a dark brown (t (:background "#C847D8FEFFFF"))) ; a light blue "*Face used to highlight `*Completions*' candidates that are extra. This means that they belong to list `icicle-extra-candidates'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-historical-candidate '((((background dark)) (:foreground "#DBD599DF0000")) ; a dark orange (t (:foreground "Blue"))) "*Face used to highlight `*Completions*' candidates that have been used." :group 'Icicles-Completions-Display :group 'faces) (when (> emacs-major-version 21) (defface icicle-historical-candidate-other '((t (:inherit icicle-historical-candidate :underline t))) "*Face to highlight `*Completions*' candidates that were used indirectly. That is, you might or might not have entered these candidates but in some sense you have used or visited them. Example: index topics that point to Info nodes that you have visited. Whether or not such highlighting is done at all is governed by option `icicle-highlight-historical-candidates-flag'. Whether it is done for a given set of candidates is governed by option `icicle-Info-visited-max-candidates'." :group 'Icicles-Completions-Display :group 'faces)) (defface icicle-input-completion-fail '((((background dark)) (:background "#22225F5F2222")) ; a dark green (t (:foreground "Black" :background "Plum"))) "*Face for highlighting failed part of input during strict completion." :group 'Icicles-Minibuffer-Display :group 'faces) (defface icicle-input-completion-fail-lax '((((background dark)) (:background "#00005E3B5A8D")) ; a dark cyan (t (:foreground "Black" :background "#FFFFB8C4BB87"))) "*Face for highlighting failed part of input during lax completion." :group 'Icicles-Minibuffer-Display :group 'faces) (defface icicle-match-highlight-Completions '((((background dark)) (:foreground "#1F1FA21CA21C")) ; a very dark cyan (t (:foreground "Red3"))) "*Face used to highlight root that was completed, in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-match-highlight-minibuffer '((t (:underline t))) "*Face used to highlight root that was completed, in minibuffer." :group 'Icicles-Minibuffer-Display :group 'faces) (defface icicle-mode-line-help '((((background dark)) (:foreground "#AC4AAC4A0000")) ; a dark yellow (t (:foreground "Blue"))) "*Face used to highlight help shown in the mode-line." :group 'Icicles-Completions-Display :group 'Icicles-Miscellaneous :group 'faces) (defface icicle-msg-emphasis '((((background dark)) (:foreground "#B19E6A64B19E")) ; a dark magenta (t (:foreground "DarkGreen"))) "*Face used to emphasize (part of) a message." :group 'Icicles-Minibuffer-Display :group 'faces) (defface icicle-multi-command-completion '((((background dark)) ; a dark cyan on a dark magenta (:foreground "#0000D53CD53C" :background "#8B3500007533")) (t (:foreground "Red" :background "#78F6FFFF8E4F"))) ; red on a light green "*Face used to indicate Icicles multi-command completion. It highlights the minibuffer indicator and the `Icy+' minor-mode lighter during multi-command completion. Not used for versions of Emacs before version 21." :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces) (defface icicle-mustmatch-completion '((((type x w32 mac graphic) (class color)) (:box (:line-width -2 :color "Blue"))) ; blue box (t (:inverse-video t))) "*Face used to indicate strict minibuffer completion. It highlights the minibuffer indicator and the `Icy' or `Icy+' minor-mode lighter during strict completion. Not used for versions of Emacs before version 21." :group 'Icicles-Minibuffer-Display :group 'Icicles-Miscellaneous :group 'faces) (defface icicle-proxy-candidate '((((background dark)) (:background "#316B22970000")) ; a very dark brown (t (:background "#E1E1EAEAFFFF" ; A light blue. :box (:line-width 2 :color "White" :style released-button)))) "*Face used to highlight proxy candidates in `*Completions*'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-saved-candidate '((((background dark)) (:background "gray20")) ; a dark gray (t (:background "gray80"))) ; a light gray "*Face used to highlight `*Completions*' candidates that have been saved." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-search-main-regexp-current '((((background dark)) (:background "#00004AA652F1")) ; a dark cyan (t (:background "misty rose"))) "*Face used to highlight current match of your search context regexp. This highlighting is done during Icicles searching." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-1 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.80) 0.10) "#071F473A0000"))) ; a dark green (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.80) 0.10) "#FA6CC847FFFF"))))) ; a light magenta "*Face used to highlight level (subgroup match) 1 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-2 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.40) 0.10) "#507400002839"))) ; a dark red (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.40) 0.10) "#C847FFFFE423"))))) ; a light cyan "*Face used to highlight level (subgroup match) 2 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-3 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.60) 0.10) "#4517305D0000"))) ; a dark brown (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.60) 0.10) "#C847D8FEFFFF"))))) ; a light blue "*Face used to highlight level (subgroup match) 3 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-4 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.20) 0.10) "#176900004E0A"))) ; a dark blue (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-saturation (hexrgb-increment-hue context-bg 0.20) 0.10) "#EF47FFFFC847"))))) ; a light yellow "*Face used to highlight level (subgroup match) 4 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-5 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.80) "#04602BC00000"))) ; a very dark green (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.80) "#FCFCE1E1FFFF"))))) ; a light magenta "*Face used to highlight level (subgroup match) 5 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-6 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.40) "#32F200001979"))) ; a very dark red (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.40) "#E1E1FFFFF0F0"))))) ; a light cyan "*Face used to highlight level (subgroup match) 6 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-context-level-7 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.60) "#316B22970000"))) ; a very dark brown (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.60) "#E1E1EAEAFFFF"))))) ; a light blue "*Face used to highlight level (subgroup match) 7 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) ;; NO AUTOLOAD COOKIE HERE. (defface icicle-search-context-level-8 (let ((context-bg (face-background 'icicle-search-main-regexp-current))) `((((background dark)) (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.20) "#12EC00003F0E"))) ; a very dark blue (t (:background ,(if (fboundp 'hexrgb-increment-saturation) (hexrgb-increment-hue context-bg 0.20) "#F6F5FFFFE1E1"))))) ; a light yellow "*Face used to highlight level (subgroup match) 8 of your search context. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-current-input '((((background dark)) (:foreground "White" :background "#7F0D00007F0D")) ; a dark magenta (t (:foreground "Black" :background "Green"))) "*Face used to highlight what your current input matches. This highlighting is done during Icicles searching whenever `icicle-search-highlight-context-levels-flag' is non-nil and the search context corresponds to the entire regexp." :group 'Icicles-Searching :group 'faces) (defface icicle-search-main-regexp-others '((((background dark)) (:background "#348608690000")) ; a very dark brown (t (:background "CadetBlue1"))) "*Face used to highlight other matches of your search context regexp. If user option `icicle-search-highlight-threshold' is less than one, then this face is not used. This highlighting is done during Icicles searching." :group 'Icicles-Searching :group 'faces) (defface icicle-special-candidate '((((background dark)) (:background "#176900004E0A")) ; a dark blue (t (:background "#EF47FFFFC847"))) ; A light yellow. "*Face used to highlight `*Completions*' candidates that are special. The meaning of special is that their names match `icicle-special-candidate-regexp'." :group 'Icicles-Completions-Display :group 'faces) (defface icicle-whitespace-highlight '((((background dark)) (:background "#000093F402A2")) ; a medium green (t (:background "Magenta"))) "*Face used to highlight initial whitespace in minibuffer input." :group 'Icicles-Minibuffer-Display :group 'faces) ;; This is defined in `faces.el', Emacs 22. This is for Emacs < 22. This is used ;; only for versions of Emacs that have `propertize' but don't have this face. (unless (facep 'minibuffer-prompt) (defface minibuffer-prompt '((((background dark)) (:foreground "cyan")) (t (:foreground "dark blue"))) "*Face for minibuffer prompts." :group 'basic-faces)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-face) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-face.el ends here icicles-2013.04.23.23400/icicles-fn.el000066400000000000000000014772361214003072700165460ustar00rootroot00000000000000;;; icicles-fn.el --- Non-interactive functions for Icicles ;; ;; Filename: icicles-fn.el ;; Description: Non-interactive functions for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:25:53 2006 ;; Version: 22.0 ;; Last-Updated: Tue Apr 30 13:55:53 2013 (-0700) ;; By: dradams ;; Update #: 13964 ;; URL: http://www.emacswiki.org/icicles-fn.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `apropos', `apropos-fn+var', `cl', `el-swank-fuzzy', `ffap', ;; `ffap-', `fuzzy', `fuzzy-match', `hexrgb', `icicles-opt', ;; `icicles-var', `kmacro', `levenshtein', `naked', `regexp-opt', ;; `thingatpt', `thingatpt+', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; non-interactive functions. For Icicles documentation, see ;; `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Macros defined here: ;; ;; `icicle-maybe-cached-action', `minibuffer-with-setup-hook'. ;; ;; Commands defined here: ;; ;; `icicle-dired-smart-shell-command', ;; `icicle-minibuffer-default-add-dired-shell-commands', ;; `icicle-shell-command', `icicle-shell-command-on-region', ;; ;; Non-interactive functions defined here: ;; ;; `assq-delete-all', `icicle-2nd-part-string-less-p', ;; `icicle-abbreviate-or-expand-file-name', ;; `icicle-all-completions', `icicle-alpha-p', ;; `icicle-alt-act-fn-for-type', `icicle-any-candidates-p', ;; `icicle-apropos-any-candidates-p', ;; `icicle-apropos-any-file-name-candidates-p', ;; `icicle-apropos-candidates', `icicle-assoc-delete-all', ;; `icicle-barf-if-outside-Completions', ;; `icicle-barf-if-outside-Completions-and-minibuffer', ;; `icicle-barf-if-outside-minibuffer', ;; `icicle-bounds-of-thing-at-point', ;; `icicle-buffer-file/process-name-less-p', ;; `icicle-buffer-smaller-p', ;; `icicle-call-then-update-Completions', `icicle-candidate-set-1', ;; `icicle-candidate-short-help', ;; `icicle-case-insensitive-string-less-p', ;; `icicle-case-string-less-p', `icicle-cdr-lessp', ;; `icicle-char-cands-from-charlist', ;; `icicle-choose-completion-string', `icicle-clear-lighter', ;; `icicle-clear-minibuffer', `icicle-color-name-w-bg', ;; `icicle-color-rgb-lessp', `icicle-command-abbrev-save', ;; `icicle-command-abbrev-used-more-p', ;; `icicle-command-names-alphabetic-p', ;; `icicle-complete-again-update', `icicle-completing-p', ;; `icicle-completing-read', `icicle-completing-read-multiple', ;; `icicle-completing-read-history', ;; `icicle-completion-all-completions', ;; `icicle-completion-setup-function', ;; `icicle-completion--embedded-envvar-table', ;; `icicle-completion-try-completion', `icicle-current-TAB-method', ;; `icicle-custom-type', `icicle-defaults-at-point', ;; `icicle-define-crm-completion-map', `icicle-delete-alist-dups', ;; `icicle-delete-count', `icicle-delete-dups', ;; `icicle-delete-whitespace-from-string', ;; `icicle-dired-read-shell-command', ;; `icicle-dir-prefix-wo-wildcards', `icicle-dirs-first-p', ;; `icicle-dirs-last-p', `icicle-displayable-cand-from-saved-set', ;; `icicle-display-cand-from-full-cand', ;; `icicle-display-completion-list', `icicle-display-Completions', ;; `icicle-display-candidates-in-Completions', ;; `icicle-expanded-common-match', ;; `icicle-expanded-common-match-1', `icicle-expand-file-name-20', ;; `icicle-expand-file-or-dir-name', ;; `icicle-explicit-saved-completion-candidates', ;; `icicle-extra-candidates-first-p', ;; `icicle-face-valid-attribute-values', `icicle-file-directory-p', ;; `icicle-file-name-apropos-candidates', ;; `icicle-file-name-directory', ;; `icicle-file-name-directory-w-default', ;; `icicle-file-name-input-p', `icicle-file-name-nondirectory', ;; `icicle-file-name-prefix-candidates', `icicle-file-readable-p', ;; `icicle-file-remote-p', `icicle-file-type-less-p', ;; `icicle-file-writable-p', `icicle-filesets-files-under', ;; `icicle-files-within', `icicle-files-within-1', ;; `icicle-filter-alist', `icicle-filter-wo-input', ;; `icicle-first-matching-candidate', `icicle-first-N', ;; `icicle-fit-completions-window', `icicle-fix-default-directory', ;; `icicle-flat-list', `icicle-frames-on', ;; `icicle-fuzzy-candidates', `icicle-get-alist-candidate', ;; `icicle-get-candidates-from-saved-set', `icicle-get-safe', ;; `icicle-dired-guess-shell-command', ;; `icicle-handle-default-for-prompt', `icicle-help-line-buffer', ;; `icicle-help-line-file', ;; `icicle-highlight-candidate-in-Completions', ;; `icicle-highlight-complete-input', ;; `icicle-highlight-initial-whitespace', ;; `icicle-highlight-input-noncompletion', ;; `icicle-highlight-input-noncompletion-rest', ;; `icicle-highlight-lighter', `icicle-historical-alphabetic-p', ;; `icicle-increment-cand-nb+signal-end', ;; `icicle-Info-node-is-indexed-by-topic', ;; `icicle-input-from-minibuffer', `icicle-insert-candidates', ;; `icicle-insert-cand-in-minibuffer', ;; `icicle-insert-Completions-help-string', ;; `icicle-join-nth-parts', `icicle-key-description', ;; `icicle-kill-a-buffer', `icicle-last-accessed-first-p', ;; `icicle-last-modified-first-p', `icicle-levenshtein-match', ;; `icicle-levenshtein-one-match', `icicle-levenshtein-one-regexp', ;; `icicle-levenshtein-strict-match', ;; `icicle-lisp-vanilla-completing-read', ;; `icicle-local-keys-first-p', `icicle-make-plain-predicate', ;; `icicle-major-mode-name-less-p', `icicle-make-face-candidate', ;; `icicle-maybe-sort-and-strip-candidates', ;; `icicle-maybe-sort-maybe-truncate', `icicle-mctize-all', ;; `icicle-mctized-display-candidate', ;; `icicle-mctized-full-candidate', `icicle-member-ignore-case', ;; `icicle-merge-saved-order-less-p', ;; `icicle-minibuffer-default-add-completions', ;; `icicle-minibuf-input', `icicle-minibuf-input-sans-dir', ;; `icicle-minibuffer-prompt-end', `icicle-mode-line-name-less-p', ;; `icicle-most-recent-first-p', `icicle-msg-maybe-in-minibuffer', ;; `icicle-ms-windows-NET-USE', ;; `icicle-multi-comp-apropos-complete-match', `icicle-multi-sort', ;; `icicle-next-candidate', `icicle-not-basic-prefix-completion-p', ;; `icicle-ORIG-choose-completion-string', ;; `icicle-ORIG-completing-read', ;; `icicle-ORIG-completing-read-multiple', ;; `icicle-ORIG-completion-setup-function', ;; `icicle-ORIG-dired-smart-shell-command', ;; `icicle-ORIG-display-completion-list', ;; `icicle-ORIG-face-valid-attribute-values', ;; `icicle-ORIG-minibuffer-default-add-completions', ;; `icicle-ORIG-read-buffer', `icicle-ORIG-read-char-by-name', ;; `icicle-ORIG-read-face-name', ;; `icicle-ORIG-read-file-name-default', ;; `icicle-ORIG-read-from-minibuffer', `icicle-ORIG-read-number', ;; `icicle-ORIG-read-string', `icicle-ORIG-shell-command', ;; `icicle-ORIG-shell-command-on-region', ;; `icicle-part-1-cdr-lessp', `icicle-part-1-lessp', ;; `icicle-part-2-lessp', `icicle-part-3-lessp', ;; `icicle-part-4-lessp', `icicle-part-N-lessp', ;; `icicle-place-cursor', `icicle-place-overlay', ;; `icicle-position', `icicle-prefix-any-candidates-p', ;; `icicle-prefix-any-file-name-candidates-p', ;; `icicle-prefix-candidates', `icicle-prefix-keys-first-p', ;; `icicle-propertize', `icicle-proxy-candidate-first-p', ;; `icicle-put-at-head', `icicle-put-whole-cand-prop', ;; `icicle-quote-file-name-part-of-cmd', ;; `icicle-readable-to-markers', `icicle-read-buffer', ;; `icicle-read-char-by-name', `icicle-read-char-exclusive', ;; `icicle-read-char-maybe-completing', `icicle-read-face-name', ;; `icicle-read-file-name', `icicle-read-file-name-default', ;; `icicle-read-from-minibuffer', ;; `icicle-read-from-minibuf-nil-default', `icicle-read-number', ;; `icicle-read-shell-command', ;; `icicle-read-shell-command-completing', `icicle-read-string', ;; `icicle-read-string-completing', ;; `icicle-recentf-make-menu-items', `icicle-recompute-candidates', ;; `icicle-remove-color-duplicates', `icicle-remove-dots', ;; `icicle-remove-duplicates', `icicle-remove-dups-if-extras', ;; `icicle-remove-if', `icicle-remove-if-not', ;; `icicle-remove-property', `icicle-replace-mct-cand-in-mct', ;; `icicle-require-match-p', `icicle-restore-standard-commands', ;; `icicle-restore-standard-options', ;; `icicle-restore-std-completion-fns', `icicle-reversible-sort', ;; `icicle-saved-fileset-p', `icicle-save-or-restore-input', ;; `icicle-save-raw-input', `icicle-scatter', ;; `icicle-scatter-match', `icicle-scroll-or-update-Completions', ;; `icicle-set-difference', `icicle-set-intersection', ;; `icicle-set-union', `icicle-show-help-in-mode-line', ;; `icicle-show-in-mode-line', `icicle-some', ;; `icicle-special-candidates-first-p', ;; `icicle-start-of-candidates-in-Completions', ;; `icicle-string-match-p', `icicle-strip-ignored-files-and-sort', ;; `icicle-subst-envvar-in-file-name', ;; `icicle-substring-no-properties', `icicle-substrings-of-length', ;; `icicle-take', `icicle-toggle-icicle-mode-twice', ;; `icicle-transform-candidates', ;; `icicle-transform-multi-completion', `icicle-try-switch-buffer', ;; `icicle-ucs-names', `icicle-unhighlight-lighter', ;; `icicle-unpropertize-completion', ;; `icicle-unsorted-apropos-candidates', ;; `icicle-unsorted-file-name-apropos-candidates', ;; `icicle-unsorted-file-name-prefix-candidates', ;; `icicle-unsorted-prefix-candidates', `icicle-upcase', ;; `icicle-value-satisfies-type-p', `icicle-var-inherits-type-p', ;; `icicle-var-is-of-type-p', `icicle-var-matches-type-p', ;; `icicle-var-val-satisfies-type-p', ;; `select-frame-set-input-focus'. ;; ;; Internal variables defined here: ;; ;; `icicle-crm-local-completion-map', ;; `icicle-crm-local-must-match-map', `icicle-dirs-done', ;; `icicle-files', `icicle-ORIG-crm-local-completion-map', ;; `icicle-ORIG-crm-local-must-match-map'. ;; ;; ;; ***** NOTE: This vanilla Emacs function is defined here for ;; Emacs 20, where it does not exist. ;; ;; `replace-regexp-in-string' (Emacs 20). ;; ;; ;; ***** NOTE: These EMACS PRIMITIVES have been REDEFINED HERE: ;; ;; `completing-read' - (See doc string.) ;; `display-completion-list' - (See doc string.) ;; `face-valid-attribute-values' - (See doc string.) ;; `read-file-name' Emacs 20, 21 only - (See doc string.) ;; `read-from-minibuffer' - (See doc string.) ;; `read-string' - (See doc string.) ;; ;; ;; ***** NOTE: The following functions defined in `simple.el' have ;; been REDEFINED HERE: ;; ;; `choose-completion-string' - ;; Don't exit minibuffer after `lisp-complete-symbol' completion. ;; `completion-setup-function' - 1. Put faces on inserted string(s). ;; 2. Help on help. ;; `repeat-complex-command' - Use `completing-read' to read command. ;; ;; ;; ***** NOTE: The following function defined in `filesets.el' has ;; been REDEFINED HERE: ;; ;; `filesets-get-filelist' - Fix. Bug #976 reported to Emacs devel. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Macros") ;; (@> "Redefined standard functions") ;; (@> "Icicles functions - completion display (not cycling)") ;; (@> "Icicles functions - TAB completion cycling") ;; (@> "Icicles functions - S-TAB completion cycling") ;; (@> "Icicles functions - common helper functions") ;; (@> "Icicles functions - sort functions") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (eval-when-compile (require 'cl)) ;; case, lexical-let, loop ;; plus, for Emacs < 21: dolist, push, pop (require 'hexrgb nil t) ;; (no error if not found): hexrgb-color-name-to-hex (require 'wid-edit+ nil t) ;; (no error if not found): ;; redefined color widget (for icicle-var-is-of-type-p) (eval-when-compile (or (condition-case nil (load-library "icicles-mac") ; Use load-library to ensure latest .elc. (error nil)) (require 'icicles-mac))) ; Require, so can load separately if not on `load-path'. ;; icicle-with-selected-window (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.) ;; icicle-buffer-ignore-space-prefix-flag, icicle-Completions-display-min-input-chars, ;; icicle-expand-input-to-common-match, icicle-hide-common-match-in-Completions-flag, ;; icicle-hide-non-matching-lines-flag, icicle-highlight-historical-candidates-flag, ;; icicle-highlight-input-initial-whitespace-flag, icicle-incremental-completion-delay, ;; icicle-incremental-completion, icicle-incremental-completion-threshold, ;; icicle-default-value, icicle-list-join-string, icicle-mark-position-in-candidate, ;; icicle-point-position-in-candidate, icicle-regexp-quote-flag, icicle-require-match-flag, ;; icicle-show-Completions-help-flag, icicle-sort-comparer, icicle-special-candidate-regexp, ;; icicle-transform-function, icicle-use-~-for-home-dir-flag (require 'icicles-var) ;; icicle-buffer-name-input-p, icicle-candidate-nb, icicle-candidate-action-fn, ;; icicle-candidate-properties-alist, icicle-cmd-calling-for-completion, icicle-common-match-string, ;; icicle-complete-input-overlay, icicle-completing-p (variable), icicle-completion-candidates, ;; icicle-current-completion-mode, icicle-current-input, icicle-current-raw-input, ;; icicle-edit-update-p, icicle-extra-candidates, icicle-ignored-extensions-regexp, ;; icicle-incremental-completion-p, icicle-initial-value, icicle-last-completion-candidate, ;; icicle-last-input, icicle-must-match-regexp, icicle-must-not-match-regexp, icicle-must-pass-predicate, ;; icicle-must-pass-after-match-predicate, icicle-nb-of-other-cycle-candidates, icicle-re-no-dot, ;; icicle-reverse-sort-p, icicle-saved-completion-candidates ;; This requirement is real, but leads to recursion. ;; You should, in any case, just load everything by loading `icicles.el'. ;; (require 'icicles-mode) ;; icicle-mode ;; Byte-compiling this file, you will likely get some error or warning ;; messages due to differences between different versions of Emacs. ;;; Defvars to quiet the byte-compiler: (when (< emacs-major-version 22) (defvar completion-annotate-function) (defvar completion-common-substring) (defvar completion-extra-properties) (defvar completion-root-regexp) (defvar icicle-Info-visited-max-candidates) ; In `icicles-opt.el' (for Emacs 22+) (defvar minibuffer-completing-symbol) (defvar minibuffer-prompt-properties) (defvar partial-completion-mode) (defvar read-file-name-completion-ignore-case) (defvar minibuffer-local-filename-completion-map) (defvar minibuffer-local-must-match-filename-map) (defvar minibuffer-local-filename-must-match-map) (defvar read-file-name-predicate) (defvar tooltip-mode)) (when (< emacs-major-version 23) (defvar completion--embedded-envvar-re) ; In `minibuffer.el'. (defvar completion-styles) ; In `minibuffer.el' (defvar icicle-Completions-text-scale-decrease)) ; In `icicles-opt.el' (for Emacs 23) (defvar completion-root-regexp) ; In `simple.el' (for Emacs 22 and 23.1) (defvar doremi-boost-down-keys) ; In `doremi.el' (defvar doremi-boost-up-keys) ; In `doremi.el' (defvar doremi-down-keys) ; In `doremi.el' (defvar doremi-up-keys) ; In `doremi.el' (defvar eyedrop-picked-background) ; In `eyedrop.el' and `palette.el' (defvar eyedrop-picked-foreground) ; In `eyedrop.el' and `palette.el' (defvar filesets-data) ; In `filesets.el' (defvar font-width-table) ; In C code. (defvar font-weight-table) ; In C code. (defvar font-slant-table) ; In C code. (defvar history-delete-duplicates) ; In C code for Emacs 22+. (defvar icicle-file-name-completion-table) ; In `icicles-var.el' for Emacs 23+. (defvar icicle-Info-hist-list) ; In `icicles-cmd2.el' (defvar icicle-Info-index-nodes) ; In `icicles-cmd2.el' (defvar icicle-Info-manual) ; In `icicles-cmd2.el' (defvar icicle-read-char-history) ; In `icicles-var.el' for Emacs 23+. (defvar icicle-read-file-name-internal-fn) ; In `icicles-var.el' for Emacs 24+. (defvar list-colors-sort) ; In `facemenu.el' (defvar 1on1-*Completions*-frame-flag) ; In `oneonone.el' (defvar minibuffer-default-in-prompt-regexps) ; In `minibuf-eldef.el'. (defvar minibuffer-local-filename-syntax) ; In `minibuffer.el' for Emacs 24+. (defvar read-buffer-completion-ignore-case) ; Emacs 23+. (defvar recentf-list) ; In `recentf.el' (defvar recentf-menu-filter-commands) (defvar recentf-menu-filter) (defvar recentf-max-menu-items) (defvar recentf-menu-open-all-flag) (defvar recentf-menu-filter-commands) (defvar recentf-menu-items-for-commands) (defvar shell-completion-execonly) ; In `shell.el' (defvar ucs-names) ; In `mule-cmds.el'. ;; The name changed during development of Emacs 23. They aliased it for 23.1, but removed it for 23.2. ;; Use the new name and alias the old, but don't declare old obsolete (let Emacs 23 do that.) (when (and (boundp 'minibuffer-local-must-match-filename-map) (fboundp 'defvaralias)) ; Emacs 22 (defvar minibuffer-local-filename-must-match-map minibuffer-local-must-match-filename-map "Local keymap for minibuffer input with completion for filenames with exact match.") (defvaralias 'minibuffer-local-must-match-filename-map 'minibuffer-local-filename-must-match-map)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Macros") ;;; Macros ----------------------------------------------------------- (defmacro icicle-maybe-cached-action (action) "Evaluate and return ACTION or `icicle-all-candidates-action'. If `icicle-all-candidates-action' is nil, use ACTION. If it is t, then set it to the value of ACTION, so the next call returns the same value." `(if icicle-all-candidates-action (if (eq icicle-all-candidates-action t) (setq icicle-all-candidates-action ,action) icicle-all-candidates-action) ,action)) ;; Same as vanilla definition. Needed for byte-compiling. (defmacro minibuffer-with-setup-hook (fun &rest body) "Temporarily add FUN to `minibuffer-setup-hook' while executing BODY. BODY should use the minibuffer at most once. Recursive uses of the minibuffer are unaffected (FUN is not called additional times). This macro actually adds an auxiliary function that calls FUN, rather than FUN itself, to `minibuffer-setup-hook'." ;; (declare (indent 1) (debug t)) (let ((hook (make-symbol "setup-hook"))) `(let (,hook) (setq ,hook (lambda () ;; Clear out this hook so it does not interfere ;; with any recursive minibuffer usage. (remove-hook 'minibuffer-setup-hook ,hook) (funcall ,fun))) (unwind-protect (progn (add-hook 'minibuffer-setup-hook ,hook) ,@body) (remove-hook 'minibuffer-setup-hook ,hook))))) ;;(@* "Redefined standard functions") ;;; Redefined standard functions ------------------------------------- ;; REPLACE ORIGINAL `choose-completion-string' in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Don't exit minibuffer if this is just a `lisp-complete-symbol' completion. ;; Go to point-max before insert choice. Respect `icicle-dir-candidate-can-exit-p'. ;; ;; Free variable `completion-reference-buffer' is defined in `simple.el'. ;; (unless (fboundp 'icicle-ORIG-choose-completion-string) (defalias 'icicle-ORIG-choose-completion-string (symbol-function 'choose-completion-string))) (cond ((= emacs-major-version 22) (defun icicle-choose-completion-string (choice &optional buffer base-size) "Switch to BUFFER and insert the completion choice CHOICE. BASE-SIZE, if non-nil, says how many characters of BUFFER's text to keep. If it is nil, we call `choose-completion-delete-max-match' to decide what to delete. If BUFFER is the minibuffer, then exit the minibuffer, unless one of the following is true: - it is reading a file name, CHOICE is a directory, and `icicle-dir-candidate-can-exit-p' is nil - `completion-no-auto-exit' is non-nil - this is just a `lisp-complete-symbol' completion." (let* ((buffer (or buffer completion-reference-buffer)) (mini-p (minibufferp buffer))) ;; If BUFFER is a minibuffer, barf unless it's currently active. (if (and mini-p (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (icicle-user-error "Minibuffer is not active for completion") ;; Set buffer so buffer-local `choose-completion-string-functions' works. (set-buffer buffer) (unless (run-hook-with-args-until-success 'choose-completion-string-functions choice buffer mini-p base-size) ;;; $$$$$$ Removed this because it led to an error in Emacs 24, since base-size is nil there. ;;; Anyway, Icicles doesn't really need or use base-size or `choose-completion-delete-max-match'. ;;; ;; Insert the completion into the buffer where completion was requested. ;;; (if base-size ;;; (delete-region (+ base-size (if mini-p (minibuffer-prompt-end) (point-min))) ;;; (if mini-p (point-max) (point))) ;;; (choose-completion-delete-max-match choice)) ;; Forget about base-size altogether. Replace the whole input always. (delete-region (+ (or base-size 0) (if mini-p (minibuffer-prompt-end) (point-min))) (if mini-p (point-max) (point))) (when mini-p (goto-char (point-max))) ; $$$$$ (was unconditional) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window that BUFFER is showing in. (let ((window (get-buffer-window buffer 0))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (equal buffer (window-buffer (minibuffer-window))) (or minibuffer-completion-table (and icicle-mode (or icicle-extra-candidates icicle-proxy-candidates))) (not (eq 'lisp-complete-symbol icicle-cmd-calling-for-completion)) ;; Exit the minibuffer if `icicle-dir-candidate-can-exit-p', ;; or not reading a file name, or chosen file is not a directory. (if (or icicle-dir-candidate-can-exit-p (not (eq minibuffer-completion-table 'read-file-name-internal)) (not (file-directory-p (field-string (point-max))))) (exit-minibuffer) (let ((mini (active-minibuffer-window))) (select-window mini) (when minibuffer-auto-raise (raise-frame (window-frame mini))))))))))) ((and (= emacs-major-version 23) (= emacs-minor-version 1)) ; Emacs 23.1 (defun icicle-choose-completion-string (choice &optional buffer base-size) "Switch to BUFFER and insert the completion choice CHOICE. BASE-SIZE, if non-nil, says how many characters of BUFFER's text to keep. If it is nil, we call `choose-completion-delete-max-match' to decide what to delete. If BUFFER is the minibuffer, then exit the minibuffer, unless one of the following is true: - it is reading a file name, CHOICE is a directory, and `icicle-dir-candidate-can-exit-p' is nil - `completion-no-auto-exit' is non-nil - this is just a `lisp-complete-symbol' completion." (let* ((buffer (or buffer completion-reference-buffer)) (mini-p (minibufferp buffer))) ;; If BUFFER is a minibuffer, barf unless it's currently active. (if (and mini-p (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (icicle-user-error "Minibuffer is not active for completion") (set-buffer buffer) ; So buffer-local `choose-completion-string-functions' works. (unless (run-hook-with-args-until-success 'choose-completion-string-functions choice buffer mini-p base-size) ;; Insert the completion into the buffer where it was requested. ;; Vanilla Emacs FIXME: ;; - There may not be a field at point, or there may be a field but it is not a ;; "completion field", in which case we have to call `choose-completion-delete-max-match', ;; even if BASE-SIZE is set. ;; - We may need to delete further than (point) to (field-end), depending on the ;; `completion-style', and for that we need extra data `completion-extra-size'. (if base-size (delete-region (+ base-size (field-beginning)) (point)) (choose-completion-delete-max-match choice)) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window that BUFFER is showing in. (let ((window (get-buffer-window buffer 0))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (minibufferp buffer) (or minibuffer-completion-table (and icicle-mode (or icicle-extra-candidates icicle-proxy-candidates))) (not (eq 'lisp-complete-symbol icicle-cmd-calling-for-completion)) ;; Exit the minibuffer if `icicle-dir-candidate-can-exit-p', ;; or not reading a file name, or chosen file is not a directory. (if (or icicle-dir-candidate-can-exit-p (not (eq minibuffer-completion-table 'read-file-name-internal)) (not (file-directory-p (field-string (point-max))))) (exit-minibuffer) (let ((mini (active-minibuffer-window))) (select-window mini) (when minibuffer-auto-raise (raise-frame (window-frame mini))))))))))) ((or (> emacs-major-version 23) ; Emacs 23.2+ (and (= emacs-major-version 23) (> emacs-minor-version 1))) (defun icicle-choose-completion-string (choice &optional buffer base-position) "Switch to BUFFER and insert the completion choice CHOICE. BASE-POSITION should be a cons whose car is the position where the choice is inserted. It is ignored if not a cons. If BUFFER is the minibuffer, then exit the minibuffer, unless one of the following is true: - it is reading a file name, CHOICE is a directory, and `icicle-dir-candidate-can-exit-p' is nil - `completion-no-auto-exit' is non-nil - this is just a `lisp-complete-symbol' completion." (unless (consp base-position) ; Older code may pass BASE-SIZE instead of BASE-POSITION. Ignore it. (message "Obsolete BASE-SIZE argument passed to `choose-completion-string'") (setq base-position nil)) (let* ((buffer (or buffer completion-reference-buffer)) (mini-p (minibufferp buffer))) ;; If BUFFER is a minibuffer, barf unless it is currently active. (if (and mini-p (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (icicle-user-error "Minibuffer is not active for completion") ;; Set buffer so buffer-local `choose-completion-string-functions' works. (set-buffer buffer) (unless (run-hook-with-args-until-success 'choose-completion-string-functions ;; 4th arg used to be MINI-P, but it was useless and unused - can just use ;; (minibufferp BUFFER). The last arg used to be BASE-SIZE - keep it to avoid ;; breaking older code. choice buffer base-position nil) ;; Forget about base-size altogether. Replace the whole input always. (delete-region (if mini-p (minibuffer-prompt-end) (point-min)) (if mini-p (point-max) (point))) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window where BUFFER is showing. (let ((window (get-buffer-window buffer t))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (minibufferp buffer) (or minibuffer-completion-table (and icicle-mode (or icicle-extra-candidates icicle-proxy-candidates))) (not (eq 'lisp-complete-symbol icicle-cmd-calling-for-completion)) ;; Exit the minibuffer if `icicle-dir-candidate-can-exit-p', ;; or not reading a file name, or chosen file is not a directory. (let* ((result (buffer-substring (field-beginning) (point))) (bounds (completion-boundaries result minibuffer-completion-table minibuffer-completion-predicate ""))) (if (or icicle-dir-candidate-can-exit-p (not (eq (car bounds) (length result)))) ;; $$$$$$ (not (eq minibuffer-completion-table 'read-file-name-internal)) ;; $$$$$$ (not (file-directory-p (field-string (point-max))))) (exit-minibuffer) ;; The candidate chosen leads to a new set of candidates (e.g., it is a dir). ;; Do not exit the minibuffer yet. (let ((mini (active-minibuffer-window))) (select-window mini) (when minibuffer-auto-raise (raise-frame (window-frame mini)))))))))))) ((= emacs-major-version 21) ; Emacs 21 (defun icicle-choose-completion-string (choice &optional buffer base-size) "Switch to BUFFER and insert the completion choice CHOICE. BASE-SIZE, if non-nil, says how many characters of BUFFER's text to keep. If it is nil, we call `choose-completion-delete-max-match' to decide what to delete. If BUFFER is the minibuffer, then exit the minibuffer, unless one of the following is true: - it is reading a file name, CHOICE is a directory, and `icicle-dir-candidate-can-exit-p' is nil - `completion-no-auto-exit' is non-nil - this is just a `lisp-complete-symbol' completion." (let* ((buffer (or buffer completion-reference-buffer)) (mini-p (save-match-data (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer))))) ;; If BUFFER is a minibuffer, barf unless it's currently active. (if (and mini-p (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (icicle-user-error "Minibuffer is not active for completion") ;; Insert the completion into the buffer where completion was requested. (set-buffer buffer) (if base-size (delete-region (+ base-size (if mini-p (icicle-minibuffer-prompt-end) (point-min))) (if mini-p (point-max) (point))) (choose-completion-delete-max-match choice)) (when mini-p (goto-char (point-max))) ; $$$$$ (was unconditional) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window that BUFFER is showing in. (let ((window (get-buffer-window buffer 0))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (equal buffer (window-buffer (minibuffer-window))) (or minibuffer-completion-table (and icicle-mode (or icicle-extra-candidates icicle-proxy-candidates))) (not (eq 'lisp-complete-symbol icicle-cmd-calling-for-completion)) ;; Exit the minibuffer if `icicle-dir-candidate-can-exit-p', ;; or not reading a file name, or chosen file is not a directory. (if (or icicle-dir-candidate-can-exit-p (not (eq minibuffer-completion-table 'read-file-name-internal)) (not (file-directory-p (field-string (point-max))))) (exit-minibuffer) (let ((mini (active-minibuffer-window))) (select-window mini) (when minibuffer-auto-raise (raise-frame (window-frame mini)))))))))) (t ; Emacs 20 (defun icicle-choose-completion-string (choice &optional buffer base-size) "Switch to BUFFER and insert the completion choice CHOICE. BASE-SIZE, if non-nil, says how many characters of BUFFER's text to keep. If it is nil, we call `choose-completion-delete-max-match' to decide what to delete. If BUFFER is the minibuffer, then exit the minibuffer, unless one of the following is true: - it is reading a file name, CHOICE is a directory, and `icicle-dir-candidate-can-exit-p' is nil - `completion-no-auto-exit' is non-nil - this is just a `lisp-complete-symbol' completion." (let* ((buffer (or buffer completion-reference-buffer)) (mini-p (save-match-data (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer))))) ;; If BUFFER is a minibuffer, barf unless it's currently active. (when (and mini-p (or (not (active-minibuffer-window)) (not (equal buffer (window-buffer (active-minibuffer-window)))))) (icicle-user-error "Minibuffer is not active for completion")) ;; Insert the completion into the buffer where completion was requested. (set-buffer buffer) (if base-size (delete-region (+ base-size (point-min)) (if mini-p (point-max) (point))) (choose-completion-delete-max-match choice)) (when mini-p (goto-char (point-max))) ; $$$$$ (was unconditional) (insert choice) (remove-text-properties (- (point) (length choice)) (point) '(mouse-face nil)) ;; Update point in the window that BUFFER is showing in. (let ((window (get-buffer-window buffer 0))) (set-window-point window (point))) ;; If completing for the minibuffer, exit it with this choice, ;; unless this was a `lisp-complete-symbol' completion. (and (not completion-no-auto-exit) (equal buffer (window-buffer (minibuffer-window))) (or minibuffer-completion-table (and icicle-mode (or icicle-extra-candidates icicle-proxy-candidates))) (not (eq 'lisp-complete-symbol icicle-cmd-calling-for-completion)) ;; Exit the minibuffer if `icicle-dir-candidate-can-exit-p', ;; or not reading a file name, or chosen file is not a directory. (if (or icicle-dir-candidate-can-exit-p (not (eq minibuffer-completion-table 'read-file-name-internal)) (not (file-directory-p (buffer-string)))) (exit-minibuffer) (select-window (active-minibuffer-window)))))))) ;; REPLACE ORIGINAL `completion-setup-function' in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Don't print the help lines here. Do that in `icicle-display-completion-list' instead. ;; That's so we can fit the `*Completions*' window to the buffer, including the help lines. ;; (unless (fboundp 'icicle-ORIG-completion-setup-function) (defalias 'icicle-ORIG-completion-setup-function (symbol-function 'completion-setup-function))) (when (< emacs-major-version 22) (defun icicle-completion-setup-function () "Set up for completion. This goes in `completion-setup-hook' so it is called after completion-list buffer text is written." (save-excursion (let* ((mainbuf (current-buffer)) (mbuf-contents (icicle-input-from-minibuffer)) (dir-of-input (and minibuffer-completing-file-name (icicle-file-name-directory (expand-file-name (substitute-in-file-name mbuf-contents)))))) ;; If reading file name and either `icicle-comp-base-is-default-dir-p' is nil or this is a ;; completion command, then set `default-directory' so it will be copied into `*Completions*'. (when (and dir-of-input (or (icicle-get-safe this-command 'icicle-completing-command) (not icicle-comp-base-is-default-dir-p))) (with-current-buffer mainbuf (setq default-directory dir-of-input))) (with-current-buffer standard-output (completion-list-mode) (set (make-local-variable 'completion-reference-buffer) mainbuf) (setq completion-base-size (cond ((and (eq minibuffer-completion-table 'read-file-name-internal) icicle-comp-base-is-default-dir-p (length default-directory))) ((eq minibuffer-completion-table 'read-file-name-internal) ;; For file name completion, use the number of chars before ;; the start of the file name component at point. (with-current-buffer mainbuf (save-excursion (skip-chars-backward "^/") (- (point) (icicle-minibuffer-prompt-end))))) ((save-match-data (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name mainbuf))) ;; Otherwise, in minibuffer, the whole input is being completed. 0)))))))) (when (or (= emacs-major-version 22) ; Emacs 22 or 23.1 (and (= emacs-major-version 23) (= emacs-minor-version 1))) (defun icicle-completion-setup-function () "Set up for completion. This goes in `completion-setup-hook' so it is called after completion-list buffer text is written." (save-excursion (let* ((mainbuf (current-buffer)) (mbuf-contents (minibuffer-completion-contents)) ; Get contents only up to point. (dir-of-input (and minibuffer-completing-file-name (icicle-file-name-directory (expand-file-name (substitute-in-file-name mbuf-contents))))) common-string-length) ;; If reading file name and either `icicle-comp-base-is-default-dir-p' is nil or this is a ;; completion command, then set `default-directory' so it will be copied into `*Completions*'. (when (and dir-of-input (or (icicle-get-safe this-command 'icicle-completing-command) (not icicle-comp-base-is-default-dir-p))) (with-current-buffer mainbuf (setq default-directory dir-of-input))) (with-current-buffer standard-output (completion-list-mode) (set (make-local-variable 'completion-reference-buffer) mainbuf) (setq completion-base-size (cond ((and minibuffer-completing-file-name icicle-comp-base-is-default-dir-p (length default-directory))) ((icicle-get-safe minibuffer-completion-table 'completion-base-size-function) ;; To compute base size, a function can use the global value of ;; `completion-common-substring' or `minibuffer-completion-contents'. (with-current-buffer mainbuf (funcall (get minibuffer-completion-table 'completion-base-size-function)))) (minibuffer-completing-file-name ;; For file name completion, use the number of chars before ;; the start of the file name component at point. (with-current-buffer mainbuf (save-excursion (skip-chars-backward completion-root-regexp) (- (point) (minibuffer-prompt-end))))) ((and (boundp 'minibuffer-completing-symbol) minibuffer-completing-symbol) nil) ;; Otherwise, in minibuffer, the base size is 0. ((minibufferp mainbuf) 0))) (setq common-string-length (cond (completion-common-substring (length completion-common-substring)) (completion-base-size (- (length mbuf-contents) completion-base-size)))) ;; Put faces on first uncommon characters and common parts. (when (and (integerp common-string-length) (>= common-string-length 0)) (let ((element-start (point-min)) (maxp (point-max)) element-common-end) (while (and (setq element-start (next-single-property-change element-start 'mouse-face)) (< (setq element-common-end (+ element-start common-string-length)) maxp)) (when (get-char-property element-start 'mouse-face) (if (and (> common-string-length 0) (get-char-property (1- element-common-end) 'mouse-face)) (put-text-property element-start element-common-end 'font-lock-face 'completions-common-part)) (if (get-char-property element-common-end 'mouse-face) (put-text-property element-common-end (1+ element-common-end) 'font-lock-face 'completions-first-difference))))))))))) (when (or (> emacs-major-version 23) ; Emacs 23.2+ (and (= emacs-major-version 23) (>= emacs-minor-version 2))) (defun icicle-completion-setup-function () "Set up for completion. This goes in `completion-setup-hook' so it is called after completion-list buffer text is written." ;; I could perhaps get rid of even more of the vanilla vestiges here... (save-excursion (let ((mainbuf (current-buffer)) (dir-of-input (and minibuffer-completing-file-name (icicle-file-name-directory (expand-file-name (substitute-in-file-name (minibuffer-completion-contents))))))) ;; If reading file name and either `icicle-comp-base-is-default-dir-p' is nil or this is a ;; completion command, then set `default-directory' so it will be copied into `*Completions*'. (when (and dir-of-input (or (icicle-get-safe this-command 'icicle-completing-command) (not icicle-comp-base-is-default-dir-p))) (with-current-buffer mainbuf (setq default-directory dir-of-input))) (with-current-buffer standard-output (completion-list-mode) (set (make-local-variable 'completion-reference-buffer) mainbuf)))))) (defun icicle-insert-Completions-help-string () "Add or remove help in `*Completions*'. This is controlled by `icicle-show-Completions-help-flag'. Show help only if that option is non-nil." (if icicle-show-Completions-help-flag (let ((instruction2 (or (and icicle-mode (substitute-command-keys (concat "(\\" "\\[icicle-minibuffer-help]: help) "))) "")) instruction1) (cond ((< emacs-major-version 22) (setq instruction1 (if window-system ; We have a mouse. (substitute-command-keys "Click \\\ \\[mouse-choose-completion] on a completion to select it. ") (substitute-command-keys ; No mouse. "In this buffer, type \\\ \\[choose-completion] to select the completion near point. ")))) ((>= emacs-major-version 22) (setq instruction1 (if (display-mouse-p) ; We have a mouse. (substitute-command-keys "Click \\\ \\[mouse-choose-completion] or type \\[choose-completion] on a completion to select it. ") (substitute-command-keys ; No mouse. "In this buffer, type \\\ \\[choose-completion] to select the completion near point. "))))) (goto-char (point-min)) (put-text-property 0 (length instruction1) 'face 'icicle-Completions-instruction-1 instruction1) (put-text-property 0 (length instruction2) 'face 'icicle-Completions-instruction-2 instruction2) (insert instruction1 instruction2 "\n")) ;; Not showing help. Remove standard Emacs help string. (goto-char (point-min)) (re-search-forward "Possible completions are:\n") (delete-region (point-min) (point)))) (defun icicle-read-from-minibuf-nil-default (prompt &optional initial-contents keymap read hist default-value inherit-input-method) "Like `read-from-minibuffer', but return nil for empty input. Args are as for `read-from-minibuffer'. If nothing is input, then nil is returned." (let ((input (read-from-minibuffer prompt initial-contents keymap nil hist default-value inherit-input-method))) (if (string= "" input) nil (if read (car (read-from-string input)) input)))) (defun icicle-completing-read-history (prompt &optional hist pred init-input def inherit-i-m) "Lax `completing-read' against entries in history HIST. Arguments are as for `completing-read'. HIST is a symbol that is a history variable. It defaults to `minibuffer-history'. Completion is lax: a match is not required." (setq hist (or hist 'minibuffer-history)) (let ((hist-val (icicle-remove-duplicates (symbol-value hist)))) (when (and (consp hist-val) (not (stringp (car hist-val)))) ; Convert, e.g. `comand-history'. (setq hist-val (mapcar #'prin1-to-string hist-val))) (completing-read prompt (mapcar #'list hist-val) pred nil init-input hist def inherit-i-m))) ;; Based on the Emacs 22 C code that defined `completing-read'. (defun icicle-lisp-vanilla-completing-read (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Lisp version of vanilla Emacs `completing-read'." (let ((pos 0) val histvar histpos position init) (setq init initial-input minibuffer-completion-table collection minibuffer-completion-predicate predicate minibuffer-completion-confirm (if (eq require-match t) nil require-match)) (setq position nil) (when init (when (consp init) (setq position (cdr init) init (car init))) (unless (stringp init) (error "`icicle-lisp-vanilla-completing-read', INIT not a string: %S" init)) (if (not position) (setq pos (1+ (length init))) ; Default is to put cursor at end of INITIAL-INPUT. (unless (integerp position) (error "`icicle-lisp-vanilla-completing-read', POSITION not an integer: %S" position)) (setq pos (1+ position)))) ; Convert zero-based to one-based. (if (symbolp hist) (setq histvar hist histpos nil) (setq histvar (car-safe hist) histpos (cdr-safe hist))) (unless histvar (setq histvar 'minibuffer-history)) (unless histpos (setq histpos 0)) ;; $$$$$$ ;; (setq val (read-from-minibuffer ;; prompt ;; (cons init pos) ; initial-contents ;; (if (not require-match) ; key map ;; (if (or (not minibuffer-completing-file-name) ;; (eq minibuffer-completing-file-name 'lambda) ;; (not (boundp 'minibuffer-local-filename-completion-map))) ;; minibuffer-local-completion-map ;; minibuffer-local-filename-completion-map) ;; (if (or (not minibuffer-completing-file-name) ;; (eq minibuffer-completing-file-name 'lambda) ;; (not (boundp 'minibuffer-local-filename-must-match-map))) ;; minibuffer-local-must-match-map ;; minibuffer-local-filename-must-match-map)) ;; nil histvar def inherit-input-method)) (setq val (read-from-minibuffer prompt (cons init pos) ; initial-contents (if (not require-match) ; keymap (if (or (not minibuffer-completing-file-name) (eq minibuffer-completing-file-name 'lambda) (not (boundp 'minibuffer-local-filename-completion-map))) minibuffer-local-completion-map (if (fboundp 'make-composed-keymap) ; Emacs 24, starting July 2011. (make-composed-keymap minibuffer-local-filename-completion-map minibuffer-local-completion-map) minibuffer-local-filename-completion-map)) (if (or (not minibuffer-completing-file-name) (eq minibuffer-completing-file-name 'lambda) (and (not (fboundp 'make-composed-keymap)) ; Emacs 24, starting July 2011. (not (boundp 'minibuffer-local-filename-must-match-map)))) minibuffer-local-must-match-map (if (fboundp 'make-composed-keymap) ; Emacs 24, starting July 2011. (make-composed-keymap minibuffer-local-filename-completion-map minibuffer-local-must-match-map) minibuffer-local-filename-must-match-map))) nil histvar def inherit-input-method)) ;; Use `icicle-filtered-default-value', not DEF, because `read-from-minibuffer' filters it. (when (consp icicle-filtered-default-value) ; Emacs 23 lets DEF be a list of strings - use first. (setq icicle-filtered-default-value (car icicle-filtered-default-value))) (when (and (stringp val) (string= val "") icicle-filtered-default-value) (setq val icicle-filtered-default-value)) val)) ;; REPLACE ORIGINAL `completing-read' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Allows for completion candidates that are lists of strings. ;; Allows for reading and returning completion candidates that are strings with properties. ;; Adds completion status indicator to minibuffer and mode-line lighter. ;; Removes `*Completions*' window. ;; ;; We use HIST-m@%=!$+&^*z instead of HIST, to avoid name capture by `minibuffer-history-variable's ;; value. If we didn't need to be Emacs 20-compatible, then we could employ ;; `#1=#:hist'...`#1#'...`#1' read syntax to use an uninterned symbol. ;; (unless (fboundp 'icicle-ORIG-completing-read) (defalias 'icicle-ORIG-completing-read (symbol-function 'completing-read))) (defun icicle-completing-read (prompt collection &optional predicate require-match initial-input hist-m@%=!$+&^*z def inherit-input-method) "Read string in minibuffer, with completion and cycling of completions. Prefix completion via \\\ `\\[icicle-prefix-word-complete]' (word) and `\\[icicle-prefix-complete]' (full). Apropos (regexp) completion via `\\[icicle-apropos-complete]'. Prefix cycling of candidate completions via `\\[icicle-previous-prefix-candidate]' and \ `\\[icicle-next-prefix-candidate]'. Apropos cycling of candidate completions via `\\[icicle-previous-apropos-candidate]' and \ `\\[icicle-next-apropos-candidate]'. Cycling of past minibuffer inputs via `\\[previous-history-element]' and \ `\\[next-history-element]'. Completing past minibuffer inputs via `\\[icicle-insert-history-element]'. Case is ignored if `completion-ignore-case' is non-nil. Position of the cursor (point) and the mark during completion cycling is determined by `icicle-point-position-in-candidate' and `icicle-mark-position-in-candidate', respectively. Highlighting of the matched part of completion candidates during cycling is determined by `icicle-match-highlight-minibuffer', `icicle-match-highlight-Completions', and `icicle-common-match-highlight-Completions'. Use `\\[icicle-minibuffer-help]' during completion for more information on completion and key bindings in Icicle mode. PROMPT is a string to prompt with. It normally ends in a colon and a space. If PROMPT has non-nil text property `icicle-fancy-candidates' on its first character, then completion candidates can be fancy - they can have properties. However, if all of the candidates would be acceptable to vanilla Emacs, then PROMPT need not use property `icicle-fancy-candidates', even for candidates that have text properties. Property `icicle-fancy-candidates' is needed only for candidates that require encoding and decoding to store and retrieve properties. See the Icicles doc, section `Programming with Fancy Candidates'. COLLECTION is an obarray or an alist whose elements' cars are strings. It can also be a function that performs the completion itself. In Emacs 22 or later, it can also be a hash table or list of strings. In Icicle mode, the car of an alist entry can also be a list of strings. In this case, the completion candidate is a multi-completion. The strings are joined pairwise with `icicle-list-join-string' to form the completion candidate seen by the user. You can use variable `icicle-candidate-properties-alist' to control the appearance of multi-completions in buffer `*Completions*'. You can use variables `icicle-list-use-nth-parts' and `icicle-list-nth-parts-join-string' to control the minibuffer behavior of multi-completions. See the Icicles documentation for more information. PREDICATE limits completion to a subset of COLLECTION. See `try-completion' and `all-completions' for more details on completion, COLLECTION, and PREDICATE. REQUIRE-MATCH can take any of these values: * nil means the user can exit using any input. * t means the user can exit only if the input is (or completes to) an element of COLLECTION or is null. * In Emacs 23 or later: - `confirm' means the user can exit with any input, but if the input is not an element of COLLECTION then confirmation is needed. - `confirm-after-completion' is similar, except that with non-matching input exit is allowed only just after completing. * Anything else behaves like t, except that hitting `\\[exit-minibuffer]' does not exit if it performs non-null completion. Regardless of the value of REQUIRE-MATCH, if the user input is empty then the function returns DEF or, if DEF is nil, an empty string. If option `icicle-require-match-flag' is non-nil, it overrides the value of REQUIRE-MATCH. If INITIAL-INPUT is non-nil, insert it in the minibuffer initially, with point positioned at the end. If it is (STRING . POSITION), the initial input is STRING, but point is placed at zero-indexed position POSITION in STRING. (This is different from `read-from-minibuffer' and related functions, which use one-indexing for POSITION.) INITIAL-INPUT is considered deprecated by vanilla Emacs, but not by Icicles. If INITIAL-INPUT is nil and DEF is non-nil, the user can use `next-history-element' to yank DEF into the minibuffer. HIST, if non-nil, specifies a history list and optionally the initial position in the list. It can be a symbol, which is the history list variable to use, or it can be a cons cell (HISTVAR . HISTPOS). If a cons cell, HISTVAR is the history list variable to use, and HISTPOS is the initial position (the position in the list used by the minibuffer history commands). For consistency, you should also specify that element of the history as the value of INITIAL-INPUT. Positions are counted starting from 1 at the beginning of the list. The variable `history-length' controls the maximum length of a history list. DEF, if non-nil, is the default value or (Emacs 23+ only) the list of default values. Option `icicle-default-value' controls the treatment of the default value (or the first default value, if DEF is a list): whether it is shown in the prompt, substituted for an empty INITIAL-INPUT, and so on. If `icicle-default-value' is t then option `icicle-default-in-prompt-format-function' is used to format DEF for its addition to PROMPT. If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. Both completion candidates and DEF are filtered using these Icicles variables: `icicle-must-match-regexp' `icicle-must-not-match-regexp' `icicle-must-pass-predicate' Completion ignores case when `completion-ignore-case' is non-nil." (unless (stringp icicle-initial-value) (setq icicle-initial-value "")) ; Convert nil to "". (unless initial-input (setq initial-input icicle-initial-value)) (if (consp initial-input) (setq icicle-initial-value (car initial-input)) (setq initial-input (format "%s" initial-input) ; Convert symbol to string icicle-initial-value initial-input)) (setq icicle-nb-of-other-cycle-candidates 0) ;; Use DEF for INITIAL-INPUT also, if `icicle-default-value' says so. (when (and def icicle-default-value (not (eq icicle-default-value t)) (stringp initial-input) (string= "" initial-input)) ;; Filter DEF using `icicle-filter-wo-input'. Done in `read-from-minibuffer' anyway, but we ;; must also do it here, to reuse the correct default value for the init value. (if (atom def) (setq initial-input (or (icicle-filter-wo-input def) "")) ; Ensure that it is non-nil. (let ((found nil) (def1 def)) (while (and (not found) def1) (setq found (icicle-filter-wo-input (car def1)) def1 (cdr def1))) (setq initial-input (or found "")))) (when (memq icicle-default-value '(insert-start preselect-start)) (setq initial-input (cons initial-input 0)))) ;; Override REQUIRE-MATCH as needed. (setq require-match (case icicle-require-match-flag ((nil) require-match) (no-match-required nil) (partial-match-ok t) (full-match-required 'full-match-required)) icicle-require-match-p require-match) (icicle-highlight-lighter) (let* ((minibuffer-history-variable minibuffer-history-variable) ;; $$$$$$$$$$ `minibuffer-completion-table' binding needed? `setq' in `*-lisp-vanilla-*'. (minibuffer-allow-text-properties t) ; This is nil for completion in vanilla Emacs. (minibuffer-completion-table collection) (icicle-fancy-cands-internal-p (or icicle-whole-candidate-as-text-prop-p icicle-fancy-candidates-p (get-text-property 0 'icicle-fancy-candidates prompt))) result) ;; Transform a cons collection to what is expected for `minibuffer-completion-table'. (when icicle-fancy-cands-internal-p (let ((c+p (icicle-mctize-all collection predicate))) (setq collection (car c+p) ; After banalizing for vanilla Emacs. predicate (cadr c+p)))) ;; $$$$$$ (setq minibuffer-completion-table collection) (when def (setq prompt (icicle-handle-default-for-prompt prompt def (eq icicle-default-value t)))) (cond ((not icicle-mode) (setq result (icicle-lisp-vanilla-completing-read prompt collection predicate require-match initial-input hist-m@%=!$+&^*z def inherit-input-method))) (t (let ((minibuffer-prompt-properties (and (boundp 'minibuffer-prompt-properties) ; Emacs 21+ only (icicle-remove-property 'face minibuffer-prompt-properties))) (minibuffer-completing-file-name ;; Can't be file-name completion unless it's a function. (and (functionp collection) minibuffer-completing-file-name))) (when (< emacs-major-version 21) (setq prompt (concat (and icicle-candidate-action-fn "+ ") prompt))) (setq result (catch 'icicle-read-top (icicle-lisp-vanilla-completing-read prompt collection predicate require-match initial-input hist-m@%=!$+&^*z def inherit-input-method))) (icicle-unpropertize-completion result)))) ;; HACK. Without this, when REQUIRE-MATCH is non-nil, `*Completions*' window ;; does not disappear. (when require-match (icicle-remove-Completions-window)) result)) (defun icicle-handle-default-for-prompt (prompt default include) "Return PROMPT, possibly changed to format or remove DEFAULT value. Argument INCLUDE: * nil means do not include DEFAULT in prompt. Remove it if there. * non-nil means include DEFAULT, formatted according to `icicle-default-in-prompt-format-function'. In the existing PROMPT before modification, recognizes inclusion of a default value according to these possible patterns: `minibuffer-default-in-prompt-regexps' \"(default ___):\" \"(default is ___):\" \" [___] \"" (when (consp default) (setq default (car default))) ;; Remove the default, if already there. (dolist (rgx (if (boundp 'minibuffer-default-in-prompt-regexps) ; Get rid of HINT if already there. minibuffer-default-in-prompt-regexps '(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'" 1) ("\\( \\[.*\\]\\):? *\\'" 1)))) (setq prompt (replace-regexp-in-string (car rgx) "" prompt nil nil (cadr rgx)))) ;; $$$$$$$$$ (when (icicle-file-name-input-p) (setq default (file-name-nondirectory default))) ;; Add DEFAULT, if INCLUDE. (if include (replace-regexp-in-string ".*\\(\\): *\\'" (funcall icicle-default-in-prompt-format-function default) prompt nil t 1) prompt)) (defun icicle-mctize-all (coll pred) "Transform collection COLL and predicate PRED for vanilla completion. COLL is an Icicles collection argument acceptable to `icicle-completing-read' but not necessarily to vanilla `completing-read': COLL can contain multi-completions. PRED is a predicate. Returns a new two-element list of the new collection and predicate: \(MCT NEWPRED), where MCT is COLL transformed and NEWPRED is PRED transformed. MCT is a collection suitable for vanilla `completing-read'. COLL is transformed to MCT by applying `icicle-mctized-full-candidate' to each of its elements. If PRED is non-nil, then NEWPRED is a predicate that applies PRED to the cdr of an MCT entry. If PRED is nil, so is NEWPRED." (when (consp coll) ;; Copy alist collection COLL, so we don't change the original alist in any way. ;; Change each entry in COLL using `icicle-mctized-full-candidate'. (setq coll (mapcar #'icicle-mctized-full-candidate coll)) ;; Convert non-nil PRED so that, for a cons entry with a string car, PRED uses the cdr ;; (which is the original entry) instead. (and pred (lexical-let ((new-pred pred)) (setq pred (lambda (x) (funcall new-pred (if (and (consp x) (stringp (car x))) (cdr x) x))))))) (list coll pred)) (defun icicle-mctized-full-candidate (cand) "Return MCT candidate that corresponds to full candidate CAND. See the source code for details." ;; If neither `icicle-fancy-cands-internal-p' nor `icicle-whole-candidate-as-text-prop-p' is ;; non-nil, then just return CAND. ;; Otherwise: ;; If CAND is a string A, we change it to (A) and then treat that (as follows). ;; If CAND is (A . B), where A is a string, then we change it to (S A . B), where S is a copy ;; of A. This way, the cdr of each MCT candidate is the original alist candidate, (A . B). ;; If CAND is (M . B), where M is a multi-completion (X Y Z...), then we change it to ;; (M' A . B), where M' is the display string for the multi-completion M. ;; Otherwise, we make no change to CAND. ;; If `icicle-whole-candidate-as-text-prop-p' is non-nil and the MCT candidate is a cons (X A . B) ;; with a string car X, then we put the cdr, (A . B), as a text property on the car X, so ;; we can get back the original (A . B) from the car. (if (not (or icicle-fancy-cands-internal-p icicle-whole-candidate-as-text-prop-p)) cand (let ((new-cand (cond ((and (consp cand) ; Multi-completion: (("aa" "bb") . cc) -> (consp (car cand)) ; ("aa^G\nbb\n\n" ("aa" "bb") . cc) (stringp (caar cand))) ;; $$$$$$ ;; (when (string-match "\n" icicle-list-join-string) ;; (setq icicle-completions-format-internal 'horizontal)) ; Override ;; $$$$$$ (cons (concat (mapconcat #'identity (car cand) icicle-list-join-string) ;; icicle-list-end-string) ; $$$$$$ (cons (mapconcat #'identity (car cand) icicle-list-join-string) cand)) ((and (consp cand) (stringp (car cand))) ; ("aa" . cc) -> ("aa" "aa" . cc) (cons (copy-sequence (car cand)) cand)) ((stringp cand) ; "aa" -> ("aa" "aa") (list (copy-sequence cand) cand)) (t ; Anything else: (aa), aa -> no change cand)))) ;; Put original alist candidates on display candidates (strings), as a text property. (when (and icicle-whole-candidate-as-text-prop-p (consp new-cand) (stringp (car new-cand))) (icicle-put-whole-cand-prop new-cand)) new-cand))) (defun icicle-put-whole-cand-prop (cand) "Put cdr of CAND on its car, as text property `icicle-whole-candidate'. This has no side effects. Returns a new propertized string corresponding to (car CAND)." (let ((text-cand (copy-sequence (car cand)))) (put-text-property 0 (length text-cand) 'icicle-whole-candidate (cdr cand) text-cand) (setcar cand text-cand) text-cand)) (defun icicle-mctized-display-candidate (cand) "Return MCT candidate that corresponds to display candidate CAND." (let ((full-cand (or (funcall icicle-get-alist-candidate-function cand) (list cand)))) (cons cand full-cand))) (defun icicle-replace-mct-cand-in-mct (old new) "Replace OLD candidate with NEW in `minibuffer-completion-table'. Both OLD and NEW have been mctized. That is, they are ready for `minibuffer-completion-table'." (let ((newlist minibuffer-completion-table)) (catch 'icicle-replace-cand-in-mct (while newlist (when (equal (car newlist) old) (setcar newlist new) (throw 'icicle-replace-cand-in-mct nil)) (setq newlist (cdr newlist)))) minibuffer-completion-table)) (defun icicle-read-file-name (prompt &optional dir default-filename require-match initial-input predicate) "Read file name, prompting with PROMPT and completing in directory DIR. Value is not expanded---you must call `expand-file-name' yourself. DIR should be an absolute directory name. It defaults to the value of `default-directory'. Default the name to DEFAULT-FILENAME if user exits the minibuffer with the same non-empty string that was inserted by this function. (If DEFAULT-FILENAME is omitted, the visited file name is used, but if INITIAL-INPUT is specified, that combined with DIR is used.) If the user exits with an empty minibuffer, this function returns an empty string. (This can only happen if the user erased the pre-inserted contents or if `insert-default-directory' is nil.) Fourth arg REQUIRE-MATCH non-nil means require existing file's name. Non-nil and non-t means also require confirmation after completion. Fifth arg INITIAL-INPUT specifies text to start with. If optional sixth arg PREDICATE is non-nil, possible completions and the resulting file name must satisfy `(funcall predicate NAME)'. This argument is only available starting with Emacs 22. Both completion candidates and DEFAULT-FILENAME are filtered using these Icicles variables: `icicle-must-match-regexp' `icicle-must-not-match-regexp' `icicle-must-pass-predicate' Directory names are highlighted in `*Completions*' using face `icicle-special-candidate'. If option `icicle-require-match-flag' is non-nil, it overrides the value of REQUIRE-MATCH. If option `icicle-add-proxy-candidates-flag' is non-nil, then the following proxy file-name candidates are included. (This inclusion can be toggled at any time from the minibuffer, using `C-M-_'.) * `*mouse-2 file name*' - Click `mouse-2' on a file name to choose it. * `*point file name*' - Use the file name at point (cursor). * Single-quoted file-name variables - Use the variable's value. Candidates `*mouse-2 file name*' and `*point file name*' are available only if library `ffap.el' can be loaded. A file-name variable has custom type `file' or (file :must-match t). If this command was invoked with the mouse, use a file dialog box if `use-dialog-box' is non-nil, and the window system or X toolkit in use provides a file dialog box. See also `read-file-name-completion-ignore-case' (Emacs version > 21) and `read-file-name-function'." (unwind-protect (let* ((mouse-file "*mouse-2 file name*") (icicle-special-candidate-regexp (or icicle-special-candidate-regexp ".+/$")) (minibuffer-completing-file-name t) (read-file-name-predicate (and (boundp 'read-file-name-predicate) read-file-name-predicate)) (ffap-available-p (or (require 'ffap- nil t) (require 'ffap nil t))) ;; The next four prevent slowing down `ffap-guesser'. (ffap-alist nil) (ffap-machine-p-known 'accept) (ffap-url-regexp nil) (ffap-shell-prompt-regexp nil) (fap (if (and (eq major-mode 'dired-mode) (fboundp 'dired-get-file-for-visit)) (condition-case nil (abbreviate-file-name (dired-get-file-for-visit)) (error nil)) (and ffap-available-p (ffap-guesser)))) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (append (and fap (list "*point file name*")) (and ffap-available-p (list mouse-file)) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand '(file (file :must-match t))) (error nil))) (push (concat "'" (symbol-name cand) "'") ipc)))) ipc))) icicle-proxy-candidates)) result) ;; ;; $$$$$$ Does Emacs 23+ need explicit directory? If so, add these three lines ;; (unless dir (setq dir default-directory)) ;; (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir))) ;; (setq dir (abbreviate-file-name dir)) ; Use `~' for home directory. (setq result (icicle-read-file-name-1 prompt dir default-filename require-match initial-input predicate)) (when ffap-available-p (cond ((save-match-data (string-match "*point file name\\*$" result)) (setq result fap)) ((save-match-data (string-match "*mouse-2 file name\\*$" result)) (setq result (progn (let ((e (read-event "Click `mouse-2' on file name"))) (read-event) ; Get rid of mouse up event. (save-excursion (mouse-set-point e) (if (and (eq major-mode 'dired-mode) (fboundp 'dired-get-file-for-visit)) ; In `dired+.el'. (condition-case nil ; E.g. error: not on file line (ignore) (abbreviate-file-name (dired-get-file-for-visit)) (error "No such file")) (or (ffap-guesser) (error "No such file")))))))))) (icicle-unpropertize-completion result) (let* ((temp (member (file-name-nondirectory result) icicle-proxy-candidates)) (symb (and temp (intern (substring (car temp) 1 (1- (length (car temp)))))))) (when (and symb (boundp symb)) (setq result (symbol-value symb)))) result) ;; Because we do this here, if a command that uses `icicle-read-file-name' needs the proxies ;; afterward then it needs to save a copy of them. (setq icicle-proxy-candidates ()))) (defun icicle-read-file-name-1 (prompt &optional dir default-filename require-match initial-input predicate) "Helper function for `icicle-read-file-name'." (setq icicle-nb-of-other-cycle-candidates 0 icicle-initial-value (or initial-input (if (stringp icicle-initial-value) icicle-initial-value ""))) (icicle-fix-default-directory) ; Make sure there are no backslashes in it. (unless (string= "" icicle-initial-value) (setq initial-input icicle-initial-value)) ;; Use DEFAULT-FILENAME for INITIAL-INPUT also, if `icicle-default-value' says so. ;; But if so, remove the directory part first. ;; Note that if DEFAULT-FILENAME is null, then we let INITIAL-INPUT remain null too. (when (and default-filename icicle-default-value (not (eq icicle-default-value t)) ;; We don't use the same test as for `completing-read': ;; (stringp initial-input) (string= "" initial-input)) (string= "" icicle-initial-value)) ;; Filter DEFAULT-FILENAME using `icicle-filter-wo-input'. Done in `read-from-minibuffer' ;; anyway, but we must also do it here, to reuse the correct default value for the init value. (if (atom default-filename) (setq initial-input (icicle-filter-wo-input (file-name-nondirectory default-filename))) (let ((found nil) (def1 default-filename)) (while (and (not found) def1) (setq found (icicle-filter-wo-input (file-name-nondirectory (car def1))) def1 (cdr def1))) (setq initial-input (or found ""))))) ;; Override REQUIRE-MATCH as needed. (setq require-match (case icicle-require-match-flag ((nil) require-match) (no-match-required nil) (partial-match-ok t) (full-match-required 'full-match-required)) icicle-require-match-p require-match) (icicle-highlight-lighter) (let ((read-file-name-function nil) (minibuffer-history-variable minibuffer-history-variable) result) (let ((minibuffer-prompt-properties (and (boundp 'minibuffer-prompt-properties) ; Emacs 21+ only (icicle-remove-property 'face minibuffer-prompt-properties)))) (when (< emacs-major-version 21) (setq prompt (concat (and icicle-candidate-action-fn "+ ") prompt))) (condition-case nil ; If Emacs 22+, use predicate arg. (setq result (catch 'icicle-read-top (funcall (or icicle-orig-read-file-name-fn 'read-file-name) prompt dir default-filename require-match initial-input predicate))) (wrong-number-of-arguments (setq result (catch 'icicle-read-top (funcall (or icicle-orig-read-file-name-fn 'read-file-name) prompt dir default-filename require-match initial-input)))))) ;; HACK. Without this, when REQUIRE-MATCH is non-nil, `*Completions*' window ;; does not disappear. (when require-match (icicle-remove-Completions-window)) result)) (when (fboundp 'read-file-name-default) ; Emacs 24+ (unless (fboundp 'icicle-ORIG-read-file-name-default) (defalias 'icicle-ORIG-read-file-name-default (symbol-function 'read-file-name-default))) ;; This is the Emacs 24.3 version of `read-file-name-default', with `icicle-read-file-name-internal-fn' ;; substituted for `read-file-name-internal'. (defun icicle-read-file-name-default (prompt &optional dir default-filename mustmatch initial predicate) "Icicles version of `read-file-name-default'. Instead of hard-coding the use of `read-file-name-internal', this uses the value of variable `icicle-read-file-name-internal-fn'. See `read-file-name' for the meaning of the arguments here." (unless dir (setq dir default-directory)) (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir))) (unless default-filename (setq default-filename (if initial (expand-file-name initial dir) buffer-file-name))) (setq dir (abbreviate-file-name dir)) ; If DIR starts with user's homedir, change that to ~. (when default-filename ; Likewise for default-filename. (setq default-filename (if (consp default-filename) (mapcar 'abbreviate-file-name default-filename) (abbreviate-file-name default-filename)))) (let ((insdef (cond ((and insert-default-directory (stringp dir)) (if initial (cons (minibuffer--double-dollars (concat dir initial)) (length (minibuffer--double-dollars dir))) (minibuffer--double-dollars dir))) (initial (cons (minibuffer--double-dollars initial) 0))))) (let ((completion-ignore-case read-file-name-completion-ignore-case) (minibuffer-completing-file-name t) (pred (or predicate 'file-exists-p)) (add-to-history nil)) (let* ((val (if (or (not (next-read-file-uses-dialog-p)) ;; File dialog boxes cannot handle remote files (Emacs bug#99). (file-remote-p dir)) ;; Emacs used to pass DIR to `read-file-name-internal' by abusing ;; PREDICATE. It is better to use `default-directory', but in order ;; to avoid changing `default-directory' in the current buffer, ;; we do not let-bind it. (let ((dir (file-name-as-directory (expand-file-name dir)))) (minibuffer-with-setup-hook (lambda () (setq default-directory dir) ;; When the first default in `minibuffer-default' duplicates the ;; initial input `insdef', remove it from `minibuffer-default'. (when (equal (or (car-safe insdef) insdef) (or (car-safe minibuffer-default) minibuffer-default)) (setq minibuffer-default (cdr-safe minibuffer-default))) ;; On first `M-n', fill `minibuffer-default' with a list of ;; defaults for reading file names. (set (make-local-variable 'minibuffer-default-add-function) (lambda () (with-current-buffer (window-buffer (minibuffer-selected-window)) (read-file-name--defaults dir initial)))) (when (boundp 'minibuffer-local-filename-syntax) (set-syntax-table minibuffer-local-filename-syntax))) ;; ICICLES: use `icicle-read-file-name-internal-fn'. (completing-read prompt icicle-read-file-name-internal-fn pred mustmatch insdef 'file-name-history default-filename))) ;; If no DEFAULT-FILENAME and DIR contains a file name, split it. (let ((file (file-name-nondirectory dir)) ;; When using a dialog box, revert to nil and non-nil ;; interpretation of mustmatch. Confirmation options need to be ;; interpreted as nil, otherwise it is impossible to create new ;; files using dialog boxes with the default settings. (dialog-mustmatch (not (memq mustmatch '(nil confirm confirm-after-completion))))) (when (and (not default-filename) (not (zerop (length file)))) (setq default-filename file dir (file-name-directory dir))) (when default-filename (setq default-filename (expand-file-name (if (consp default-filename) (car default-filename) default-filename) dir))) (setq add-to-history t) (x-file-dialog prompt dir default-filename dialog-mustmatch (eq predicate 'file-directory-p))))) (replace-in-history (eq (car-safe file-name-history) val))) ;; If `completing-read' returned the inserted default string itself (rather than a new string with ;; the same contents) then the user typed RET with the minibuffer empty. In that case, return "" ;; so that commands such as `set-visited-file-name' can distinguish. (when (consp default-filename) (setq default-filename (car default-filename))) (when (eq val default-filename) ; `completing-read' did not add to the history. Do that. (unless replace-in-history (setq add-to-history t)) (setq val "")) (unless val (error "No file name specified")) (when (and default-filename (string-equal val (if (consp insdef) (car insdef) insdef))) (setq val default-filename)) (setq val (substitute-in-file-name val)) (if replace-in-history ;; Replace what `Fcompleting_read' added to the history with what we will actually return. ;; As an exception, if that is the same as the second item in `file-name-history', it is a ;; duplicate (Emacs bug #4657). (let ((val1 (minibuffer--double-dollars val))) (when history-delete-duplicates (setcdr file-name-history (delete val1 (cdr file-name-history)))) (if (string= val1 (cadr file-name-history)) (pop file-name-history) (setcar file-name-history val1))) (when add-to-history ;; Add the value to the history, unless it matches the last value already there. (let ((val1 (minibuffer--double-dollars val))) (unless (and (consp file-name-history) (equal (car file-name-history) val1)) (setq file-name-history (cons val1 (if history-delete-duplicates (delete val1 file-name-history) file-name-history))))))) val))))) (defun icicle-fix-default-directory () "Convert backslashes in `default-directory' to slashes." ;; This is a hack. If you do `C-x 4 f' from a standalone minibuffer ;; frame, `default-directory' on MS Windows has this form: ;; `C:\some-dir/'. There is a backslash character in the string. This ;; is not a problem for standard Emacs, but it is a problem for Icicles, ;; because we interpret backslashes using regexp syntax - they are not ;; file separators for Icicles. So, we call `substitute-in-file-name' to ;; change all backslashes in `default-directory' to slashes. This ;; shouldn't hurt, because `default-directory' is an absolute directory ;; name - it doesn't contain environment variables. For example, we ;; convert `C:\some-dir/' to `c:/some-directory/'." (setq default-directory (icicle-abbreviate-or-expand-file-name (substitute-in-file-name default-directory)))) (defun icicle-remove-property (prop plist) "Remove property PROP from property-list PLIST, non-destructively. Returns the modified copy of PLIST." (let ((cpy plist) (result ())) (while cpy (unless (eq prop (car cpy)) (setq result `(,(cadr cpy) ,(car cpy) ,@result))) (setq cpy (cddr cpy))) (nreverse result))) ;; REPLACE ORIGINAL `read-from-minibuffer' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Respect `icicle-default-value'. ;; ;; We use HIST-m@%=!$+&^*z instead of HIST, to avoid name capture by `minibuffer-history-variable's ;; value. If we didn't need to be Emacs 20-compatible, then we could employ ;; `#1=#:hist'...`#1#'...`#1' read syntax to use an uninterned symbol. ;; (unless (fboundp 'icicle-ORIG-read-from-minibuffer) (defalias 'icicle-ORIG-read-from-minibuffer (symbol-function 'read-from-minibuffer))) (defun icicle-read-from-minibuffer (prompt &optional initial-contents keymap read hist-m@%=!$+&^*z default-value inherit-input-method) "Read a string from the minibuffer, prompting with string PROMPT. The optional second arg INITIAL-CONTENTS is an alternative to DEFAULT-VALUE. Vanilla Emacs considers it to be obsolete, but Icicles does not. It is discussed in more detail below. Third arg KEYMAP is a keymap to use while reading; if omitted or nil, the default is `minibuffer-local-map'. If fourth arg READ is non-nil, then interpret the result as a Lisp object and return that object. In other words, return this: (car (read-from-string INPUT-STRING)) Fifth arg HIST, if non-nil, specifies a history list and optionally the initial position in the list. It can be a symbol, which is the history list variable to use, or it can be a cons cell (HISTVAR . HISTPOS). If a cons cell, HISTVAR is the history list variable to use and HISTPOS is the initial position for use by the minibuffer history commands. For consistency, you should also specify that element of the history as the value of INITIAL-CONTENTS. Positions are counted starting from 1 at the beginning of the list. Sixth arg DEFAULT-VALUE is a string, nil, or (for Emacs 23 and later) a non-empty list of strings. The strings are available to the user as input via `\\\\[next-history-element]'. NOTE: Unlike a default-value parameter for some other functions such as `completing-read', if the user hits `RET' with empty input then DEFAULT-VALUE is NOT returned. In that case, if READ is nil then the empty string, \"\", is returned. If READ is non-nil then the DEFAULT-VALUE string (or the first string in DEFAULT-VALUE if DEFAULT-VALUE is a list) is read. Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. If variable `minibuffer-allow-text-properties' is non-nil then the string returned includes whatever text properties were present in the minibuffer. Otherwise the return value has no text properties. Option `icicle-default-value' controls how the default value, DEFAULT-VALUE, is treated. The remainder of this documentation string describes parameter INITIAL-CONTENTS in more detail. If non-nil, INITIAL-CONTENTS is a string to be inserted into the minibuffer before reading input. Normally, point is put at the end of that string. However, if INITIAL-CONTENTS is (STRING . POSITION), the initial input is STRING and point is placed at one-indexed position POSITION in the minibuffer. Any integer value less than or equal to one puts point at the beginning of the string. Note that this behavior differs from the way such arguments are used in `completing-read' and some other functions, which use zero-indexing for POSITION." (unless initial-contents (setq initial-contents "")) ;; Filter DEFAULT-VALUE using `icicle-filter-wo-input'. (when default-value (setq default-value (if (atom default-value) (icicle-filter-wo-input default-value) (delq nil (mapcar #'icicle-filter-wo-input default-value))))) ; Emacs 23 accepts a list. ;; Save new default value for caller (e.g. `icicle-lisp-vanilla-completing-read'. (setq icicle-filtered-default-value default-value) ;; If a list of strings, use the first one for prompt etc. (let ((def-value (if (consp default-value) (car default-value) default-value))) ;; Maybe use DEFAULT-VALUE for INITIAL-CONTENTS also. (when (and icicle-default-value (not (eq icicle-default-value t)) def-value (stringp initial-contents) (string= "" initial-contents)) (setq initial-contents (if (integerp def-value) ; Character (string def-value) def-value))) ;;; $$$$$$ (when (and def-value (eq icicle-default-value t)) ; Add DEFAULT-VALUE to PROMPT. ;;; (when (icicle-file-name-input-p) (setq def-value (file-name-nondirectory def-value))) ;;; (setq prompt (if (string-match "\\(.*\\)\\(: *\\)$" prompt) ;;; (concat (substring prompt (match-beginning 1) (match-end 1)) " (" def-value ;;; ")" (substring prompt (match-beginning 2) (match-end 2))) ;;; (concat prompt def-value)))) ) (icicle-ORIG-read-from-minibuffer prompt initial-contents keymap read hist-m@%=!$+&^*z default-value inherit-input-method)) ;; REPLACE ORIGINAL `minibuffer-default-add-completions' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Respect Icicles global filters, so you don't see, as defaults, candidates that were filtered out. ;; (when (fboundp 'minibuffer-default-add-completions) ; Emacs 23+. (unless (fboundp 'icicle-ORIG-minibuffer-default-add-completions) (defalias 'icicle-ORIG-minibuffer-default-add-completions (symbol-function 'minibuffer-default-add-completions))) ;; Use this as `minibuffer-default-add-function'. (defun icicle-minibuffer-default-add-completions () "Like `icicle-ORIG-minibuffer-default-add-completions', but respect global filters." (let ((def minibuffer-default) (all (icicle-all-completions "" minibuffer-completion-table minibuffer-completion-predicate 'HIDE-SPACES))) (setq all (icicle-remove-if-not (lambda (cand) (let ((case-fold-search completion-ignore-case)) (icicle-filter-wo-input cand))) all)) (if (listp def) (append def all) (cons def (delete def all)))))) ;; REPLACE ORIGINAL `read-buffer' (built-in). ;; ;; 1. Interactively, uses `another-buffer' or `other-buffer' if no default. ;; 2. Emacs 23+ compatible: handles `read-buffer-function' ;; and `read-buffer-completion-ignore-case'. ;; 3. Respects `icicle-buffer-ignore-space-prefix-flag'. ;; (unless (fboundp 'icicle-ORIG-read-buffer) (defalias 'icicle-ORIG-read-buffer (symbol-function 'read-buffer))) (defun icicle-read-buffer (prompt &optional default require-match) "Read the name of a buffer and return it as a string. Prompt with first arg, PROMPT (a string). If user input is empty (just `RET') then return the default value, which is: - optional second arg DEFAULT, if non-nil - `another-buffer' or `other-buffer', otherwise. If `another-buffer' is undefined, then use `other-buffer'. Starting with Emacs 23, DEFAULT can be a list of names (strings), in which case the first name in the list is returned on empty input. Non-nil REQUIRE-MATCH means to allow only names of existing buffers. It is the same as for `completing-read'. Case sensitivity is determined by `read-buffer-completion-ignore-case', if defined, or `completion-ignore-case' otherwise. This binds variable `icicle-buffer-name-input-p' to non-nil." (let ((icicle-buffer-name-input-p t)) (if (and (boundp 'read-buffer-function) read-buffer-function) (funcall read-buffer-function prompt default require-match) (when (interactive-p) (setq default (or default (if (fboundp 'another-buffer) ; In `misc-fns.el'. (another-buffer nil t) (other-buffer (current-buffer)))))) (when (bufferp default) (setq default (buffer-name default))) ; Need a string as default. (let ((completion-ignore-case (if (boundp 'read-buffer-completion-ignore-case) read-buffer-completion-ignore-case completion-ignore-case))) (completing-read prompt (cond ((and (eq icicle-buffer-complete-fn 'internal-complete-buffer) icicle-buffer-ignore-space-prefix-flag) 'internal-complete-buffer) ; Emacs 22+ (icicle-buffer-complete-fn) (t (mapcar (lambda (buf) (and (buffer-live-p buf) (list (buffer-name buf)))) (buffer-list)))) nil require-match nil 'buffer-name-history default nil))))) ;; REPLACE ORIGINAL `read-number' defined in `subr.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; 1. Let user enter a numeric variable name, for its value. Allow completion. ;; 2. Allow for error reading input. ;; 3. Call `ding' if not a number, and don't redisplay for `sit-for'. ;; (when (fboundp 'read-number) ; Emacs 22+ (unless (fboundp 'icicle-ORIG-read-number) (defalias 'icicle-ORIG-read-number (symbol-function 'read-number))) (defun icicle-read-number (prompt &optional default) "Read a number in the minibuffer, prompting with PROMPT (a string). DEFAULT is returned if the user hits `RET' without typing anything. If option `icicle-add-proxy-candidates-flag' is non-nil, the user can also enter the name of a numeric variable - its value is returned. Completion is available for this. A numeric variable is a variable whose value or whose custom type is compatible with type `integer', `number', or `float'." (unwind-protect (let ((num nil) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand (if (>= emacs-major-version 22) '(number integer float) '(number integer))) (error nil))) (push (symbol-name cand) ipc)))) ipc)) icicle-proxy-candidates)) ;; Emacs 23 allows DEFAULT to be a list of strings - use the first one for prompt etc. (default1 (if (atom default) default (setq default (delq nil default)) (car default)))) (when default (save-match-data (setq prompt (if (string-match "\\(\\):[ \t]*\\'" prompt) (replace-match (format " (default %s)" default1) t t prompt 1) (replace-regexp-in-string "[ \t]*\\'" (format " (default %s) " default1) prompt t t))))) (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (while (progn (let ((str (completing-read prompt nil nil nil nil nil (if (consp default) (mapcar #'number-to-string default) (and default1 (number-to-string default1))))) temp) (setq num (cond ((zerop (length str)) default1) ((setq temp (member str icicle-proxy-candidates)) (symbol-value (intern (car temp)))) ((stringp str) (condition-case nil (read str) (error nil)))))) (unless (numberp num) (icicle-ding) (message "Not a number. Try again.") (sit-for 0.5 nil t) t))) num) ;; Because we do this here, if a command that uses `icicle-read-number' needs the proxies ;; afterward then it needs to save a copy of them. (setq icicle-proxy-candidates ())))) ;; Can't replace standard `read-char-exclusive' with this, because, starting with Emacs 22, it has ;; an optional SECONDS arg that cannot be simulated using `completing-read'. (defun icicle-read-char-exclusive (prompt &optional inherit-input-method) "Read a character in the minibuffer, prompting with PROMPT (a string). It is returned as a number. Optional arg INHERIT-INPUT-METHOD is as for `completing-read'. If option `icicle-add-proxy-candidates-flag' is non-nil, the user can also enter the name of a character variable - its value is returned. Completion is available for this. A character variable is a variable whose value is compatible with type `character'." (unwind-protect (let* ((char nil) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand '(character)) (error nil))) (push (symbol-name cand) ipc)))) ipc)) icicle-proxy-candidates)) str temp) (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (setq str (completing-read prompt nil nil nil nil nil nil inherit-input-method) char (cond ((zerop (length str)) (error "No character read")) ((setq temp (member str icicle-proxy-candidates)) (symbol-value (intern (car temp)))) ((stringp str) (condition-case nil (progn (when (> (length str) 1) (message "First char is used: `%c'" (elt str 0)) (sit-for 2)) (elt str 0)) (error nil))))) char) ;; Because we do this here, if a command that uses `icicle-read-char-exclusive' needs the proxies ;; afterward then it needs to save a copy of them. (setq icicle-proxy-candidates ()))) ;; Not used in Icicles code, but used by other libraries. (defun icicle-read-string-completing (prompt &optional default pred hist) "Read a string in the minibuffer, prompting with PROMPT (a string). If the user hits `RET' without typing anything, return DEFAULT, or \"\" if DEFAULT is nil. PRED is a predicate that filters the variables available for completion. HIST is the history list to use, as for `completing-read'. If option `icicle-add-proxy-candidates-flag' is non-nil, the user can also enter the name of a string variable - its value is returned. Completion is available for this. A string variable is a variable whose value or whose custom type is compatible with type `string'." (unwind-protect (let ((strg nil) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (condition-case nil (icicle-var-is-of-type-p cand '(string color regexp)) (error nil))) (push (symbol-name cand) ipc)))) ipc)) icicle-proxy-candidates)) ;; Emacs 23 allows DEFAULT to be a list of strings - use the first one for prompt etc. (default1 (if (consp default) (car default) default))) (when default (save-match-data (setq prompt (if (string-match "\\(\\):[ \t]*\\'" prompt) (replace-match (format " (default %s)" default1) t t prompt 1) (replace-regexp-in-string "[ \t]*\\'" (format " (default %s) " default1) prompt t t))))) (when icicle-proxy-candidates (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (let ((strg-read (completing-read prompt nil pred nil (and (consp hist) (nth (cdr hist) (symbol-value (car hist)))) hist default)) temp) (setq strg (cond ((zerop (length strg-read)) (or default1 "")) ((setq temp (member strg-read icicle-proxy-candidates)) (setq temp (symbol-value (intern (car temp)))) (cond ((and (symbolp hist) (consp (symbol-value hist))) (setcar (symbol-value hist) temp)) ((and (consp hist) (symbolp (car hist)) (consp (symbol-value (car hist)))) (setcar (symbol-value (car hist)) temp))) temp) (t strg-read)))) strg) ;; Because we do this here, if a command that uses `icicle-read-string-completing' needs the proxies ;; afterward then it needs to save a copy of them. (setq icicle-proxy-candidates ()))) ;; Same as `help-var-is-of-type-p'. (defun icicle-var-is-of-type-p (variable types &optional mode) "Return non-nil if VARIABLE satisfies one of the custom types in TYPES. TYPES is a list of `defcustom' type sexps or a list of regexp strings. TYPES are matched, in order, against VARIABLE's type definition or VARIABLE's current value, until one is satisfied or all are tried. If TYPES is a list of regexps, then each is regexp-matched against VARIABLE's custom type. Otherwise, TYPES is a list of type sexps, each of which is a definition acceptable for `defcustom' :type or the first symbol of such a definition (e.g. `choice'). In this case, two kinds of type comparison are possible: 1. VARIABLE's custom type, or its first symbol, is matched using `equal' against each type in TYPES. 2. VARIABLE's current value is checked against each type in TYPES to see if it satisfies one of them. In this case, VARIABLE's own type is not used; VARIABLE might not even be typed - it could be a variable not defined using `defcustom'. For any of the comparisons against VARIABLE's type, either that type can be checked directly or its supertypes (inherited types) can also be checked. These different type-checking possibilities depend on the value of argument MODE, as follows, and they determine the meaning of the returned value: `direct': VARIABLE's type matches a member of list TYPES `inherit': VARIABLE's type matches or is a subtype of a TYPES member `value': VARIABLE is bound, and its value satisfies a type in TYPES `inherit-or-value': `inherit' or `value', tested in that order `direct-or-value': `direct' or `value', tested in that order anything else (default): `inherit' VARIABLE's current value cannot satisfy a regexp type: it is impossible to know which concrete types a value must match." (case mode ((nil inherit) (icicle-var-inherits-type-p variable types)) (inherit-or-value (or (icicle-var-inherits-type-p variable types) (icicle-var-val-satisfies-type-p variable types))) (value (icicle-var-val-satisfies-type-p variable types)) (direct (icicle-var-matches-type-p variable types)) (direct-or-value (or (member (icicle-get-safe variable 'custom-type) types) (icicle-var-val-satisfies-type-p variable types))) (otherwise (icicle-var-inherits-type-p variable types)))) (defun icicle-var-matches-type-p (variable types) "VARIABLE's type matches a member of TYPES." (catch 'icicle-type-matches (let ((var-type (icicle-get-safe variable 'custom-type))) (dolist (type types) (when (if (stringp type) (save-match-data (string-match type (format "%s" (format "%S" var-type)))) (equal var-type type)) (throw 'icicle-type-matches t)))) nil)) (defun icicle-var-inherits-type-p (variable types) "VARIABLE's type matches or is a subtype of a member of list TYPES." (catch 'icicle-type-inherits (let ((var-type (icicle-get-safe variable 'custom-type))) (dolist (type types) (while var-type (when (or (and (stringp type) (save-match-data (string-match type (format "%s" (format "%S" var-type))))) (equal type var-type)) (throw 'icicle-type-inherits t)) (when (consp var-type) (setq var-type (car var-type))) (when (or (and (stringp type) (save-match-data (string-match type (format "%s" (format "%S" var-type))))) (equal type var-type)) (throw 'icicle-type-inherits t)) (setq var-type (car (icicle-get-safe var-type 'widget-type)))) (setq var-type (icicle-get-safe variable 'custom-type)))) nil)) (defun icicle-var-val-satisfies-type-p (variable types) "VARIABLE is bound, and its value satisfies a type in the list TYPES." (and (boundp variable) (let ((val (symbol-value variable))) (and (widget-convert (icicle-get-safe variable 'custom-type)) (icicle-value-satisfies-type-p val types))))) (defun icicle-value-satisfies-type-p (value types) "Return non-nil if VALUE satisfies a type in the list TYPES." (catch 'icicle-type-value-satisfies (dolist (type types) (unless (stringp type) ; Skip, for regexp type. (setq type (widget-convert type)) ;; Satisfies if either :match or :validate. (when (condition-case nil (progn (when (and (widget-get type :match) (widget-apply type :match value)) (throw 'icicle-type-value-satisfies t)) (when (and (widget-get type :validate) (progn (widget-put type :value value) (not (widget-apply type :validate)))) (throw 'icicle-type-value-satisfies t))) (error nil)) (throw 'icicle-type-value-satisfies t)))) nil)) (defun icicle-custom-type (variable) "Returns the `defcustom' type of VARIABLE. Returns nil if VARIABLE is not a user option. Note: If the library that defines VARIABLE has not yet been loaded, then `icicle-custom-type' loads it. Be sure you want to do that before you call this function." (and (custom-variable-p variable) (or (get variable 'custom-type) (progn (custom-load-symbol variable) (get variable 'custom-type))))) (when (fboundp 'read-char-by-name) ; Emacs 23+ (defun icicle-read-char-maybe-completing (&optional prompt names inherit-input-method seconds) "Read a char with PROMPT, possibly completing against character NAMES. If the character read is `C-q' then read another character. Otherwise, if the character read is a completing key (e.g. `TAB'), then complete. Elements of alist NAMES have the form of `ucs-names' elements: (CHAR-NAME . CHAR-CODE) NAMES defaults to the subset of `ucs-names' that corresponds to the characters that have been read previously. The other arguments are as in `read-char-by-name'." (unless names (setq names (or (icicle-char-cands-from-charlist) (icicle-ucs-names)))) (let ((chr (read-char prompt inherit-input-method seconds))) (if (eq chr ?\C-q) (setq chr (read-char prompt inherit-input-method seconds)) ; ^Q - read next (when (member (vector chr) (append icicle-prefix-complete-keys icicle-apropos-complete-keys)) (add-to-list 'unread-command-events chr) (setq chr (icicle-read-char-by-name prompt names)))) chr)) (defun icicle-char-cands-from-charlist (&optional chars) "Characters in list CHARS that are listed in `icicle-ucs-names'. CHARS defaults to the value of `icicle-read-char-history'." (unless chars (setq chars icicle-read-char-history)) (let ((cands ()) name.char) (dolist (char chars) (when (setq name.char (rassq char (icicle-ucs-names))) (push name.char cands))) cands))) ;; REPLACE ORIGINAL `read-char-by-name' in `mule-cmds.el' (Emacs 23+). ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; 1. Use `icicle-ucs-names', not `ucs-names'. ;; 2. Exclude character names "" and "VARIATION SELECTOR*". ;; 3. Display the character itself, after its name, in `*Completions*'. ;; 4. Added optional arg NAMES. ;; 5. Add char read to `icicle-read-char-history'. ;; 5. See doc string for the rest. ;; (when (fboundp 'read-char-by-name) ; Emacs 23+ (unless (fboundp 'icicle-ORIG-read-char-by-name) (defalias 'icicle-ORIG-read-char-by-name (symbol-function 'read-char-by-name))) (defun icicle-read-char-by-name (prompt &optional names) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its Unicode property `name' or `old-name'. Return the char as a number. You can use completion against the Unicode name of the character. In Icicle mode: * The character itself is displayed next to its name, even though it is not part of the completion candidate. WYSIWYG. * When you cycle among candidates, the current character and its Unicode code point are shown in the mode line (provided user option `icicle-help-in-mode-line-delay' is greater than zero.) If you use a dedicated `*Completions*' frame, then the font used in `*Completions*' is the same as the frame from which you invoked completion. If you use library `doremi-frm.el' then you can increase the font size for `*Completions*' dynamically using `C-x -'. As an alternative to completing the Unicode name, you can input a number for the Unicode code point: a hexidecimal number or a number in hash notation: #o21430 for octal, #x2318 for hex, or #10r8984 for decimal. Non-nil optional arg NAMES is an alist of names to use in place of the value returned by `icicle-ucs-names'. It must have the same form as such a return value: (CHAR-NAME . CHAR-CODE)." (unless names (setq names (icicle-ucs-names))) (dolist (name.char names) ;; $$$$$$ (when (and (not (string= "" (car name.char))) ;; ;; $$$$$$ Maybe make this optional? ;; (not (string-match "\\`VARIATION SELECTOR" (car name.char)))) (unless (string= "" (car name.char)) ;; Display char itself after the name, in `*Completions*'. (let* ((disp-string (concat (car name.char) "\t" (propertize (string (cdr name.char)) 'face 'icicle-extra-candidate))) (symb (intern (car name.char)))) (put symb 'icicle-display-string disp-string) (icicle-candidate-short-help (format "Char: %-10cCode Point: %d" (cdr name.char) (cdr name.char)) disp-string) (put-text-property 0 1 'icicle-orig-cand symb disp-string)))) (let* ((new-prompt (copy-sequence prompt)) (IGNORE-1 (put-text-property 0 1 'icicle-fancy-candidates t new-prompt)) (completion-ignore-case t) (input (completing-read new-prompt `(lambda (string pred action) (if (eq action 'metadata) '(metadata (category . unicode-name)) (complete-with-action action ',names string pred))))) chr) (let ((orig-cand (get-text-property 0 'icicle-orig-cand input))) (when orig-cand (setq input (symbol-name orig-cand)))) (setq chr (cond ((string-match-p "\\`[0-9a-fA-F]+\\'" input) (string-to-number input 16)) ((string-match-p "^#" input) (read input)) (t (cdr (assoc-string input names t))))) (add-to-list 'icicle-read-char-history chr) chr)) ;; This would not be needed if there were not Emacs bug #9653. (defun icicle-ucs-names () "Same as `ucs-names', except remove entries with an empty name: \"\"." (setq ucs-names (assq-delete-all "" (ucs-names))))) ; Free var here: `ucs-names'. ;; REPLACE ORIGINAL `read-string' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Respect `icicle-default-value' (via use of `read-from-minibuffer'). ;; ;; We use HIST-m@%=!$+&^*z instead of HISTORY, to avoid name capture by `minibuffer-history-variable's ;; value. If we didn't need to be Emacs 20-compatible, then we could employ ;; `#1=#:hist'...`#1#'...`#1' read syntax to use an uninterned symbol. ;; (unless (fboundp 'icicle-ORIG-read-string) (defalias 'icicle-ORIG-read-string (symbol-function 'read-string))) (defun icicle-read-string (prompt &optional initial-input hist-m@%=!$+&^*z default-value inherit-input-method) "Read a string from the minibuffer, prompting with string PROMPT. If non-nil, second arg INITIAL-INPUT is a string to insert before reading. Vanilla Emacs considers it to be obsolete, but Icicles does not. It behaves like argument INITIAL-CONTENTS in `read-from-minibuffer'. See the documentation string of `read-from-minibuffer' for details. The third arg HISTORY, if non-nil, specifies a history list and optionally the initial position in the list. See `read-from-minibuffer' for details of HISTORY argument. Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is used for history commands, and as the value to return if the user enters the empty string. Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits the current input method and the setting of enable-multibyte-characters." (setq prompt (icicle-handle-default-for-prompt prompt default-value 'INCLUDE)) (let ((value (read-from-minibuffer prompt initial-input nil nil hist-m@%=!$+&^*z default-value inherit-input-method))) (when (and default-value (equal value "")) (setq value (if (consp default-value) (car default-value) default-value))) value)) ;; REPLACE ORIGINAL `read-face-name' in `faces.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Show face names in `*Completions*' with the faces they name. ;; (unless (fboundp 'icicle-ORIG-read-face-name) (defalias 'icicle-ORIG-read-face-name (symbol-function 'read-face-name))) (cond ((< emacs-major-version 21) (defun icicle-read-face-name (prompt) ; Emacs 20 "Read a face name with completion and return its face symbol. PROMPT is the prompt. If option `icicle-add-proxy-candidates-flag' is non-nil, then you can also enter the name of a face-name variable - its value is returned. A face-name variable is a variable with custom-type `face'. If library `eyedropper.el' is used, then you can also choose proxy candidate `*point face name*' to use the face at point." (require 'eyedropper nil t) (let ((icicle-multi-completing-p t) (icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts '(1)) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (append (and (fboundp 'eyedrop-face-at-point) (list "*point face name*")) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (eq (get cand 'custom-type) 'face)) (push `,(concat "'" (symbol-name cand) "'") ipc)))) ipc))) icicle-proxy-candidates)) face) (setq prompt (copy-sequence prompt)) ; So we can modify it by adding property. (put-text-property 0 1 'icicle-fancy-candidates t prompt) (while (= (length face) 0) (setq face (icicle-transform-multi-completion (completing-read prompt (mapcar #'icicle-make-face-candidate (face-list)) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history))))) (let ((proxy (car (member face icicle-proxy-candidates)))) (cond ((save-match-data (string-match "*point face name\\*$" face)) (eyedrop-face-at-point)) (proxy (symbol-value (intern (substring proxy 1 (1- (length proxy)))))) (t (intern face))))))) ((= emacs-major-version 21) ; Emacs 21 (defun icicle-read-face-name (prompt) "Read a face name with completion and return its face symbol. PROMPT is the prompt. If option `icicle-add-proxy-candidates-flag' is non-nil, then you can also enter the name of a face-name variable - its value is returned. A face-name variable is a variable with custom-type `face'. If library `eyedropper.el' is used, then you can also choose proxy candidate `*point face name*' to use the face at point." (require 'eyedropper nil t) (let ((icicle-multi-completing-p t) (icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts '(1)) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (append (and (fboundp 'eyedrop-face-at-point) (list "*point face name*")) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (eq (get cand 'custom-type) 'face)) (push `,(concat "'" (symbol-name cand) "'") ipc)))) ipc))) icicle-proxy-candidates)) (face-list (face-list)) (def (icicle-thing-at-point 'symbol)) face) (cond ((assoc def face-list) (setq prompt (concat prompt " (default " def "): "))) (t (setq def nil prompt (concat prompt ": ")))) (setq prompt (copy-sequence prompt)) ; So we can modify it by adding property. (put-text-property 0 1 'icicle-fancy-candidates t prompt) (while (equal "" (setq face (icicle-transform-multi-completion (completing-read prompt (mapcar #'icicle-make-face-candidate face-list) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) def))))) (let ((proxy (car (member face icicle-proxy-candidates)))) (cond ((save-match-data (string-match "*point face name\\*$" face)) (eyedrop-face-at-point)) (proxy (symbol-value (intern (substring proxy 1 (1- (length proxy)))))) (t (intern face))))))) ((< emacs-major-version 24) ; Emacs 22-23 (defun icicle-read-face-name (prompt &optional string-describing-default multiple) "Read a face name with completion and return its face symbol By default, use the face(s) on the character after point. If that character has the property `read-face-name', that overrides the `face' property. PROMPT should be a string that describes what the caller will do with the face; it should not end in a space. STRING-DESCRIBING-DEFAULT should describe what default the caller will use if the user just types RET; you can omit it. If MULTIPLE is non-nil, return a list of faces (possibly only one). Otherwise, return a single face. If option `icicle-add-proxy-candidates-flag' is non-nil, then you can also enter the name of a face-name variable - its value is returned. A face-name variable is a variable with custom-type `face'. If library `palette.el' or `eyedropper.el' is used, then you can also choose proxy candidate `*point face name*' to use the face at point." (or (require 'palette nil t) (require 'eyedropper nil t)) (let ((faceprop (or (get-char-property (point) 'read-face-name) (get-char-property (point) 'face))) (aliasfaces ()) (nonaliasfaces ()) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (eq (get cand 'custom-type) 'face)) (push `,(concat "'" (symbol-name cand) "'") ipc)))) ipc)) icicle-proxy-candidates)) faces) ;; Undo Emacs 22 brain-dead treatment of PROMPT arg. (when (save-match-data (string-match ": $" prompt)) (setq prompt (substring prompt 0 -2))) ;; Try to get a face name from the buffer. (when (memq (intern-soft (icicle-thing-at-point 'symbol)) (face-list)) (setq faces (list (intern-soft (icicle-thing-at-point 'symbol))))) ;; Add the named faces that the `face' property uses. (if (and (consp faceprop) ;; Don't treat an attribute spec as a list of faces. (not (keywordp (car faceprop))) (not (memq (car faceprop) '(foreground-color background-color)))) (dolist (f faceprop) (when (symbolp f) (push f faces))) (when (and faceprop (symbolp faceprop)) (push faceprop faces))) (delete-dups faces) (cond (multiple ;; We leave this branch as it is. Icicles does nothing special with ;; `completing-read-multiple'. (require 'crm) (mapatoms (lambda (symb) (when (custom-facep symb) ; Build up the completion tables. (if (get symb 'face-alias) (push (symbol-name symb) aliasfaces) (push (symbol-name symb) nonaliasfaces))))) (let* ((input (completing-read-multiple ; Read the input. (if (or faces string-describing-default) (format "%s (default %s): " prompt (if faces (mapconcat 'symbol-name faces ",") string-describing-default)) (format "%s: " prompt)) ;; This lambda expression is the expansion of Emacs 22 macro ;; (complete-in-turn nonaliasfaces aliasfaces). We expand it so ;; this can be compiled also in Emacs < 22 to work for Emacs 22. (lambda (string predicate mode) (cond ((eq mode t) (or (all-completions string nonaliasfaces predicate) (all-completions string aliasfaces predicate))) ((eq mode nil) (or (try-completion string nonaliasfaces predicate) (try-completion string aliasfaces predicate))) (t (or (test-completion string nonaliasfaces predicate) (test-completion string aliasfaces predicate))))) nil t nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) (and faces (mapconcat 'symbol-name faces ",")))) (output (cond ((or (equal input "") (equal input '(""))) ; Canonicalize. faces) ((stringp input) (mapcar 'intern (split-string input ", *" t))) ((listp input) (mapcar 'intern input)) (input)))) output)) ; Return the list of faces (t (when (consp faces) (setq faces (list (car faces)))) (let ((icicle-multi-completing-p t) (icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts '(1)) (face-list (face-list)) (def (if faces (mapconcat 'symbol-name faces ",") string-describing-default)) face) (setq prompt (copy-sequence prompt)) ; So we can modify it by adding property. (put-text-property 0 1 'icicle-fancy-candidates t prompt) (while (equal "" (setq face (icicle-transform-multi-completion (completing-read (if def (format "%s (default %s): " prompt def) (format "%s: " prompt)) (mapcar #'icicle-make-face-candidate face-list) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) def))))) (let ((proxy (car (member face icicle-proxy-candidates)))) (if proxy (symbol-value (intern (substring proxy 1 (1- (length proxy))))) (intern face))))))))) (t (defun icicle-read-face-name (prompt &optional default multiple) "Read a face name with completion and return its face symbol. By default, use the face(s) on the character after point. If that character has the property `read-face-name', that overrides the `face' property. PROMPT should be a string that describes what the caller will do with the face; it should not end in a space. Optional arg DEFAULT provides the value to display in the minibuffer prompt. If not a string then it is also what is returned if the user just hits `RET' (empty input). If a string then `nil' is returned. If MULTIPLE is non-nil, return a list of faces (possibly only one). Otherwise, return a single face. If option `icicle-add-proxy-candidates-flag' is non-nil, then you can also enter the name of a face-name variable - its value is returned. A face-name variable is a variable with custom-type `face'. If library `palette.el' or `eyedropper.el' is used, then you can also choose proxy candidate `*point face name*' to use the face at point." (or (require 'palette nil t) (require 'eyedropper nil t)) (let ((faceprop (or (get-char-property (point) 'read-face-name) (get-char-property (point) 'face))) (aliasfaces ()) (nonaliasfaces ()) (icicle-proxy-candidates (append (and icicle-add-proxy-candidates-flag (not icicle-exclude-default-proxies) (let ((ipc ())) (mapatoms (lambda (cand) (when (and (user-variable-p cand) (eq (get cand 'custom-type) 'face)) (push `,(concat "'" (symbol-name cand) "'") ipc)))) ipc)) icicle-proxy-candidates)) faces) ;; Undo vanilla Emacs brain-dead treatment of PROMPT arg. (when (save-match-data (string-match ": $" prompt)) (setq prompt (substring prompt 0 -2))) ;; Try to get a face name from the buffer. (when (memq (intern-soft (icicle-thing-at-point 'symbol)) (face-list)) (setq faces (list (intern-soft (icicle-thing-at-point 'symbol))))) ;; Add the named faces that the `face' property uses. (if (and (consp faceprop) ;; Don't treat an attribute spec as a list of faces. (not (keywordp (car faceprop))) (not (memq (car faceprop) '(foreground-color background-color)))) (dolist (f faceprop) (when (symbolp f) (push f faces))) (when (and faceprop (symbolp faceprop)) (push faceprop faces))) (delete-dups faces) (cond (multiple ;; We leave this branch as it is. Icicles does nothing special with ;; `completing-read-multiple'. (require 'crm) (mapatoms (lambda (s) (when (custom-facep s) ; Build up the completion tables. (if (get s 'face-alias) (push (symbol-name s) aliasfaces) (push (symbol-name s) nonaliasfaces))))) (let* ((input (completing-read-multiple ; Read the input. (if (or faces default) (format "%s (default `%s'): " prompt (if faces (mapconcat 'symbol-name faces ",") default)) (format "%s: " prompt)) (completion-table-in-turn nonaliasfaces aliasfaces) nil t nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) (and faces (mapconcat 'symbol-name faces ",")))) (output (cond ((or (equal input "") (equal input '(""))) ; Canonicalize. (or faces (and (not (stringp default)) default))) ((stringp input) (mapcar 'intern (split-string input ", *" t))) ((listp input) (mapcar 'intern input)) (input)))) output)) ; Return the list of faces (t (when (consp faces) (setq faces (list (car faces)))) (let ((icicle-multi-completing-p t) (icicle-list-nth-parts-join-string ": ") (icicle-list-join-string ": ") ;; $$$$$$ (icicle-list-end-string "") (icicle-list-use-nth-parts '(1)) (face-list (face-list)) (def (if faces (mapconcat 'symbol-name faces ",") (and (not (stringp default)) default))) face) (setq prompt (copy-sequence prompt)) ; So we can modify it by adding property. (put-text-property 0 1 'icicle-fancy-candidates t prompt) (while (equal "" (setq face (icicle-transform-multi-completion (completing-read (if def (format "%s (default `%s'): " prompt def) (format "%s: " prompt)) (mapcar #'icicle-make-face-candidate face-list) nil (not (stringp icicle-WYSIWYG-Completions-flag)) nil (if (boundp 'face-name-history) 'face-name-history 'icicle-face-name-history) def))))) (let ((proxy (car (member face icicle-proxy-candidates)))) (if proxy (symbol-value (intern (substring proxy 1 (1- (length proxy))))) (intern face)))))) )))) (defun icicle-make-face-candidate (face) "Return a completion candidate for FACE. The value of option `icicle-WYSIWYG-Completions-flag' determines the kind of candidate to use. If nil, then the face name is used (a string). If a string, then a multi-completion candidate is used, with the face name followed by a sample swatch using FACE on the string's text. If t, then the candidate is the face name itself, propertized with FACE." (if (stringp icicle-WYSIWYG-Completions-flag) (let ((swatch (copy-sequence icicle-WYSIWYG-Completions-flag))) (put-text-property 0 (length icicle-WYSIWYG-Completions-flag) 'face face swatch) (list (list (symbol-name face) swatch))) (let ((face-name (copy-sequence (symbol-name face)))) (when icicle-WYSIWYG-Completions-flag (put-text-property 0 (length face-name) 'face face face-name)) (list face-name)))) ;; REPLACE ORIGINAL `face-valid-attribute-values' in `faces.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Show color names in `*Completions*' with the (background) colors they name. ;; This is really so that commands such as `modify-face' take advantage of colored candidates. ;; We don't bother to try the same thing for Emacs 20, but the fix (directly to `modify-face') is ;; similar and trivial. ;; (when (fboundp 'face-valid-attribute-values) ; Emacs 21+. (unless (fboundp 'icicle-ORIG-face-valid-attribute-values) (defalias 'icicle-ORIG-face-valid-attribute-values (symbol-function 'face-valid-attribute-values))) (if (fboundp 'window-system) ; Emacs 23+ ;; Emacs 23+ `font-family-list' is strings, not conses of strings like older `x-font-family-list'. (defun icicle-face-valid-attribute-values (attribute &optional frame) "Return valid values for face attribute ATTRIBUTE. The optional argument FRAME is used to determine available fonts and colors. If it is nil or not specified, the selected frame is used. Value is an alist of (NAME . VALUE) if ATTRIBUTE expects a value out of a set of discrete values. Value is `integerp' if ATTRIBUTE expects an integer value." (let ((valid (case attribute (:family (if (window-system frame) (mapcar (lambda (x) (cons x x)) ; Just strings, so don't take car. (font-family-list)) ;; Only one font on TTYs. (list (cons "default" "default")))) (:foundry (list nil)) (:width (mapcar (lambda (x) (cons (symbol-name (aref x 1)) (aref x 1))) font-width-table)) (:weight (mapcar (lambda (x) (cons (symbol-name (aref x 1)) (aref x 1))) font-weight-table)) (:slant (mapcar (lambda (x) (cons (symbol-name (aref x 1)) (aref x 1))) font-slant-table)) (:inverse-video (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute))) ((:underline :overline :strike-through :box) (if (window-system frame) (nconc (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute)) (mapcar (lambda (c) (cons c c)) (mapcar #'icicle-color-name-w-bg (defined-colors frame)))) (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute)))) ((:foreground :background) (mapcar (lambda (c) (cons c c)) (mapcar #'icicle-color-name-w-bg (defined-colors frame)))) ((:height) 'integerp) (:stipple (and (memq (window-system frame) '(x ns)) ; No stipple on w32 (mapcar #'list (apply #'nconc (mapcar (lambda (dir) (and (file-readable-p dir) (file-directory-p dir) (directory-files dir))) x-bitmap-file-path))))) (:inherit (cons '("none" . nil) (mapcar (lambda (c) (cons (symbol-name c) c)) (face-list)))) (t (error "`icicle-face-valid-attribute-values': YOU SHOULD NOT SEE THIS; \ Use `M-x icicle-send-bug-report'"))))) (if (and (listp valid) (not (memq attribute '(:inherit)))) (nconc (list (cons "unspecified" 'unspecified)) valid) valid))) (defun icicle-face-valid-attribute-values (attribute &optional frame) ; Emacs 21-22. "Return valid values for face attribute ATTRIBUTE. The optional argument FRAME is used to determine available fonts and colors. If it is nil or not specified, the selected frame is used. Value is an alist of (NAME . VALUE) if ATTRIBUTE expects a value out of a set of discrete values. Value is `integerp' if ATTRIBUTE expects an integer value." (let ((valid (case attribute (:family (if window-system (mapcar (lambda (x) (cons (car x) (car x))) (if (fboundp 'font-family-list) (font-family-list) (x-font-family-list))) ;; Only one font on TTYs. (list (cons "default" "default")))) ((:width :weight :slant :inverse-video) (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute))) ((:underline :overline :strike-through :box) (if window-system (nconc (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute)) (mapcar (lambda (c) (cons c c)) (mapcar #'icicle-color-name-w-bg (x-defined-colors frame)))) (mapcar (lambda (x) (cons (symbol-name x) x)) (internal-lisp-face-attribute-values attribute)))) ((:foreground :background) (mapcar (lambda (c) (cons c c)) (mapcar #'icicle-color-name-w-bg (x-defined-colors frame)))) ((:height) 'integerp) (:stipple (and (memq window-system '(x w32 mac)) (mapcar #'list (apply #'nconc (mapcar (lambda (dir) (and (file-readable-p dir) (file-directory-p dir) (directory-files dir))) x-bitmap-file-path))))) (:inherit (cons '("none" . nil) (mapcar (lambda (c) (cons (symbol-name c) c)) (face-list)))) (t (error "`icicle-face-valid-attribute-values': YOU SHOULD NOT SEE THIS; \ Use `M-x icicle-send-bug-report'"))))) (if (and (listp valid) (not (memq attribute '(:inherit)))) (nconc (list (cons "unspecified" 'unspecified)) valid) valid)))) (defun icicle-color-name-w-bg (color-name) "Return copy of string COLOR-NAME with its background of that color. If `hexrgb.el' is not loaded, then just return COLOR-NAME." (if (featurep 'hexrgb) (let ((propertized-name (copy-sequence color-name))) (put-text-property 0 (length propertized-name) 'face (cons 'background-color (hexrgb-color-name-to-hex color-name)) propertized-name) propertized-name) color-name))) ;; REPLACE ORIGINAL `completing-read-multiple' stuff in `crm.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Essentially, we just inhibit Icicles features for Icicle mode. ;; (eval-after-load "crm" '(progn (when (fboundp 'crm-init-keymaps) (crm-init-keymaps)) ; Emacs 22, but not 23. ;; Save vanilla CRM stuff as `icicle-ORIG-' stuff. (unless (fboundp 'icicle-ORIG-completing-read-multiple) (fset 'icicle-ORIG-completing-read-multiple (symbol-function 'completing-read-multiple))) (defvar icicle-ORIG-crm-local-completion-map crm-local-completion-map "Original CRM completion map.") (defvar icicle-ORIG-crm-local-must-match-map crm-local-must-match-map "Original CRM must-match map.") ;; Define CRM stuff to use in Icicle mode. Basically, just inhibit Icicles features. (defun icicle-completing-read-multiple (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Read multiple strings in the minibuffer, with completion. Return the strings read, as a list. By using this functionality, you can specify multiple strings at a single prompt, optionally using completion. Most Icicles completions features are available, but because `TAB' here performs `crm' completion it does not also cycle among completion candidates. You can, as always, use `down' to do that. You specify multiple strings by separating the strings with a prespecified separator regexp (separator character, prior to Emacs 24.3). For example, if the separator regexp is \",\" then you specify the strings 'alice', 'bob', and 'eve' as 'alice,bob,eve'. The separator regexp is the value of variable `crm-separator', whose default value is the value of `crm-default-separator', which is \",\". Contiguous strings of non-separator-characters are referred to as \"elements\". In the above example, the elements are 'alice', 'bob', and 'eve'. Completion is available on a per-element basis. For example, if your input in the minibuffer is 'alice,bob,eve' and point is between the 'l' and the 'i', pressing `TAB' operates on element 'alice'. See `completing-read' for details about the arguments." (let ((icicle-highlight-input-completion-failure nil)) (icicle-ORIG-completing-read-multiple prompt collection predicate require-match initial-input hist def inherit-input-method))) ;; Helper function - workaround because of a lack of multiple inheritance for keymaps. (defun icicle-define-crm-completion-map (map) "Make basic bindings for keymap MAP, a crm completion map." (set-keymap-parent map minibuffer-local-completion-map) (define-key map [remap minibuffer-complete] ; Emacs 22, 23. (if (fboundp 'crm-complete) #'crm-complete #'crm-minibuffer-complete)) (when (fboundp 'crm-complete-word) (define-key map [remap minibuffer-complete-word] #'crm-complete-word)) (when (and (boundp 'icicle-word-completion-keys) (fboundp 'crm-complete-word)) (dolist (key icicle-word-completion-keys) (define-key map key #'crm-complete-word))) (define-key map [remap minibuffer-completion-help] ; Emacs 22, 23. (if (fboundp 'crm-completion-help) #'crm-completion-help #'crm-minibuffer-completion-help)) (define-key map "?" #'crm-completion-help) ; Put back `?' as help (self-insert for Icicles). (when (boundp 'icicle-prefix-complete-keys) ; Don't use Icicles completion. (dolist (key icicle-prefix-complete-keys) (define-key map key ; Emacs 22, 23. (if (fboundp 'crm-complete) #'crm-complete #'crm-minibuffer-complete))))) (defvar icicle-crm-local-completion-map (let ((map (make-sparse-keymap))) (icicle-define-crm-completion-map map) map) "Local keymap for minibuffer multiple input with completion. Analog of `minibuffer-local-completion-map'.") (defvar icicle-crm-local-must-match-map (let ((map (make-sparse-keymap))) (icicle-define-crm-completion-map map) (define-key map [remap minibuffer-complete-and-exit] (if (fboundp 'crm-complete-and-exit) #'crm-complete-and-exit #'crm-minibuffer-complete-and-exit)) map) "Local keymap for minibuffer multiple input with exact match completion. Analog of `minibuffer-local-must-match-map' for crm.") ;; Now, toggle Icicle mode, to take into account loading `crm.el' and redefining its stuff. (eval-after-load "icicles-mode" '(icicle-toggle-icicle-mode-twice)))) ;; REPLACE ORIGINAL `read-shell-command' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; Uses Icicles completion. ;; (defun icicle-read-shell-command (prompt &optional initial-contents hist default-value inherit-input-method) "Read a shell command. Use file-name completion, unless INITIAL-CONTENTS is non-nil. For completion, pass args to `icicle-read-shell-command-completing'." (if initial-contents (if (fboundp 'icicle-ORIG-read-shell-command) ; Emacs < 23 (icicle-ORIG-read-shell-command prompt initial-contents hist default-value inherit-input-method) (error "`icicle-read-shell-command': YOU SHOULD NOT SEE THIS; Use `M-x icicle-send-bug-report'")) (minibuffer-with-setup-hook (lambda () (set (make-local-variable 'minibuffer-default-add-function) 'minibuffer-default-add-shell-commands)) (icicle-read-shell-command-completing prompt initial-contents (or hist 'shell-command-history) default-value inherit-input-method)))) ;; REPLACE ORIGINAL `shell-command' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; Uses Icicles completion. ;; ;; Not needed for Emacs 23+ - Icicles completion is automatic via `icicle-read-shell-command'. ;; (unless (fboundp 'read-shell-command) ;; Emacs < 23 only (defun icicle-dired-smart-shell-command (command &optional output-buffer error-buffer) "Like `icicle-shell-command', but in the current Virtual Dired directory. Uses Icicles completion - see `icicle-read-shell-command-completing'." (interactive (list (icicle-read-shell-command "Shell command: " nil nil (cond (buffer-file-name (file-relative-name buffer-file-name)) ((eq major-mode 'dired-mode) (dired-get-filename t t)))) current-prefix-arg shell-command-default-error-buffer)) (let ((default-directory (if (fboundp 'dired-default-directory) ; Emacs 21+. (dired-default-directory) (default-directory)))) (icicle-shell-command command output-buffer error-buffer)))) ;; REPLACE ORIGINAL `shell-command' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; Uses Icicles completion. ;; ;; Not needed for Emacs 23+ - Icicles completion is automatic via `icicle-read-shell-command'. ;; (unless (fboundp 'read-shell-command) ;; Emacs < 23 only (unless (fboundp 'icicle-ORIG-shell-command) (defalias 'icicle-ORIG-shell-command (symbol-function 'shell-command))) (defun icicle-shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any. Uses Icicles completion - see `icicle-read-shell-command-completing'. With prefix argument, insert the COMMAND's output at point. If COMMAND ends in ampersand, execute it asynchronously. The output appears in the buffer `*Async Shell Command*'. That buffer is in shell mode. Otherwise, COMMAND is executed synchronously. The output appears in the buffer `*Shell Command Output*'. If the output is short enough to display in the echo area (which is determined by the variables `resize-mini-windows' and `max-mini-window-height'), it is shown there, but it is nonetheless available in buffer `*Shell Command Output*' even though that buffer is not automatically displayed. To specify a coding system for converting non-ASCII characters in the shell command output, use \\[universal-coding-system-argument] \ before this command. Noninteractive callers can specify coding systems by binding `coding-system-for-read' and `coding-system-for-write'. The optional second argument OUTPUT-BUFFER, if non-nil, says to put the output in some other buffer. If OUTPUT-BUFFER is a buffer or buffer name, put the output there. If OUTPUT-BUFFER is not a buffer and not nil, insert output in current buffer. (This cannot be done asynchronously.) In either case, the output is inserted after point (leaving mark after it). If the command terminates without error, but generates output, and you did not specify \"insert it in the current buffer\", the output can be displayed in the echo area or in its buffer. If the output is short enough to display in the echo area \(determined by the variable `max-mini-window-height' if `resize-mini-windows' is non-nil), it is shown there. Otherwise,the buffer containing the output is displayed. If there is output and an error, and you did not specify \"insert it in the current buffer\", a message about the error goes at the end of the output. If there is no output, or if output is inserted in the current buffer, then `*Shell Command Output*' is deleted. If the optional third argument ERROR-BUFFER is non-nil, it is a buffer or buffer name to which to direct the command's standard error output. If it is nil, error output is mingled with regular output. In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER." (interactive (list (icicle-read-shell-command "Shell command: " nil nil (and buffer-file-name (file-relative-name buffer-file-name))) current-prefix-arg shell-command-default-error-buffer)) (icicle-ORIG-shell-command command output-buffer error-buffer))) ;; REPLACE ORIGINAL `shell-command-on-region' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; Uses Icicles completion. ;; ;; Not needed for Emacs 23+ - Icicles completion is automatic via `icicle-read-shell-command'. ;; (unless (fboundp 'read-shell-command) ;; Emacs < 23 only (unless (fboundp 'icicle-ORIG-shell-command-on-region) (defalias 'icicle-ORIG-shell-command-on-region (symbol-function 'shell-command-on-region))) (defun icicle-shell-command-on-region (start end command &optional output-buffer replace error-buffer display-error-buffer) "Execute string COMMAND in inferior shell with region as input. Uses Icicles completion - see `icicle-read-shell-command-completing'. Normally, display any output in temp buffer `*Shell Command Output*'; Prefix arg means replace the region with it. Return the exit code of COMMAND. To specify a coding system for converting non-ASCII characters in the input and output to the shell command, use \\[universal-coding-system-argument] before this command. By default, the input (from the current buffer) is encoded in the same coding system that will be used to save the file, `buffer-file-coding-system'. If the output is going to replace the region, then it is decoded from that same coding system. The noninteractive arguments are START, END, COMMAND, OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER. Noninteractive callers can specify coding systems by binding `coding-system-for-read' and `coding-system-for-write'. If the command generates output, the output may be displayed in the echo area or in a buffer. If the output is short enough to display in the echo area \(determined by the variable `max-mini-window-height' if `resize-mini-windows' is non-nil), it is shown there. Otherwise it is displayed in the buffer `*Shell Command Output*'. The output is available in that buffer in both cases. If there is output and an error, a message about the error appears at the end of the output. If there is no output, or if output is inserted in the current buffer, then `*Shell Command Output*' is deleted. If the optional fourth argument OUTPUT-BUFFER is non-nil, that says to put the output in some other buffer. If OUTPUT-BUFFER is a buffer or buffer name, put the output there. If OUTPUT-BUFFER is not a buffer and not nil, insert output in the current buffer. In either case, the output is inserted after point (leaving mark after it). If REPLACE, the optional fifth argument, is non-nil, that means insert the output in place of text from START to END, putting point and mark around it. If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer or buffer name to which to direct the command's standard error output. If it is nil, error output is mingled with regular output. If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there were any errors. (This is always t, interactively.) This argument is not available before Emacs 22. In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER." (interactive (let (string) (unless (mark) (icicle-user-error "The mark is not set now, so no region")) ;; Do this before calling region-beginning and region-end, in case subprocess ;; output relocates them while we are in the minibuffer. (setq string (icicle-read-shell-command "Shell command on region: ")) ;; call-interactively recognizes region-beginning and region-end specially, ;; leaving them in the history. (list (region-beginning) (region-end) string current-prefix-arg current-prefix-arg shell-command-default-error-buffer (= emacs-major-version 22)))) (if (= emacs-major-version 22) ; `icicle-shell-command-on-region' not defined for Emacs 23+. (icicle-ORIG-shell-command-on-region start end command output-buffer replace error-buffer display-error-buffer) (icicle-ORIG-shell-command-on-region start end command output-buffer replace error-buffer)))) (defvar icicle-files () "A files list") ;; REPLACE ORIGINAL `dired-read-shell-command' defined in `dired-aux.el' ;; and redefined in `dired-x.el', saving it for restoration when you toggle `icicle-mode'. ;; ;; Uses Icicles completion. ;; Uses `icicle-minibuffer-default-add-dired-shell-commands', not ;; `minibuffer-default-add-dired-shell-commands'. ;; Binds `icicle-files' for use as free var elsewhere. ;; (defun icicle-dired-read-shell-command (prompt arg files) "Read a shell command for FILES using file-name completion. Uses Icicles completion - see `icicle-read-shell-command-completing'. ARG is passed to `dired-mark-prompt' as its first arg, for the prompt. FILES are the files for which the shell command should be appropriate." (let ((icicle-files files)) (minibuffer-with-setup-hook (lambda () (set (make-local-variable 'minibuffer-default-add-function) 'icicle-minibuffer-default-add-dired-shell-commands)) (dired-mark-pop-up nil 'shell files 'icicle-dired-guess-shell-command (format prompt (dired-mark-prompt arg files)) files)))) (defun icicle-dired-guess-shell-command (prompt files) "Read a shell command for FILES using file-name completion. Call `icicle-read-shell-command-completing', passing PROMPT and FILES." (icicle-read-shell-command-completing prompt nil nil nil nil files)) ;; Similar to `minibuffer-default-add-dired-shell-commands', but if Dired-X is available ;; we include also the commands from `dired-guess-default'. ;; ;; Free var here: `icicle-files' is bound in `icicle-dired-read-shell-command'. ;; (defun icicle-minibuffer-default-add-dired-shell-commands () "Return a list of all commands associated with current dired files. The commands are from `minibuffer-default-add-dired-shell-commands', and if `dired-x.el' is used, `dired-guess-default'." (interactive) (let ((dired-guess-cmds (and (boundp 'icicle-files) (fboundp 'dired-guess-default) (dired-guess-default icicle-files))) (mailcap-cmds (and (boundp 'icicle-files) (require 'mailcap nil t) (mailcap-file-default-commands icicle-files)))) (when (stringp dired-guess-cmds) (setq dired-guess-cmds (list dired-guess-cmds))) (if (listp minibuffer-default) (append minibuffer-default dired-guess-cmds mailcap-cmds) (cons minibuffer-default (append dired-guess-cmds mailcap-cmds))))) (defun icicle-read-shell-command-completing (prompt &optional initial-contents hist default-value inherit-input-method files) "Read a shell command using file-name completion. FILES name some files for which the command might be appropriate. The other arguments are the same as those for `read-from-minibuffer', except that READ and KEYMAP are missing, and HIST defaults to `shell-command-history'. Completion is lax, so you can use any shell command you want, not just a completion candidate, and you can edit the completed input to add options and arguments etc. In addition to file-name candidates, the following are combined to produce extra completion candidates (which are indicated using face `icicle-extra-candidates' in buffer `*Completions*'): * If you use Dired X, then the rules defined by user option `dired-guess-shell-alist-user' and variable `dired-guess-shell-alist-default' provide candidates appropriate for the marked files in Dired. * MIME-type associations provide candidates appropriate for the marked files (Emacs 23 and later), * If option `icicle-guess-commands-in-path' is non-nil, then executable files (or all files, if `shell-completion-execonly' is nil) in your search path provide candidates. In addition, if `icicle-extra-candidates' is non-nil, its elements are also included as extra candidates. Help is available for individual candidates, using `C-M-RET', `C-M-mouse-2', and so on. For an extra candidate (that is, for a shell command guessed to be appropriate), help is provided by the `apropos' shell command (if available). For a file name, help shows the file's properties." (let* ((dired-guess-files (and files (fboundp 'dired-guess-default) (dired-guess-default files))) (icicle-sort-comparer 'icicle-extra-candidates-first-p) (completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) (insert-default-directory nil) (icicle-extra-candidates-dir-insert-p nil) (icicle-point-position-in-candidate 'input-end) (icicle-candidate-help-fn (lambda (cand) (if (member cand icicle-extra-candidates) (with-output-to-temp-buffer "*Help*" (princ (shell-command-to-string (concat "apropos " (shell-quote-argument cand))))) (icicle-describe-file cand nil 'NO-ERROR-P)))) (icicle-extra-candidates icicle-extra-candidates) (icicle-must-match-regexp icicle-file-match-regexp) (icicle-must-not-match-regexp icicle-file-no-match-regexp) (icicle-must-pass-after-match-predicate icicle-file-predicate) (icicle-transform-function 'icicle-remove-dups-if-extras) ;; (icicle-sort-comparer (or icicle-file-sort icicle-sort-comparer)) (icicle-require-match-flag icicle-file-require-match-flag) (icicle-default-value ; Let user get default via `M-n', but don't insert it. (and (memq icicle-default-value '(t nil)) icicle-default-value))) (when (and dired-guess-files (atom dired-guess-files)) (setq dired-guess-files (list dired-guess-files))) ;; Add dired-guess guesses and mailcap guesses to `icicle-extra-candidates'. (setq icicle-extra-candidates (append dired-guess-files (and files (require 'mailcap nil t) ; Emacs 23+. (fboundp 'mailcap-file-default-commands) (mailcap-file-default-commands files)) icicle-extra-candidates)) (when icicle-guess-commands-in-path ; Add commands available from user's search path. (setq icicle-extra-candidates (append icicle-extra-candidates (or icicle-shell-command-candidates-cache (icicle-recompute-shell-command-candidates))))) (when icicle-extra-candidates (setq prompt (copy-sequence prompt)) ; So we can modify it by adding property. (put-text-property 0 1 'icicle-fancy-candidates t prompt)) (let ((cmd (icicle-read-file-name prompt nil default-value nil initial-contents))) (when icicle-quote-shell-file-name-flag (setq cmd (icicle-quote-file-name-part-of-cmd cmd))) cmd))) (defun icicle-quote-file-name-part-of-cmd (strg) "Double-quote the file name that starts string STRG, for the shell. This assumes a UNIX-style shell, for which the following characters normally need to be escaped in file names: [ \t\n;<>&|()'\"#$]. This is appropriate, for example, if you use Cygwin with MS Windows. STRG is assumed to be a shell command, possibly including arguments and possibly ending with `&' to indicate asynchronous execution. The beginning of STRG is assumed to be a file name, possibly including the characters [ \t\n;<>&|()'\"#$]. This function double-quotes the file name only, not the rest of STRG. Example: If STRG is `c:/Program Files/My Dir/mycmd.exe arg1 arg2 &', and file c:/Program Files/My Dir/mycmd.exe exists, then this returns `\"c:/Program Files/My Dir/mycmd.exe\" arg1 arg2 &'." (save-match-data (if (not (string-match "[ \t\n;<>&|()'\"#$]" strg)) strg (let ((indx 0) (compl "") (filename "") (quoted-strg strg) prefix) (while (and indx ; Find longest prefix that matches a file name. (setq indx (1+ (length compl))) (<= indx (length strg)) (setq prefix (substring strg 0 indx)) (setq compl (try-completion prefix 'read-file-name-internal (if (> emacs-major-version 22) minibuffer-completion-predicate default-directory)))) (when (and (<= (length compl) (length strg)) (string-match compl strg 0) (or (icicle-file-remote-p compl) ; Don't let Tramp try to access it. (file-exists-p compl))) (setq filename compl))) (if (or (string= "" filename) (not (or (icicle-file-remote-p filename) ; Don't let Tramp try to access it. (file-exists-p filename)))) strg (setq quoted-strg (concat "\"" filename "\"")) (setq quoted-strg (concat quoted-strg (substring strg (length filename))))))))) ;; REPLACE ORIGINAL `recentf-make-menu-items' defined in `recentf.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Adds Icicles submenu to `Open Recent' menu. ;; (defun icicle-recentf-make-menu-items (&optional menu) "Make menu items from the recent list. This is a menu filter function which ignores the MENU argument." (setq recentf-menu-filter-commands ()) (let* ((recentf-menu-shortcuts 0) (file-items (icicle-condition-case-no-debug err (mapcar 'recentf-make-menu-item (recentf-apply-menu-filter recentf-menu-filter (recentf-menu-elements recentf-max-menu-items))) (error (message "recentf update menu failed: %s" (error-message-string err)))))) (append (or file-items '(["No files" t :help "No recent file to open" :active nil])) (if recentf-menu-open-all-flag '(["All..." recentf-open-files :help "Open recent files through a dialog" :active t]) (and (< recentf-max-menu-items (length recentf-list)) ; `recentf-list' is free here. '(["More..." recentf-open-more-files :help "Open files not in the menu through a dialog" :active t]))) (and recentf-menu-filter-commands '("---")) recentf-menu-filter-commands (and recentf-menu-items-for-commands '("---")) recentf-menu-items-for-commands (and icicle-mode '(("Icicles" ["+ Open Recent File..." icicle-recent-file] ["+ Open Recent File (Other Window)..." icicle-recent-file-other-window] ["+ Remove from Recent Files List..." icicle-remove-file-from-recentf-list])))))) ;;(@* "Icicles functions - completion display (not cycling)") ;;; Icicles functions - completion display (not cycling) ------------- (defun icicle-display-candidates-in-Completions (&optional reverse-p no-display-p) "Refresh the current set of completion candidates in `*Completions*'. REVERSE-P non-nil means display the candidates in reverse order. NO-DISPLAY-P non-nil means do not display the candidates; just recompute them. If the value is `no-msg', then do not show a minibuffer message indicating that candidates were updated." ;; FREE var used here (bound in `icicle-Info-index'): `icicle-Info-hist-list'. ;;$$ ;; Pred is special if `minibuffer-completion-table' is a function. ;; (when (and (not (functionp minibuffer-completion-table)) ;; (functionp minibuffer-completion-predicate)) ;; (setq icicle-completion-candidates ;; (icicle-remove-if-not ;; (lambda (cand) ;; (funcall minibuffer-completion-predicate ;; (if (arrayp minibuffer-completion-table) (intern cand) (list cand)))) ;; icicle-completion-candidates))) ;; $$$ (case icicle-incremental-completion ;; ((t always) (setq icicle-incremental-completion-p 'always)) ;; ((nil) (setq icicle-incremental-completion-p nil))) ;; $$$$$ (unless (input-pending-p) ; Do nothing if user hit a key. ;; Upgrade `icicle-incremental-completion-p' if we are redisplaying, so that completions will ;; be updated by `icicle-call-then-update-Completions' when you edit. (setq icicle-incremental-completion-p icicle-incremental-completion) (when (and (eq t icicle-incremental-completion-p) (get-buffer-window "*Completions*" 0)) (setq icicle-incremental-completion-p 'always)) (let ((nb-cands (length icicle-completion-candidates))) ;; $$$$$$ Could use this binding to prevent frame fitting, to allow room for images. ;; But that is not really the solution. Really should fit the frame or window in such a way ;; that it takes image sizes into account. Might need to wait for a fix to Emacs bug #7822. ;; (autofit-frames-flag (not icicle-image-files-in-Completions))) (cond ((eq no-display-p 'no-msg)) ; No-op. (no-display-p (icicle-msg-maybe-in-minibuffer "Candidates updated (%s matching): %s" icicle-current-completion-mode (icicle-propertize (format "%d" nb-cands) 'face 'icicle-msg-emphasis))) ((null icicle-completion-candidates) (save-selected-window (icicle-remove-Completions-window)) (icicle-msg-maybe-in-minibuffer (if (eq 'apropos icicle-current-completion-mode) (let ((typ (car (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist)))) (concat "No " typ (and typ " ") "completions")) (case (icicle-current-TAB-method) (fuzzy "No fuzzy completions") (swank "No swank (fuzzy symbol) completions") (vanilla "No vanilla completions") (t "No prefix completions"))))) (t (when (> nb-cands icicle-incremental-completion-threshold) (message "Displaying completion candidates...")) ;; Display `*Completions*' now, so we can get its window's width. ;; We don't wait for `with-output-to-temp-buffer' to display it, because displaying it ;; might lead to splitting the display window, which would change its width. ;; We need to know the width in order to calculate the proper candidate formatting. (when (consp icicle-completion-candidates) (let ((fit-frame-inhibit-fitting-flag t) (comp-buf (get-buffer-create "*Completions*"))) (unless (get-buffer-window comp-buf 'visible) (save-selected-window (display-buffer comp-buf t 0) (deactivate-mark))))) ; Remove any leftover mouse selection. (with-output-to-temp-buffer "*Completions*" ;; Each candidate in `icicle-completion-candidates' is a string, regardless of the ;; original type of candidate used (e.g. symbol, string, alist candidate,...). Here, ;; provided `icicle-fancy-cands-internal-p' is non-nil, we transform these candidates, ;; replacing each by a string that takes into account symbol properties ;; `icicle-display-string' and `icicle-special-candidate'. ;; ;; Because `icicle-completion-candidates' is affected, changes to the candidate strings ;; (e.g. propertizing) are also reflected in the completion return value chosen by the ;; user. It is not only the display in `*Completions*' that is affected. ;; ;; The symbol whose properties are used is the one in the current obarray that is named ;; by the string candidate to be transformed. If there is no such symbol, then no ;; transformation occurs. Unless `minibuffer-completion-table' is an obarray, the ;; global obarray is used to get the symbol. ;; ;; 1. If the symbol has an `icicle-display-string' property, then that property value ;; must be a string (possibly propertized). We replace the candidate by that string. ;; ;; 2. If the symbol has an `icicle-special-candidate' property, then we transfer the ;; property to the candidate string as a set of text properties. (If the value is ;; not a plist, and `icicle-special-candidate-regexp' is nil, then just apply face ;; `icicle-special-candidate'.) The effect is similar to using ;; `icicle-special-candidate-regexp', but the completion return value is also ;; affected. (when icicle-fancy-cands-internal-p (setq icicle-completion-candidates (mapcar (lambda (cand) (let* ((symb (intern-soft cand (and (arrayp minibuffer-completion-table) minibuffer-completion-table))) (display-strg (and symb (stringp (get symb 'icicle-display-string)) (get symb 'icicle-display-string))) (new-cand (or display-strg cand)) (spec-prop (and symb (get symb 'icicle-special-candidate)))) ;; Apply `icicle-special-candidate' property's value. ;; If the value is a plist, then apply the properties as text props. ;; Else (the value is t), apply face `icicle-special-candidate'. (when spec-prop (setq new-cand (copy-sequence new-cand)) (if (consp spec-prop) (add-text-properties 0 (length new-cand) spec-prop new-cand) (unless icicle-special-candidate-regexp (add-text-properties 0 (length new-cand) '(face icicle-special-candidate) new-cand)))) new-cand)) icicle-completion-candidates))) ;; The `icicle-condition-case-no-debug' should not be needed, but it prevents an ;; "End of buffer" message from `display-completion-list' on Emacs 22. (icicle-condition-case-no-debug nil (display-completion-list (if reverse-p (reverse icicle-completion-candidates) icicle-completion-candidates)) (error nil))) (save-excursion (save-window-excursion (with-current-buffer (get-buffer "*Completions*") (let* ((buffer-read-only nil) (eob (point-max)) (filep (or (icicle-file-name-input-p) icicle-abs-file-candidates)) (dir (and filep icicle-last-input (icicle-file-name-directory icicle-last-input))) (histvar (and (symbolp minibuffer-history-variable) (boundp minibuffer-history-variable) minibuffer-history-variable)) (hist (and histvar (if filep (let ((default-directory dir)) (mapcar #'expand-file-name (symbol-value histvar))) (symbol-value histvar)))) (case-fold-search ;; Don't bother with buffer completion, `read-buffer-completion-ignore-case'. (if (and filep (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case))) (when (fboundp 'remove-images) (remove-images (point-min) (point-max))) (goto-char (icicle-start-of-candidates-in-Completions)) (while (not (eobp)) (let* ((beg (point)) (end (next-single-property-change beg 'mouse-face nil eob)) (next (next-single-property-change end 'mouse-face nil eob)) (faces ())) ;; Highlight candidate specially if it is a proxy candidate. (let ((candidate (icicle-current-completion-in-Completions))) ;;$$$ (when dir (setq candidate (expand-file-name candidate dir))) (when (member candidate icicle-proxy-candidates) (setq faces (cons 'icicle-proxy-candidate faces)) (if (not icicle-proxy-candidate-regexp) (add-text-properties beg end (cons 'face (list faces))) (save-match-data (when (string-match icicle-proxy-candidate-regexp candidate) (add-text-properties (+ beg (match-beginning 0)) (+ beg (match-end 0)) (cons 'face (list faces)))))))) ;; Highlight candidate specially if it is an extra candidate. (let ((candidate (icicle-current-completion-in-Completions))) ;;$$$ (when dir (setq candidate (expand-file-name candidate dir))) (save-match-data (when (member candidate icicle-extra-candidates) (setq faces (cons 'icicle-extra-candidate faces)) (add-text-properties beg end (cons 'face (list faces)))))) ;; Highlight candidate specially if it is a special candidate. (let ((candidate (icicle-current-completion-in-Completions))) ;;$$$ (when dir (setq candidate (expand-file-name candidate dir))) (save-match-data (when (and icicle-special-candidate-regexp (string-match icicle-special-candidate-regexp candidate)) (setq faces (cons 'icicle-special-candidate faces)) (if (not icicle-special-candidate-regexp) (add-text-properties beg end (cons 'face (list faces))) (add-text-properties (+ beg (match-beginning 0)) (+ beg (match-end 0)) (cons 'face (list faces))))))) ;; Highlight candidate (`*-historical-candidate') if it was used previously. (when icicle-highlight-historical-candidates-flag (let ((candidate (icicle-current-completion-in-Completions))) (when (and (consp hist) (not (member candidate icicle-hist-cands-no-highlight))) (let ((default-directory dir)) (when (member (if filep (expand-file-name (icicle-transform-multi-completion candidate)) candidate) hist) (add-text-properties beg end `(face ,(setq faces (cons 'icicle-historical-candidate faces))))))))) ;; Highlight Info index-entry cand (`icicle-historical-candidate-other') ;; if its node has been visited. ;; ;; FREE var here (bound in `icicle-Info-index'): `icicle-Info-hist-list'. (when (and (> emacs-major-version 21) (memq icicle-last-top-level-command '(Info-index icicle-Info-index)) icicle-highlight-historical-candidates-flag (boundp 'icicle-Info-hist-list) (consp icicle-Info-hist-list) (<= nb-cands icicle-Info-visited-max-candidates) (progn (message "Highlighting topics in visited nodes...") t)) (let ((candidate (icicle-current-completion-in-Completions))) (when (or (assoc candidate icicle-Info-index-cache) (icicle-some (mapcar 'cadr icicle-Info-hist-list) candidate #'icicle-Info-node-is-indexed-by-topic)) (add-text-properties beg end `(face ,(setq faces (cons 'icicle-historical-candidate-other faces))))))) ;; Highlight, inside the candidate, the expanded common match. (when (and icicle-current-input (not (string= "" icicle-current-input))) (save-excursion (save-restriction (narrow-to-region beg end) ; Restrict to the completion candidate. (when (re-search-forward (regexp-quote (icicle-minibuf-input-sans-dir icicle-current-input)) nil t) (setq faces (cons 'icicle-common-match-highlight-Completions faces)) (put-text-property (match-beginning 0) (point) 'face faces))))) ;; Hide match for `icicle-current-input' (expanded common match, if available), ;; if `icicle-hide-common-match-in-Completions-flag' is non-nil. (save-excursion (save-restriction (narrow-to-region beg end) ; Restrict to the completion candidate. (when (and icicle-hide-common-match-in-Completions-flag icicle-common-match-string) (when (re-search-forward (regexp-quote icicle-common-match-string) nil t) (if (> emacs-major-version 20) (put-text-property (match-beginning 0) (point) 'display "...") (put-text-property (match-beginning 0) (point) 'invisible t)))))) ;; Highlight, inside the candidate, what the input expression matches. (unless (and icicle-current-raw-input (string= "" icicle-current-raw-input) icicle-apropos-complete-match-fn) (save-excursion (save-restriction (narrow-to-region beg end) ; Restrict to the completion candidate. (let ((fn (if (and (eq 'prefix icicle-current-completion-mode) (not (memq (icicle-current-TAB-method) '(fuzzy swank)))) ;; $$$$$$ What is best for `vanilla' (Emacs 23) completion? 'search-forward (case icicle-apropos-complete-match-fn (icicle-scatter-match (lambda (input bound noerr) (re-search-forward (icicle-scatter input) bound noerr))) (icicle-levenshtein-match (if (= icicle-levenshtein-distance 1) (lambda (input bound noerr) (re-search-forward (icicle-levenshtein-one-regexp input) bound noerr)) 're-search-forward)) (otherwise 're-search-forward))))) (save-excursion (when (and (funcall fn (icicle-minibuf-input-sans-dir icicle-current-raw-input) nil t) (not (eq (match-beginning 0) (point)))) (setq faces (cons 'icicle-match-highlight-Completions faces)) (put-text-property (match-beginning 0) (point) 'face faces))) ;; If `icicle-hide-non-matching-lines-flag' then hide all lines ;; of candidate that do not match current input. (let ((candidate (icicle-current-completion-in-Completions)) (input (icicle-minibuf-input-sans-dir icicle-current-raw-input)) (cbeg beg)) (when (and icicle-hide-non-matching-lines-flag (string-match "\n" candidate) (not (string= "\n" candidate))) (goto-char cbeg) (while (not (eobp)) (unless (funcall fn input (line-end-position) t) (if (> emacs-major-version 20) (put-text-property (line-beginning-position) (min (1+ (line-end-position)) (point-max)) 'display "...\n") (put-text-property (line-beginning-position) (min (1+ (line-end-position)) (point-max)) 'invisible t))) (forward-line 1)))))))) ;; Highlight candidate if it has been saved. (when (and icicle-highlight-saved-candidates-flag icicle-saved-completion-candidates) (let ((candidate (icicle-current-completion-in-Completions))) (when (member candidate icicle-saved-completion-candidates) (let ((ov (make-overlay beg end))) (push ov icicle-saved-candidate-overlays) (overlay-put ov 'face 'icicle-saved-candidate) (overlay-put ov 'priority '10))))) ;; Treat `icicle-candidate-properties-alist'. ;; A `face' prop will unfortunately wipe out any `face' prop we just applied. (when icicle-candidate-properties-alist (save-excursion (save-restriction (narrow-to-region beg end) ; Restrict to the completion candidate. (let* ((candidate (buffer-substring (point-min) (point-max))) (orig-pt (point)) (start 0) (end 0) (partnum 1) (join (concat "\\(" icicle-list-join-string "\\|$\\)")) (len-cand (length candidate)) (len-join (length icicle-list-join-string)) (first t)) (save-match-data (while (and (or first (not (= end (match-beginning 0))) (< (+ end len-join) len-cand)) (string-match join candidate (if (and (not first) (= end (match-beginning 0)) (< end len-cand)) (+ end len-join) end)) (< end len-cand)) (setq first nil end (or (match-beginning 0) len-cand)) (let* ((entry (assq partnum icicle-candidate-properties-alist)) (properties (cadr entry)) (propertize-join-string (car (cddr entry)))) (when properties (add-text-properties (+ start orig-pt) (+ end orig-pt) properties)) (when propertize-join-string (add-text-properties (+ end orig-pt) (+ end orig-pt len-join) properties))) (setq partnum (1+ partnum) start (match-end 0)))))))) ;; Show thumbnail for an image file or image-file bookmark (Bookmark+). (when (and icicle-image-files-in-Completions (if (fboundp 'display-graphic-p) (display-graphic-p) window-system) (or (and filep (fboundp 'image-file-name-regexp)) (and icicle-show-multi-completion-flag (symbolp icicle-last-top-level-command) (string-match "^icicle-bookmark-" (symbol-name icicle-last-top-level-command))))) (let ((image-file (if (and icicle-show-multi-completion-flag (symbolp icicle-last-top-level-command) ;; We could alternatively put a property on such symbols and ;; test that. But just matching the cmd name is OK so far. (string-match "^icicle-bookmark-" (symbol-name icicle-last-top-level-command))) ;; This is bound by the bookmark commands to `(1)': bookmark name. ;; The file name is part #2, so we rebind this here. (let ((icicle-list-use-nth-parts '(2))) (icicle-transform-multi-completion (icicle-current-completion-in-Completions))) (icicle-transform-multi-completion (icicle-current-completion-in-Completions))))) (when (and (require 'image-dired nil t) (icicle-string-match-p (image-file-name-regexp) image-file)) (let ((thumb-img (append (image-dired-get-thumbnail-image image-file) '(:margin 2))) (img-ov (overlays-in (point) (min (point-max) (1+ (point)))))) (if img-ov (delete-overlay (car img-ov)) (put-image thumb-img beg) (setq img-ov (loop for ov in (overlays-in (point) (min (point-max) (1+ (point)))) when (overlay-get ov 'put-image) collect ov into ovs finally return (car ovs))) (overlay-put img-ov 'image-file image-file) (overlay-put img-ov 'thumb-img thumb-img) (overlay-put img-ov 'image-size (image-size thumb-img)))) ;; Replace file name with a space. (when (eq 'image-only icicle-image-files-in-Completions) (let ((name-ov (overlays-in end end))) (if name-ov (delete-overlay (car name-ov)) (setq name-ov (make-overlay beg end)) (overlay-put name-ov 'display " "))))))) (goto-char next))) ;; Remove all newlines for images-only display. (when (eq icicle-image-files-in-Completions 'image-only) (save-excursion (goto-char (icicle-start-of-candidates-in-Completions)) (while (and (re-search-forward "$") (not (eobp))) (delete-char 1))))) (set-buffer-modified-p nil) (setq buffer-read-only t)))) ;; Put lighter, number of candidates, completion mode, and sort order in mode line. (with-current-buffer (get-buffer "*Completions*") (set (make-local-variable 'mode-line-format) (format " %s%s%s, sorting %s%s" (icicle-propertize (format "%d" nb-cands) 'face 'icicle-mode-line-help) (if (and icicle-max-candidates (integerp icicle-max-candidates) ; Not `RESET'. (< icicle-max-candidates icicle-nb-candidates-before-truncation)) (format "%s candidates shown" (icicle-propertize (format "/%d" icicle-nb-candidates-before-truncation) 'face 'icicle-mode-line-help)) " candidates") (if (memq icicle-current-completion-mode '(prefix apropos)) (format ", %s completion" (icicle-propertize (cond ((eq 'apropos icicle-current-completion-mode) ;; If nil, COLLECTION arg is probably a fn and we set it to nil ;; to prevent automatic input matching in ;; `icicle-unsorted-apropos-candidates', because COLLECTION fn ;; does everything. So here we treat nil like `apropos'. (if icicle-apropos-complete-match-fn (or (car (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist)) "") "apropos")) ((eq 'prefix icicle-current-completion-mode) (case (icicle-current-TAB-method) (fuzzy "fuzzy") (swank "swank (fuzzy symbol)") (vanilla "vanilla") (t "prefix")))) 'face 'icicle-mode-line-help)) "") (icicle-propertize (or (car (rassoc icicle-sort-comparer icicle-sort-orders-alist)) "turned OFF") 'face 'icicle-mode-line-help) (if (and icicle-reverse-sort-p icicle-sort-comparer) (icicle-propertize " (reversed)" 'face 'icicle-mode-line-help) ""))) (let* ((lighter (cadr (assoc 'icicle-mode minor-mode-alist))) (regexp (and lighter (concat (regexp-quote icicle-lighter-truncation) "$"))) props) (when lighter (setq lighter (concat lighter " ") props (text-properties-at 0 lighter)) (when (string-match regexp lighter) (setq lighter (substring lighter 0 (match-beginning 0)))) (add-text-properties 0 (length lighter) props lighter)) (setq mode-line-format (concat lighter mode-line-format))) (goto-char (icicle-start-of-candidates-in-Completions)) (set-window-point (get-buffer-window "*Completions*" 0) (point)) (icicle-fit-completions-window)) ;; Use the same font family as the starting buffer. This is particularly for picking up ;; the proper font for Unicode chars in `*Completions*'. Emacs 23+ only. ;; But skip this if using `oneonone.el', since `1on1-display-*Completions*-frame' does it. (when (and (not (fboundp '1on1-display-*Completions*-frame)) (get-buffer-window "*Completions*" 'visible) icicle-pre-minibuffer-buffer (> emacs-major-version 22)) (save-window-excursion (select-window (get-buffer-window "*Completions*" 'visible)) (when (one-window-p t);; $$$$$ Also this? (window-dedicated-p (selected-window)) (let* ((orig-win (get-buffer-window icicle-pre-minibuffer-buffer 'visible)) (orig-font-fam (and (window-live-p orig-win) (save-window-excursion (select-window orig-win) (face-attribute 'default :family))))) (when orig-font-fam (set-face-attribute 'default (selected-frame) :family orig-font-fam)))))) (message nil))))) ; Clear out any "Looking for..." (when (> emacs-major-version 21) (defun icicle-Info-node-is-indexed-by-topic (node topic) "Return non-nil if Info NODE is indexed by TOPIC. The value returned is (TOPIC NODE Info-current-file), and it is cached in `icicle-Info-index-cache'." ;; FREE vars used here (bound in `icicle-Info-index'): `icicle-Info-index-nodes', `icicle-Info-manual'. (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" (regexp-quote topic))) ;; Bind these to nil to not perform menu fontification, to avoid its slowdown (Info-fontify-maximum-menu-size nil) (Info-fontify-visited-nodes nil) (Info-hide-note-references nil) (index-nodes icicle-Info-index-nodes) nextnode) (and index-nodes (catch 'icicle-Info-node-is-indexed-by-topic (condition-case nil (with-temp-buffer (Info-mode) (if (and (featurep 'info+) (> emacs-major-version 21)) (Info-find-node icicle-Info-manual (car index-nodes) nil 'NOMSG) (Info-find-node icicle-Info-manual (car index-nodes))) (setq index-nodes (cdr index-nodes)) (while (progn (goto-char (point-min)) (while (re-search-forward pattern nil t) (when (string= (match-string-no-properties 2) node) (add-to-list 'icicle-Info-index-cache (list topic node Info-current-file)) (throw 'icicle-Info-node-is-indexed-by-topic (list topic node Info-current-file)))) (setq index-nodes (cdr index-nodes) nextnode (car index-nodes))) (Info-goto-node nextnode))) (error nil)) nil))))) ;; REPLACE ORIGINAL `display-completion-list' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; 1. Does not remove text properties from candidates when it displays them in `*Completions*'. ;; 2. Adjusts number of columns and their widths to window size. ;; 3. The optional second arg is ignored. In vanilla Emacs < 23, this is a string ;; representing a common prefix, and faces `completions-first-difference' and ;; `completions-common-part' are used on candidates. ;; (unless (fboundp 'icicle-ORIG-display-completion-list) (defalias 'icicle-ORIG-display-completion-list (symbol-function 'display-completion-list))) (defun icicle-display-completion-list (completions &optional ignored) "Display the list of completions, COMPLETIONS, using `standard-output'. Each element may be just a symbol or string or may be a list of two strings to be printed as if concatenated. If it is a list of two strings, the first is the actual completion alternative, the second serves as annotation. `standard-output' must be a buffer. The actual completion alternatives, as inserted, are given the `mouse-face' property of `highlight'. At the end, this runs the normal hook `completion-setup-hook'. It can find the completion buffer in `standard-output'. The optional second arg is ignored." (if (not (bufferp standard-output)) (let ((standard-output (current-buffer))) (icicle-display-completion-list completions)) (let ((mainbuf (current-buffer))) ; $$$$$$ For Emacs 23 crap that puts base-size in last cdr. (with-current-buffer standard-output (goto-char (point-max)) (let ((cand-intro-string (if completions "Possible completions are:\n" "There are no possible completions of what you have typed."))) (when (and icicle-show-Completions-help-flag completions) (icicle-insert-Completions-help-string) (put-text-property 0 (length cand-intro-string) 'face 'icicle-Completions-instruction-1 cand-intro-string)) ;; Show `There are no possible...' anyway, even if not `icicle-show-Completions-help-flag'. (when (or icicle-show-Completions-help-flag (null completions)) (insert cand-intro-string))) ;; $$$$$$$$ Emacs 23 nonsense. Revisit this when Stefan finally removes that crud. ;; This is done in Emacs 23 `display-completion-list'. (when (and completions (fboundp 'completion-all-sorted-completions)) ; Emacs 23 (let ((last (last completions))) ;; Set base-size from the tail of the list. (set (make-local-variable 'completion-base-size) (or (cdr last) (and (minibufferp mainbuf) 0))) (setcdr last nil))) ; Make completions a properly nil-terminated list. (icicle-insert-candidates completions))) ;; In vanilla Emacs < 23, the hook is run with `completion-common-substring' bound to ;; what is here called IGNORED. (run-hooks 'completion-setup-hook) nil)) (defun icicle-insert-candidates (candidates) "Insert completion candidates from list CANDIDATES into the current buffer." (when (consp candidates) (let ((annotation-fn (or ; Emacs 23+ (and icicle-last-completion-candidate (fboundp 'completion-metadata-get) (completion-metadata-get (completion-metadata icicle-last-completion-candidate minibuffer-completion-table minibuffer-completion-predicate) 'annotation-function)) (and (boundp 'completion-extra-properties) (plist-get completion-extra-properties :annotation-function)) (and (boundp 'completion-annotate-function) completion-annotate-function)))) (when annotation-fn ; Emacs 23+ uses a list (CAND ANNOTATION) for the candidate. (setq candidates (mapcar (lambda (cand) (let ((ann (condition-case nil (funcall annotation-fn cand) (error nil)))) (if ann (list cand ann) cand))) candidates)))) (let* ((multilinep (lambda (cand) (if (consp cand) (or (string-match "\n" (car cand)) (string-match "\n" (cadr cand))) (string-match "\n" cand)))) (any-multiline-p (loop for cand in candidates if (funcall multilinep cand) return t finally return nil)) (max-cand-len (apply #'max (mapcar (lambda (cand) (if (consp cand) (+ (length (car cand)) (length (cadr cand))) (length cand))) candidates))) (comp-win (get-buffer-window (current-buffer) 0)) (wwidth (let ((spcl-frame-params (special-display-p (buffer-name)))) (cond ((and spcl-frame-params ; Special-buffer. Use its default frame width. (or (and (consp spcl-frame-params) (cdr (assq 'width (cadr spcl-frame-params)))) (cdr (assq 'width special-display-frame-alist)) (cdr (assq 'width default-frame-alist))))) (comp-win (1- (window-width comp-win))) ; Width picked by `display-buffer'. (t 40)))) ; Failsafe. (nb-cands (length candidates)) (columns (if any-multiline-p 1 (or icicle-Completions-max-columns (max 1 (min (/ (* 100 wwidth) (* icicle-candidate-width-factor max-cand-len)) nb-cands))))) (colwidth (if (eq 1 columns) (min max-cand-len wwidth) (/ wwidth columns))) (column-nb 0) (rows (ceiling nb-cands columns)) (row 0) startpos endpos string) (when (eq 1 columns) (setq wwidth colwidth)) (dolist (cand candidates) (setq endpos (point)) (cond ((eq icicle-completions-format 'vertical) ; Vertical layout. (when (>= row rows) (forward-line (- rows)) (setq column-nb (+ column-nb colwidth) row 0)) (when (> column-nb 0) (end-of-line) (let ((cand-end (point))) (indent-to column-nb icicle-inter-candidates-min-spaces) (put-text-property cand-end (point) 'mouse-face nil) ; Turn off `mouse-face', `face' (put-text-property cand-end (point) 'face nil)))) (t ; Horizontal layout (`horizontal' or nil). (unless (bolp) (put-text-property (point) (point) 'mouse-face nil) ; Turn off `mouse-face' (indent-to (* (max 1 column-nb) colwidth) icicle-inter-candidates-min-spaces) (when (< wwidth (+ (max colwidth (if (consp cand) (+ (length (car cand)) (length (cadr cand))) (length cand))) (current-column))) (save-excursion ; This is like `fixup-whitespace', but only forward. (delete-region (point) (progn (skip-chars-forward " \t") (point))) (unless (or (looking-at "^\\|\\s)") (save-excursion (forward-char -1) (looking-at "$\\|\\s(\\|\\s'"))) (insert ?\ ))) (insert "\n") (setq column-nb columns))) ; End of the row. Simulate being in farthest column. (when (< endpos (point)) (set-text-properties endpos (point) nil)))) ;; Convert candidate (but not annotation) to unibyte or to multibyte, if needed. (setq string (if (consp cand) (car cand) cand)) (cond ((and (null enable-multibyte-characters) (multibyte-string-p string)) (setq string (string-make-unibyte string))) ((and enable-multibyte-characters (not (multibyte-string-p string))) (setq string (string-make-multibyte string)))) (put-text-property (point) (progn (insert string) (point)) 'mouse-face 'highlight) ; Insert cand. ;; Insert annotation, if `icicle-show-annotations-flag'. (when (and icicle-show-annotations-flag (consp cand) (cadr cand)) (set-text-properties (point) (progn (insert (cadr cand)) (point)) '(face icicle-annotation))) (if (not (eq icicle-completions-format 'vertical)) (setq column-nb (mod (1+ column-nb) columns)) (if (> column-nb 0) (forward-line) (insert "\n")) ; Vertical layout. (setq row (1+ row))) (when (funcall multilinep cand) (insert (if (eq 'vertical icicle-completions-format) "\n" "\n\n")))) (when (eq icicle-completions-format 'vertical) ; Remove extra newline we inserted at eob. (save-excursion (goto-char (point-max)) (when (bolp) (delete-backward-char 1))))))) ;; ARG is not used in any calls yet/currently. (defun icicle-fit-completions-window (&optional arg) "Fit the height of the window that is showing completions to its contents. Optional ARG determines what the effect is, as follows: `fit-only' - fit window to contents, but do not scale text size `scale-only' - scale text size but do not fit window to contents anything else - scale text size and fit window to contents Window fitting is available only for Emacs 24+, because `fit-window-to-buffer' is broken for Emacs 21-23 (it can remove windows). Text size scaling uses `icicle-Completions-text-scale-decrease' and is available only for Emacs 23+. (No scaling in any case if using `oneonone.el' with a `*Completions*' frame.)." (unless (or (eq arg 'scale-only) (= emacs-major-version 23) ; `fit-window-to-buffer' is broken before 24: removes windows. (= emacs-major-version 22)) (when (and (eq major-mode 'completion-list-mode) (fboundp 'fit-window-to-buffer)) (let ((win (get-buffer-window "*Completions*" 0))) (unless (< (window-width win) (frame-width)) ; Don't shrink if split horizontally. (fit-window-to-buffer win (or (icicle-get-safe icicle-last-top-level-command 'icicle-Completions-window-max-height) icicle-Completions-window-max-height)))))) (unless (eq arg 'fit-only) (when (and (boundp 'icicle-Completions-text-scale-decrease) ; Emacs 23+ (eq major-mode 'completion-list-mode) (or (not (boundp '1on1-*Completions*-frame-flag)) (not 1on1-*Completions*-frame-flag))) (text-scale-decrease icicle-Completions-text-scale-decrease)))) (defun icicle-highlight-initial-whitespace (input) "Highlight any initial whitespace in your input. Only if `icicle-highlight-input-initial-whitespace-flag' is non-nil. INPUT is the current user input, that is, the completion root. This must be called in the minibuffer." (when (and icicle-highlight-input-initial-whitespace-flag (not (string= "" input))) (let ((case-fold-search ;; Don't bother with buffer completion and `read-buffer-completion-ignore-case'. (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case))) (save-excursion (goto-char (icicle-minibuffer-prompt-end)) (when (and (icicle-file-name-input-p) insert-default-directory) (search-forward (icicle-file-name-directory-w-default input) nil t)) ; Skip directory. (save-excursion (save-restriction (narrow-to-region (point) (point-max)) ; Search within completion candidate. (while (and (not (eobp)) (looking-at "\\(\\s-\\|\n\\)+")) (put-text-property (point) (min (point-max) (1+ (point))) 'face 'icicle-whitespace-highlight) (forward-char 1)) ;; Remove any previous whitespace highlighting that is no longer part of prefix. (while (not (eobp)) (when (eq (get-text-property (point) 'face) 'icicle-whitespace-highlight) (put-text-property (point) (min (point-max) (1+ (point))) 'face nil)) (forward-char 1)))))))) (defun icicle-minibuffer-prompt-end () "Buffer position of end of minibuffer prompt, or `point-min'. Version of `minibuffer-prompt-end' that works for Emacs 20 and later." (if (fboundp 'minibuffer-prompt-end) (minibuffer-prompt-end) (point-min))) ;;(@* "Icicles functions - TAB completion cycling") ;;; Icicles functions - TAB completion cycling -------------------- (defun icicle-prefix-candidates (input) "List of prefix or fuzzy completions for the current partial INPUT. INPUT is a string. Each candidate is a string." (setq icicle-candidate-nb nil) (if (or (and (eq 'fuzzy (icicle-current-TAB-method)) (featurep 'fuzzy-match)) (and (eq 'swank (icicle-current-TAB-method)) (featurep 'el-swank-fuzzy))) (condition-case nil (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-fuzzy-candidates input))) (quit (top-level))) ; Let `C-g' stop it. (let ((cands (icicle-unsorted-prefix-candidates input))) (if icicle-abs-file-candidates (icicle-strip-ignored-files-and-sort cands) (icicle-maybe-sort-maybe-truncate cands))))) (defun icicle-fuzzy-candidates (input) "Return fuzzy matches for INPUT. Handles also swank fuzzy symbol match." (condition-case nil (let ((candidates ())) ;; $$$$ Should treat other `minibuffer-completion-table' types also. (cond ((and (vectorp minibuffer-completion-table) (not (eq (icicle-current-TAB-method) 'swank))) (mapatoms (lambda (symb) (when (or (null minibuffer-completion-predicate) (funcall minibuffer-completion-predicate symb)) (push (symbol-name symb) candidates))) minibuffer-completion-table) (setq candidates (if (equal "" input) (sort (all-completions "" minibuffer-completion-table minibuffer-completion-predicate) #'icicle-case-string-less-p) (FM-all-fuzzy-matches input candidates)))) ((vectorp minibuffer-completion-table) (setq candidates (mapcar #'car (car (el-swank-fuzzy-completions input icicle-swank-timeout (or minibuffer-completion-predicate 'fboundp) (min (length input) icicle-swank-prefix-length)))))) ((and (consp minibuffer-completion-table) (consp (car minibuffer-completion-table))) (dolist (cand minibuffer-completion-table) (when (or (null minibuffer-completion-predicate) (funcall minibuffer-completion-predicate cand)) (push (car cand) candidates))) (setq candidates (if (equal "" input) (sort (all-completions "" minibuffer-completion-table minibuffer-completion-predicate) #'icicle-case-string-less-p) (FM-all-fuzzy-matches input candidates))))) (let ((icicle-extra-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-extra-candidates)) (icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-proxy-candidates)) (filtered-candidates (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (let ((case-fold-search completion-ignore-case)) (and (icicle-filter-wo-input cand) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand))))) candidates))))) (when (consp filtered-candidates) (setq icicle-common-match-string (icicle-expanded-common-match input filtered-candidates))) (unless filtered-candidates (setq icicle-common-match-string nil)) filtered-candidates)) (quit (top-level)))) ; Let `C-g' stop it. (defun icicle-unsorted-prefix-candidates (input) "Unsorted list of prefix completions for the current partial INPUT. Unless `icicle-expand-input-to-common-match' = 0 this also sets `icicle-common-match-string' to the expanded common match of the input over all candidates." (condition-case nil (let* ((m-c-table ;; Prevent Emacs 23.2+ from using `internal-complete-buffer' if not ignoring space prefixes. ;; This lets `icicle-toggle-ignored-space-prefix' refresh to include space prefixes. (if (or (not (eq minibuffer-completion-table 'internal-complete-buffer)) icicle-buffer-ignore-space-prefix-flag) minibuffer-completion-table (mapcar (lambda (buf) (and (buffer-live-p buf) (list (buffer-name buf)))) (buffer-list)))) (candidates (if (icicle-not-basic-prefix-completion-p) (icicle-completion-all-completions input m-c-table minibuffer-completion-predicate ;; $$$$$$ (- (point) (field-beginning))) (length input) (and (fboundp 'completion--field-metadata) ;Emacs 24 (completion--field-metadata (field-beginning)))) (icicle-all-completions input m-c-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)))) (icicle-extra-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match (concat "^" (regexp-quote input)) cand))) icicle-extra-candidates)) (icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match (concat "^" (regexp-quote input)) cand))) icicle-proxy-candidates)) (filtered-candidates (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (let ((case-fold-search completion-ignore-case)) (and (icicle-filter-wo-input cand) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand))))) candidates))))) (when (and (not (eq icicle-expand-input-to-common-match 0)) (consp filtered-candidates)) (let ((common-prefix (if (icicle-not-basic-prefix-completion-p) (icicle-completion-try-completion input m-c-table minibuffer-completion-predicate ;; $$$$$$ (- (point) (field-beginning))) (length input) (and (fboundp 'completion--field-metadata) (completion--field-metadata ; Emacs 24 (field-beginning)))) (try-completion input m-c-table minibuffer-completion-predicate)))) (setq icicle-common-match-string (if (eq t common-prefix) input common-prefix)))) (unless filtered-candidates (setq icicle-common-match-string nil)) filtered-candidates) (quit (top-level)))) ; Let `C-g' stop it. (defun icicle-file-name-prefix-candidates (input) "List of prefix completions for partial file name INPUT. INPUT is a string. Candidates can be directories. Each candidate is a string." (setq icicle-candidate-nb nil) ;; $$$$$$ (let ((default-directory (icicle-file-name-directory-w-default input))) ;; $$$$$$ (icicle-unsorted-file-name-prefix-candidates ;; $$$$$$ (or (icicle-file-name-nondirectory input) "")))) (icicle-strip-ignored-files-and-sort (icicle-unsorted-file-name-prefix-candidates input))) (defun icicle-unsorted-file-name-prefix-candidates (input) "Unsorted list of prefix completions for the current file-name INPUT. Unless `icicle-expand-input-to-common-match' = 0 this also sets `icicle-common-match-string' to the expanded common match of the input over all candidates." (setq input (substitute-in-file-name input)) (let ((minibuffer-completion-table (if (> emacs-major-version 23) icicle-file-name-completion-table minibuffer-completion-table))) (condition-case nil (let* ((pred (if (< emacs-major-version 23) default-directory minibuffer-completion-predicate)) (candidates (if (icicle-not-basic-prefix-completion-p) (icicle-completion-all-completions input minibuffer-completion-table pred (length input) (and (fboundp 'completion--field-metadata) ; Emacs 24 (completion--field-metadata (field-beginning)))) (icicle-all-completions input minibuffer-completion-table pred))) (icicle-extra-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match (concat "^" (regexp-quote input)) cand))) icicle-extra-candidates)) (icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match (concat "^" (regexp-quote input)) cand))) icicle-proxy-candidates)) (filtered-candidates (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (let ((case-fold-search (if (boundp 'read-file-name-completion-ignore-case) read-file-name-completion-ignore-case completion-ignore-case))) (if (member cand '("../" "./")) (member input '(".." ".")) ; Prevent "" from matching "../" (and ;;; $$$$$$ REMOVED - This was no good for PCM - e.g. input `ic-o' and candidates `icicles-opt.el[c]'. ;;; We don't do it for non-file-name completion, anyway, and it doesn't seem needed. ;;; (save-match-data ;;; (string-match (concat "^" (regexp-quote input)) cand)) (icicle-filter-wo-input cand) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand)))))) candidates))))) (when (and (not (eq icicle-expand-input-to-common-match 0)) (consp filtered-candidates)) (let ((common-prefix (if (icicle-not-basic-prefix-completion-p) (icicle-completion-try-completion input minibuffer-completion-table minibuffer-completion-predicate (length input) (and (fboundp 'completion--field-metadata) (completion--field-metadata ; Emacs 24 (field-beginning)))) (try-completion input minibuffer-completion-table pred)))) ;; If common prefix matches an empty directory, use that dir as the sole completion. (when (and (stringp common-prefix) (save-match-data (string-match "/\\.$" common-prefix))) ; Matches /., /.. (setq common-prefix (substring common-prefix 0 (- (length common-prefix) 2)))) (setq icicle-common-match-string (if (eq t common-prefix) input common-prefix)))) (unless filtered-candidates (setq icicle-common-match-string nil)) filtered-candidates) (quit (top-level))))) ; Let `C-g' stop it. ;;; Similar to the vanilla function. Only the `let' in each of the cond clauses is different. ;;; We do not remove a `$' prefix. (So we return 0 as the first boundary.) (when (> emacs-major-version 23) (defun icicle-completion--embedded-envvar-table (string _pred action) "Completion table for environment variables embedded in a string. The envvar syntax (and escaping) rules followed by this table are the same as for `substitute-in-file-name'." ;; Ignore _PRED arg, because predicates passed via `read-file-name-internal' are not 100% correct and ;; fail here: e.g. predicates like `file-directory-p', whereas the filename completed needs to be passed ;; through `substitute-in-file-name' before it can be passed to `file-directory-p'. (when (string-match completion--embedded-envvar-re string) (let* ((beg (or (match-beginning 2) (match-beginning 1))) (table (completion--make-envvar-table)) (prefix (substring string 0 beg))) (cond ((eq action 'lambda) ;; This table is expected to be used in conjunction with some other table that provides the ;; main completion. Let the other table handle the test-completion case. nil) ((or (eq (car-safe action) 'boundaries) (eq action 'metadata)) ;; Return boundaries/metadata only if there's something to complete, since otherwise when ;; used in `completion-table-in-turn', we could return boundaries and let some subsequent ;; table return a list of completions. ;; ;; FIXME: Maybe it should rather be fixed in `completion-table-in-turn' instead, but it's ;; difficult to do it efficiently there. (when (try-completion (substring string beg) table nil) ;; Compute the boundaries of the subfield to which this completion applies. (if (eq action 'metadata) '(metadata (category . environment-variable)) (let ((suffix (cdr action))) `(boundaries 0 ; Return 0 as first boundary, since we do not remove `$' prefix. . ,(when (string-match "[^[:alnum:]_]" suffix) (match-beginning 0))))))) (t (if (eq ?{ (aref string (1- beg))) (setq table (apply-partially 'completion-table-with-terminator "}" table))) ;; Envvar completion must be case-sensitive, even when file-name completion is not. (let* ((completion-ignore-case nil) (comp (complete-with-action action table (substring string beg) (lambda (&rest args) t)))) (if (stringp comp) (concat prefix comp) (mapcar (lambda (s) (concat prefix s)) comp))))))))) ;;(@* "Icicles functions - S-TAB completion cycling") ;;; Icicles functions - S-TAB completion cycling ------------------- (defun icicle-apropos-candidates (input) "List of candidate apropos completions for the current partial INPUT. INPUT is a string. Each candidate is a string." (setq icicle-candidate-nb nil) (let ((cands (icicle-unsorted-apropos-candidates input))) (if icicle-abs-file-candidates (icicle-strip-ignored-files-and-sort cands) (icicle-maybe-sort-maybe-truncate cands)))) (defun icicle-unsorted-apropos-candidates (input) "Unsorted list of apropos completions for the current partial INPUT. Unless `icicle-expand-input-to-common-match' = 0 this also sets `icicle-common-match-string' to the expanded common match of the input over all candidates." (condition-case nil (progn (when icicle-regexp-quote-flag (setq input (regexp-quote input))) (let* ((m-c-table ;; Prevent Emacs 23.2+ from using `internal-complete-buffer' if not ignoring space prefixes. ;; This lets `icicle-toggle-ignored-space-prefix' refresh to include space prefixes. (if (or (not (eq minibuffer-completion-table 'internal-complete-buffer)) icicle-buffer-ignore-space-prefix-flag) minibuffer-completion-table (mapcar (lambda (buf) (and (buffer-live-p buf) (list (buffer-name buf)))) (buffer-list)))) (candidates (if (and (functionp m-c-table) (not icicle-apropos-complete-match-fn)) ;; Let the function do it all. (icicle-all-completions input m-c-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)) (icicle-all-completions "" m-c-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)))) (icicle-extra-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-extra-candidates)) (icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-proxy-candidates)) (filtered-candidates (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (let ((case-fold-search completion-ignore-case)) (and (icicle-filter-wo-input cand) (or (not icicle-apropos-complete-match-fn) ;; Assume no match if error - e.g. due to `string-match' with ;; binary data in Emacs 20. Do this everywhere we call ;; `icicle-apropos-complete-match-fn'. (condition-case nil (funcall icicle-apropos-complete-match-fn input cand) (error nil))) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand))))) candidates))))) (when (and (not (eq icicle-expand-input-to-common-match 0)) (consp filtered-candidates)) (setq icicle-common-match-string (icicle-expanded-common-match input filtered-candidates))) (unless filtered-candidates (setq icicle-common-match-string nil)) filtered-candidates)) ; Return candidates. (quit (top-level)))) ; Let `C-g' stop it. (defun icicle-file-name-apropos-candidates (input) "List of apropos completions for partial file-name INPUT. INPUT is a string. Candidates can be directories. Each candidate is a string." (setq icicle-candidate-nb nil) (let ((default-directory (icicle-file-name-directory-w-default input))) (icicle-strip-ignored-files-and-sort (icicle-unsorted-file-name-apropos-candidates (or (icicle-file-name-nondirectory input) ""))))) (defun icicle-unsorted-file-name-apropos-candidates (input) "Unsorted list of apropos completions for the partial file-name INPUT. Unless `icicle-expand-input-to-common-match' = 0 this also sets `icicle-common-match-string' to the expanded common match of the input over all candidates." (condition-case nil (progn (when icicle-regexp-quote-flag (setq input (regexp-quote input))) (let* ((pred (if (< emacs-major-version 23) default-directory minibuffer-completion-predicate)) (candidates ;; $$$$$ Should we remove string test for Emacs 23? (if (and (not (stringp minibuffer-completion-predicate)) (not icicle-apropos-complete-match-fn) (functionp minibuffer-completion-table)) ;; Let the function do it all. (icicle-all-completions input minibuffer-completion-table pred) (icicle-all-completions "" minibuffer-completion-table pred))) (icicle-extra-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-extra-candidates)) (icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (save-match-data (string-match input cand))) icicle-proxy-candidates)) (filtered-candidates (icicle-transform-candidates (append icicle-extra-candidates icicle-proxy-candidates (icicle-remove-if-not (lambda (cand) (let ((case-fold-search (if (boundp 'read-file-name-completion-ignore-case) read-file-name-completion-ignore-case completion-ignore-case))) (if (member cand '("../" "./")) (member input '(".." ".")) ; Prevent "" from matching "../" (and (icicle-filter-wo-input cand) (or (not icicle-apropos-complete-match-fn) ;; Assume no match if error - e.g. due to `string-match' ;; with binary data in Emacs 20. Do this everywhere we ;; call `icicle-apropos-complete-match-fn'. (condition-case nil (funcall icicle-apropos-complete-match-fn input cand) (error nil))) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand)))))) candidates))))) (unless (eq icicle-expand-input-to-common-match 0) (setq icicle-common-match-string (if (consp filtered-candidates) (icicle-expanded-common-match input filtered-candidates) nil))) (unless filtered-candidates (setq icicle-common-match-string nil)) filtered-candidates)) ; Return candidates. (quit (top-level)))) ; Let `C-g' stop it. (defun icicle-expanded-common-match (input candidates) "Return the expanded common match for INPUT among all CANDIDATES. This assumes that INPUT matches each string in list CANDIDATES. Return nil if there is no common match. The expanded common match is typically, but not always, the longest common match. See the documentation, section `Expanded-Common-Match Completion', for details." ;; Since `icicle-expanded-common-match-1' checks only the first match for a single candidate, ;; we call it twice, once using the first candidate and once using the second. ;; Typically, one of these tries will give us the longest common match. (catch 'ecm-error (let ((first-try (icicle-expanded-common-match-1 input candidates)) (second-try nil)) (when (and first-try (cadr candidates)) (setq second-try (icicle-expanded-common-match-1 input (cons (cadr candidates) (cons (car candidates) (cddr candidates)))))) (if (> (length second-try) (length first-try)) second-try first-try)))) (defun icicle-expanded-common-match-1 (input candidates) "Helper function for `icicle-expanded-common-match." ;; This does not always give a longest common match, because it looks only at the first match ;; of INPUT with the first candidate. What it returns is the longest match that is common to ;; all CANDIDATES and also contains the first match in the first candidate. (let ((case-fold-search ;; Do not bother with buffer completion and `read-buffer-completion-ignore-case'. (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case)) (first (car candidates))) ;; Apart from this condition, use `string-match' in this function, not `icicle-apropos-complete-match-fn'. ;; `string-match' should always be the right thing, and `icicle-apropos-complete-match-fn' is sometimes ;; inappropriate - e.g., when it is `icicle-apropos-complete-match-fn'. (and icicle-apropos-complete-match-fn ; Return nil if no match function. (save-match-data ;; Assume no common match in case of error - e.g. due to `string-match' with binary data ;; in Emacs 20. Do this throughout, whenever we call `string-match' or ;; `icicle-apropos-complete-match-fn'. (unless (condition-case nil ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match input first) (error (throw 'ecm-error nil))) (error (throw 'ecm-error nil))) ; If input doesn't match candidate, return nil. (let* ((len-first (length first)) (beg 0) (end len-first) (orig-match-beg (match-beginning 0)) (orig-match-end (match-end 0)) (ecm first) ; "ecm" for "expanded common match". (rest (cdr candidates)) beg-ecm beg-next) (if (= orig-match-beg end) (setq ecm "") ; INPUT was, for instance, "$" or "\\>$; return "". ;; Compare with the rest of the candidates, reducing as needed. (while (and rest ecm) (condition-case nil ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match input (car rest)) (error (throw 'ecm-error nil))) ; If input doesn't match candidate, return nil. (setq beg-next (match-beginning 0)) ;; Remove any prefix that doesn't match some other candidate. (while (and (< beg orig-match-beg) (not (condition-case nil ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match (regexp-quote (substring ecm 0 (- orig-match-end beg))) (car rest)) (error (throw 'ecm-error nil)))) (progn (setq beg-ecm (match-beginning 0)) (>= beg-ecm beg-next))) ;; Take a character off of the left. (setq ecm (substring ecm 1) beg (1+ beg))) ;; Remove any suffix that doesn't match some other candidate. (while (and (> end 0) (not (condition-case nil ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match (regexp-quote ecm) (car rest)) (error (throw 'ecm-error nil))))) ;; Take a character off of the right. (setq ecm (substring ecm 0 (1- (length ecm))) end (1- end))) (unless (and (condition-case nil ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match (regexp-quote ecm) (car rest)) (error (throw 'ecm-error nil))) (condition-case nil ; Input must match the substring that is common. ;; Use `string-match' here, not `icicle-apropos-complete-match-fn'. (string-match input ecm) (error (throw 'ecm-error nil)))) (setq ecm nil)) ; No possible expansion (pop rest)) ecm)))))) (defun icicle-multi-comp-apropos-complete-match (input candidate) "Match function for progressive completion with multi-completions. Return non-nil if current multi-completion INPUT matches CANDIDATE. INPUT is split by `icicle-list-join-string' and rejoined, adding the equivalent of `.*' to the join strings, where `.' matches newline too. The resulting regexp is matched against CANDIDATE." (let* ((any (concat icicle-dot-string "*")) (len-any (length any)) (fields (save-match-data (split-string input (regexp-quote icicle-list-join-string)))) (first (car fields)) (regexps ())) (unless (and (>= (length first) len-any) (string= any (substring first (- len-any)))) (setq first (concat first any))) (setq fields (cdr fields)) (dolist (field fields) (unless (or (string= "" field) (and (>= (length field) len-any) (string= any (substring field 0 len-any)))) (setq field (concat any field))) (push field regexps)) (string-match (concat first icicle-list-join-string (mapconcat #'identity (nreverse regexps) icicle-list-join-string)) candidate))) (defun icicle-scatter-match (string completion) "Returns non-nil if STRING scatter-matches COMPLETION. This means that all of the characters in STRING are also in string COMPLETION, in the same order, but perhaps scattered among other characters. For example, STRING = \"ure\" matches COMPLETION \"curried\"." (string-match (icicle-scatter string) completion)) (defun icicle-scatter (string) "Returns a regexp that matches a scattered version of STRING. The regexp will match any string that contains the characters in STRING, in the same order, but possibly with other characters as well. Returns, e.g., \"a[^b]*b[^c]*c[^d]*d\" for input string \"abcd\"." ;; This backtracking version is a bit slower, esp. for Emacs 20: ;; (if (> emacs-major-version 21) ;; (mapconcat #'regexp-quote (split-string string "" t) ".*") ;; (mapconcat #'regexp-quote (split-string string "") ".*")) ;; ;; This version is from Emacs bug #12796. (let ((first t)) (mapconcat (lambda (ch) (if (not first) (concat "[^" (string ch) "]*" (regexp-quote (string ch))) (setq first nil) (regexp-quote (string ch)))) string ""))) (defun icicle-levenshtein-strict-match (s1 s2) "String S1 is within `icicle-levenshtein-distance' of string S2. This means that S1 differs by at most `icicle-levenshtein-distance' character deletions, insertions, or replacements from S2. The string lengths too must differ by at most `icicle-levenshtein-distance'. You probably want to turn off incremental completion (`C-#') if you use this match method; it is quite slow. To use this match method, you must also have library `levenshtein.el'." (and (require 'levenshtein nil t) (<= (levenshtein-distance s1 s2) icicle-levenshtein-distance))) (defun icicle-levenshtein-match (s1 s2) "String S1 is within `icicle-levenshtein-distance' of a substring of S2. S1 and S2 are strings. This means that S1 and some substring of S2 differ by at most `icicle-levenshtein-distance' character deletions, insertions, or replacements. You will probably want to turn off incremental completion (`C-#') if you use this match method; it can be quite slow, especially with a large value of `icicle-levenshtein-distance'. To use this method with a value other than 1, you must also have library `levenshtein.el'." (if (= icicle-levenshtein-distance 1) (icicle-levenshtein-one-match s1 s2) (unless (require 'levenshtein nil t) (icicle-user-error "You need library `levenshtein.el' for this")) (catch 'icicle-levenshtein-match (dolist (sub (icicle-substrings-of-length s2 (length s1))) (when (<= (levenshtein-distance s1 sub) icicle-levenshtein-distance) (throw 'icicle-levenshtein-match t))) nil))) ;; This is much faster than testing with `levenshtein-distance' and a value of 1. (defun icicle-levenshtein-one-match (s1 s2) "S1 is within a Levenshtein distance of one of some substring of S2. That is, S1 with 0 or 1 char inserted, deleted or replaced is a substring of S2. S1 and S2 are strings. You do not need library `levenshtein.el' to use this function." (string-match (icicle-levenshtein-one-regexp s1) s2)) (defun icicle-levenshtein-one-regexp (string) "Return a regexp for strings that are 1 Levenshtein unit from STRING." (let ((indx 0) (regexp "\\(")) (dotimes (indx (length string)) (setq regexp (concat regexp (substring string 0 indx) ".?" (substring string (1+ indx)) "\\|" (substring string 0 indx) "." (substring string indx) "\\|"))) (setq regexp (concat (substring regexp 0 -1) ")")))) (defun icicle-substrings-of-length (string &optional len) "Return a list of substrings of STRING that have length LEN. If LEN is nil, treat it as the length of STRING." (unless len (setq len (length string))) (if (zerop len) (list "") (let ((subs ())) (dotimes (idx (- (length string) (1- len))) (push (substring string idx (+ idx len)) subs)) (nreverse subs)))) ;;(@* "Icicles functions - common helper functions") ;;; Icicles functions - common helper functions ---------------------- (defun icicle-try-switch-buffer (buffer) "Try to switch to BUFFER, first in same window, then in other window. If the selected window already shows BUFFER, then do nothing." (when (and (buffer-live-p buffer) (not icicle-inhibit-try-switch-buffer)) (condition-case err-switch-to (unless (eq (window-buffer) buffer) (switch-to-buffer buffer)) (error (and (string= "Cannot switch buffers in minibuffer window" (error-message-string err-switch-to)) ;; Try another window. Don't bother if the buffer to switch to is a minibuffer. (condition-case err-switch-other (unless (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)) (switch-to-buffer-other-window buffer)) (error (error-message-string err-switch-other)))))))) ; Return error message string. ;; Main cycling function - used by `icicle-next-prefix-candidate', `icicle-next-apropos-candidate'. (defun icicle-next-candidate (nth candidates-fn &optional regexp-p) "Replace input by NTH next or previous completion for an input. Default value of NTH is 1, meaning use the next completion. Negative NTH means use a previous, not subsequent, completion. CANDIDATES-FN is a function that returns the list of candidate completions for its argument, the current partial input (a string). Optional arg REGEXP-P non-nil means that CANDIDATES-FN uses regexp matching. This is used to highlight the appropriate matching root. If option `icicle-help-in-mode-line-delay' is positive, then help on the current candidate is shown in the mode line." (let ((saved-last-input icicle-last-input)) ; For call to `icicle-recompute-candidates'. (unless (stringp icicle-last-completion-candidate) (setq icicle-last-completion-candidate icicle-initial-value)) (setq nth (or nth 1) icicle-current-input (if (icicle-file-name-input-p) ; But not for `icicle-abs-file-candidates'. (abbreviate-file-name (icicle-input-from-minibuffer 'leave-envar)) (icicle-input-from-minibuffer)) icicle-cycling-p t) (unless (and (icicle-get-safe this-command 'icicle-apropos-cycling-command) (or (icicle-get-safe last-command 'icicle-apropos-cycling-command) (memq last-command '(icicle-candidate-action icicle-remove-candidate icicle-mouse-remove-candidate icicle-apropos-complete icicle-apropos-complete-no-display)))) (setq icicle-common-match-string nil)) ; Don't use old one, in `icicle-save-or-restore-input'. (icicle-save-or-restore-input) (unless (eq this-command last-command) (icicle-recompute-candidates nth candidates-fn saved-last-input)) (icicle-save-or-restore-input) ; Again, based on updated `icicle-common-match-string'. (cond ((null icicle-completion-candidates) (save-selected-window (icicle-remove-Completions-window)) (minibuffer-message " [No completion]")) (t (icicle-clear-minibuffer) (let ((nb-cands (length icicle-completion-candidates)) (unit (if (wholenump nth) 1 -1)) next) ;; So `icomplete+' can append the number of other candidates to the minibuffer. (setq icicle-nb-of-other-cycle-candidates (1- nb-cands)) (icicle-increment-cand-nb+signal-end nth nb-cands) (setq next (elt icicle-completion-candidates icicle-candidate-nb)) (while (null next) ; Skip null candidates. (icicle-increment-cand-nb+signal-end unit nb-cands) (setq next (elt icicle-completion-candidates icicle-candidate-nb))) ;; Update last-candidate to NEXT. Need a copy, because we change its text properties. (setq icicle-last-completion-candidate (copy-sequence next)) (icicle-insert-cand-in-minibuffer icicle-last-completion-candidate regexp-p) ;; Highlight current completion candidate, if `*Completions*' is displayed. (when (get-buffer-window "*Completions*" 0) ;; Refresh `*Completions*', updating it to reflect the current candidates. (unless (or (and (icicle-get-safe this-command 'icicle-apropos-cycling-command) (or (icicle-get-safe last-command 'icicle-apropos-cycling-command) (memq last-command '(icicle-candidate-action icicle-remove-candidate icicle-mouse-remove-candidate)))) (and (icicle-get-safe this-command 'icicle-prefix-cycling-command) (or (icicle-get-safe last-command 'icicle-prefix-cycling-command) (memq last-command '(icicle-candidate-action icicle-remove-candidate icicle-mouse-remove-candidate))))) (icicle-display-candidates-in-Completions)) (save-selected-window (select-window (get-buffer-window "*Completions*" 'visible)) (if (fboundp 'thumfr-only-raise-frame) (thumfr-only-raise-frame) (raise-frame))) (icicle-highlight-candidate-in-Completions)) (setq icicle-mode-line-help icicle-last-completion-candidate)))))) (defun icicle-insert-cand-in-minibuffer (candidate regexp-p) "Insert CANDIDATE in minibuffer. Highlight root and initial whitespace. REGEXP-P non-nil means use regexp matching to highlight root." ;; Highlight any initial whitespace (probably a user typo). (icicle-highlight-initial-whitespace (if regexp-p icicle-current-raw-input icicle-current-input)) ;; Underline the root that was completed, in the minibuffer. (let ((inp (icicle-minibuf-input-sans-dir icicle-current-input)) (case-fold-search ;; Don't bother with buffer completion and `read-buffer-completion-ignore-case'. (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case)) indx) (unless (and regexp-p (not icicle-regexp-quote-flag)) (setq inp (regexp-quote inp))) (save-match-data (setq indx (string-match inp icicle-last-completion-candidate)) (when indx ;; Should not need to ignore errors, but `*-last-completion-candidate' has been a read-only object (?) (condition-case nil (put-text-property indx (match-end 0) 'face 'icicle-match-highlight-minibuffer icicle-last-completion-candidate) (error nil))))) (goto-char (icicle-minibuffer-prompt-end)) ; Need for Emacs 22+, or can get `Text read-only' error. ;; Insert candidate in minibuffer, and place cursor. (insert (if (and (icicle-file-name-input-p) ;; $$$$$$ insert-default-directory ; (2012-06-28) (or (not (member icicle-last-completion-candidate icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-dir-prefix-wo-wildcards icicle-current-input) "") candidate) (icicle-place-cursor icicle-current-input)) (defun icicle-dir-prefix-wo-wildcards (filename) "Return the directory portion of FILENAME. If using partial completion, this is the portion before the first occurrence of `*'. Otherwise, this is just `file-name-directory'." (if (and (icicle-not-basic-prefix-completion-p) (boundp 'completion-styles) (member 'partial-completion completion-styles) (string-match "/[^/]*\\*" filename)) (substring filename 0 (1+ (match-beginning 0))) (or (file-name-directory filename) ""))) ; Don't return nil, in any case. ;; Note: Property `icicle-mode-line-help' with a function value is not used yet in Icicles code. (defun icicle-show-help-in-mode-line (candidate) "If short help for CANDIDATE is available, show it in the mode-line. Do this only if `icicle-help-in-mode-line-delay' is positive. For a string or symbol CANDIDATE: Use the help from property `icicle-mode-line-help', if that is non-nil, or the help from property `help-echo' if that is non-nil. For a string CANDIDATE, check only the first char for the property. The value of property `icicle-mode-line-help' can be a string or a function. If a string, use that as the help. If a function, apply the function to the candidate and use the result as the help." (when (> icicle-help-in-mode-line-delay 0) (let* ((cand (cond (;; Call to `lacarte-execute(-menu)-command' (in `lacarte.el'). ;; Use command associated with menu item. (consp lacarte-menu-items-alist) (cdr (assoc candidate lacarte-menu-items-alist))) (;; Key-completion candidate. Get command from candidate. icicle-completing-keys-p (if (string= ".." candidate) "GO UP" (let ((cmd-name (save-match-data (string-match "\\(.+\\) = \\(.+\\)" candidate) (substring candidate (match-beginning 2) (match-end 2))))) (if (string= "..." cmd-name) "Prefix key" (intern-soft cmd-name))))) (;; Buffer or file name. (or (get-buffer candidate) (icicle-file-name-input-p) icicle-abs-file-candidates) (icicle-transform-multi-completion candidate)) (t ; Convert to symbol or nil. (intern-soft (icicle-transform-multi-completion candidate))))) (doc (progn (when (stringp candidate) (setq candidate (icicle-transform-multi-completion candidate))) (cond ((and (stringp candidate) ; String with help as property. (let ((prop (or (get-text-property 0 'icicle-mode-line-help candidate) (get-text-property 0 'help-echo candidate)))) (if (functionp prop) (funcall prop candidate) prop)))) ((and cand (symbolp cand) ; Symbol. (cond ((get cand 'icicle-mode-line-help)) ; Icicles help prop. ((get cand 'help-echo)) ; General help prop. ((fboundp cand) ; Function. (or (documentation cand t) ; Functon's doc string. (if (string-match ; Easy-menu item. "^menu-function-[0-9]+$" (symbol-name cand)) (format "%s" (symbol-function cand)) (format "Command `%s'" cand)))) ((facep cand) (face-documentation cand)) ; Face. (t (documentation-property ; Variable. cand 'variable-documentation t))))) ((and (consp cand) (eq (car cand) 'lambda)) ; Lambda form. (format "%s" cand)) ((and (stringp cand) ; Prefix key, `..'. (member cand '("Prefix key" "GO UP"))) cand) ((stringp candidate) ; String without help property. (cond ((and (or (icicle-file-name-input-p) ; File name. icicle-abs-file-candidates) (or (icicle-file-remote-p candidate) ; Avoid Tramp. (file-exists-p candidate))) (if (get-file-buffer candidate) (concat (icicle-help-line-buffer (get-file-buffer candidate) 'NO-BYTES-P 'NO-FILE-P) " " (icicle-help-line-file cand)) (icicle-help-line-file candidate))) ((get-buffer candidate) ; Non-file buffer. (icicle-help-line-buffer candidate)) (t nil)))))) ; Punt. (doc-line1 (and (stringp doc) (string-match ".+$" doc) (match-string 0 doc)))) (when doc-line1 (put-text-property 0 (length doc-line1) 'face 'icicle-mode-line-help doc-line1) (icicle-show-in-mode-line doc-line1 (cond ((get-buffer-window "*Completions*" 'visible) "*Completions*") ((eq (current-buffer) (window-buffer (minibuffer-window))) (cadr (buffer-list))) (t (current-buffer)))))))) (defun icicle-help-line-buffer (buffer &optional no-bytes-p no-file-p) "Simple help string for BUFFER. Non-nil NO-BYTES-P means do not include the number of bytes. Non-nil NO-FILE-P means do not include the buffer's file name." (with-current-buffer buffer (let* ((mode (format "Mode: %s" (if (fboundp 'format-mode-line) (format-mode-line mode-name) mode-name))) (bytes (format "Bytes: %s" (let ((size (buffer-size))) (if (> size most-positive-fixnum) (format "> %d" most-positive-fixnum) size)))) (file (or (buffer-file-name) (and (eq major-mode 'dired-mode) default-directory)))) (cond ((and no-bytes-p no-file-p) mode) ((or no-file-p (not file)) (concat mode ", " bytes)) (t (setq file (format "File: %s" (icicle-abbreviate-or-expand-file-name file))) (if no-bytes-p (concat mode ", " file) (concat mode ", " bytes ", " file))))))) (defun icicle-help-line-file (file) "Simple help string for FILE." (let ((attrs (file-attributes file))) (and attrs (format "Bytes: %s, Saved: %s, Access: %s" (let ((size (nth 7 attrs))) (if (> size most-positive-fixnum) (format "> %d" most-positive-fixnum) size)) (format-time-string "%c" (nth 5 attrs)) (nth 8 attrs))))) ; "%Y-%m-%d %H" (defun icicle-show-in-mode-line (text &optional buffer) "Display TEXT in BUFFER's mode line. The text is shown for `icicle-help-in-mode-line-delay' seconds, or until a user event. So call this last in a sequence of user-visible actions." (message nil) ; Remove any msg, such as "Computing completion candidates...". (with-current-buffer (or buffer (current-buffer)) (make-local-variable 'mode-line-format) ; Needed for Emacs 21+. (let ((mode-line-format text)) (force-mode-line-update) (sit-for icicle-help-in-mode-line-delay)) (force-mode-line-update))) (defun icicle-recompute-candidates (nth candidates-fn saved-last-input) "Recompute `icicle-completion-candidates', if needed. If buffer `*Completions*' is already displayed, it is updated. This does nothing, unless the user changed the minibuffer input or the completion type has changed (from apropos to prefix or vice versa). NTH < 0 means candidate order is reversed in `*Completions*'. Argument CANDIDATES-FN is a function that recomputes the candidates. SAVED-LAST-INPUT is the last input, as in `icicle-last-input'." (unless (and icicle-last-completion-command (string= icicle-current-input saved-last-input) ; No change in user input. ;; No change in completion type: apropos vs prefix. (or (and (or (icicle-get-safe icicle-last-completion-command 'icicle-apropos-completing-command) (memq icicle-last-completion-command '(icicle-candidate-set-complement icicle-mouse-remove-candidate icicle-keep-only-past-inputs))) (symbolp 'this-command) (or (get this-command 'icicle-apropos-completing-command) (get this-command 'icicle-apropos-cycling-command))) (and (or (icicle-get-safe icicle-last-completion-command 'icicle-prefix-completing-command) (memq icicle-last-completion-command '(icicle-candidate-set-complement icicle-mouse-remove-candidate icicle-keep-only-past-inputs))) (symbolp this-command) (or (get this-command 'icicle-prefix-completing-command) (get this-command 'icicle-prefix-cycling-command))))) (when (string= icicle-current-input saved-last-input) ; Changed completion type, not user input. ;; Set `icicle-last-completion-command', to record new completion type. (cond ((icicle-get-safe this-command 'icicle-prefix-cycling-command) (setq icicle-last-completion-command (if (eq icicle-last-completion-command 'icicle-apropos-complete-no-display) 'icicle-prefix-complete-no-display 'icicle-prefix-complete))) ((icicle-get-safe this-command 'icicle-apropos-cycling-command) (setq icicle-last-completion-command (if (eq icicle-last-completion-command 'icicle-prefix-complete-no-display) 'icicle-apropos-complete-no-display 'icicle-apropos-complete))))) ;; Recompute and redisplay completion candidates. Reset candidate number. (setq icicle-completion-candidates (condition-case nil (funcall candidates-fn icicle-current-input) (error icicle-completion-candidates))) ; No change if completion error. (when (get-buffer-window "*Completions*" 0) ; Update `*Completions*' display or remove it. (if icicle-completion-candidates (icicle-display-candidates-in-Completions (not (wholenump nth))) (save-selected-window (icicle-remove-Completions-window)))))) (defun icicle-save-raw-input () "Save `icicle-current-raw-input' as the latest previous input. It is saved to `icicle-previous-raw-file-name-inputs', if completing a file name, or `icicle-previous-raw-non-file-name-inputs', otherwise." (let* ((prev-inputs-var (if (icicle-file-name-input-p) 'icicle-previous-raw-file-name-inputs 'icicle-previous-raw-non-file-name-inputs)) (prev-inputs (symbol-value prev-inputs-var))) (unless (string= "" icicle-current-raw-input) (set prev-inputs-var (icicle-put-at-head prev-inputs-var icicle-current-raw-input))) (when (> (length prev-inputs) icicle-completion-history-max-length) (setcdr (nthcdr (1- icicle-completion-history-max-length) prev-inputs) ())))) (defun icicle-save-or-restore-input () "Save the current minibuffer input, or restore the last input. If there is a previous input and we are cycling, then restore the last input. (Cycled completions don't count as input.) Otherwise, save the current input for use by `C-l', and then compute the expanded common match. There are several particular cases that modulate the behavior - see the code." (cond ;; Restore last input, if there is some to restore and we are cycling. ((and icicle-last-input icicle-cycling-p icicle-last-completion-candidate) (setq icicle-current-input icicle-last-input)) ; Return `icicle-current-input'. (t (cond ;; Save the current input for `C-l', then update it to the expanded common match. ;; Do *NOT* do this if: ;; or there is no common match string ;; or the last command was a cycling command ;; or the input and the completion mode have not changed ;; (so saved regexp will not be overwritten). ((not (or ;;; ;; the user does not want automatic expansion to the common match for this completion mode ;;; $$$$$$ (and (eq icicle-current-completion-mode 'apropos) ;;; (not (eq icicle-expand-input-to-common-match 4))) ;;; (and (eq icicle-current-completion-mode 'prefix) ;;; (not (memq icicle-expand-input-to-common-match '(3 4)))) (not icicle-common-match-string) (and (symbolp last-command) (get last-command 'icicle-cycling-command) (not (get last-command 'icicle-completing-command))) ; Not `TAB' or `S-TAB'. (and (equal icicle-last-input icicle-current-input) (eq icicle-current-completion-mode (if (icicle-get-safe icicle-last-completion-command 'icicle-prefix-completing-command) 'prefix 'apropos))))) ;; Expand current input to expanded common match, after saving it for `C-l'. (let ((common (if (icicle-file-name-input-p) ;; $$$$$$ (and (icicle-file-name-input-p) ; (2012-06-28) ;; insert-default-directory) (if (string= "" icicle-common-match-string) (or (icicle-file-name-directory icicle-current-input) "") (directory-file-name (icicle-abbreviate-or-expand-file-name icicle-common-match-string (icicle-file-name-directory icicle-current-input) (not insert-default-directory)))) icicle-common-match-string))) ;; Save current input for `C-l', then save common match as current input. ;; Do NOT do anything if we're ignoring letter case and that is the only difference ;; between the common match and the input (e.g. MS Windows file names). (unless (and case-fold-search (string= (icicle-upcase icicle-current-input) (icicle-upcase common)) (not (string= icicle-current-input common))) ;; Save input for `C-l' if this is not `C-l' or `C-L'. ;; Save it also if this is the first cycling command, or the first after completion. (unless (or (memq this-command '(icicle-retrieve-previous-input icicle-retrieve-next-input)) (and icicle-cycling-p (or icicle-candidate-nb ; Not the first cycling command. (icicle-get-safe last-command 'icicle-completing-command)))) (setq icicle-current-raw-input icicle-current-input) ;; Save it for `C-l', unless it is "". Drop old entries when too big. (icicle-save-raw-input)) ;; Save expanded common match as current input, unless input is a directory. ;; Use `icicle-file-directory-p'. ;; `file-directory-p' fails to consider "~/foo//usr/" a directory. ;; $$$$$$ We could use the `icicle-file-directory-p' code with `icicle-file-name-directory' ;; instead of `icicle-file-name-directory-w-default', if that presents a problem. (unless (and (icicle-file-name-input-p) (icicle-file-directory-p icicle-current-input)) (setq icicle-current-input common))))) ;; Save input for `C-l'. ;; Do NOT do this if: ;; this command is `C-l' or `C-L' ;; or we are cycling or the last command was a cycling command ;; or this command is the same as last command. ((not (or (memq this-command '(icicle-retrieve-previous-input icicle-retrieve-next-input)) icicle-cycling-p (and (symbolp last-command) (get last-command 'icicle-cycling-command) (not (get this-command 'icicle-completing-command))) ;;$$$ (icicle-get-safe last-command 'icicle-completing-command) (eq last-command this-command))) (setq icicle-current-raw-input icicle-current-input) ;; Save it for `C-l', unless it is "". Drop old entries when too big. (icicle-save-raw-input)) ;; Forget last raw input, so it is not highlighted in `*Completions*'. ;; Do NOT do this if we are cycling. ((not icicle-cycling-p) (setq icicle-current-raw-input ""))))) (setq icicle-last-input icicle-current-input)) ; Return `icicle-current-input'. (defun icicle-put-at-head (list-var element) "Put ELEMENT at the front of the value of LIST-VAR. If ELEMENT is already a member of the list, then it is moved to the front. Otherwise, it is added to the front. Membership is tested with `equal'. The return value is the new value of LIST-VAR. This is a destructive operation: the list structure is changed." (let* ((lis (symbol-value list-var)) (tl (member element lis))) (cond ((null lis) (set list-var (list element))) ;;;((eq tl lis) (set list-var (cdr lis))) ((not (eq tl lis)) (when tl (setcdr (nthcdr (1- (- (length lis) (length tl))) lis) (cdr tl))) (set list-var (cons element lis))))) (symbol-value list-var)) (defun icicle-remove-dots (filename) "Strip leading string through last ../ or ./ from FILENAME." (let ((newname filename)) (save-match-data (while (or (string-match "\\.\\./" newname) (string-match "\\./" newname) ;; Emacs 21+ `file-relative-name' returns ".." and "." (no slash) for "" first arg (string-match "^\\.\\.$" newname) (string-match "^\\.$" newname)) (setq newname (substring newname (match-end 0))))) newname)) (defun icicle-increment-cand-nb+signal-end (incr max) "Increment candidate number by INCR modulo MAX, and signal end of cycle." (setq icicle-candidate-nb (if icicle-candidate-nb (+ incr icicle-candidate-nb) (if (natnump incr) 0 (1- max)))) (let ((wrapped (mod icicle-candidate-nb max))) (when (and (/= wrapped icicle-candidate-nb) (eq last-command this-command)) (let ((visible-bell t)) (ding))) (setq icicle-candidate-nb wrapped))) (defun icicle-place-cursor (input &optional dont-activate-p) "Position point and mark with respect to the minibuffer candidate. Positions are `icicle-point-position-in-candidate' and `icicle-mark-position-in-candidate', respectively. INPUT is the current user input, that is, the completion root. Optional argument DONT-ACTIVATE-P means do not activate the mark." (let ((case-fold-search ;; Do not bother with buffer completion and `read-buffer-completion-ignore-case'. (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case)) input-start-position) (goto-char (icicle-minibuffer-prompt-end)) (setq input-start-position (point)) (when (and (icicle-file-name-input-p) insert-default-directory) (search-forward (icicle-file-name-directory-w-default input) nil t) (setq input-start-position (point))) ; Skip directory. ;; Locate completion root within current completion candidate. (when (or (memq icicle-point-position-in-candidate '(root-start root-end)) (memq icicle-mark-position-in-candidate '(root-start root-end))) (save-excursion (save-restriction (narrow-to-region (point) (point-max)) ; Search within the completion candidate. (condition-case lossage (re-search-forward (if icicle-regexp-quote-flag (regexp-quote (icicle-minibuf-input-sans-dir input)) (icicle-minibuf-input-sans-dir input)) nil t) (invalid-regexp (when (string-match "\\`Premature \\|\\`Unmatched \\|\\`Invalid " (cadr lossage)) (goto-char (point-max)))))))) ;; Position point. (case icicle-point-position-in-candidate (input-start (goto-char input-start-position)) (input-end (goto-char (point-max))) (root-start (goto-char (max input-start-position (match-beginning 0)))) (root-end (goto-char (max input-start-position (match-end 0))))) ;; Position mark. (unless (eq icicle-point-position-in-candidate icicle-mark-position-in-candidate) (push-mark (case icicle-mark-position-in-candidate (input-start input-start-position) (input-end (point-max)) (root-start (max input-start-position (match-beginning 0))) (root-end (max input-start-position (match-end 0)))) 'nomsg (not dont-activate-p))))) (defun icicle-highlight-candidate-in-Completions () "Highlight the current candidate in `*Completions*'." (let ((compl-win (get-buffer-window "*Completions*" 0)) curr-cand-pos) (when compl-win (set-window-dedicated-p compl-win t) (save-window-excursion (select-window compl-win) (goto-char (icicle-start-of-candidates-in-Completions)) (icicle-move-to-next-completion icicle-candidate-nb t) (set-buffer-modified-p nil) (setq curr-cand-pos (point))) (set-window-point compl-win curr-cand-pos)))) (defun icicle-place-overlay (start end overlay face priority buffer &rest properties) "Put OVERLAY with FACE and PRIORITY between START and END in BUFFER. OVERLAY is a symbol whose value is the overlay. If nil, the overlay is created. If non-nil, it is simply moved. PROPERTIES are additional overlay properties to add: pairs of a property and a value." (if (symbol-value overlay) ; Overlay exists, just move it. (move-overlay (symbol-value overlay) start end buffer) (set overlay (make-overlay start end buffer)) (overlay-put (symbol-value overlay) 'face face) (overlay-put (symbol-value overlay) 'priority priority))) (defun icicle-strip-ignored-files-and-sort (candidates) "Remove file names with ignored extensions, and \".\". Sort CANDIDATES. If `icicle-sort-comparer' is nil, then do not sort." (when (fboundp 'completion-ignored-build-apply) ; In `completion-ignored-build.el'. (let ((completion-ignored-extensions completion-ignored-extensions)) (completion-ignored-build-apply) (icicle-update-ignored-extensions-regexp))) (let* ((pred1 (lambda (cand) (or (save-match-data (string-match icicle-ignored-extensions-regexp cand)) (string= "./" cand)))) (pred2 (lambda (cand) (string= "./" cand))) (new-candidates (icicle-remove-if (if icicle-ignored-extensions-regexp pred1 pred2) candidates))) ;; If the only candidates have ignored extensions, then use them. (unless new-candidates (setq new-candidates (icicle-remove-if pred2 candidates))) (icicle-maybe-sort-maybe-truncate new-candidates))) (defun icicle-transform-candidates (candidates) "Apply `icicle-transform-function' to CANDIDATES. If `icicle-transform-function' is nil, return CANDIDATES. This transformation is applied before completion candidates are made available to the user, in particular, before they are displayed in `*Completions*'. This transformation has nothing to do with that performed by `icicle-transform-multi-completion'." (if icicle-transform-function (funcall icicle-transform-function candidates) candidates)) (defun icicle-transform-multi-completion (candidate) "Transform display CANDIDATE according to `icicle-list-use-nth-parts'. If CANDIDATE is not a multi-completion, return CANDIDATE unchanged. Return the possibly transformed candidate." (if (and icicle-list-use-nth-parts (not (equal "" candidate))) (let ((parts (split-string candidate icicle-list-join-string))) (icicle-join-nth-parts parts)) candidate)) (defun icicle-join-nth-parts (parts) "Join the elements in PARTS using `icicle-list-nth-parts-join-string'. The parts to join are specified by `icicle-list-use-nth-parts'." (let* ((maxpart (length parts)) (indexes icicle-list-use-nth-parts) (cand "") (firstp t) partnum) (if (null parts) "" ; Nothing to join. (while indexes (setq partnum (car indexes)) (unless firstp (setq cand (concat cand icicle-list-nth-parts-join-string))) (setq firstp nil) (unless (> partnum maxpart) (setq cand (concat cand (nth (1- partnum) parts)))) (setq indexes (cdr indexes))) cand))) (defun icicle-display-cand-from-full-cand (cand) "Return the display candidate corresponding to full candidate CAND." (let ((parts (car cand))) (if (atom parts) parts ; Not a multi-completion. (if icicle-list-use-nth-parts (icicle-join-nth-parts parts) ; Join mult-completion parts per `icicle-list-use-nth-parts'. ;; Multi-completion, but no joining specified. Reconstitute the display candidate. ;; $$$$$$ (concat (mapconcat #'identity parts icicle-list-join-string) ;; icicle-list-end-string) ; $$$$$$ (mapconcat #'identity parts icicle-list-join-string))))) (defun icicle-file-name-directory (filename) "Like `file-name-directory', but backslash is not a directory separator. Do not treat backslash as a directory separator, even on MS Windows. Escape any backslashes, then call `file-name-directory' and return what it returns." (let ((max-char-in-name 0) (repl-char 0)) ; NULL char: ?\^@ ;; Set REPL-CHAR to 1+ the highest char code used in FILENAME, or NULL if that is not possible. (dolist (char (append filename ())) ; `string-to-list' (when (> char max-char-in-name) (setq max-char-in-name char))) ;; Make sure we do not go past the max allowable char for Emacs. If so, just use NULL char. ;; Emacs 20-22 has no `max-char' function, so just try adding 1 and see if result is valid. (when (or (and (fboundp 'max-char) ; Emacs 23+ (< (1+ max-char-in-name) (max-char))) (char-valid-p (1+ max-char-in-name))) ; Emacs 20-22. (setq repl-char (1+ max-char-in-name))) (let* ((escaped-file (subst-char-in-string ?\\ repl-char ; Replace \ by REPL-CHAR filename 'IN-PLACE)) (dir (file-name-directory escaped-file))) (setq filename (and dir (subst-char-in-string repl-char ?\\ ; Replace REPL-CHAR by \ dir 'IN-PLACE))))) filename) (defun icicle-file-name-directory-w-default (file) "`icicle-file-name-directory', or `default-directory' if that is nil." (or (icicle-file-name-directory file) default-directory)) (defun icicle-file-name-nondirectory (filename) "Like `file-name-nondirectory', but does not treat backslash specially. That is, backslash is never treated as a directory separator." (let ((max-char-in-name 0) (repl-char 0)) ; NULL char: ?\^@ ;; Set REPL-CHAR to 1+ the highest char code used in FILENAME, or NULL if that is not possible. (dolist (char (append filename ())) ; `string-to-list' (when (> char max-char-in-name) (setq max-char-in-name char))) ;; Make sure we do not go past the max allowable char for Emacs. If so, just use NULL char. ;; Emacs 20-22 has no `max-char' function, so just try adding 1 and see if result is valid. (when (or (and (fboundp 'max-char) ; Emacs 23+ (< (1+ max-char-in-name) (max-char))) (char-valid-p (1+ max-char-in-name))) ; Emacs 20-22. (setq repl-char (1+ max-char-in-name))) (setq filename (subst-char-in-string repl-char ?\\ ; Replace REPL-CHAR by \ (file-name-nondirectory (subst-char-in-string ?\\ repl-char ; Replace \ by REPL-CHAR filename 'IN-PLACE)) 'IN-PLACE))) filename) ;; $$$$$ ;; (defun icicle-file-name-input-p () ;; "Return non-nil if expected input is a file name. ;; This is used, instead of variable `minibuffer-completing-file-name', ;; because we sometimes complete against an explicit alist of file names, ;; even in the overall context of file-name input. In that case, we do ;; not want to use file-name completion. An example of this is ;; completing against a history list of file names, using ;; `icicle-history'." ;; ;; Note that some Emacs 20 code uses this as the equivalent of ;; ;; `minibuffer-completing-file-name': ;; ;; (memq minibuffer-completion-table '(read-file-name-internal read-directory-name-internal)) ;; (and (symbolp minibuffer-completion-table) (stringp minibuffer-completion-predicate))) (defun icicle-file-name-input-p () "Return non-nil if reading a file name using `read-file-name'. This means that completion candidates are relative file names. If instead you want to test whether input is a file name, absolute or relative, use this test: (or (icicle-file-name-input-p) icicle-abs-file-candidates)" minibuffer-completing-file-name) (defun icicle-file-directory-p (file) "Local, faster replacement for `file-directory-p'. This does not do all of the file-handler processing that `file-directory-p' does, so it is not a general replacement." (and (stringp file) (string= file (icicle-file-name-directory-w-default file)))) (defun icicle-minibuf-input () "Return the user minibuffer input as a string, without text-properties." (save-selected-window (select-window (minibuffer-window)) (icicle-input-from-minibuffer))) ;;$$$ Do we need to double all $'s in output from `icicle-subst-envvar-in-file-name', ;; before calling `substitute-in-file-name'? (defun icicle-input-from-minibuffer (&optional leave-envvars-p) "Return the minibuffer input as a string, without text-properties. Unless optional arg LEAVE-ENVVARS-P is non-nil, substitute any environment vars by their values. The current buffer must be a minibuffer." (let ((input (if (fboundp 'minibuffer-contents) (minibuffer-contents) ; e.g. Emacs 22 (buffer-substring (point-min) (point-max))))) ; e.g. Emacs 20 ;; $$$$$$$$ (if (fboundp 'minibuffer-contents-no-properties) ;; (minibuffer-contents-no-properties) ; e.g. Emacs 22 ;; (buffer-substring-no-properties (point-min) (point-max))))) ; e.g. Emacs 20 (when (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (not (string= "" input)) ; Do nothing if user deleted everything in minibuffer. (not leave-envvars-p)) (let ((last-char "") (max-input-char 0) (repl-char 0)) ; NULL char: ?\^@ (when (eq ?\$ (aref input (1- (length input)))) (setq last-char "$" input (substring input 0 (1- (length input))))) ;; Set REPL-CHAR to 1+ the highest char code used in INPUT, or NULL if that is not possible. (dolist (char (append input ())) ; `string-to-list' (when (> char max-input-char) (setq max-input-char char))) ;; Make sure we do not go past the max allowable char for Emacs. If so, just use NULL char. ;; Emacs 20-22 has no `max-char' function, so just try adding 1 and see if result is valid. (when (or (and (fboundp 'max-char) ; Emacs 23+ (< (1+ max-input-char) (max-char))) (char-valid-p (1+ max-input-char))) ; Emacs 20-22. (setq repl-char (1+ max-input-char))) (setq input (save-match-data ; Need `save-match-data' around `icicle-subst-envvar-in-file-name'. (concat (subst-char-in-string repl-char ?\\ ; Replace REPL-CHAR by \ (condition-case nil (substitute-in-file-name (icicle-subst-envvar-in-file-name (subst-char-in-string ?\\ repl-char ; Replace \ by REPL-CHAR input 'IN-PLACE))) (error input)) 'IN-PLACE) last-char))))) input)) (defun icicle-minibuf-input-sans-dir (&optional input) "Return the user input, except for a directory portion if reading a file." (unless input (setq input (icicle-minibuf-input))) (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (icicle-file-name-nondirectory input) input)) (defun icicle-subst-envvar-in-file-name (input) "Substitute any environment vars in INPUT by their values. Unlike `substitute-in-file-name', this does not make any other changes, such as switching `\\' to `/' on MS Windows." (let ((pat1 "[^$]\\([$]{\\([^$}]+\\)}\\)") ; e.g. aaa${HOME} (pat2 "^[$]{\\([^$}]+\\)}") ; e.g. ${HOME} (pat3 "[^$]\\([$]\\([^$]+\\)\\)") ; e.g. aaa$HOME (pat4 "^[$]\\([^$]+\\)")) ; e.g. $HOME (cond ((string-match pat1 input) (replace-regexp-in-string pat1 (or (getenv (match-string 2 input)) (concat "$" (match-string 2 input))) input t t 1)) ((string-match pat2 input) (replace-regexp-in-string pat2 (or (getenv (match-string 1 input)) (concat "$" (match-string 1 input))) input t t)) ((string-match pat3 input) (replace-regexp-in-string pat3 (or (getenv (match-string 2 input)) (concat "$" (match-string 2 input))) input t t 1)) ((string-match pat4 input) (replace-regexp-in-string pat4 (or (getenv (match-string 1 input)) (concat "$" (match-string 1 input))) input t t)) (t input)))) ;; Provide for Emacs 20. ;; (unless (fboundp 'replace-regexp-in-string) (defun replace-regexp-in-string (regexp rep string &optional fixedcase literal subexp start) "Replace all matches for REGEXP with REP in STRING. Return a new string containing the replacements. Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the arguments with the same names of function `replace-match'. If START is non-nil, start replacements at that index in STRING. REP is either a string used as the NEWTEXT arg of `replace-match' or a function. If it is a function it is applied to each match to generate the replacement passed to `replace-match'; the match-data at this point are such that match 0 is the function's argument. To replace only the first match (if any), make REGEXP match up to \\' and replace a sub-expression, e.g. (replace-regexp-in-string \"\\\\(foo\\\\).*\\\\'\" \"bar\" \" foo foo\" nil nil 1) => \" bar foo\" " ;; To avoid excessive consing from multiple matches in long strings, ;; don't just call `replace-match' continually. Walk down the ;; string looking for matches of REGEXP and building up a (reversed) ;; list MATCHES. This comprises segments of STRING which weren't ;; matched interspersed with replacements for segments that were. ;; [For a `large' number of replacements it's more efficient to ;; operate in a temporary buffer; we can't tell from the function's ;; args whether to choose the buffer-based implementation, though it ;; might be reasonable to do so for long enough STRING.] (let ((l (length string)) (start (or start 0)) matches str mb me) (save-match-data (while (and (< start l) (string-match regexp string start)) (setq mb (match-beginning 0) me (match-end 0)) ;; If we matched the empty string, make sure we advance by one char (when (= me mb) (setq me (min l (1+ mb)))) ;; Generate a replacement for the matched substring. ;; Operate only on the substring to minimize string consing. ;; Set up match data for the substring for replacement; ;; presumably this is likely to be faster than munging the ;; match data directly in Lisp. (string-match regexp (setq str (substring string mb me))) (setq matches (cons (replace-match (if (stringp rep) rep (funcall rep (match-string 0 str))) fixedcase literal str subexp) (cons (substring string start mb) matches))) ; unmatched prefix (setq start me)) ;; Reconstruct a string from the pieces. (setq matches (cons (substring string start l) matches)) ; leftover (apply #'concat (nreverse matches)))))) (defun icicle-filter-wo-input (candidate) "Filter completion (string) CANDIDATE using regexps and predicate. If CANDIDATE passes the filtering, return CANDIDATE. Else return nil. In addition to filtering out empty-string candidates, these variables are used for the filtering: `icicle-must-match-regexp' `icicle-must-not-match-regexp' `icicle-must-pass-predicate' This filtering is in addition to and prior to matching user input. Users do not see any candidates filtered out here. This filtering does not affect proxy candidates or extra candidates. See also variable `icicle-must-pass-after-match-predicate', which is similar to `icicle-must-pass-predicate' but is used after filtering using the user input." (and (not (string= "" candidate)) ; Filter out empty strings. (or (not icicle-must-match-regexp) (save-match-data (string-match icicle-must-match-regexp candidate))) (or (not icicle-must-not-match-regexp) (not (save-match-data (string-match icicle-must-not-match-regexp candidate)))) (or (not icicle-must-pass-predicate) (funcall icicle-must-pass-predicate candidate)) candidate)) (defun icicle-complete-again-update (&optional no-display) "Complete again and update completions list. Update display too, if already shown and NO-DISPLAY is nil." (setq icicle-completion-candidates (condition-case nil (funcall (case icicle-last-completion-command ((icicle-prefix-complete icicle-prefix-complete-no-display icicle-prefix-word-complete) (if (icicle-file-name-input-p) #'icicle-file-name-prefix-candidates #'icicle-prefix-candidates)) (t (if (icicle-file-name-input-p) #'icicle-file-name-apropos-candidates #'icicle-apropos-candidates))) icicle-current-input) (error icicle-completion-candidates))) ; No change if completion error. (when (and (get-buffer-window "*Completions*" 0) (not no-display)) (icicle-display-candidates-in-Completions))) (defun icicle-msg-maybe-in-minibuffer (format-string &rest args) "Display FORMAT-STRING as a message. If called with the minibuffer inactive, use `message'. Otherwise: If `icicle-minibuffer-message-ok-p', then use `minibuffer-message'. Else do nothing (no message display)." (if (active-minibuffer-window) (when icicle-minibuffer-message-ok-p (save-selected-window (select-window (minibuffer-window)) (minibuffer-message (apply #'format (concat " [" format-string "]") args)))) (apply #'message format-string args))) (defun icicle-delete-count (elt elts count) "Delete by side effect the first COUNT occurrences of ELT from list ELTS. This is like `delete', but it deletes only the first COUNT `equal' occurrences." (while (and elts (equal elt (car elts)) (>= (setq count (1- count)) 0)) (setq elts (cdr elts))) (let ((tail elts) (nn count)) (if (cdr tail) (while (and (cdr tail) (> nn 0)) (when (equal elt (cadr tail)) (setq nn (1- nn)) (setcdr tail (cddr tail))) (setq tail (cdr tail))) (when (and (equal elt (car tail)) (> count 0)) (setq tail (cdr tail))))) ; Remove matching singleton. elts) (defun icicle-position (item list) "Zero-based position of first occurrence of ITEM in LIST, else nil." (let ((index 0)) (catch 'icicle-position (dolist (xx list) (when (equal xx item) (throw 'icicle-position index)) (setq index (1+ index))) nil))) (defun icicle-remove-if (pred xs) "A copy of list XS with no elements that satisfy predicate PRED." (let ((result ())) (dolist (x xs) (unless (funcall pred x) (push x result))) (nreverse result))) (defun icicle-remove-if-not (pred xs) "A copy of list XS with only elements that satisfy predicate PRED." (let ((result ())) (dolist (x xs) (when (funcall pred x) (push x result))) (nreverse result))) (defun icicle-frames-on (buffer &optional frame) ; From `frames-on' in `frame-fns.el'. "List of all live frames showing BUFFER (a buffer or its name). The optional FRAME argument is as for function `get-buffer-window'." (filtered-frame-list (function (lambda (fr) (get-buffer-window buffer fr))))) (defun icicle-candidate-set-1 (set-fn msg) "Helper function for defining Icicle set commands. SET-FN is the function to apply to the current and saved candidates. MESSAGE is the confirmation message to display in the minibuffer." (setq icicle-completion-candidates (funcall set-fn icicle-completion-candidates icicle-saved-completion-candidates)) (if (null icicle-completion-candidates) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [EMPTY SET]")) (icicle-maybe-sort-and-strip-candidates) (icicle-scroll-or-update-Completions msg))) (defun icicle-maybe-sort-and-strip-candidates () "Sort `icicle-completion-candidates'. Strip ignored file names too." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) ; File names: relative or absolute. (setq icicle-completion-candidates (icicle-strip-ignored-files-and-sort icicle-completion-candidates)) (setq icicle-completion-candidates (icicle-maybe-sort-maybe-truncate icicle-completion-candidates)))) (defun icicle-scroll-or-update-Completions (msg) "Scroll `*Completions*' if this command was repeated; else update it." (if (get-buffer-window "*Completions*" 0) (if (eq last-command this-command) ;; User repeated the command. Scroll window around. (icicle-scroll-Completions-forward) ;; User did something else (e.g. changed input). Update the display. (icicle-display-candidates-in-Completions) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message msg))) ;; No window yet. Show window. (icicle-display-candidates-in-Completions) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message msg)))) ;; $$ No longer used. (defun icicle-display-Completions () "Display `*Completions*' buffer." (let ((completions (icicle-all-completions "" minibuffer-completion-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)))) (when (> (length icicle-completion-candidates) icicle-incremental-completion-threshold) (message "Displaying completion candidates...")) (with-output-to-temp-buffer "*Completions*" (display-completion-list (icicle-maybe-sort-maybe-truncate completions))))) ;; This works hand in hand with `icicle-doremi-increment-max-candidates+'. Update both together. (defun icicle-maybe-sort-maybe-truncate (cands) "Return a copy of candidate list CANDS, maybe sorted, maybe truncated. Sort according to `icicle-sort-comparer'. Truncate according to `icicle-max-candidates'." (let ((new-cands cands)) (when icicle-sort-comparer (setq new-cands (icicle-reversible-sort new-cands))) (when icicle-max-candidates (let ((lighter (cadr (assoc 'icicle-mode minor-mode-alist))) (regexp (concat (regexp-quote icicle-lighter-truncation) "$"))) (cond ((and new-cands (integerp icicle-max-candidates) ; Not `RESET'. (< icicle-max-candidates ; Save total number before truncation (setq icicle-nb-candidates-before-truncation (length new-cands)))) (unless (string-match regexp lighter) (icicle-clear-lighter 'not-truncated) (add-to-list 'minor-mode-alist `(icicle-mode ,(concat lighter icicle-lighter-truncation))))) (new-cands ;; Save total number before truncation in `icicle-nb-candidates-before-truncation'. (setq icicle-nb-candidates-before-truncation (length new-cands)) (when (string-match regexp lighter) (icicle-clear-lighter 'truncated) (add-to-list 'minor-mode-alist `(icicle-mode ,(substring lighter 0 (- (length lighter) (length icicle-lighter-truncation)))))))) (if (eq 'RESET icicle-max-candidates) ; `RESET' is from `icicle-doremi-increment-max-candidates+'. (setq icicle-max-candidates nil) (setq new-cands (icicle-take icicle-max-candidates new-cands))))) new-cands)) (defun icicle-take (num xs) "Return a new list with the first NUM elements of list XS. No error handling. NUM must be in the range 0 to (length XS)." ;; A recursive version would be just this: ;; (and xs (not (zerop num)) (cons (car xs) (icicle-take (1- num) (cdr xs))))) (let (newlist) (while (and xs (> num 0)) (setq newlist (cons (car xs) newlist) num (1- num) xs (cdr xs))) (nreverse newlist))) ;; From `cl-seq.el', function `union', without keyword treatment. (defun icicle-set-union (list1 list2) "Combine LIST1 and LIST2 using a set-union operation. The result list contains all items that appear in either LIST1 or LIST2. This is a non-destructive function; it copies the data if necessary." (cond ((null list1) list2) ((null list2) list1) ((equal list1 list2) list1) (t (unless (>= (length list1) (length list2)) (setq list1 (prog1 list2 (setq list2 list1)))) ; Swap them. (while list2 (unless (member (car list2) list1) (setq list1 (cons (car list2) list1))) (setq list2 (cdr list2))) list1))) ;; From `cl-seq.el', function `intersection', without keyword treatment. (defun icicle-set-intersection (list1 list2) "Set intersection of lists LIST1 and LIST2. This is a non-destructive operation: it copies the data if necessary." (and list1 list2 (if (equal list1 list2) list1 (let ((result ())) (unless (>= (length list1) (length list2)) (setq list1 (prog1 list2 (setq list2 list1)))) ; Swap them. (while list2 (when (member (car list2) list1) (setq result (cons (car list2) result))) (setq list2 (cdr list2))) result)))) ;; Like `cl-seq.el', function `set-difference', but without keyword treatment. No TEST arg, just KEY. ;; Same as `frame-cmds-set-difference' in `frame-cmds.el'. (defun icicle-set-difference (list1 list2 &optional key) "Combine LIST1 and LIST2 using a set-difference operation. Optional arg KEY is a function used to extract the part of each list item to compare. Comparison is done using `equal'. The result list contains all items that appear in LIST1 but not LIST2. This is non-destructive; it makes a copy of the data if necessary, to avoid corrupting the original LIST1 and LIST2." (if (or (null list1) (null list2)) list1 (let ((keyed-list2 (and key (mapcar key list2))) (result ())) (while list1 (unless (if key (member (funcall key (car list1)) keyed-list2) (member (car list1) list2)) (setq result (cons (car list1) result))) (setq list1 (cdr list1))) result))) (defun icicle-some (list arg2 predicate) "Apply binary PREDICATE successively to an item of LIST and ARG2. Return the first non-nil value returned by PREDICATE, or nil if none. PREDICATE must be a function with two required arguments." (let ((result nil)) (catch 'icicle-some (dolist (arg1 list) (when (setq result (funcall predicate arg1 arg2)) (throw 'icicle-some result)))) result)) ;; No longer used. (defun icicle-flat-list (val1 val2) "Return a flat list with all values in VAL1 and VAL2." (let ((result nil)) (unless (listp val1) (setq val1 (list val1))) (unless (listp val2) (setq val2 (list val2))) (while val1 (add-to-list 'result (pop val1))) (while val2 (add-to-list 'result (pop val2))) result)) (defun icicle-get-candidates-from-saved-set (set-name &optional dont-expand-filesets-p) "Return the saved set of completion candidates named SET-NAME. SET-NAME can be the name of either an Icicles saved completion set or, if `icicle-filesets-as-saved-completion-sets-flag', an Emacs fileset. If optional arg DONT-EXPAND-FILESETS-P is non-nil, then don't expand fileset entries in a saved completion set. Instead, return them as string candidates." (let ((cache-file (cdr (assoc set-name icicle-saved-completion-sets))) fst) (cond ((and (not cache-file) ; Fileset - get explicit file list. icicle-filesets-as-saved-completion-sets-flag (featurep 'filesets) filesets-data (setq fst (filesets-get-fileset-from-name set-name))) (icicle-explicit-saved-completion-candidates (list fst))) ((not cache-file) (error "No such saved set: `%s'" set-name)) ((not (icicle-file-readable-p cache-file)) (error "Cannot read cache file `%s'" cache-file)) (t ; Icicles saved completion set. (let ((list-buf (find-file-noselect cache-file 'nowarn)) (cands-read ()) (candidates ())) (message "Retrieving saved candidates from `%s'..." cache-file) (unwind-protect (condition-case err (when (listp (setq cands-read (read list-buf))) (message "Set `%s' read from file `%s'" set-name cache-file)) (error (error "Could not read cache file. %s" (error-message-string err)))) (icicle-kill-a-buffer list-buf)) (unless cands-read (error "No completion candidates in file `%s'" cache-file)) (dolist (cand (nreverse cands-read)) ; Convert saved to displayable candidates. (if (not (icicle-saved-fileset-p cand)) (push (icicle-displayable-cand-from-saved-set cand) candidates) (condition-case err (require 'filesets) (error "Set `%s' includes a fileset, but cannot load `fileset.el'" set-name)) (filesets-init) (if dont-expand-filesets-p (push cand candidates) (setq candidates (append (mapcar #'icicle-displayable-cand-from-saved-set (icicle-get-candidates-from-saved-set (cadr cand))) candidates))))) candidates))))) (defun icicle-explicit-saved-completion-candidates (&optional saved-set) "Return the list of files represented by a saved completion set. Any fileset entries in the saved set are expanded to an explicit list of file names. Optional arg SAVED-SET is the Icicles saved completion set to use. It can be the set itself or its name. If SAVED-SET is nil, use `icicle-saved-completion-candidates'." (unless saved-set (setq saved-set icicle-saved-completion-candidates)) (when (stringp saved-set) (setq saved-set (icicle-get-candidates-from-saved-set saved-set))) (let ((files ()) (mode nil)) (dolist (entry saved-set) (cond ((atom entry) (push entry files)) ((and (featurep 'filesets) (or (setq mode (filesets-entry-mode entry)) ; ("my-fs" (:files "a" "b")) (setq entry (cons "dummy" entry) ; (:files "a" "b") mode (filesets-entry-mode entry)))) (message "Gathering file names...") (dolist (file (filesets-get-filelist entry mode)) (push file files))) (t (error "Bad `icicle-saved-completion-candidates' entry: `%S'" entry)))) (nreverse files))) (defun icicle-saved-fileset-p (entry) "Return non-nil if ENTRY is a fileset entry in a saved completion set. ENTRY is a list whose car is `:fileset' - it is not a fileset name." (and (consp entry) (eq (car entry) ':fileset))) (defun icicle-displayable-cand-from-saved-set (cand) "Return display candidate for saved candidate CAND. If CAND is an atom, then return it as is." (let ((cand-w-mrkrs (icicle-readable-to-markers cand))) (if (atom cand-w-mrkrs) cand-w-mrkrs (let ((icicle-whole-candidate-as-text-prop-p t)) (car (icicle-mctized-full-candidate cand-w-mrkrs)))))) (defun icicle-readable-to-markers (cand) "Convert (deserialize) Lisp-readable representation CAND of candidate. A Lisp-readable candidate uses the following to represent a marker: (icicle-file-marker FILE-NAME MARKER-POSITION) or (icicle-marker BUFFER-NAME MARKER-POSITION)" (if (and (consp cand) (consp (cdr cand)) (consp (cddr cand)) (null (cdr (cddr cand))) (memq (car cand) '(icicle-file-marker icicle-marker))) (let ((file-or-buf (cadr cand)) (pos (car (cddr cand))) mrker buf) (if (eq (car cand) 'icicle-file-marker) (let ((buf (find-file-noselect file-or-buf))) (unless buf (error "Cannot find file `%s'" file-or-buf)) (setq file-or-buf buf)) (unless (get-buffer file-or-buf) (icicle-user-error "You must first visit buffer `%s'" file-or-buf))) (set-marker (setq mrker (make-marker)) pos (get-buffer file-or-buf)) mrker) (if (consp cand) (cons (icicle-readable-to-markers (car cand)) (icicle-readable-to-markers (cdr cand))) cand))) ;; REPLACE ORIGINAL `filesets-get-filelist' in `filesets.el'. ;; The original is bugged (I filed Emacs bug #976 on 2008-09-13). ;; For `:tree': ;; * First get the tree from the ENTRY. ;; * Return all matching files under the directory, including in subdirs up to ;; `filesets-tree-max-level' for the entry. ;; (eval-after-load 'filesets '(defun filesets-get-filelist (entry &optional mode event) "Get all files for fileset ENTRY. Assume MODE (see `filesets-entry-mode'), if provided." (let* ((mode (or mode (filesets-entry-mode entry))) (fl (case mode ((:files) (filesets-entry-get-files entry)) ((:file) (list (filesets-entry-get-file entry))) ((:ingroup) (let ((entry (expand-file-name (if (stringp entry) entry (filesets-entry-get-master entry))))) (cons entry (filesets-ingroup-cache-get entry)))) ((:tree) (let* ((dirpatt (filesets-entry-get-tree entry)) ; Added this line. (dir (nth 0 dirpatt)) ; Use DIRPATT, not ENTRY. (patt (nth 1 dirpatt)) ; Use DIRPATT, not ENTRY. (depth (or (filesets-entry-get-tree-max-level entry) filesets-tree-max-level))) (icicle-filesets-files-under 0 depth entry dir patt (and icicle-mode (icicle-file-name-input-p))))) ((:pattern) (let ((dirpatt (filesets-entry-get-pattern entry))) (if dirpatt (let ((dir (filesets-entry-get-pattern--dir dirpatt)) (patt (filesets-entry-get-pattern--pattern dirpatt))) ;;(filesets-message 3 "Filesets: scanning %s" dirpatt) (filesets-directory-files dir patt ':files t)) ;; (message "Filesets: malformed entry: %s" entry))))))) (filesets-error 'error "Filesets: malformed entry: " entry))))))) (filesets-filter-list fl (lambda (file) (not (filesets-filetype-property file event))))))) (defun icicle-filesets-files-under (level depth entry dir patt &optional relativep) "Files under DIR that match PATT. LEVEL is the current level under DIR. DEPTH is the maximal tree scanning depth for ENTRY. ENTRY is a fileset. DIR is a directory. PATT is a regexp that included file names must match. RELATIVEP non-nil means use relative file names." (and (or (= depth 0) (< level depth)) (let* ((dir (file-name-as-directory dir)) (files-here (filesets-directory-files dir patt nil (not relativep) (filesets-entry-get-filter-dirs-flag entry))) (subdirs (filesets-filter-dir-names files-here)) ; Subdirectories at this level. (files (filesets-filter-dir-names ; Remove directory names. (apply #'append files-here (mapcar (lambda (subdir) ; Files below this level. (let* ((subdir (file-name-as-directory subdir)) (full-subdir (concat dir subdir))) (icicle-filesets-files-under (+ level 1) depth entry full-subdir patt))) subdirs)) t))) files))) ;; Note that initial and trailing spaces will not be noticeable. That's OK. (defun icicle-highlight-complete-input () "Highlight minibuffer input, showing that it is a sole completion. Overlay `icicle-complete-input-overlay' is created with `match' face, unless it exists." (let ((case-fold-search ;; Don't bother with buffer completion and `read-buffer-completion-ignore-case'. (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case)) input-start-position) (save-excursion (goto-char (icicle-minibuffer-prompt-end)) (setq input-start-position (point)) (when (and (icicle-file-name-input-p) insert-default-directory) (search-forward (icicle-file-name-directory-w-default (icicle-input-from-minibuffer 'leave-envvars)) nil t) (setq input-start-position (point))) ; Skip directory. (if icicle-complete-input-overlay ; Don't recreate if exists. (move-overlay icicle-complete-input-overlay input-start-position (point-max) (current-buffer)) (setq icicle-complete-input-overlay (make-overlay input-start-position (point-max))) (overlay-put icicle-complete-input-overlay 'face 'icicle-complete-input))))) (defun icicle-call-then-update-Completions (fn &rest args) "Call FN with ARGS, then update `*Completions*' with input matches." (save-match-data (apply fn args) ;;$$$ (let ((tramp-completion-mode t)) ; Fool Tramp into thinking it is in completion mode. (setq icicle-current-input (icicle-input-from-minibuffer) icicle-input-fail-pos nil) (setq icicle-last-input nil);; $$$$$$$$ So icicle-save-or-restore-input => recompute candidates. (when (overlayp icicle-complete-input-overlay) (delete-overlay icicle-complete-input-overlay)) (icicle-highlight-initial-whitespace icicle-current-input) (if (< (length icicle-current-input) icicle-Completions-display-min-input-chars) (save-selected-window (icicle-remove-Completions-window)) ;; `icicle-highlight-input-noncompletion' return value saves call to `icicle-file-remote-p'. (let ((remote-test (icicle-highlight-input-noncompletion))) ;; If ALL of the following are true, then update `*Completions*' (complete again): ;; ;; * Incremental completion is turned on. ;; ;; * At LEAST ONE of the following is true: ;; - `icicle-highlight-input-noncompletion' determined that it's a local file. ;; - We're not completing file names. ;; - The user said not to test for remote file names (i.e. assume files are local). ;; - `icicle-highlight-input-noncompletion' did not determine that it is a remote file ;; AND we test and determine now that it is not a remote file. ;; ;; * `*Completions*' is already displayed ;; OR `icicle-incremental-completion-p' is neither t nor nil (e.g. `always'). ;; ;; * There are not too many candidates ;; OR we have waited the full delay. (when (and icicle-incremental-completion-p (or (eq remote-test 'file-local-p) (not (icicle-file-name-input-p)) (not icicle-test-for-remote-files-flag) ; This means user claims it's local. (and (not (eq remote-test 'file-remote-p)) ;; Might still be remote if `icicle-highlight-input-completion-failure' ;; is `always' or `explicit-remote' - cannot tell from `remote-test'. (not (icicle-file-remote-p icicle-current-input)))) (or (get-buffer-window "*Completions*" 0) ; Already displayed. ;; If value is, say, `always' or `display' then update anyway. (not (eq t icicle-incremental-completion-p))) (let ((len (length icicle-completion-candidates))) ;;; $$$$$$ (or (and (> len 1) (> icicle-incremental-completion-threshold len)) ; Not many ;;; REPLACED PREVIOUS LINE with next one: `sit-for' even if only one candidate. (or (> icicle-incremental-completion-threshold len) ; Not many (sit-for icicle-incremental-completion-delay)))) ; Wait, unless input. ;;; $$$$$$ OLD ;;; (when (and icicle-incremental-completion-p ;;; (or (memq remote-test '(file-local-p file-remote-p)) ;;; (not (icicle-file-name-input-p)) ;;; (not icicle-test-for-remote-files-flag) ;;; ;; Might still be remote if `icicle-highlight-input-completion-failure' ;;; ;; is `always' or `explicit-remote' - cannot tell from `remote-test'. ;;; (and (not (eq remote-test 'file-local-p)) ; We don't know if it's local. ;;; (not (icicle-file-remote-p icicle-current-input)))) ;;; (or (get-buffer-window "*Completions*" 0) ; Already displayed. ;;; ;; If value is, say, `always' or `display' then update anyway. ;;; (not (eq t icicle-incremental-completion-p))) ;;; (let ((len (length icicle-completion-candidates))) ;;; (or (and (> len 1) (> icicle-incremental-completion-threshold len)) ; Not many ;;; (sit-for icicle-incremental-completion-delay)))) ; Wait, unless input. (let ((icicle-edit-update-p t)) (funcall (or icicle-last-completion-command (if (eq icicle-current-completion-mode 'prefix) #'icicle-prefix-complete #'icicle-apropos-complete))) (run-hooks 'icicle-update-input-hook))))) (setq mark-active nil))) (defun icicle-highlight-input-noncompletion () "Highlight the portion of the current input that does not complete. See the doc strings of `icicle-highlight-input-completion-failure' and `icicle-test-for-remote-files-flag' for information about when this highlighting occurs. If we know the input is a remote file name, return `file-remote-p'. If we know it is a local file name, return `file-local-p'. If part of the input matches candidates, return that matching part. If no highlighting was attempted, return nil." (let ((input-start (icicle-minibuffer-prompt-end)) (input (icicle-input-from-minibuffer)) (file-local-p nil)) (cond ;; No input. ((string= "" input) "") ; Return string: highlighting attempted. ;; One of these: pending input, ;; not highlighting, ;; highlighting `explicit-*' but not explicitly completing (TAB/S-TAB), ;; highlighting `implicit-*' but not incrementally completing, ;; highlighting `*-strict' but not strict completion (and testing remote files) ;; there are more candidates than the threshold for highlighting. ((or (input-pending-p) (not icicle-highlight-input-completion-failure) (and (not (icicle-get-safe this-command 'icicle-completing-command)) (memq icicle-highlight-input-completion-failure '(explicit explicit-strict explicit-remote))) (and (not icicle-incremental-completion) (memq icicle-highlight-input-completion-failure '(implicit implicit-strict))) (and (not (icicle-require-match-p)) icicle-test-for-remote-files-flag ; nil flag ignores strict setting for highlighting (memq icicle-highlight-input-completion-failure '(implicit-strict explicit-strict))) (let ((len (length icicle-completion-candidates))) (and (> len 1) (> len icicle-highlight-input-completion-failure-threshold)))) nil) ; Return nil: no highlighting attempted. ;; Cursor is to the left of the last mismatch position. ((and icicle-input-fail-pos (< (point) icicle-input-fail-pos)) (setq icicle-input-fail-pos nil) ; Reset failure position. ;; Remove vestigial highlighting on matched part (e.g. from another completion mode). (when (and (> (or icicle-input-fail-pos (point-max)) input-start) (overlayp icicle-input-completion-fail-overlay)) (delete-overlay icicle-input-completion-fail-overlay)) nil) ; Return nil: no highlighting attempted. ;; Remote file-name input, user did not say to skip testing for remote files, ;; and highlighting is not `always' or `explicit-remote'. ((and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (not (memq icicle-highlight-input-completion-failure '(always explicit-remote))) icicle-test-for-remote-files-flag (let ((remotep (icicle-file-remote-p input))) (unless remotep (setq file-local-p 'file-local-p)) ; We know it's local, so save that. remotep)) ;; Do the same as for the previous, except return indication that we know it is a remote file. (setq icicle-input-fail-pos nil) (when (and (> (or icicle-input-fail-pos (point-max)) input-start) (overlayp icicle-input-completion-fail-overlay)) (delete-overlay icicle-input-completion-fail-overlay)) 'file-remote-p) ; Return `file-remote-p': we know it is a remote file. ((and icicle-highlight-input-completion-failure-delay (progn (message nil) ; Clear any message, e.g. "Computing completion candidates..." (sit-for icicle-highlight-input-completion-failure-delay))) ;; First, a quick check through last two chars. ;; If last succeeds, then done. ;; If last fails and next-to-last succeeds, then done. ;; Otherwise, highlight the others using a binary search. (let ((matchp (icicle-any-candidates-p input))) ; Entire input, through last char. (unless matchp ;; Record failure position and highlight last char. (setq icicle-input-fail-pos (if icicle-input-fail-pos (min icicle-input-fail-pos (point-max)) (point-max))) (cond (icicle-input-completion-fail-overlay ; Don't recreate if exists. ;; Specify buffer in case overlay exists but is in a diff (e.g. recursive) minibuffer. (move-overlay icicle-input-completion-fail-overlay (1- icicle-input-fail-pos) (point-max) (window-buffer (active-minibuffer-window))) (overlay-put icicle-input-completion-fail-overlay 'face (if (icicle-require-match-p) 'icicle-input-completion-fail 'icicle-input-completion-fail-lax))) (t (setq icicle-input-completion-fail-overlay (make-overlay (1- icicle-input-fail-pos) (point-max))) (overlay-put icicle-input-completion-fail-overlay 'face (if (icicle-require-match-p) 'icicle-input-completion-fail 'icicle-input-completion-fail-lax)))) ;; See if next-to-last char gives a match. Typical use case: mistyping a char at end. (setq input (substring input 0 (1- (length input)))) (unless (string= "" input) (setq matchp (icicle-any-candidates-p input)) ;; If more than just the last char fails, highlight the others using binary search. (unless matchp (icicle-highlight-input-noncompletion-rest))))) ;; Highlighting attempted, so return non-nil. If we know it's local, return `file-local-p'. ;; If we don't know that, return the part of INPUT that matches. (or file-local-p input)) (t nil)))) ; Return nil: no highlighting attempted. (defun icicle-highlight-input-noncompletion-rest () "Helper function for `icicle-highlight-input-noncompletion'." (let* ((input-start (icicle-minibuffer-prompt-end)) (pos (1- icicle-input-fail-pos)) (delta pos) (last-pos input-start) (matchp nil) input) (while (and (> pos input-start) (or (not matchp) (< pos icicle-input-fail-pos))) ; Binary search. (setq input (buffer-substring input-start pos) delta (max 1 (/ (abs (- pos last-pos)) 2)) matchp (icicle-any-candidates-p input)) ;; $$$$$$ Emacs BUG (prefix completion): c:/foo/$$ does not highlight the `$$', because ;; (try-completion "c:/foo/$" 'read-file-name-internal "c:/foo/") returns "c:/foo/$". ;; (However, c:/foo/$ highlights the `$' correctly.) (unless matchp (setq icicle-input-fail-pos (min pos icicle-input-fail-pos))) (setq last-pos pos pos (if matchp (+ pos delta) (- pos delta)))) (unless (or (< pos input-start) (> pos icicle-input-fail-pos)) (cond (icicle-input-completion-fail-overlay ; Don't recreate if exists. (move-overlay icicle-input-completion-fail-overlay (1- icicle-input-fail-pos) (point-max)) (overlay-put icicle-input-completion-fail-overlay 'face (if (icicle-require-match-p) 'icicle-input-completion-fail 'icicle-input-completion-fail-lax))) (t (setq icicle-input-completion-fail-overlay (make-overlay (1- icicle-input-fail-pos) (point-max))) (overlay-put icicle-input-completion-fail-overlay 'face (if (icicle-require-match-p) 'icicle-input-completion-fail 'icicle-input-completion-fail-lax))))) input)) ; Return part of INPUT that matches. (defun icicle-ms-windows-NET-USE (drive) "Return result of calling MS Windows `NET USE' command on DRIVE. DRIVE is a Windows drive name, such as `f:'. A return value of zero means DRIVE is a mapped network drive." (if (and (fboundp 'puthash) (hash-table-p icicle-ms-windows-drive-hash)) (let ((lookup (gethash drive icicle-ms-windows-drive-hash 'no-assoc))) (if (eq lookup 'no-assoc) (puthash drive (call-process shell-file-name nil nil nil shell-command-switch (concat "NET USE " drive)) icicle-ms-windows-drive-hash) lookup)) ;; Don't bother to hash for Emacs 20, 21, unless `cl.el' happens to be loaded. (call-process shell-file-name nil nil nil shell-command-switch (concat "NET USE " drive)))) ;;; $$$$$$ ;;; (defun icicle-file-remote-p (file) ; Older definition - new one is like `bmkp-file-remote-p'. ;;; "Non-nil means FILE is likely to name a file on a remote system. ;;; For MS Windows, if `icicle-network-drive-means-remote-flag' is non-nil ;;; then this includes a file on a mapped network drive. ;;; Otherwise, use, in order, `ffap-file-remote-p' or `file-remote-p'. If ;;; those functions are not defined then return nil." ;;; (or (and (eq system-type 'windows-nt) ;;; ;; $$$$ (save-match-data ; IS THIS NEEDED? ;;; (let ((case-fold-search t)) (string-match "\\`\\([a-z]:\\)" file)) ;;; (eq 0 (condition-case nil ;;; (icicle-ms-windows-NET-USE (match-string 1 file)) ;;; (error nil))) ;;; icicle-network-drive-means-remote-flag) ;;; (and (fboundp 'ffap-file-remote-p) (ffap-file-remote-p file)) ;;; (and (fboundp 'file-remote-p) (file-remote-p file)))) (defun icicle-file-remote-p (file) "Non-nil means FILE is likely to name a file on a remote system. For MS Windows, if `icicle-network-drive-means-remote-flag' is non-nil then this includes a file on a mapped network drive. Otherwise, use, in order, `ffap-file-remote-p' or `file-remote-p'. If those functions are not defined then return nil." (or (and (eq system-type 'windows-nt) ;; $$$$ (save-match-data ; IS THIS NEEDED? (let ((case-fold-search t)) (string-match "\\`\\([a-z]:\\)" file)) (eq 0 (condition-case nil (icicle-ms-windows-NET-USE (match-string 1 file)) (error nil))) icicle-network-drive-means-remote-flag) (and (fboundp 'file-remote-p) (file-remote-p file)) (and (stringp file) (string-match "\\`/[^/]+:" file) (match-string 0 file)))) ;;; $$$$$ Should these `*-any-*' fns call `icicle-transform-candidates'? For now, no, to save time. (defun icicle-any-candidates-p (input) "Return non-nil if there is any completion for INPUT, nil otherwise." (condition-case nil (funcall (case icicle-current-completion-mode (apropos (if (icicle-file-name-input-p) #'icicle-apropos-any-file-name-candidates-p #'icicle-apropos-any-candidates-p)) (otherwise (if (icicle-file-name-input-p) #'icicle-prefix-any-file-name-candidates-p #'icicle-prefix-any-candidates-p))) input) (error nil))) (defun icicle-prefix-any-candidates-p (input) "Return non-nil if current partial INPUT has prefix completions." (setq input (regexp-quote input) input (concat "^" input)) (icicle-apropos-any-candidates-p input)) (defun icicle-prefix-any-file-name-candidates-p (input) "Return non-nil if partial file-name INPUT has prefix completions." (setq input (regexp-quote input) input (concat (file-name-directory input) "^" (file-name-nondirectory input))) (icicle-apropos-any-file-name-candidates-p input)) (defun icicle-apropos-any-candidates-p (input) "Return non-nil if current partial INPUT has apropos completions." (when icicle-regexp-quote-flag (setq input (regexp-quote input))) (let* ((minibuffer-completion-table minibuffer-completion-table) (minibuffer-completion-predicate minibuffer-completion-predicate) (all (icicle-all-completions "" minibuffer-completion-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)))) (catch 'icicle-apropos-any-candidates-p (dolist (cand all) ;; Assume no match if error - e.g. due to `string-match' with binary data in Emacs 20. ;; Do this everywhere we call `icicle-apropos-complete-match-fn'. (when (or (not icicle-apropos-complete-match-fn) (condition-case nil (and (funcall icicle-apropos-complete-match-fn input cand) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand))) (error nil))) (throw 'icicle-apropos-any-candidates-p cand))) nil))) (defun icicle-apropos-any-file-name-candidates-p (input) "Return non-nil if partial file-name INPUT has apropos completions." (when (and input (not (string= "" input)) (eq (aref input (1- (length input))) ?\/)) (setq input (substring input 0 (1- (length input))))) ; So we don't non-match highlight the /. (let* ((default-directory (icicle-file-name-directory-w-default input)) (minibuffer-completion-table minibuffer-completion-table) (minibuffer-completion-predicate minibuffer-completion-predicate)) (setq input (or (icicle-file-name-nondirectory input) "")) (condition-case nil (progn (when icicle-regexp-quote-flag (setq input (regexp-quote input))) (let* ((pred (if (< emacs-major-version 23) default-directory minibuffer-completion-predicate)) (candidates (icicle-all-completions "" minibuffer-completion-table pred)) (case-fold-search (if (boundp 'read-file-name-completion-ignore-case) read-file-name-completion-ignore-case completion-ignore-case))) (catch 'icicle-apropos-any-file-name-candidates-p (dolist (cand candidates) (when (if (member cand '("../" "./")) (member input '(".." ".")) ; Prevent "" from matching "../" (or (not icicle-apropos-complete-match-fn) ;; Assume no match if error - e.g. due to `string-match' with ;; binary data in Emacs 20. Do this everywhere we call ;; `icicle-apropos-complete-match-fn'. (condition-case nil (and (funcall icicle-apropos-complete-match-fn input cand) (or (not icicle-must-pass-after-match-predicate) (funcall icicle-must-pass-after-match-predicate cand))) (error nil)))) (throw 'icicle-apropos-any-file-name-candidates-p cand))) nil))) (quit (top-level))))) ; Let `C-g' stop it. (defun icicle-clear-minibuffer () "Delete all user input in the minibuffer. This must be called from the minibuffer." (if (fboundp 'delete-minibuffer-contents) (delete-minibuffer-contents) (erase-buffer))) ;; Same as `member-ignore-case' from Emacs 22+. (if (fboundp 'member-ignore-case) (defalias 'icicle-member-ignore-case (symbol-function 'member-ignore-case)) (defun icicle-member-ignore-case (elt list) "Like `member', but ignore differences in case and text representation. ELT must be a string: ignore non-string elements of LIST. Treat uppercase and lowercase letters as equal. Convert Unibyte strings to multibyte, for the comparison." (while (and list (not (and (stringp (car list)) (eq t (compare-strings elt 0 nil (car list) 0 nil t))))) (setq list (cdr list))))) (defun icicle-assoc-delete-all (key alist) "Delete from ALIST all elements whose car is `equal' to KEY. Return the modified alist. Elements of ALIST that are not conses are ignored." (while (and (consp (car alist)) (equal (car (car alist)) key)) (setq alist (cdr alist))) (let ((tail alist) tail-cdr) (while (setq tail-cdr (cdr tail)) (if (and (consp (car tail-cdr)) (equal (car (car tail-cdr)) key)) (setcdr tail (cdr tail-cdr)) (setq tail tail-cdr)))) alist) (defun icicle-delete-alist-dups (alist) "Destructively remove conses from ALIST with `equal' `car's. Store the result in ALIST and return it. ALIST must be a proper list. Of several element with `equal' `car's in ALIST, the first one is kept." (let ((tail alist)) (while tail (when (consp (car tail)) (setcdr tail (icicle-assoc-delete-all (caar tail) (cdr tail)))) (setq tail (cdr tail)))) alist) ;; Same as `delete-dups' from Emacs 22+. (if (fboundp 'delete-dups) (defalias 'icicle-delete-dups (symbol-function 'delete-dups)) (defun icicle-delete-dups (list) "Destructively remove `equal' duplicates from LIST. Store the result in LIST and return it. LIST must be a proper list. Of several `equal' occurrences of an element in LIST, the first one is kept." (let ((tail list)) (while tail (setcdr tail (delete (car tail) (cdr tail))) (setq tail (cdr tail)))) list)) (if (> emacs-major-version 20) ; Emacs 21+ (defun icicle-remove-duplicates (sequence &optional test) "Copy of SEQUENCE with duplicate elements removed. Optional arg TEST is the test function. If nil, test with `equal'. See `make-hash-table' for possible values of TEST." (setq test (or test #'equal)) (let ((htable (make-hash-table :test test))) (loop for elt in sequence unless (gethash elt htable) do (puthash elt elt htable) finally return (loop for i being the hash-values in htable collect i)))) (defun icicle-remove-duplicates (list &optional use-eq) "Copy of LIST with duplicate elements removed. Test using `equal' by default, or `eq' if optional USE-EQ is non-nil." (let ((tail list) new) (while tail (unless (if use-eq (memq (car tail) new) (member (car tail) new)) (push (car tail) new)) (pop tail)) (nreverse new)))) (defun icicle-remove-dups-if-extras (list) "`icicle-remove-duplicates' if `icicle-extra-candidates' is non-nil. If `icicle-extra-candidates' is nil, then just return LIST. Note: When you use this as the value of `icicle-transform-function', be aware that during completion and before applying this function, `icicle-extra-candidates' is redefined locally by removing its candidates that do not match the current input. So this function then has the effect of removing any duplicates that match the input. If there are no such matching candidates, then LIST is returned." (if icicle-extra-candidates (icicle-remove-duplicates list) list)) (defun icicle-file-readable-p (file) "Return non-nil if FILE (a string) names a readable file." (and (not (string= "" file)) (file-readable-p file) (not (file-directory-p file)))) (defun icicle-file-writable-p (file) "Return non-nil if FILE (a string) names a writable file." (and (not (string= "" file)) (file-writable-p file) (not (file-directory-p file)))) (defvar icicle-dirs-done () "Directories already processed.") ;; Args INCLUDE-DIRS-P and PREDICATE are not used in the Icicles code yet ;; ;; This is the SAME as `diredp-files-within' in Dired+. This code must be kept in sync with that. ;; (defun icicle-files-within (file-list accum &optional no-symlinks-p include-dirs-p predicate) "List of readable files in FILE-LIST, handling directories recursively. FILE-LIST is a list of file names or a function that returns such. If a function then invoke it with no args to get the list of files. Accessible directories in the list of files are processed recursively to include their files and the files in their subdirectories. The directories themselves are not included, unless optional arg INCLUDE-DIRS-P is non-nil. (Directories in `icicle-ignored-directories' are skipped.) But if there is a Dired buffer for such a directory, and if FILE-LIST is a function, then it is invoked in that Dired buffer to return the list of files to use. E.g., if FILE-LIST is `dired-get-marked-files' then only the marked files and subdirectories are included. If you have more than one Dired buffer for a directory that is processed here, then only the first one in `dired-buffers' is used. The list of files is accumulated in ACCUM, which is used for recursive calls. Non-nil optional arg NO-SYMLINKS-P means do not follow symbolic links. Non-nil optional arg INCLUDE-DIRS-P means include directory names along with the names of non-directories. Non-nil optional arg PREDICATE must be a function that accepts a file-name argument. Only files (and possibly directories) that satisfy PREDICATE are included in the result." (if (fboundp 'diredp-files-within) ; The code SHOULD be kept the same! (diredp-files-within file-list accum no-symlinks-p include-dirs-p predicate) ;; Binds `icicle-dirs-done' for use as free var in `icicle-files-within-1'." (let ((icicle-dirs-done ())) (nreverse (icicle-files-within-1 file-list accum no-symlinks-p include-dirs-p predicate))))) ;; This is the SAME as `diredp-files-within-1' in Dired+. This code must be kept in sync with that. ;; (defun icicle-files-within-1 (file-list accum no-symlinks-p include-dirs-p predicate) "Helper for `icicle-files-within'." ; `icicle-dirs-done' is free here. (if (fboundp 'diredp-files-within-1) (diredp-files-within-1 file-list accum no-symlinks-p include-dirs-p predicate) (let ((files (if (functionp file-list) (funcall file-list) file-list)) (res accum) file) (when (and files predicate) (setq files (icicle-remove-if-not predicate files))) (while files (setq file (car files)) (unless (and no-symlinks-p (file-symlink-p file)) (if (file-directory-p file) ;; Skip directory if ignored, already treated, or inaccessible. (when (and (not (member (file-name-nondirectory file) icicle-ignored-directories)) (not (member (file-truename file) icicle-dirs-done)) (file-accessible-directory-p file)) (setq res (icicle-files-within-1 (or (and (functionp file-list) (dired-buffers-for-dir file) ; Removes killed buffers. (with-current-buffer (cdr (assoc (file-name-as-directory file) dired-buffers)) (funcall file-list))) (directory-files file 'FULL icicle-re-no-dot)) res no-symlinks-p include-dirs-p predicate)) (when include-dirs-p (push file res)) (push (file-truename file) icicle-dirs-done)) (when (file-readable-p file) (push file res)))) (pop files)) res))) (defun icicle-delete-whitespace-from-string (string &optional from to) "Remove whitespace from substring of STRING from FROM to TO. If FROM is nil, then start at the beginning of STRING (FROM = 0). If TO is nil, then end at the end of STRING (TO = length of STRING). FROM and TO are zero-based indexes into STRING. Character FROM is affected (possibly deleted). Character TO is not." (setq from (or from 0) to (or to (length string))) (with-temp-buffer (insert string) (goto-char (+ from (point-min))) (let ((count from) char) (while (and (not (eobp)) (< count to)) (setq char (char-after)) (if (memq char '(?\ ?\t ?\n)) (delete-char 1) (forward-char 1)) (setq count (1+ count))) (buffer-string)))) (defun icicle-barf-if-outside-minibuffer () "Raise an error if `this-command' is called outside the minibuffer." (unless (eq (current-buffer) (window-buffer (minibuffer-window))) (icicle-user-error "Command `%s' must be called from the minibuffer" this-command))) (defun icicle-barf-if-outside-Completions () "Raise error if `this-command' is called outside buffer `*Completions*'." (unless (eq (current-buffer) (get-buffer "*Completions*")) (icicle-user-error "Command `%s' must be called from `*Completions*' buffer" this-command))) (defun icicle-barf-if-outside-Completions-and-minibuffer () "Error if `this-command' called outside `*Completions*' and minibuffer." (unless (or (eq (current-buffer) (window-buffer (minibuffer-window))) (eq (current-buffer) (get-buffer "*Completions*"))) (icicle-user-error "`%s' must be called from `*Completions*' or minibuffer" this-command))) (defun icicle-command-abbrev-save () "Save `icicle-command-abbrev-alist'. Used on `kill-emacs-hook'." (icicle-condition-case-no-debug err ; Don't raise an error, since it's on `kill-emacs-hook. (let ((sav (get 'icicle-command-abbrev-alist 'saved-value))) (unless (and (or (null sav) (and (consp sav) (consp (car sav)) (consp (cdar sav)) (consp (car (cdar sav))))) (equal icicle-command-abbrev-alist (car (cdar sav)))) (funcall icicle-customize-save-variable-function 'icicle-command-abbrev-alist icicle-command-abbrev-alist))) (error (message "Cannot save new value of `icicle-command-abbrev-alist'") (sleep-for 3)))) (defun icicle-expand-file-or-dir-name (input dir) "Expand file-name INPUT in directory DIR. Similar to `expand-file-name', except: - If INPUT does not end in a slash, and DIR/INPUT is a directory, add a trailing slash. - If INPUT ends in a slash, but DIR/INPUT is not a directory, then remove the trailing slash. - if INPUT or DIR contains consecutive slashes (`/'), do not collapse them to a single slash." (let ((expanded-input (directory-file-name (icicle-expand-file-name-20 input dir)))) ;; Add trailing slash if input is a directory. (when (file-directory-p expanded-input) (setq expanded-input (file-name-as-directory expanded-input))) expanded-input)) (defun icicle-expand-file-name-20 (input dir) "Emacs 20's `expand-file-name': does not collapse consecutive slashes." ;; Replace // with five ^Gs, then replace back again. (let ((escaped-input (and input (replace-regexp-in-string "//" (make-string 5 7) input))) (escaped-dir (and dir (replace-regexp-in-string "//" (make-string 5 7) dir)))) (replace-regexp-in-string (make-string 5 7) "//" (expand-file-name escaped-input escaped-dir)))) (defun icicle-start-of-candidates-in-Completions () "Return buffer position of the first candidate in `*Completions*'." (save-excursion (goto-char (point-min)) (when icicle-show-Completions-help-flag (forward-line 2)) (point))) (defun icicle-key-description (keys &optional prefix angles) "Like `key-description', but does not use angle brackets, by default. Non-nil optional arg ANGLES means use angle brackets." (let ((result (if (< emacs-major-version 22) (key-description keys) (key-description keys prefix)))) (unless angles ; Assume that spaces separate function keys. (setq result (replace-regexp-in-string "<\\([^>]+\\)>" "\\1" result 'fixed-case))) result)) ;; $$ Not used. ;; (defun icicle-alist-delete-all (key alist &optional test) ;; "Delete from ALIST all elements whose car is the same as KEY. ;; Optional arg TEST is the equality test to use. If nil, `eq' is used. ;; Return the modified alist. ;; Elements of ALIST that are not conses are ignored." ;; (setq test (or test #'eq)) ;; (while (and (consp (car alist)) (funcall test (car (car alist)) key)) ;; (setq alist (cdr alist))) ;; (let ((tail alist) tail-cdr) ;; (while (setq tail-cdr (cdr tail)) ;; (if (and (consp (car tail-cdr)) (funcall test (car (car tail-cdr)) key)) ;; (setcdr tail (cdr tail-cdr)) ;; (setq tail tail-cdr)))) ;; alist) ;; Standard Emacs 22+ function, defined here for Emacs 20, 21. (unless (fboundp 'select-frame-set-input-focus) ; Defined in Emacs 22. (defun select-frame-set-input-focus (frame) "Select FRAME, raise it, and set input focus, if possible." (select-frame frame) (raise-frame frame) ;; Ensure, if possible, that frame gets input focus. (cond ((eq window-system 'x) (x-focus-frame frame)) ((eq window-system 'w32) (w32-focus-frame frame))) (cond (focus-follows-mouse (set-mouse-position (selected-frame) (1- (frame-width)) 0))))) ;; Standard Emacs 21+ function, defined here for Emacs 20. (unless (fboundp 'assq-delete-all) (defun assq-delete-all (key alist) "Delete from ALIST all elements whose car is `eq' to KEY. Return the modified alist. Elements of ALIST that are not conses are ignored." (while (and (consp (car alist)) (eq (car (car alist)) key)) (setq alist (cdr alist))) (let ((tail alist) tail-cdr) (while (setq tail-cdr (cdr tail)) (if (and (consp (car tail-cdr)) (eq (car (car tail-cdr)) key)) (setcdr tail (cdr tail-cdr)) (setq tail tail-cdr)))) alist)) (defun icicle-first-N (n list) "Return a new list of at most the N first elements of LIST." (let ((firstN ())) (while (and list (> n 0)) (push (car list) firstN) (setq n (1- n) list (cdr list))) (setq firstN (nreverse firstN)))) (defun icicle-abbreviate-or-expand-file-name (filename &optional dir dont-add-default-dir-p) "Expand FILENAME, and abbreviate it if `icicle-use-~-for-home-dir-flag'. If FILENAME is not absolute, call `icicle-expand-file-name-20' to make it absolute. This does not collapse consecutive slashes (`/'). If `icicle-use-~-for-home-dir-flag', call `abbreviate-file-name'. If DIR is absolute, pass it to `icicle-expand-file-name-20'. Otherwise, ignore it (treat it as nil)." (unless (file-name-absolute-p filename) (when (and dir (not dont-add-default-dir-p) (not (file-name-absolute-p dir))) (setq dir nil)) ; Do not use a relative dir. (setq filename (icicle-expand-file-name-20 filename dir))) (if icicle-use-~-for-home-dir-flag (abbreviate-file-name filename) filename)) (defun icicle-reversible-sort (list &optional key) "`sort' LIST using `icicle-sort-comparer'. Reverse the result if `icicle-reverse-sort-p' is non-nil. If `icicle-sort-comparer' is a cons (other than a lambda form), then use `icicle-multi-sort' as the sort predicate. Otherwise, use `icicle-sort-comparer' as the sort predicate. Optional arg KEY is a selector function to apply to each item to be be compared. If nil, then the entire item is used." ;;$$ (when (and icicle-edit-update-p icicle-completion-candidates ;; (> (length icicle-completion-candidates) icicle-incremental-completion-threshold)) ;; (message "Sorting candidates...")) (unless key (setq key 'identity)) (let ((sort-fn (and icicle-sort-comparer (lambda (s1 s2) (when icicle-transform-before-sort-p (setq s1 (icicle-transform-multi-completion s1) s2 (icicle-transform-multi-completion s2))) ;; If we have an inappropriate sort order, get rid of it. This can happen if ;; the user chooses a sort appropriate to one kind of candidate and then ;; tries completion for a different kind of candidate. (condition-case nil (and icicle-sort-comparer ; nil in case of error earlier in list. (if (and (not (functionp icicle-sort-comparer)) (consp icicle-sort-comparer)) (icicle-multi-sort (funcall key s1) (funcall key s2)) (funcall icicle-sort-comparer (funcall key s1) (funcall key s2)))) (error (message "Inappropriate sort order - reverting to UNSORTED") (sit-for 1) (setq icicle-sort-comparer nil) nil)))))) (when sort-fn (setq list (sort list (if icicle-reverse-sort-p (lambda (a b) (not (funcall sort-fn a b))) sort-fn))))) list) ;; Essentially the same as `bmkp-multi-sort'. (defun icicle-multi-sort (s1 s2) "Try predicates in `icicle-sort-comparer', in order, until one decides. The (binary) predicates are applied to S1 and S2. See the description of `icicle-sort-comparer'. If `icicle-reverse-multi-sort-p' is non-nil, then reverse the order for using multi-sorting predicates." (let ((preds (car icicle-sort-comparer)) (final-pred (cadr icicle-sort-comparer)) (result nil)) (when icicle-reverse-multi-sort-p (setq preds (reverse preds))) (catch 'icicle-multi-sort (dolist (pred preds) (setq result (funcall pred s1 s2)) (when (consp result) (when icicle-reverse-multi-sort-p (setq result (list (not (car result))))) (throw 'icicle-multi-sort (car result)))) (and final-pred (if icicle-reverse-multi-sort-p (not (funcall final-pred s1 s2)) (funcall final-pred s1 s2)))))) (defun icicle-make-plain-predicate (pred &optional final-pred) "Return a plain predicate that corresponds to component-predicate PRED. PRED and FINAL-PRED correspond to their namesakes in `icicle-sort-comparer' (which see). PRED should return `(t)', `(nil)', or nil. Optional arg FINAL-PRED is the final predicate to use if PRED cannot decide (returns nil). If FINAL-PRED is nil, then `icicle-alpha-p' is used as the final predicate." `(lambda (b1 b2) (let ((res (funcall ',pred b1 b2))) (if res (car res) (funcall ',(or final-pred 'icicle-alpha-p) b1 b2))))) (defun icicle-alpha-p (s1 s2) "True if string S1 sorts alphabetically before string S2. Comparison respects `case-fold-search'." (when case-fold-search (setq s1 (icicle-upcase s1) s2 (icicle-upcase s2))) (string-lessp s1 s2)) (defun icicle-get-alist-candidate (string &optional no-error-p) "Return full completion candidate that corresponds to displayed STRING. STRING is the name of the candidate, as shown in `*Completions*'. Non-nil optional argument NO-ERROR-P means display a message and return nil instead of raising an error if STRING is ambiguous. If the value of NO-ERROR-P is `no-error-no-msg', then show no message and just return nil. If `icicle-whole-candidate-as-text-prop-p' is non-nil, then the full candidate might be available as text property `icicle-whole-candidate' of STRING. If so, then that is used. Otherwise, the full candidate is obtained from `icicle-candidates-alist'. In this case: If the user cycled among candidates or used `mouse-2', then use the current candidate number, and ignore STRING. Otherwise: If only one candidate matches STRING, use that. Else respect NO-ERROR-P and tell user to use cycling or `mouse-2'." (or (and icicle-whole-candidate-as-text-prop-p (get-text-property 0 'icicle-whole-candidate string)) (and icicle-candidates-alist (let ((cand-entries (icicle-filter-alist icicle-candidates-alist icicle-completion-candidates))) (if (wholenump icicle-candidate-nb) ; Cycled or used `mouse-2' to choose the candidate. (elt cand-entries (mod icicle-candidate-nb (length icicle-candidates-alist))) ;; If `icicle-completion-candidates' is nil, because user didn't use `TAB' or `S-TAB', ;; then `icicle-candidates-alist' can contain non-matches. So, we check for more than ;; one match. However, we cannot just use `assoc', because candidates might be ;; multi-completions (lists). (let ((first-match (icicle-first-matching-candidate string icicle-candidates-alist))) (if (and first-match (not (icicle-first-matching-candidate string (setq cand-entries (delete first-match cand-entries))))) first-match ; Only one match, so use it. (let ((msg "Ambiguous choice. Cycle or use `mouse-2' to choose unique matching \ candidate.")) (unless no-error-p (error msg)) (unless (eq no-error-p 'no-error-no-msg) (icicle-msg-maybe-in-minibuffer msg)) nil)))))))) ; Return nil for ambiguous string if NO-ERROR-P. (defun icicle-filter-alist (alist filter-keys) "Filter ALIST, keeping items whose cars match FILTER-KEYS, in order. The original ALIST is not altered; a copy is filtered and returned. If FILTER-KEYS is empty, then ALIST is returned, not a copy." (if filter-keys (icicle-remove-if-not (lambda (item) (member (if (consp (car item)) ;; $$$$$$ (concat (mapconcat #'identity (car item) icicle-list-join-string) ;; icicle-list-end-string) ; $$$$$$ (mapconcat #'identity (car item) icicle-list-join-string) (car item)) filter-keys)) alist) alist)) ;;; $$$$$$$$$$$$$$$$$$ ;;; (defun icicle-first-matching-candidate (cand candidates) ;;; "Return the first element of alist CANDIDATES that matches CAND. ;;; If CANDIDATES is a normal list of completion candidates, then this is ;;; just `assoc'. ;;; If CANDIDATES contains multi-completions, then matching means matching ;;; the concatenated multi-completion parts, joined by ;;; `icicle-list-join-string'." ;;; (cond ((null candidates) nil) ;;; ((if (consp (caar candidates)) ; Multi-completion candidate ;;; (save-match-data ;;; (string-match cand (mapconcat #'identity (caar candidates) ;;; icicle-list-join-string))) ;;; (equal cand (caar candidates))) ; This case is just `assoc'. ;;; (car candidates)) ;;; (t (icicle-first-matching-candidate cand (cdr candidates))))) (defun icicle-first-matching-candidate (cand candidates) "Return the first element of alist CANDIDATES that matches CAND. Return nil if there is no such element. If CANDIDATES is a normal list of completion candidates, then this is just `assoc'. If CANDIDATES contains multi-completions, then matching means matching the concatenated multi-completion parts, joined by `icicle-list-join-string'." (let ((res nil)) (if (null candidates) (setq res nil) (while (and candidates (not res)) (when (or (and (consp (caar candidates)) ; Multi-completion candidate (save-match-data (string-match (regexp-quote cand) ;; $$$$$$ (concat (mapconcat #'identity (caar candidates) ;; icicle-list-join-string) ;; icicle-list-end-string) ; $$$$$$ (mapconcat #'identity (caar candidates) icicle-list-join-string)))) (equal cand (caar candidates))) (setq res (car candidates))) (setq candidates (cdr candidates)))) res)) (defun icicle-completing-p () "Non-nil if reading minibuffer input with completion. This caches the value returned in variable `icicle-completing-p'. Use the function, not the variable, to test, if not sure to be in the minibuffer." (setq icicle-completing-p ; Cache the value. (and (active-minibuffer-window) ;; We used to include filename keymaps in MAPS, but that does not work for ;; Emacs > 24.3 - it uses a composed keymap that it creates on the fly. ;; So instead we just check `minibuffer-completing-file-name' now for Emacs 22+. (or (and minibuffer-completing-file-name (> emacs-major-version 21)) (let* ((loc-map (current-local-map)) (parent (keymap-parent loc-map)) (maps (list minibuffer-local-completion-map minibuffer-local-must-match-map))) (and (or (and parent (member parent maps)) (member loc-map maps)) t)))))) ; Cache t, not the keymap portion. ;; This is just `substring-no-properties', defined also for Emacs < 22. (defun icicle-substring-no-properties (string &optional from to) "Return a substring of STRING, without text properties. It starts at index FROM and ending before TO. TO may be nil or omitted; then the substring runs to the end of STRING. If FROM is nil or omitted, the substring starts at the beginning of STRING. If FROM or TO is negative, it counts from the end. With one argument, just copy STRING without its properties." (if (fboundp 'substring-no-properties) (substring-no-properties string from to) ; Emacs 22. (let ((substrg (copy-sequence (substring string (or from 0) to)))) (set-text-properties 0 (length substrg) nil substrg) substrg))) (defun icicle-highlight-lighter () "Highlight `Icy' mode-line indicator of Icicle mode. Highlighting indicates the current completion status." (when icicle-highlight-lighter-flag (let ((strg ;; Don't bother with buffer completion and `read-buffer-completion-ignore-case'. (if (if (and (or (icicle-file-name-input-p) icicle-abs-file-candidates) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case) " ICY" " Icy")) (face (cond ((and icicle-candidate-action-fn (icicle-require-match-p)) '(icicle-multi-command-completion icicle-mustmatch-completion)) (icicle-candidate-action-fn 'icicle-multi-command-completion) ((icicle-require-match-p) '(icicle-completion icicle-mustmatch-completion)) (t 'icicle-completion)))) (when icicle-candidate-action-fn (setq strg (concat strg "+"))) (when (and icicle-multi-completing-p icicle-show-multi-completion-flag) (setq strg (concat strg "||"))) (put-text-property 0 (length strg) 'face face strg) (icicle-clear-lighter) (add-to-list 'minor-mode-alist `(icicle-mode ,strg))) (condition-case nil (if (fboundp 'redisplay) (redisplay t) (force-mode-line-update t)) (error nil)))) ; Ignore errors from, e.g., killed buffers. (defun icicle-unhighlight-lighter () "Unhighlight `Icy' mode-line indicator of Icicle mode." (when icicle-highlight-lighter-flag (let ((strg (if case-fold-search " ICY" " Icy"))) (icicle-clear-lighter) (add-to-list 'minor-mode-alist `(icicle-mode ,strg))) (condition-case nil (if (fboundp 'redisplay) (redisplay t) (force-mode-line-update t)) (error nil)))) ; Ignore errors from, e.g., killed buffers. (defun icicle-clear-lighter (&optional only) "Remove Icicle mode lighter from `minor-mode-alist'." (unless (eq only 'truncated) (setq minor-mode-alist (delete '(icicle-mode " Icy") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " Icy+") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " ICY") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " ICY+") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " Icy||") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " Icy+||") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " ICY||") minor-mode-alist) minor-mode-alist (delete '(icicle-mode " ICY+||") minor-mode-alist))) (unless (eq only 'not-truncated) (setq minor-mode-alist (delete `(icicle-mode ,(concat " Icy" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " Icy+" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " ICY" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " ICY+" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " Icy||" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " Icy+||" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " ICY||" icicle-lighter-truncation)) minor-mode-alist) minor-mode-alist (delete `(icicle-mode ,(concat " ICY+||" icicle-lighter-truncation)) minor-mode-alist)))) (defun icicle-ding () "Same as `ding', but respects `icicle-inhibit-ding-flag'." (unless icicle-inhibit-ding-flag (ding))) (defun icicle-kill-a-buffer (buf &optional nomsg) "Kill buffer BUF. Optional arg NOMSG non-nil means don't display an error message." (save-selected-window (setq buf (get-buffer buf)) (if buf (icicle-condition-case-no-debug err (if (not (buffer-live-p buf)) (unless nomsg (message "Buffer already deleted: `%s'" buf)) (let ((enable-recursive-minibuffers t)) ; In case called from minibuffer, and modified. (if (fboundp 'kill-buffer-and-its-windows) (kill-buffer-and-its-windows buf) ; Defined in `misc-cmds.el'. (kill-buffer buf)))) (error nil)) (unless nomsg (message "No such live buffer: `%s'" (icicle-propertize (format "%s" buf) 'face 'icicle-msg-emphasis)))))) (defun icicle-propertize (object &rest properties) "Like `propertize', but for all Emacs versions. If OBJECT is not a string, then use `prin1-to-string' to get a string." (let ((new (if (stringp object) (copy-sequence object) (prin1-to-string object)))) (add-text-properties 0 (length new) properties new) new)) ;; Same as `tap-string-match-p' in `thingatpt+.el'. (if (fboundp 'string-match-p) (defalias 'icicle-string-match-p 'string-match-p) ; Emacs 23+ (defun icicle-string-match-p (regexp string &optional start) "Like `string-match', but this saves and restores the match data." (save-match-data (string-match regexp string start)))) (defun icicle-unpropertize-completion (string) "Remove text properties from STRING. STRING is typicaly a completion candidate or result. If STRING is not a string, just return it (raise no error). If `icicle-remove-icicles-props-p' is nil, just return STRING. This is the case for some Icicles functions that need to further process the completion result. Otherwise, if option `icicle-unpropertize-completion-result-flag' is non-nil, then remove all text properties. Otherwise remove only Icicles internal text properties: 1. any text properties in `icicle-candidate-properties-alist'. 2. The following internal text properties added by Icicles: `display', `help-echo', `icicle-fancy-candidates', `icicle-mode-line-help', `icicle-special-candidate', `icicle-user-plain-dot', `icicle-whole-candidate', `invisible'. \(Property `mouse-face' is removed by `choose-completion-string'.\)" (when (and (stringp string) icicle-remove-icicles-props-p) ; Do nothing if we're inhibiting removal. (let ((len (length string))) (if icicle-unpropertize-completion-result-flag (set-text-properties 0 len nil string) (remove-text-properties 0 len '(display nil help-echo nil rear-nonsticky nil icicle-fancy-candidates nil icicle-mode-line-help nil icicle-special-candidate nil icicle-user-plain-dot nil icicle-whole-candidate nil invisible nil) string) (dolist (entry icicle-candidate-properties-alist) (put-text-property 0 len (car (cadr entry)) nil string))))) string) ;; $$$$$$ Filed Emacs BUG #8795. They added a non-optional arg, METADATA (with no doc). ;; (defun icicle-completion-all-completions (string table pred point &optional metadata) "Icicles version of `completion-all-completions'. 1. Handle all Emacs versions. 2. Append `$' to each candidate, if current input ends in `$'. 3. Remove the last cdr, which might hold the base size. 4. METADATA is optional and defaults to `completion--field-metadata' at `field-beginning'." (let* ((mdata (and (fboundp 'completion--field-metadata) (or metadata (completion--field-metadata (field-beginning))))) ;; $$$$$$$$ UNLESS BUG #8795 is fixed, need METADATA even if nil. (res (if (fboundp 'completion--field-metadata) ; Emacs 24 added a 5th arg, METADATA. (completion-all-completions string table pred point mdata) (completion-all-completions string table pred point)))) (when (consp res) (let ((last (last res))) (when last (setcdr last nil)))) (let* ((input-sans-dir (icicle-minibuf-input-sans-dir icicle-current-input)) (env-var-p (and (icicle-not-basic-prefix-completion-p) (> (length input-sans-dir) 0) (eq ?\$ (aref input-sans-dir 0))))) (when env-var-p (setq res (mapcar (lambda (cand) (concat "$" cand)) res)))) res)) ;; $$$$$$ Filed Emacs BUG #4708. `completion-try-completion' does not return nil when it should. ;; E.g. (completion-try-completion "c:/some-dir/$HOMj" nil 17) returns: ("c:/some-dir/$$HOMj" . 18) ;; ;; This causes `icicle-highlight-input-noncompletion' not to highlight the `j' in the above example. ;; ;; $$$$$$ Filed Emacs BUG #8795. They added a non-optional arg, METADATA (with no doc). ;; (defun icicle-completion-try-completion (string table pred point &optional metadata) "Icicles version of `completion-try-completion'. 1. Handle all Emacs versions. 2. Remove the last cdr, which might hold the base size. 3. METADATA is optional and defaults to `completion--field-metadata' at `field-beginning'." (let* ((mdata (and (fboundp 'completion--field-metadata) (or metadata (completion--field-metadata (field-beginning))))) ;; $$$$$$$$ UNLESS BUG #8795 is fixed, still need METADATA, even if nil. (res (if (fboundp 'completion--field-metadata) ; Emacs 24 added a 5th arg, METADATA. (completion-try-completion string table pred point mdata) (completion-try-completion string table pred point)))) (when (consp res) (setq res (car res))) res)) (defun icicle-require-match-p () "Return non-nil if completion is strict. Return non-nil if current REQUIRE-MATCH arg to `completing-read' or `read-file-name' really means require match (sheesh!)." (if (> emacs-major-version 22) (eq t icicle-require-match-p) icicle-require-match-p)) ;; Note: Property `icicle-mode-line-help' with a function value is not used yet in Icicles code. (defun icicle-candidate-short-help (help string) "Put HELP on STRING as text properties. HELP is a help string or a function that takes a display completion candidate as argument. To display help for a candidate, the function is applied to the candidate to obtain its help string. Put `help-echo' property if `tooltip-mode' is non-nil. Put `icicle-mode-line-help' property (on the first character only) if `icicle-help-in-mode-line-delay' is positive. Return STRING, whether propertized or not." (unless (equal "" string) (when (> icicle-help-in-mode-line-delay 0) (put-text-property 0 1 'icicle-mode-line-help help string)) (when (and (boundp 'tooltip-mode) tooltip-mode) (put-text-property 0 (length string) 'help-echo help string))) string) ;; This is not used by Icicles, since the color functions require `hexrgb.el'. (defun icicle-remove-color-duplicates (list) "Copy of LIST with duplicate color candidates removed. Candidates are considered duplicates if they have the same color name, abstracting from whitespace and letter case." (let ((tail list) new) (save-match-data (while tail (let* ((this (car tail)) (pseudo-color-p (string-match "^\*" this))) (string-match ": " this) (unless pseudo-color-p (setq this (icicle-delete-whitespace-from-string (downcase this) 0 (match-beginning 0)))) (unless (member this new) (push this new))) (pop tail))) (nreverse new))) (defun icicle-alt-act-fn-for-type (type) "Returns an action function chosen by user for type TYPE (a string). Typical use: Bind `icicle-candidate-alt-action-fn' and `icicle-all-candidates-list-alt-action-fn' to the return value. However, you must first bind `icicle-orig-window' to the window that is current before user input is read from the minibuffer." (lexical-let ((type type)) ; Does this binding really help? (lambda (cands) (unless (listp cands) (setq cands (list cands))) ; So it works for both single and all cands. (let* ((enable-recursive-minibuffers t) (anything-actions (and (> emacs-major-version 21) icicle-use-anything-candidates-flag (require 'anything nil t) (icicle-get-anything-actions-for-type (intern type)))) (actions ; Must sort, for `icicle-candidates-alist', (sort ; or else `icicle-candidate-nb' will be wrong. (append anything-actions (mapcar (lambda (act) (cons (format "%s" act) act)) (icicle-remove-if-not #'functionp (cdr (assoc type icicle-type-actions-alist))))) (lambda (a1 a2) (funcall 'string-lessp (car a1) (car a2))))) (icicle-sort-comparer 'string-lessp) ; Must be the same order as actions. (icicle-candidate-action-fn ; For "how". (lambda (fn) (let ((icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "function")) icicle-saved-completion-candidate) (icicle-with-selected-window ; A macro in `icicles-mac.el'. (if (and (boundp 'icicle-orig-window) (window-live-p icicle-orig-window)) icicle-orig-window (selected-window)) ; Punt wo `icicle-orig-window'. (dolist (cand cands) (setq icicle-saved-completion-candidate cand) (icicle-apply-to-saved-candidate fn t type)))))) ;; Save & restore these, so `icomplete-exhibit' on `post-command-hook' has no error. (minibuffer-completion-table minibuffer-completion-table) (minibuffer-completion-predicate minibuffer-completion-predicate)) (setq cands (mapcar (lambda (obj) (setq obj (icicle-transform-multi-completion obj)) (cond ((not (stringp obj)) obj) ((memq (intern type) '(command face function option symbol variable)) (intern obj)) ((and (eq (intern type) 'frame) (fboundp 'get-a-frame)) (get-a-frame obj)) (t obj))) cands)) (setq icicle-candidates-alist actions) (let (icicle-saved-completion-candidate) (cond ((null actions) ;; Undefined TYPE - provide all Emacs `functionp' symbol names as candidates. (let* ((icicle-must-pass-after-match-predicate (lambda (s) (functionp (intern s)))) (action (icicle-maybe-cached-action (completing-read "How (action): " obarray)))) (dolist (cand cands) (setq icicle-saved-completion-candidate cand) (icicle-apply-to-saved-candidate action)))) ((null (cdr actions)) (dolist (cand cands) (funcall (icicle-maybe-cached-action (cdar actions)) cand))) (t (let* ((icicle-show-Completions-initially-flag t) (action (icicle-maybe-cached-action (completing-read "How (action): " actions)))) (icicle-with-selected-window (if (and (boundp 'icicle-orig-window) (window-live-p icicle-orig-window)) icicle-orig-window (selected-window)) ; Punt: no `icicle-orig-window'. (let ((icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "function"))) (dolist (cand cands) (setq icicle-saved-completion-candidate cand) (icicle-apply-to-saved-candidate action t type)))))))))))) (defun icicle-toggle-icicle-mode-twice () "Toggle Icicle mode twice. Load `icicles-mode.el' if not loaded." ;; Just a convenience function, to avoid Emacs warning about calling `icy-mode' with no arg. (require 'icicles-mode) (let ((curr (if (and (boundp 'icicle-mode) icicle-mode) 1 -1))) (icy-mode (- curr)) (icy-mode curr))) (defun icicle-current-TAB-method () "Current completion method for \ `\\\\[icicle-prefix-complete]'. This resets variable `icicle-current-TAB-method' when needed." (or (car (memq icicle-current-TAB-method icicle-TAB-completion-methods)) (car icicle-TAB-completion-methods))) (defun icicle-not-basic-prefix-completion-p () "`icicle-current-TAB-method' is `vanilla', and Emacs > release 22." (and (eq 'vanilla (icicle-current-TAB-method)) (boundp 'completion-styles))) (defun icicle-all-completions (string collection &optional predicate hide-spaces) "Version of vanilla `all-completions' that works for all Emacs releases. Starting with Emacs 23.2, `all-completions' no longer accepts a fourth argument, so we drop that arg in that case." (condition-case nil ; Emacs 23.2+ has no 4th parameter. (all-completions string collection predicate hide-spaces) (wrong-number-of-arguments (all-completions string collection predicate)))) (defun icicle-bounds-of-thing-at-point (thing &optional syntax-table) "`thingatpt+.el' version of `bounds-of-thing-at-point', if possible. `tap-bounds-of-thing-at-point' if defined, else `bounds-of-thing-at-point'. if non-nil, set SYNTAX-TABLE for the duration." (if (fboundp 'tap-bounds-of-thing-at-point) (tap-bounds-of-thing-at-point thing syntax-table) (if (and (fboundp 'with-syntax-table) (syntax-table-p syntax-table)) ; Emacs 21+. (with-syntax-table syntax-table (bounds-of-thing-at-point thing syntax-table)) (bounds-of-thing-at-point thing)))) ; Punt - ignore any SYNTAX-TABLE arg. (defun icicle-defaults-at-point () "Return default(s) obtained from things at/near point. For Emacs 23 and later, return a list of defaults (strings). For Emacs 22 and prior, return a single default (a string)." (cond ((car icicle-thing-at-point-functions) (if (> emacs-major-version 22) (mapcar #'funcall (car icicle-thing-at-point-functions)) (funcall (caar icicle-thing-at-point-functions)))) ((fboundp 'non-nil-symbol-name-nearest-point) (funcall #'non-nil-symbol-name-nearest-point)) ((icicle-thing-at-point 'symbol)) ((function-called-at-point)))) ;;(@* "Icicles functions - sort functions") ;;; Icicles functions - sort functions ------------------------------- (defun icicle-merge-saved-order-less-p (s1 s2) "String S1 has a lower index than S2 in current and saved candidates list." (let ((cs1 (icicle-position s1 icicle-completion-candidates)) (cs2 (icicle-position s2 icicle-completion-candidates)) (ss1 (icicle-position s1 icicle-saved-completion-candidates)) (ss2 (icicle-position s2 icicle-saved-completion-candidates)) len) (unless cs1 (error "`%s' is not currently a candidate" s1)) (unless cs2 (error "`%s' is not currently a candidate" s2)) (unless ss1 (setq ss1 (setq len (length icicle-saved-completion-candidates)))) (unless ss2 (setq ss2 (or len (length icicle-saved-completion-candidates)))) (< (+ cs1 ss1) (+ cs2 ss2)))) (defun icicle-historical-alphabetic-p (s1 s2) "Non-nil means S1 is a past input and S2 is not or S1 < S2 (alphabet). Return non-nil if S1 is a previous input and either S2 is not or S1 `icicle-case-string-less-p' S2. S1 and S2 must be strings. When used as a comparison function for completion candidates, this makes candidates matching previous inputs available first (at the top of buffer `*Completions*'). Candidates are effectively in two groups, each of which is sorted alphabetically separately: matching previous inputs, followed by matching candidates that have not yet been used." ;; We could use `icicle-delete-duplicates' to shorten the history, but that takes time too. ;; And, starting in Emacs 22, histories will not contain duplicates anyway. (let ((hist (and (symbolp minibuffer-history-variable) (boundp minibuffer-history-variable) (symbol-value minibuffer-history-variable))) (dir (and (icicle-file-name-input-p) (icicle-file-name-directory-w-default (or icicle-last-input icicle-current-input))))) (if (not (consp hist)) (icicle-case-string-less-p s1 s2) (when dir (setq s1 (expand-file-name s1 dir) s2 (expand-file-name s2 dir))) (let ((s1-previous-p (member s1 hist)) (s2-previous-p (member s2 hist))) (or (and (not s1-previous-p) (not s2-previous-p) (icicle-case-string-less-p s1 s2)) (and s1-previous-p (not s2-previous-p)) (and s1-previous-p s2-previous-p (icicle-case-string-less-p s1 s2))))))) ;; $$ Alternative definition, but it doesn't seem any faster, and is slightly less clear. ;; (defun icicle-most-recent-first-p (s1 s2) ;; "Non-nil means S1 was used more recently than S2. ;; Also: ;; S1 < S2 if S1 was used previously but S2 was not. ;; S1 < S2 if neither was used previously ;; and S1 `icicle-case-string-less-p' S2." ;; ;; We could use `icicle-delete-duplicates' to shorten the history, but that takes time too. ;; ;; And, starting in Emacs 22, histories will not contain duplicates anyway. ;; (let ((hist (and (symbolp minibuffer-history-variable) ;; (symbol-value minibuffer-history-variable))) ;; (dir (and (icicle-file-name-input-p) ;; (icicle-file-name-directory-w-default (or icicle-last-input icicle-current-input)))) ;; (s1-in-hist nil) ;; (s2-in-hist nil)) ;; (if (not (consp hist)) ;; (icicle-case-string-less-p s1 s2) ;; (when dir (setq s1 (expand-file-name s1 dir) s2 (expand-file-name s2 dir))) ;; (while (and hist (not (setq s1-in-hist (equal s1 (car hist))))) ;; (when (setq s2-in-hist (equal s2 (car hist))) (setq hist nil)) ;; (setq hist (cdr hist))) ;; (or (and hist s1-in-hist) (and (not s2-in-hist) (icicle-case-string-less-p s1 s2)))))) (defun icicle-most-recent-first-p (s1 s2) "Non-nil means S1 was used as input more recently than S2. Also: S1 < S2 if S1 was used as input previously but S2 was not. S1 < S2 if neither was used as input previously and S1 `icicle-case-string-less-p' S2." ;; We could use `icicle-delete-duplicates' to shorten the history, but that takes time too. ;; And, starting in Emacs 22, histories do not contain duplicates anyway. (let ((hist (and (symbolp minibuffer-history-variable) (boundp minibuffer-history-variable) (symbol-value minibuffer-history-variable))) (dir (and (icicle-file-name-input-p) (icicle-file-name-directory-w-default (or icicle-last-input icicle-current-input)))) (s1-tail ()) (s2-tail ())) (if (not (consp hist)) (icicle-case-string-less-p s1 s2) (when dir (setq s1 (expand-file-name s1 dir) s2 (expand-file-name s2 dir))) (setq s1-tail (member s1 hist) s2-tail (member s2 hist)) (cond ((and s1-tail s2-tail) (>= (length s1-tail) (length s2-tail))) (s1-tail t) (s2-tail nil) (t (icicle-case-string-less-p s1 s2)))))) (put 'icicle-buffer-smaller-p 'icicle-buffer-sort-predicate t) ;; This predicate is used for buffer-name completion. (defun icicle-buffer-smaller-p (b1 b2) "Non-nil means buffer named B1 is smaller than buffer named B2." (< (with-current-buffer b1 (buffer-size)) (with-current-buffer b2 (buffer-size)))) (put 'icicle-major-mode-name-less-p 'icicle-buffer-sort-predicate t) ;; This predicate is used for buffer-name completion. (defun icicle-major-mode-name-less-p (b1 b2) "Non-nil means major mode name of buffer B1 is `string-less-p' that of B2. If those names are identical, then buffer names are compared. Comparison is not case-sensitive." (let ((bm1 (icicle-upcase (symbol-name (with-current-buffer b1 major-mode)))) (bm2 (icicle-upcase (symbol-name (with-current-buffer b2 major-mode))))) (if (string= bm1 bm2) (string-lessp b1 b2) (string-lessp bm1 bm2)))) (when (fboundp 'format-mode-line) ; Emacs 22+ (put 'icicle-mode-line-name-less-p 'icicle-buffer-sort-predicate t) ;; This predicate is used for buffer-name completion. (defun icicle-mode-line-name-less-p (b1 b2) "Non-nil means buffer B1 mode in mode line is `string-less-p' that of B2. If those names are identical, then buffer names are compared. Comparison is not case-sensitive." (let ((bm1 (icicle-upcase (with-current-buffer b1 (format-mode-line mode-name)))) (bm2 (icicle-upcase (with-current-buffer b2 (format-mode-line mode-name))))) (if (string= bm1 bm2) (string-lessp b1 b2) (string-lessp bm1 bm2))))) (put 'icicle-buffer-file/process-name-less-p 'icicle-buffer-sort-predicate t) ;; This predicate is used for buffer-name completion. (defun icicle-buffer-file/process-name-less-p (b1 b2) "Non-nil means file/process name of buffer B1 is `string-less-p' that of B2. The absolute file name of a buffer is used, not the relative name. Comparison is case-insensitive on systems where file-name case is insignificant. Buffers not associated with files or processes are sorted last." (setq b1 (get-buffer b1) b2 (get-buffer b2)) (let ((fp-b1 (or (buffer-file-name b1) (let ((pb1 (get-buffer-process b1))) (and (processp pb1) (process-name pb1))))) (fp-b2 (or (buffer-file-name b2) (let ((pb2 (get-buffer-process b2))) (and (processp pb2) (process-name pb2)))))) (and fp-b1 (or (not fp-b2) (if (memq system-type '(ms-dos windows-nt cygwin)) (string-lessp (icicle-upcase fp-b1) (icicle-upcase fp-b2)) (string-lessp fp-b1 fp-b2)))))) (put 'icicle-file-type-less-p 'icicle-file-name-sort-predicate t) ;; This predicate is used for file-name completion. (defun icicle-file-type-less-p (s1 s2) "Non-nil means type of file S1 is less than that of S2, or S1 < S2 (alpha). A directory has a lower file type than a non-directory. The type of a non-directory is its extension. Extensions are compared alphabetically. If not doing file-name completion, then this is the same as `icicle-case-string-less-p'." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (let ((s1-dir-p (icicle-file-directory-p s1)) (s2-dir-p (icicle-file-directory-p s2))) (cond ((and s1-dir-p s2-dir-p) (icicle-case-string-less-p s1 s2)) ; Both are dirs, so alpha. ((not (or s1-dir-p s2-dir-p)) ; Neither is a dir. Compare extensions. (let ((es1 (file-name-extension s1 t)) (es2 (file-name-extension s2 t))) (if (string= es1 es2) ; If extensions the same, then compare file names. (icicle-case-string-less-p s1 s2) (icicle-case-string-less-p es1 es2)))) (s1-dir-p))) ; Directories come before files. (icicle-case-string-less-p s1 s2))) (put 'icicle-dirs-first-p 'icicle-file-name-sort-predicate t) ;; This predicate is used for file-name completion. (defun icicle-dirs-first-p (s1 s2) "Non-nil means S1 is a dir and S2 a file, or S1 < S2 (alphabet). If not doing file-name completion, then this is the same as `icicle-case-string-less-p'." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (let ((s1-dir-p (icicle-file-directory-p s1)) (s2-dir-p (icicle-file-directory-p s2))) (if (or (and s1-dir-p s2-dir-p) ; Both or neither are directories. (not (or s1-dir-p s2-dir-p))) (icicle-case-string-less-p s1 s2) ; Compare equals. s1-dir-p)) ; Directories come before files. (icicle-case-string-less-p s1 s2))) (put 'icicle-dirs-last-p 'icicle-file-name-sort-predicate t) ;; This predicate is used for file-name completion. (defun icicle-dirs-last-p (s1 s2) "Non-nil means S1 is a file and S2 a dir, or S1 < S2 (alphabet). If not doing file-name completion, then this is the same as `icicle-case-string-less-p'." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (let ((s1-dir-p (icicle-file-directory-p s1)) (s2-dir-p (icicle-file-directory-p s2))) (if (or (and s1-dir-p s2-dir-p) ; Both or neither are directories. (not (or s1-dir-p s2-dir-p))) (icicle-case-string-less-p s1 s2) ; Compare equals. s2-dir-p)) ; Files come before directories. (icicle-case-string-less-p s1 s2))) (put 'icicle-2nd-part-string-less-p 'icicle-multi-completion-sort-predicate t) ;; This predicate is used for multi-completion. (defun icicle-2nd-part-string-less-p (s1 s2) "`icicle-case-string-less-p' for second parts, then for first parts. S1 and S2 are multi-completion strings. Returns non-nil if either of these is true: * The second parts of S1 and S2 are the equivalent and the first part of S1 comes before the first part of S2, alphabetically. * The second part of S1 comes before the second part of S2, alphabetically. Alphabetical comparison is done using `icicle-case-string-less-p'." (let* ((icicle-list-use-nth-parts '(2)) (s1-2nd (icicle-transform-multi-completion s1)) (s2-2nd (icicle-transform-multi-completion s2))) (or (icicle-case-string-less-p s1-2nd s2-2nd) (and (string= s1-2nd s2-2nd) (let* ((icicle-list-use-nth-parts '(1)) (s1-1st (icicle-transform-multi-completion s1)) (s2-1st (icicle-transform-multi-completion s2)))))))) (put 'icicle-last-accessed-first-p 'icicle-file-name-sort-predicate t) ;; This predicate is used for file-name completion. (defun icicle-last-accessed-first-p (s1 s2) "Non-nil means file S1 was last accessed after S2 was. If not doing file-name completion, then this is the same as `icicle-case-string-less-p'." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (let ((acc-date1 (nth 4 (file-attributes s1))) (acc-date2 (nth 4 (file-attributes s2)))) (or (< (car acc-date2) (car acc-date1)) ; High-order bits. (and (= (car acc-date2) (car acc-date1)) ; Low-order bits. (< (cadr acc-date2) (cadr acc-date1))))) (icicle-case-string-less-p s1 s2))) (put 'icicle-last-modified-first-p 'icicle-file-name-sort-predicate t) ;; This predicate is used for file-name completion. (defun icicle-last-modified-first-p (s1 s2) "Non-nil means file S1 was last modified after S2 was. If not doing file-name completion, then this is the same as `icicle-case-string-less-p'." (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (let ((mod-date1 (nth 5 (file-attributes s1))) (mod-date2 (nth 5 (file-attributes s2)))) (or (< (car mod-date2) (car mod-date1)) ; High-order bits. (and (= (car mod-date2) (car mod-date1)) ; Low-order bits. (< (cadr mod-date2) (cadr mod-date1))))) (icicle-case-string-less-p s1 s2))) (put 'icicle-command-abbrev-used-more-p 'icicle-command-sort-predicate t) ;; This predicate is used for command and abbreviation completion. (defun icicle-command-abbrev-used-more-p (s1 s2) "Return non-nil if S1 was invoked more often than S2 via an abbrev. S1 and S2 are strings naming commands. If neither was invoked or both were invoked the same number of times, then return non-nil if S1 is `string-lessp' S2." (let* ((alist-tails (mapcar #'cdr icicle-command-abbrev-alist)) (s1-entry (assq (intern s1) alist-tails)) (s2-entry (assq (intern s2) alist-tails))) (if (and (not s1-entry) (not s2-entry)) (string-lessp s1 s2) (let ((s1-rank (elt s1-entry 1)) (s2-rank (elt s2-entry 1))) (cond ((and (not s1-rank) (not s2-rank)) (string-lessp s1 s2)) ((and s1-rank s2-rank (eq s1-rank s2-rank)) (string-lessp s1 s2)) (t (>= (or s1-rank 0) (or s2-rank 0)))))))) (defun icicle-part-N-lessp (n s1 s2) "`icicle-case-string-less-p' applied to the Nth parts of S1 and S2. The strings each have at least N parts, separated by `icicle-list-join-string'. Parts other than the Nth are ignored. Return non-nil if and only if the Nth part of S1 is less than the Nth part of S2. The Nth parts are compared lexicographically without regard to letter case. N is one-based, so a value of 1 means compare the first parts." (unless (and (wholenump n) (> n 0)) (error "`icicle-part-N-lessp': N must be > 0")) (let ((case-fold-search t) (part-N-s1 (elt (split-string s1 icicle-list-join-string) (1- n))) (part-N-s2 (elt (split-string s2 icicle-list-join-string) (1- n)))) (and part-N-s1 part-N-s2 ; In case strings were not multipart. (icicle-case-string-less-p part-N-s1 part-N-s2)))) (defun icicle-part-1-lessp (s1 s2) "`icicle-part-N-lessp', with N = 1." (icicle-part-N-lessp 1 s1 s2)) (defun icicle-part-2-lessp (s1 s2) "`icicle-part-N-lessp', with N = 2." (icicle-part-N-lessp 2 s1 s2)) (defun icicle-part-3-lessp (s1 s2) "`icicle-part-N-lessp', with N = 3." (icicle-part-N-lessp 3 s1 s2)) (defun icicle-part-4-lessp (s1 s2) "`icicle-part-N-lessp', with N = 4." (icicle-part-N-lessp 4 s1 s2)) (defun icicle-cdr-lessp (s1 s2) "Non-nil means the cdr of S1's entry < the cdr of S2's entry. Entry here means the complete alist element candidate that corresponds to the displayed candidate (string) S1 or S2. Returns nil if comparing the cdrs using `<' would raise an error." (condition-case nil (< (cdr (funcall icicle-get-alist-candidate-function s1)) (cdr (funcall icicle-get-alist-candidate-function s2))) (error nil))) (defun icicle-part-1-cdr-lessp (s1 s2) "First part and cdr of S1 are less than those of S2." (or (icicle-part-1-lessp s1 s2) (and (not (icicle-part-1-lessp s2 s1)) (icicle-cdr-lessp s1 s2)))) ;; This predicate is used for color completion. (defun icicle-color-rgb-lessp (s1 s2) "Non-nil means the RGB components of S1 are less than those of S2. Specifically, the red components are compared first, then if they are equal the blue components are compared, then if those are also equal the green components are compared. The strings are assumed to have at least two parts, with the parts separated by `icicle-list-join-string' The second parts of the strings are RGB triplets that start with `#'." (icicle-part-2-lessp s1 s2)) ; Just compare lexicographically. ;; This predicate is used for key completion. (defun icicle-prefix-keys-first-p (s1 s2) "Non-nil if S1 is a prefix key and S2 is not or S1 < S2 (alphabet). For this function, a prefix key is represented by a string that ends in \"...\". When used as a comparison function for completion candidates, this makes prefix keys that match your input available first (at the top of buffer `*Completions*'). Candidates are effectively in two groups, each of which is sorted alphabetically separately: prefix keys, followed by non-prefix keys. Letter case is ignored. The special key representation \"..\" is, however, less than all other keys, including prefix keys." (let* ((prefix-string " = \\.\\.\\.$") (parent-string "..") (s1-prefix-p (save-match-data (string-match prefix-string s1))) (s2-prefix-p (save-match-data (string-match prefix-string s2))) (completion-ignore-case t)) (and (not (string= parent-string s2)) (or (string= parent-string s1) (and (not s1-prefix-p) (not s2-prefix-p) (icicle-case-string-less-p s1 s2)) (and s1-prefix-p (not s2-prefix-p)) (and s1-prefix-p s2-prefix-p (icicle-case-string-less-p s1 s2)))))) ;; This predicate is used for key completion. (defun icicle-local-keys-first-p (s1 s2) "Non-nil if S1 is a local key and S2 is not or S1 < S2 (alphabet). For this function, a local key is highlighted as a special candidate. When used as a comparison function for completion candidates, this makes local keys that match your input available first (at the top of buffer `*Completions*'). Candidates are effectively in two groups, each of which is sorted alphabetically separately: local keys, followed by non-prefix keys. Letter case is ignored. The special key representation \"..\" is, however, less than all other keys, including local keys." (or (string= ".." s1) (and (not (string= ".." s2)) (icicle-special-candidates-first-p s1 s2)))) ;; This predicate is used for key completion. (defun icicle-command-names-alphabetic-p (s1 s2) "Non-nil if command name of S1 `icicle-case-string-less-p' that of S2. When used as a comparison function for completion candidates, this assumes that each candidate, S1 and S2, is composed of a key name followed by \" = \", followed by the corresponding command name." (let ((icicle-list-join-string " = ")) ; Fake a multi-completion. Candidate is key = cmd. (icicle-part-2-lessp s1 s2))) (defun icicle-special-candidates-first-p (s1 s2) "Non-nil if S1 is special candidate and S2 is not or S1 "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Macros") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, ;; Fifth Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;; Byte-compiling this file, you will likely get some error or warning ;; messages. All of the following are benign. They are due to ;; differences between different versions of Emacs. ;; ;; Compiling in Emacs 20: ;; ;; the function x-focus-frame is not known to be defined. (eval-when-compile (require 'cl)) ;; incf, plus for Emacs < 21: dolist, push ;; Quiet the byte compiler for Emacs versions before 22. For some reason, a value is required. (unless (boundp 'minibuffer-completing-symbol) (defvar minibuffer-completing-symbol nil) (defvar minibuffer-message-timeout 2) (defvar minibuffer-prompt-properties nil)) ;; Quiet the byte-compiler. (defvar icicle-inhibit-try-switch-buffer) (defvar read-file-name-completion-ignore-case) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Macros") ;;; Macros ----------------------------------------------------------- ;; $$$$$$ ;; Same as vanilla `condition-case-no-debug', which is available starting with Emacs 23. ;; (defmacro icicle-condition-case-no-debug (var bodyform &rest handlers) ;; "Like `condition-case', but does not catch anything when debugging. ;; Specifically, non-nil `debug-on-error' means catch no signals. ;; This is the same as `condition-case-no-debug': added to use in older ;; Emacs versions too." ;; (let ((bodysym (make-symbol "body"))) ;; `(let ((,bodysym (lambda () ,bodyform))) ;; (if debug-on-error ;; (funcall ,bodysym) ;; (condition-case ,var ;; (funcall ,bodysym) ;; ,@handlers))))) ;; Same definition as in `icicles-fn.el'. (defun icicle-remove-if (pred xs) "A copy of list XS with no elements that satisfy predicate PRED." (let ((result ())) (dolist (x xs) (unless (funcall pred x) (push x result))) (nreverse result))) ;; Same definition as in `icicles-fn.el'. (defun icicle-assoc-delete-all (key alist) "Delete from ALIST all elements whose car is `equal' to KEY. Return the modified alist. Elements of ALIST that are not conses are ignored." (while (and (consp (car alist)) (equal (car (car alist)) key)) (setq alist (cdr alist))) (let ((tail alist) tail-cdr) (while (setq tail-cdr (cdr tail)) (if (and (consp (car tail-cdr)) (equal (car (car tail-cdr)) key)) (setcdr tail (cdr tail-cdr)) (setq tail tail-cdr)))) alist) (defmacro icicle-condition-case-no-debug (var bodyform &rest handlers) "Like `condition-case', but do not catch per `debug-on-(error|quit)'. If both `debug-on-error' and `debug-on-quit' are non-nil, then handle only other signals - enter the debugger for errors and `C-g'. If `debug-on-error' is non-nil and `debug-on-quit' is nil, then handle all signals except errors that would be caught by an `error' handler. Enter the debugger on such errors. If `debug-on-quit' is non-nil and `debug-on-error' is nil, then handle all signals except quitting. Enter the debugger on quit (`C-g'). NOTE: 1. This does not treat `error' and `quit' handlers specially when they are in a list that is the car of a handler. In such a case the handler remains in effect in spite of the values of `debug-on-(error|quit)'. 2. Only errors that would be caught by an `error' handler (if one were present) enter the debugger when `debug-on-error' is non-nil. When a specific error handler (e.g. `arith-error') is present, it still handles such an error - the debugger is not entered just because `debug-on-error' is non-nil." (let ((bodysym (make-symbol "body"))) `(let ((,bodysym (lambda () ,bodyform))) (cond ((and debug-on-error debug-on-quit) (condition-case ,var (funcall ,bodysym) ,@(icicle-remove-if (lambda (hh) (memq (car hh) '(error quit))) handlers))) (debug-on-error (condition-case ,var (funcall ,bodysym) ,@(icicle-remove-if (lambda (hh) (eq (car hh) 'error)) handlers))) (debug-on-quit (condition-case ,var (funcall ,bodysym) ,@(icicle-remove-if (lambda (hh) (eq (car hh) 'quit)) handlers))) (t (condition-case ,var (funcall ,bodysym) ,@handlers)))))) (if (fboundp 'with-selected-window) ; Emacs 22+ (defalias 'icicle-with-selected-window (symbol-function 'with-selected-window)) (defmacro icicle-with-selected-window (window &rest body) "Execute the forms in BODY with WINDOW as the selected window. The value returned is the value of the last form in BODY. This macro saves and restores the selected window, as well as the selected window of each frame. It does not change the order of recently selected windows. If the previously selected window of some frame is no longer live at the end of BODY, that frame's selected window is left alone. If the selected window is no longer live, then whatever window is selected at the end of BODY remains selected. This macro uses `save-current-buffer' to save and restore the current buffer, since otherwise its normal operation could potentially make a different buffer current. It does not alter the buffer list ordering." ;; Most of this code is a copy of save-selected-window. `(let ((save-selected-window-window (selected-window)) ;; It is necessary to save all of these, because calling ;; select-window changes frame-selected-window for whatever ;; frame that window is in. (save-selected-window-alist (mapcar (lambda (frame) (list frame (frame-selected-window frame))) (frame-list)))) (save-current-buffer (unwind-protect (progn (if (> emacs-major-version 21) (select-window ,window 'norecord) ; Emacs 22+ (select-window ,window)) ,@body) (dolist (elt save-selected-window-alist) (and (frame-live-p (car elt)) (window-live-p (cadr elt)) (if (> emacs-major-version 22) (set-frame-selected-window (car elt) (cadr elt) 'norecord) ; Emacs 23+ (set-frame-selected-window (car elt) (cadr elt))))) (when (window-live-p save-selected-window-window) (if (> emacs-major-version 21) (select-window save-selected-window-window 'norecord) ; Emacs 22+ (select-window save-selected-window-window)))))))) (defmacro icicle-user-error (&rest args) "`user-error' if defined, otherwise `error'." `(if (fboundp 'user-error) (user-error ,@args) (error ,@args))) (defmacro icicle-define-add-to-alist-command (command doc-string construct-item-fn alist-var &optional dont-save) "Define COMMAND that adds an item to an alist user option. Any items with the same key are first removed from the alist. DOC-STRING is the doc string of COMMAND. CONSTRUCT-ITEM-FN is a function that constructs the new item. It reads user input. ALIST-VAR is the alist user option. Optional arg DONT-SAVE non-nil means do not call `customize-save-variable' to save the updated variable." `(defun ,command () ,(concat doc-string "\n\nNote: Any items with the same key are first removed from the alist.") (interactive) (let ((new-item (funcall ,construct-item-fn))) (setq ,alist-var (icicle-assoc-delete-all (car new-item) ,alist-var)) (push new-item ,alist-var) ,(unless dont-save `(customize-save-variable ',alist-var ,alist-var)) (message "Added to `%s': `%S'" ',alist-var new-item)))) (defmacro icicle-buffer-bindings (&optional pre-bindings post-bindings) "Bindings to use in multi-command definitions for buffer names. PRE-BINDINGS is a list of additional bindings, which are created before the others. POST-BINDINGS is similar, but the bindings are created after the others." ;; Use `append' rather than backquote syntax (with ,@post-bindings in particular) because of a bug ;; in Emacs 20. This ensures that you can byte-compile in, say, Emacs 20 and still use the result ;; in later Emacs releases. `,(append pre-bindings `((icicle-buffer-name-input-p t) ; But must also be non-nil for non multi-commands. (icicle-buffer-complete-fn (and (fboundp 'internal-complete-buffer) 'internal-complete-buffer)) (completion-ignore-case (or (and (boundp 'read-buffer-completion-ignore-case) read-buffer-completion-ignore-case) completion-ignore-case)) (icicle-show-Completions-initially-flag (or icicle-show-Completions-initially-flag icicle-buffers-ido-like-flag)) (icicle-top-level-when-sole-completion-flag (or icicle-top-level-when-sole-completion-flag icicle-buffers-ido-like-flag)) (icicle-default-value (if (and icicle-buffers-ido-like-flag icicle-default-value) icicle-buffers-ido-like-flag icicle-default-value)) (icicle-must-match-regexp icicle-buffer-match-regexp) (icicle-must-not-match-regexp icicle-buffer-no-match-regexp) (icicle-must-pass-after-match-predicate icicle-buffer-predicate) (icicle-require-match-flag icicle-buffer-require-match-flag) (icicle-extra-candidates icicle-buffer-extras) (icicle-delete-candidate-object 'icicle-kill-a-buffer) ; `S-delete' kills current buf (icicle-transform-function 'icicle-remove-dups-if-extras) (icicle--temp-orders (append (list '("by last display time") ; Renamed from "turned OFF'. '("*...* last" . icicle-buffer-sort-*...*-last) '("by buffer size" . icicle-buffer-smaller-p) '("by major mode name" . icicle-major-mode-name-less-p) (and (fboundp 'icicle-mode-line-name-less-p) '("by mode-line mode name" . icicle-mode-line-name-less-p)) '("by file/process name" . icicle-buffer-file/process-name-less-p)) (delete '("turned OFF") (copy-sequence icicle-sort-orders-alist)))) ;; Put `icicle-buffer-sort' first. If already in the list, move it, else add it, to beginning. (icicle-sort-orders-alist (progn (when (and icicle-buffer-sort-first-time-p icicle-buffer-sort) (setq icicle-sort-comparer icicle-buffer-sort icicle-buffer-sort-first-time-p nil)) (if icicle-buffer-sort (let ((already-there (rassq icicle-buffer-sort icicle--temp-orders))) (if already-there (cons already-there (setq icicle--temp-orders (delete already-there icicle--temp-orders))) (cons `("by `icicle-buffer-sort'" . ,icicle-buffer-sort) icicle--temp-orders))) icicle--temp-orders))) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "buffer"))) (icicle-bufflist (if (eq 'use-default icicle-buffer-prefix-arg-filtering) (if (not current-prefix-arg) (buffer-list) (cond ((and (consp current-prefix-arg) (> (prefix-numeric-value current-prefix-arg) 16)) ; `C-u C-u C-u' (icicle-remove-if (lambda (bf) (get-buffer-window bf 0)) (buffer-list))) ((and (consp current-prefix-arg) (> (prefix-numeric-value current-prefix-arg) 4)) ; `C-u C-u' (icicle-remove-if-not (lambda (bf) (get-buffer-window bf 0)) (buffer-list))) ((and (consp current-prefix-arg) (fboundp 'derived-mode-p)) ; `C-u' (icicle-remove-if-not (lambda (bf) (derived-mode-p (with-current-buffer bf major-mode))) (buffer-list))) ((zerop (prefix-numeric-value current-prefix-arg)) ; `C-0' (let ((this-mode major-mode)) (icicle-remove-if-not `(lambda (bf) (with-current-buffer bf (eq major-mode ',this-mode))) (buffer-list)))) ((< (prefix-numeric-value current-prefix-arg) 0) ; `C--' (cdr (assq 'buffer-list (frame-parameters)))) (t ; `C-1' (icicle-remove-if-not (lambda (bf) (or (buffer-file-name bf) (with-current-buffer bf (eq major-mode 'dired-mode)))) (buffer-list))))) (catch 'icicle-buffer-bindings (dolist (entry icicle-buffer-prefix-arg-filtering) (when (funcall (car entry) current-prefix-arg) (throw 'icicle-buffer-bindings (if (cdr entry) (icicle-remove-if (cdr entry) (buffer-list)) (buffer-list))))) (buffer-list)))) (icicle-bufflist (icicle-remove-if (lambda (bf) (icicle-string-match-p "^ [*]Minibuf-[0-9]" (buffer-name bf))) icicle-bufflist))) post-bindings)) (defmacro icicle-file-bindings (&optional pre-bindings post-bindings) "Bindings to use in multi-command definitions for file names. PRE-BINDINGS is a list of additional bindings, which are created before the others. POST-BINDINGS is similar, but the bindings are created after the others." ;; We use `append' rather than backquote syntax (with ,@post-bindings in particular) because of a bug ;; in Emacs 20. This ensures that you can byte-compile in, say, Emacs 20 and still use the result ;; in later Emacs releases. `,(append pre-bindings `((completion-ignore-case (or (and (boundp 'read-file-name-completion-ignore-case) read-file-name-completion-ignore-case) completion-ignore-case)) (icicle-show-Completions-initially-flag (or icicle-show-Completions-initially-flag icicle-files-ido-like-flag)) (icicle-top-level-when-sole-completion-flag (or icicle-top-level-when-sole-completion-flag icicle-files-ido-like-flag)) (icicle-default-value (if (and icicle-files-ido-like-flag icicle-default-value) icicle-files-ido-like-flag ;; Get default via `M-n', but do not insert it. (and (memq icicle-default-value '(t nil)) icicle-default-value))) (icicle-must-match-regexp icicle-file-match-regexp) (icicle-must-not-match-regexp icicle-file-no-match-regexp) (icicle-must-pass-after-match-predicate icicle-file-predicate) (icicle-require-match-flag icicle-file-require-match-flag) (icicle-extra-candidates icicle-file-extras) (icicle-transform-function 'icicle-remove-dups-if-extras) ;; Put `icicle-file-sort' first. If already in the list, move it, else add it, to beginning. (icicle--temp-orders (copy-sequence icicle-sort-orders-alist)) (icicle-sort-orders-alist (progn (when (and icicle-file-sort-first-time-p icicle-file-sort) (setq icicle-sort-comparer icicle-file-sort icicle-file-sort-first-time-p nil)) (if icicle-file-sort (let ((already-there (rassq icicle-file-sort icicle--temp-orders))) (if already-there (cons already-there (setq icicle--temp-orders (delete already-there icicle--temp-orders))) (cons `("by `icicle-file-sort'" ,@icicle-file-sort) icicle--temp-orders))) icicle--temp-orders))) (icicle-candidate-help-fn (lambda (cand) (icicle-describe-file cand current-prefix-arg t))) (icicle-candidate-alt-action-fn (or icicle-candidate-alt-action-fn (icicle-alt-act-fn-for-type "file"))) (icicle-all-candidates-list-alt-action-fn (or icicle-all-candidates-list-alt-action-fn (icicle-alt-act-fn-for-type "file"))) (icicle-delete-candidate-object 'icicle-delete-file-or-directory)) post-bindings)) (defmacro icicle-define-command (command doc-string function prompt collection &optional predicate require-match initial-input hist def inherit-input-method bindings first-sexp undo-sexp last-sexp not-interactive-p) ;; Hard-code these in doc string, because \\[...] prefers ASCII ;; `C-return' instead of `\\[icicle-candidate-action]' ;; `C-down' instead of `\\[icicle-next-candidate-per-mode-action]' ;; `C-up', `C-wheel-up' instead of `\\[icicle-previous-candidate-per-mode-action]' ;; `C-next' instead of `\\[icicle-next-apropos-candidate-action]' ;; `C-prior' instead of `\\[icicle-previous-apropos-candidate-action]' ;; `C-end' instead of `\\[icicle-next-prefix-candidate-action]' ;; `C-home' instead of `\\[icicle-previous-prefix-candidate-action]' "Define COMMAND with DOC-STRING based on FUNCTION. COMMAND is a symbol. DOC-STRING is a string. FUNCTION is a function that takes one argument, read as input. (If the argument to FUNCTION is a file name or directory name, then use macro `icicle-define-file-command', instead.) BINDINGS is a list of `let*' bindings added around the command code. The following bindings are pre-included - you can refer to them in the command body (including in FIRST-SEXP, LAST-SEXP, UNDO-SEXP). `icicle-orig-buff' is bound to (current-buffer) `icicle-orig-window' is bound to (selected-window) BINDINGS is macroexpanded, so it can also be a macro call that expands to a list of bindings. For example, you can use `icicle-buffer-bindings' here. In case of user quit (`C-g') or error, an attempt is made to restore the original buffer. FIRST-SEXP is a sexp evaluated before the main body of the command. UNDO-SEXP is a sexp evaluated in case of error or if the user quits. LAST-SEXP is a sexp evaluated after the main body of the command. It is always evaluated, in particular, even in case of error or quit. NOT-INTERACTIVE-P non-nil means to define COMMAND as a non-interactive function that reads multi-command input. Other arguments are as for `completing-read'. In order, the created command does this: - Uses DOC-STRING, with information about Icicles bindings appended. - Binds BINDINGS for the rest of the command. - Evaluates FIRST-SEXP. - Reads input with `completing-read', using PROMPT, COLLECTION, PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF, and INHERIT-INPUT-METHOD. - Calls FUNCTION on the input that was read. - Evaluates UNDO-SEXP in case of error or if the user quits. - Evaluates LAST-SEXP. The created command also binds `icicle-candidate-action-fn' to a function that calls FUNCTION on the current completion candidate. Note that the BINDINGS are of course not in effect within `icicle-candidate-action-fn'." `(defun ,command () ,(concat doc-string "\n\nRead input, then " (and (symbolp function) (concat "call `" (symbol-name function) "'\nto ")) "act on it. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active: \\\ `C-mouse-2', `C-return' - Act on current completion candidate only `C-down', `C-wheel-down' - Move to next completion candidate and act `C-up', `C-wheel-up' - Move to previous completion candidate and act `C-next' - Move to next apropos-completion candidate and act `C-prior' - Move to previous apropos-completion candidate and act `C-end' - Move to next prefix-completion candidate and act `C-home' - Move to previous prefix-completion candidate and act `\\[icicle-all-candidates-action]' - Act on *all* candidates, successively (careful!) When candidate action and cycling are combined (e.g. `C-next'), user option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `C-M-RET', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'.") ,(and (not not-interactive-p) '(interactive)) (let* ((icicle-orig-buff (current-buffer)) (icicle-orig-window (selected-window)) ,@(macroexpand bindings) (icicle-candidate-action-fn (lambda (candidate) (let ((minibuffer-completion-table minibuffer-completion-table) (minibuffer-completion-predicate minibuffer-completion-predicate) (minibuffer-completion-confirm minibuffer-completion-confirm) (minibuffer-completing-file-name minibuffer-completing-file-name) (minibuffer-completing-symbol (and (boundp 'minibuffer-completing-symbol) minibuffer-completing-symbol)) (minibuffer-exit-hook minibuffer-exit-hook) (minibuffer-help-form minibuffer-help-form) (minibuffer-history-variable minibuffer-history-variable) (minibuffer-history-case-insensitive-variables minibuffer-history-case-insensitive-variables) (minibuffer-history-sexp-flag minibuffer-history-sexp-flag) (minibuffer-message-timeout (and (boundp 'minibuffer-message-timeout) minibuffer-message-timeout)) (minibuffer-prompt-properties (and (boundp 'minibuffer-prompt-properties) minibuffer-prompt-properties)) (minibuffer-setup-hook minibuffer-setup-hook) (minibuffer-text-before-history minibuffer-text-before-history)) (icicle-condition-case-no-debug in-action-fn ;; Treat 3 cases, because previous use of `icicle-candidate-action-fn' ;; might have killed the buffer or deleted the window. (cond ((and (buffer-live-p icicle-orig-buff) (window-live-p icicle-orig-window)) (with-current-buffer icicle-orig-buff (save-selected-window (select-window icicle-orig-window) (funcall #',function candidate)))) ((window-live-p icicle-orig-window) (save-selected-window (select-window icicle-orig-window) (funcall #',function candidate))) (t (funcall #',function candidate))) (error (unless (string= "Cannot switch buffers in minibuffer window" (error-message-string in-action-fn)) (error "%s" (error-message-string in-action-fn))) (when (window-live-p icicle-orig-window) (select-window icicle-orig-window) (select-frame-set-input-focus (selected-frame))) (funcall #',function candidate))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) nil)))) ; Return nil for success. ,first-sexp (icicle-condition-case-no-debug act-on-choice (let ((cmd-choice (if icicle-buffer-name-input-p (icicle-read-buffer ,prompt ,def ,require-match) (completing-read ,prompt ,collection ,predicate ,require-match ,initial-input ,hist ,def ,inherit-input-method)))) ;; Reset after reading input, so that commands can tell whether input has been read. (setq icicle-candidate-action-fn nil) (funcall #',function cmd-choice)) (quit (icicle-try-switch-buffer icicle-orig-buff) ,undo-sexp) (error (icicle-try-switch-buffer icicle-orig-buff) ,undo-sexp (error "%s" (error-message-string act-on-choice)))) ,last-sexp))) (defmacro icicle-define-file-command (command doc-string function prompt &optional dir default-filename require-match initial-input predicate bindings first-sexp undo-sexp last-sexp not-interactive-p) ;; Hard-code these in doc string, because \\[...] prefers ASCII ;; `C-return' instead of `\\[icicle-candidate-action]' ;; `C-down' instead of `\\[icicle-next-candidate-per-mode-action]' ;; `C-up', `C-wheel-up' instead of `\\[icicle-previous-candidate-per-mode-action]' ;; `C-next' instead of `\\[icicle-next-apropos-candidate-action]' ;; `C-prior' instead of `\\[icicle-previous-apropos-candidate-action]' ;; `C-end' instead of `\\[icicle-next-prefix-candidate-action]' ;; `C-home' instead of `\\[icicle-previous-prefix-candidate-action]' "Define COMMAND with DOC-STRING based on FUNCTION. COMMAND is a symbol. DOC-STRING is a string. FUNCTION is a function that takes one file-name or directory-name argument, read as input. (Use macro `icicle-define-command' for a FUNCTION whose argument is not a file or directory name.) BINDINGS is a list of `let*' bindings added around the command code. The following bindings are pre-included - you can refer to them in the command body (including in FIRST-SEXP, LAST-SEXP, UNDO-SEXP). `icicle-orig-buff' is bound to (current-buffer) `icicle-orig-window' is bound to (selected-window) BINDINGS is macroexpanded, so it can also be a macro call that expands to a list of bindings. For example, you can use `icicle-buffer-bindings' or `icicle-file-bindings' here. In case of user quit (`C-g') or error, an attempt is made to restore the original buffer. FIRST-SEXP is a sexp evaluated before the main body of the command. UNDO-SEXP is a sexp evaluated in case of error or if the user quits. LAST-SEXP is a sexp evaluated after the main body of the command. It is always evaluated, in particular, even in case of error or quit. NOT-INTERACTIVE-P non-nil means to define COMMAND as a non-interactive function that reads multi-command input. Other arguments are as for `read-file-name'. In order, the created command does this: - Uses DOC-STRING, with information about Icicles bindings appended. - Binds BINDINGS for the rest of the command. - Evaluates FIRST-SEXP. - Reads input with `read-file-name', using PROMPT, DIR, DEFAULT-FILENAME, REQUIRE-MATCH, INITIAL-INPUT, and PREDICATE. - Calls FUNCTION on the input that was read. - Evaluates UNDO-SEXP in case of error or if the user quits. - Evaluates LAST-SEXP. The created command also binds `icicle-candidate-action-fn' to a function that calls FUNCTION on the current completion candidate. Note that the BINDINGS are of course not in effect within `icicle-candidate-action-fn'." `(defun ,command () ,(concat doc-string "\n\nRead input, then " (and (symbolp function) (concat "call `" (symbol-name function) "'\nto ")) "act on it. Input-candidate completion and cycling are available. While cycling, these keys with prefix `C-' are active: \\\ `C-mouse-2', `C-return' - Act on current completion candidate only `C-down', `C-wheel-down' - Move to next completion candidate and act `C-up', `C-wheel-up' - Move to previous completion candidate and act `C-next' - Move to next apropos-completion candidate and act `C-prior' - Move to previous apropos-completion candidate and act `C-end' - Move to next prefix-completion candidate and act `C-home' - Move to previous prefix-completion candidate and act `\\[icicle-all-candidates-action]' - Act on *all* candidates, successively (careful!) When candidate action and cycling are combined (e.g. `C-next'), user option `icicle-act-before-cycle-flag' determines which occurs first. With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2', `C-M-RET', `C-M-down', and so on) provide help about candidates. Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or `C-g' to quit. This is an Icicles command - see command `icicle-mode'.") ,(and (not not-interactive-p) '(interactive)) (let* ((icicle-orig-buff (current-buffer)) (icicle-orig-window (selected-window)) ,@(macroexpand bindings) (icicle-candidate-action-fn (lambda (candidate) (let ((minibuffer-completion-table minibuffer-completion-table) (minibuffer-completion-predicate minibuffer-completion-predicate) (minibuffer-completion-confirm minibuffer-completion-confirm) (minibuffer-completing-file-name minibuffer-completing-file-name) (minibuffer-completing-symbol (and (boundp 'minibuffer-completing-symbol) minibuffer-completing-symbol)) (minibuffer-exit-hook minibuffer-exit-hook) (minibuffer-help-form minibuffer-help-form) (minibuffer-history-variable minibuffer-history-variable) (minibuffer-history-case-insensitive-variables minibuffer-history-case-insensitive-variables) (minibuffer-history-sexp-flag minibuffer-history-sexp-flag) (minibuffer-message-timeout (and (boundp 'minibuffer-message-timeout) minibuffer-message-timeout)) (minibuffer-prompt-properties (and (boundp 'minibuffer-prompt-properties) minibuffer-prompt-properties)) (minibuffer-setup-hook minibuffer-setup-hook) (minibuffer-text-before-history minibuffer-text-before-history)) (setq candidate (expand-file-name candidate (and icicle-last-input (icicle-file-name-directory (directory-file-name icicle-last-input))))) (icicle-condition-case-no-debug in-action-fn ;; Treat 3 cases, because previous use of `icicle-candidate-action-fn' ;; might have deleted the file or the window. (cond ((and (buffer-live-p icicle-orig-buff) (window-live-p icicle-orig-window)) (with-current-buffer icicle-orig-buff (save-selected-window (select-window icicle-orig-window) (funcall #',function candidate)))) ((window-live-p icicle-orig-window) (save-selected-window (select-window icicle-orig-window) (funcall #',function candidate))) (t (funcall #',function candidate))) (error (unless (string= "Cannot switch buffers in minibuffer window" (error-message-string in-action-fn)) (error "%s" (error-message-string in-action-fn))) (when (window-live-p icicle-orig-window) (select-window icicle-orig-window) (select-frame-set-input-focus (selected-frame))) (funcall #',function candidate))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) nil)))) ; Return nil for success. ,first-sexp (icicle-condition-case-no-debug act-on-choice (let ((file-choice (if (< emacs-major-version 21) ; No predicate arg for Emacs 20. (read-file-name ,prompt ,dir ,default-filename ,require-match ,initial-input) (read-file-name ,prompt ,dir ,default-filename ,require-match ,initial-input ,predicate)))) ;; Reset after reading input, so that commands can tell whether input has been read. (setq icicle-candidate-action-fn nil) ; Reset after completion. (funcall #',function file-choice)) (quit (icicle-try-switch-buffer icicle-orig-buff) ,undo-sexp) (error (icicle-try-switch-buffer icicle-orig-buff) ,undo-sexp (error "%s" (error-message-string act-on-choice)))) ,last-sexp))) (defmacro icicle-define-sort-command (sort-order comparison-fn doc-string) "Define a command to sort completions by SORT-ORDER. SORT-ORDER is a short string (or symbol) describing the sort order. It is used after the phrase \"Sorting is now \". Examples: \"by date\", \"alphabetical\", \"directories first\", and \"previously used first\". The new command is named by replacing any spaces in SORT-ORDER with hyphens (`-') and then adding the prefix `icicle-sort-'. COMPARISON-FN is a function that compares two strings, returning non-nil if and only if the first string sorts before the second. DOC-STRING is the doc string of the new command." (unless (stringp sort-order) (setq sort-order (symbol-name sort-order))) (let ((command (intern (concat "icicle-sort-" (replace-regexp-in-string "\\s-+" "-" sort-order))))) `(progn (setq icicle-sort-orders-alist (icicle-assoc-delete-all ,sort-order icicle-sort-orders-alist)) (push (cons ,sort-order ',comparison-fn) icicle-sort-orders-alist) (defun ,command () ,doc-string (interactive) (setq icicle-sort-comparer #',comparison-fn) (message "Sorting is now %s%s" ,(icicle-propertize (concat sort-order (and icicle-reverse-sort-p ", REVERSED")) 'face 'icicle-msg-emphasis)) (icicle-complete-again-update))))) (defmacro icicle-define-bookmark-command (type &optional prompt &rest args) "Define an Icicles multi-command for jumping to bookmarks of type TYPE. TYPE is a string to be used for the doc string, default prompt, and in function names. It should be lowercase and contain no spaces. Optional arg PROMPT is the completion prompt. ARGS is a list of any additional arguments to be passed to the appropriate `bmkp-TYPE-alist-only' function." `(icicle-define-bookmark-command-1 nil ,type ,prompt ,args)) (defmacro icicle-define-bookmark-other-window-command (type &optional prompt &rest args) "Same as `icicle-define-bookmark-command', but command uses other window." `(icicle-define-bookmark-command-1 t ,type ,prompt ,args)) ;; Similar to `icicle-define-search-bookmark-command'. Could combine them. (defmacro icicle-define-bookmark-command-1 (otherp type prompt args) "Helper macro for `icicle-define*-bookmark-command' macros. The command defined raises an error unless library `Bookmark+' can be loaded." `(icicle-define-command ,(intern (format "icicle-bookmark-%s%s" type (if otherp "-other-window" ""))) ; Command name ,(format "Jump to a%s %s bookmark%s. Like `icicle-bookmark%s', but with %s bookmarks only. This is a multi-command version of `bmkp-%s-jump%s'. %s You need library `Bookmark+' for this command." (if (memq (aref type 0) '(?a ?e ?i ?o ?u)) "n" "") ; `a' or `an' type (if otherp " in other window" "") (if otherp "-other-window" "") type type (if otherp "-other-window" "") (if (string-match "tags" type) ; Additional info about refreshing tags list. " By default, the tag choices for completion are NOT refreshed, to save time. Use a prefix arg if you want to refresh them. For example, use a prefix arg after you have switched to a different bookmark file, after you have added new tags to some bookmarks, or after you have completely removed some tags from all bookmarks. IOW, any time the set of existing tags has changed, you might want to use a prefix arg, to update the list of tags available for completion." "")) ; Doc string (lambda (cand) (,(if otherp 'icicle-bookmark-jump-other-window 'icicle-bookmark-jump) ; Action fn. (icicle-transform-multi-completion cand))) prompt1 icicle-candidates-alist nil ; `completing-read' args (not icicle-show-multi-completion-flag) nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) nil nil ((IGNORED1 (unless (require 'bookmark+ nil t) ; Additional bindings (icicle-user-error "You need library `Bookmark+' for this command"))) (IGNORED2 (bookmark-maybe-load-default-file)) ; `bookmark-alist'. (enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on disk... (bmk-alist (bmkp-sort-omit (funcall ',(intern (format "bmkp-%s-alist-only" type)) ,@args))) (completion-ignore-case bookmark-completion-ignore-case) (prompt1 ,(or prompt (format "%s%s bookmark: " (capitalize (substring type 0 1)) (substring type 1 (length type))))) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) nil (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) ;; This binding is for `icicle-autofile-action', in `icicle-bind-file-candidate-keys'. (icicle-full-cand-fn (and (equal ,type "autofile") #'icicle-make-bookmark-candidate)) (icicle-candidates-alist (mapcar #'icicle-make-bookmark-candidate bmk-alist)) (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p) ("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p)) (and (member ,type '("info" "region")) '(("by Info location" (bmkp-info-cp) icicle-alpha-p))) (and (member ,type '("gnus" "region")) '(("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p))) (and (member ,type '("url" "region")) '(("by URL" (bmkp-url-cp) icicle-alpha-p))) (and (not (member ,type '("bookmark-list" "desktop" "gnus" "info" "man" "url"))) '(("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) (and (not (member ,type '("bookmark-list" "desktop" "dired" "non-file"))) '(("by file name" (bmkp-file-alpha-cp) icicle-alpha-p))) (and (member ,type '("local-file" "file" "dired" "region")) '(("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p))) (and (not (string= ,type "desktop")) '(("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p))) (and (get-buffer "*Bookmark List*") '(("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn (lambda (cand) (when icicle-show-multi-completion-flag (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand))))) (when (equal ,type "autofile") (icicle-bind-file-candidate-keys)) ; First code (icicle-bookmark-cleanup-on-quit) ; Undo code (progn (when (equal ,type "autofile") (icicle-unbind-file-candidate-keys)) (icicle-bookmark-cleanup)))) ; Last code ;; Similar to `icicle-define-bookmark-command-1'. Could combine them. (defmacro icicle-define-search-bookmark-command (type &optional prompt &rest args) "Define Icicles multi-command for searching bookmarks of type TYPE. TYPE is a string to be used for the doc string, default prompt, and in function names. It should be lowercase and contain no spaces. Optional arg PROMPT is the completion prompt. ARGS is a list of any additional arguments to be passed to the appropriate `bmkp-TYPE-alist-only' function. The command defined raises an error unless library `Bookmark+' can be loaded." `(icicle-define-command ,(intern (format "icicle-search-%s-bookmark" type)) ; Command name ,(format "Search %s bookmark text. Like `icicle-search-bookmark', but with %s bookmarks only. You need library `Bookmark+' for this command." type type) ; Doc string icicle-search-bookmark-action ; Action function prompt1 icicle-candidates-alist nil ; `completing-read' args (not icicle-show-multi-completion-flag) nil (if (boundp 'bookmark-history) 'bookmark-history 'icicle-bookmark-history) nil nil ((IGNORED1 (unless (require 'bookmark+ nil t) ; Bindings (icicle-user-error "You need library `Bookmark+' for this command"))) (IGNORED2 (bookmark-maybe-load-default-file)) ; `bookmark-alist'. (enable-recursive-minibuffers t) ; In case we read input, e.g. File changed on... (completion-ignore-case bookmark-completion-ignore-case) (prompt1 ,(or prompt (format "Search %s bookmark: " type))) (icicle-list-use-nth-parts '(1)) (icicle-candidate-properties-alist (if (not icicle-show-multi-completion-flag) nil (if (facep 'file-name-shadow) '((2 (face file-name-shadow)) (3 (face bookmark-menu-heading))) '((3 (face bookmark-menu-heading)))))) (icicle-transform-function (if (interactive-p) nil icicle-transform-function)) (icicle-whole-candidate-as-text-prop-p t) (icicle-transform-before-sort-p t) (icicle-delete-candidate-object 'icicle-bookmark-delete-action) ;; This binding is for `icicle-autofile-action', in `icicle-bind-file-candidate-keys'. (icicle-full-cand-fn (and (equal ,type "autofile") #'icicle-make-bookmark-candidate)) (icicle-candidates-alist (mapcar #'icicle-make-bookmark-candidate (bmkp-sort-omit (funcall ',(intern (format "bmkp-%s-alist-only" type)) ,@args)))) (regexp (icicle-search-read-context-regexp)) (bookmark-automatically-show-annotations nil) ; Do not show annotations (icicle-sort-orders-alist (append '(("in *Bookmark List* order") ; Renamed from "turned OFF'. ("by bookmark name" . icicle-alpha-p) ("by last bookmark access" (bmkp-bookmark-last-access-cp) icicle-alpha-p) ("by bookmark visit frequency" (bmkp-visited-more-cp) icicle-alpha-p)) (and (member ,type '("info" "region")) '(("by Info location" (bmkp-info-cp) icicle-alpha-p))) (and (member ,type '("gnus" "region")) '(("by Gnus thread" (bmkp-gnus-cp) icicle-alpha-p))) (and (member ,type '("url" "region")) '(("by URL" (bmkp-url-cp) icicle-alpha-p))) (and (not (member ,type '("bookmark-list" "desktop" "gnus" "info" "man" "url"))) '(("by bookmark type" (bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) icicle-alpha-p))) (and (not (member ,type '("bookmark-list" "desktop" "dired" "non-file"))) '(("by file name" (bmkp-file-alpha-cp) icicle-alpha-p))) (and (member ,type '("local-file" "file" "dired" "region")) '(("by local file type" (bmkp-local-file-type-cp) icicle-alpha-p) ("by local file size" (bmkp-local-file-size-cp) icicle-alpha-p) ("by last local file access" (bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p) ("by last local file update" (bmkp-local-file-updated-more-recently-cp) icicle-alpha-p))) (and (not (string= ,type "desktop")) '(("by last buffer or file access" (bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) icicle-alpha-p))) (and (get-buffer "*Bookmark List*") '(("marked before unmarked (in *Bookmark List*)" (bmkp-marked-cp) icicle-alpha-p))) '(("by previous use alphabetically" . icicle-historical-alphabetic-p) ("case insensitive" . icicle-case-insensitive-string-less-p)))) (icicle-candidate-help-fn (lambda (cand) (when icicle-show-multi-completion-flag (setq cand (funcall icicle-get-alist-candidate-function cand)) (setq cand (cons (caar cand) (cdr cand)))) (if current-prefix-arg (bmkp-describe-bookmark-internals cand) (bmkp-describe-bookmark cand))))) (when (equal ,type "autofile") (icicle-bind-file-candidate-keys)) ; First code (icicle-bookmark-cleanup-on-quit) ; Undo code (progn (when (equal ,type "autofile") (icicle-unbind-file-candidate-keys)) (icicle-bookmark-cleanup)))) ; Last code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-mac) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-mac.el ends here icicles-2013.04.23.23400/icicles-mcmd.el000066400000000000000000016137521214003072700170560ustar00rootroot00000000000000;;; icicles-mcmd.el --- Minibuffer commands for Icicles ;; ;; Filename: icicles-mcmd.el ;; Description: Minibuffer commands for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:25:04 2006 ;; Version: 22.0 ;; Last-Updated: Wed Apr 24 14:34:01 2013 (-0700) ;; By: dradams ;; Update #: 19118 ;; URL: http://www.emacswiki.org/icicles-mcmd.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `apropos', `apropos-fn+var', `cl', `doremi', `el-swank-fuzzy', ;; `ffap', `ffap-', `fuzzy', `fuzzy-match', `hexrgb', `icicles-fn', ;; `icicles-opt', `icicles-var', `image-dired', `kmacro', ;; `levenshtein', `mouse3', `mwheel', `naked', `regexp-opt', ;; `ring', `ring+', `thingatpt', `thingatpt+', `wid-edit', ;; `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; commands to be used mainly in the minibuffer or buffer ;; `*Completions*' (and a few non-interactive functions used in those ;; commands). For top-level commands, see `icicles-cmd1.el' and ;; `icicles-cmd2.el'. For Icicles documentation, see ;; `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Commands defined here - (+) means a multi-command: ;; ;; `cycle-icicle-expand-to-common-match', ;; `cycle-icicle-image-file-thumbnail', ;; `cycle-icicle-incremental-completion', ;; `cycle-icicle-sort-order', ;; `cycle-icicle-S-TAB-completion-method', ;; `cycle-icicle-TAB-completion-method', ;; `icicle-abort-recursive-edit', `icicle-add-file-to-fileset', ;; `icicle-add/update-saved-completion-set', ;; `icicle-all-candidates-action', ;; `icicle-all-candidates-alt-action', ;; `icicle-all-candidates-list-action', ;; `icicle-all-candidates-list-alt-action', ;; `icicle-apropos-complete', `icicle-apropos-complete-and-exit', ;; `icicle-apropos-complete-and-narrow', ;; `icicle-apropos-complete-and-widen', ;; `icicle-apropos-complete-no-display', ;; `icicle-backward-char-magic', ;; `icicle-backward-delete-char-untabify', ;; `icicle-backward-kill-paragraph', ;; `icicle-backward-kill-sentence', `icicle-backward-kill-sexp', ;; `icicle-backward-kill-word', `icicle-beginning-of-line+', ;; `icicle-candidate-action', `icicle-candidate-alt-action', ;; `icicle-candidate-read-fn-invoke', ;; `icicle-candidate-set-complement', ;; `icicle-candidate-set-define', ;; `icicle-candidate-set-difference', ;; `icicle-candidate-set-intersection', ;; `icicle-candidate-set-retrieve', ;; `icicle-candidate-set-retrieve-from-variable', ;; `icicle-candidate-set-retrieve-more', ;; `icicle-candidate-set-retrieve-persistent', ;; `icicle-candidate-set-save', `icicle-candidate-set-save-more', ;; `icicle-candidate-set-save-more-selected', ;; `icicle-candidate-set-save-persistently', ;; `icicle-candidate-set-save-selected', ;; `icicle-candidate-set-save-to-variable', ;; `icicle-candidate-set-swap', `icicle-candidate-set-truncate', ;; `icicle-candidate-set-union', ;; `icicle-change-alternative-sort-order', ;; `icicle-change-history-variable', `icicle-change-sort-order', ;; `icicle-choose-completion', `icicle-completing-read+insert', ;; `icicle-Completions-mouse-3-menu', ;; `icicle-cycle-expand-to-common-match', ;; `icicle-cycle-image-file-thumbnail', ;; `icicle-cycle-incremental-completion', ;; `icicle-delete-backward-char', `icicle-delete-candidate-object', ;; `icicle-delete-char', `icicle-delete-windows-on', ;; `icicle-describe-file', `icicle-digit-argument', ;; `icicle-dispatch-C-^', `icicle-dispatch-C-.', ;; `icicle-dispatch-C-x.', `icicle-dispatch-M-_', ;; `icicle-dispatch-M-comma', `icicle-dispatch-M-q', ;; `icicle-doremi-candidate-width-factor+', ;; `icicle-doremi-increment-max-candidates+', ;; `icicle-doremi-increment-swank-prefix-length+', ;; `icicle-doremi-increment-swank-timeout+', ;; `icicle-doremi-inter-candidates-min-spaces+', ;; `icicle-doremi-zoom-Completions+', `icicle-end-of-line+', ;; `icicle-erase-minibuffer', ;; `icicle-erase-minibuffer-or-history-element', ;; `icicle-exit-minibuffer', `icicle-file-all-tags-narrow', ;; `icicle-file-all-tags-regexp-narrow', ;; `icicle-file-some-tags-narrow', ;; `icicle-file-some-tags-regexp-narrow', ;; `icicle-forward-char-magic', `icicle-goto/kill-failed-input', ;; `icicle-help-on-candidate', ;; `icicle-help-on-next-apropos-candidate', ;; `icicle-help-on-next-prefix-candidate', ;; `icicle-help-on-previous-apropos-candidate', ;; `icicle-help-on-previous-prefix-candidate', ;; `icicle-help-string-completion', ;; `icicle-help-string-non-completion', `icicle-history', ;; `icicle-insert-completion', `icicle-insert-dot-command', ;; (+)`icicle-insert-history-element', ;; `icicle-insert-key-description', ;; `icicle-insert-list-join-string', ;; `icicle-insert-newline-in-minibuffer', ;; `icicle-insert-string-at-point', ;; `icicle-insert-string-from-variable', `icicle-isearch-complete', ;; (+)`icicle-isearch-history-complete', ;; (+)`icicle-isearch-history-insert', ;; `icicle-keep-only-buffer-cands-for-derived-mode', ;; `icicle-keep-only-buffer-cands-for-mode', ;; `icicle-keep-only-buffer-cands-for-visible', ;; `icicle-keep-only-past-inputs', `icicle-kill-line', ;; `icicle-kill-paragraph', `icicle-kill-region', ;; `icicle-kill-region-wimpy', `icicle-kill-sentence', ;; `icicle-kill-sexp', `icicle-kill-word', `icicle-make-directory', ;; `icicle-minibuffer-complete-and-exit', `icicle-minibuffer-help', ;; `icicle-mouse-candidate-action', ;; `icicle-mouse-candidate-alt-action', ;; `icicle-mouse-candidate-read-fn-invoke', ;; `icicle-mouse-candidate-set-save', ;; `icicle-mouse-candidate-set-save-more', ;; `icicle-mouse-choose-completion', ;; `icicle-mouse-help-on-candidate', ;; `icicle-mouse-remove-candidate', ;; `icicle-mouse-save/unsave-candidate', ;; `icicle-mouse-save-then-kill', `icicle-mouse-yank-secondary', ;; `icicle-move-to-next-completion', ;; `icicle-move-to-previous-completion', `icicle-multi-inputs-act', ;; `icicle-multi-inputs-save', `icicle-narrow-candidates', ;; `icicle-narrow-candidates-with-predicate', ;; `icicle-negative-argument', `icicle-next-apropos-candidate', ;; `icicle-next-apropos-candidate-action', ;; `icicle-next-apropos-candidate-alt-action', ;; `icicle-next-candidate-per-mode', ;; `icicle-next-candidate-per-mode-action', ;; `icicle-next-candidate-per-mode-alt-action', ;; `icicle-next-history-element', `icicle-next-line', ;; `icicle-next-prefix-candidate', ;; `icicle-next-prefix-candidate-action', ;; `icicle-next-prefix-candidate-alt-action', ;; `icicle-next-S-TAB-completion-method', ;; `icicle-next-TAB-completion-method', ;; `icicle-ORIG-choose-completion', `icicle-ORIG-exit-minibuffer', ;; `icicle-ORIG-minibuffer-complete-and-exit', ;; `icicle-ORIG-mouse-choose-completion', ;; `icicle-ORIG-next-history-element', `icicle-ORIG-sit-for', ;; `icicle-ORIG-switch-to-completions', `icicle-other-history', ;; `icicle-plus-saved-sort', ;; `icicle-pp-eval-expression-in-minibuffer', ;; `icicle-prefix-complete', `icicle-prefix-complete-no-display', ;; `icicle-prefix-word-complete', ;; `icicle-previous-apropos-candidate', ;; `icicle-previous-apropos-candidate-action', ;; `icicle-previous-apropos-candidate-alt-action', ;; `icicle-previous-candidate-per-mode', ;; `icicle-previous-candidate-per-mode-action', ;; `icicle-previous-candidate-per-mode-alt-action', ;; `icicle-previous-line', `icicle-previous-prefix-candidate', ;; `icicle-previous-prefix-candidate-action', ;; `icicle-previous-prefix-candidate-alt-action', ;; `icicle-read+insert-file-name', `icicle-regexp-quote-input', ;; `icicle-remove-candidate', ;; `icicle-remove-buffer-cands-for-derived-mode', ;; `icicle-remove-buffer-cands-for-mode', ;; `icicle-remove-buffer-cands-for-visible', ;; `icicle-remove-Completions-window', `icicle-resolve-file-name', ;; `icicle-retrieve-last-input', `icicle-retrieve-next-input', ;; `icicle-retrieve-previous-input', `icicle-reverse-sort-order', ;; (+)`icicle-roundup', `icicle-save-predicate-to-variable', ;; `icicle-save/unsave-candidate', ;; `icicle-scroll-Completions-backward', ;; `icicle-scroll-Completions-forward', `icicle-scroll-backward', ;; `icicle-scroll-forward', `icicle-search-define-replacement', ;; `icicle-self-insert', `icicle-sit-for', ;; `icicle-sort-alphabetical', `icicle-sort-by-abbrev-frequency', ;; `icicle-sort-by-directories-first', ;; `icicle-sort-by-directories-last', `icicle-sort-by-file-type', ;; `icicle-sort-by-last-file-access-time', ;; `icicle-sort-by-last-file-modification-time', ;; `icicle-sort-by-last-use-as-input', ;; `icicle-sort-by-previous-use-alphabetically', ;; `icicle-sort-by-2nd-parts-alphabetically', ;; `icicle-sort-case-insensitive', ;; `icicle-sort-extra-candidates-first', ;; `icicle-sort-proxy-candidates-first', ;; `icicle-sort-special-candidates-first', ;; `icicle-sort-turned-OFF', `icicle-switch-to-Completions-buf', ;; `icicle-switch-to-completions', ;; `icicle-switch-to/from-minibuffer', `icicle-toggle-.', ;; `icicle-toggle-~-for-home-dir', ;; `icicle-toggle-alternative-sorting', ;; `icicle-toggle-angle-brackets', `icicle-toggle-annotation', ;; `icicle-toggle-case-sensitivity', `icicle-toggle-C-for-actions', ;; `icicle-toggle-completions-format', `icicle-toggle-dot', ;; `icicle-toggle-expand-to-common-match', ;; `icicle-toggle-hiding-common-match', ;; `icicle-toggle-hiding-non-matching-lines', ;; `icicle-toggle-highlight-all-current', ;; `icicle-toggle-highlight-historical-candidates', ;; `icicle-toggle-highlight-saved-candidates', ;; `icicle-toggle-ignored-extensions', ;; `icicle-toggle-ignored-space-prefix', ;; `icicle-toggle-ignoring-comments', ;; `icicle-toggle-include-cached-files', ;; `icicle-toggle-include-recent-files', ;; `icicle-toggle-literal-replacement', ;; `icicle-toggle-network-drives-as-remote', ;; `icicle-toggle-proxy-candidates', `icicle-toggle-regexp-quote', ;; `icicle-toggle-remote-file-testing', ;; `icicle-toggle-search-cleanup', ;; `icicle-toggle-search-complementing-domain', ;; `icicle-toggle-search-replace-common-match', ;; `icicle-toggle-search-replace-whole', ;; `icicle-toggle-search-whole-word', ;; `icicle-toggle-show-multi-completion', `icicle-toggle-sorting', ;; `icicle-toggle-transforming', ;; `icicle-toggle-WYSIWYG-Completions', `icicle-top-level', ;; `icicle-transpose-chars', `icicle-transpose-sexps', ;; `icicle-transpose-words', `icicle-universal-argument', ;; `icicle-universal-argument-minus', ;; `icicle-universal-argument-more', ;; `icicle-universal-argument-other-key', `icicle-up-directory', ;; `icicle-use-interactive-command-history', ;; `icicle-widen-candidates', `icicle-yank', `icicle-yank-pop', ;; `icicle-yank-secondary', `toggle-icicle-.', ;; `toggle-icicle-~-for-home-dir', ;; `toggle-icicle-alternative-sorting', ;; `toggle-icicle-angle-brackets', `toggle-icicle-annotation', ;; `toggle-icicle-case-sensitivity', `toggle-icicle-C-for-actions', ;; `toggle-icicle-completions-format', `toggle-icicle-dot', ;; `toggle-icicle-expand-to-common-match', ;; `toggle-icicle-hiding-common-match', ;; `toggle-icicle-hiding-non-matching-lines', ;; `toggle-icicle-highlight-all-current', ;; `toggle-icicle-highlight-historical-candidates', ;; `toggle-icicle-highlight-saved-candidates', ;; `toggle-icicle-ignored-extensions', ;; `toggle-icicle-ignored-space-prefix', ;; `toggle-icicle-include-cached-files', ;; `toggle-icicle-include-recent-files', ;; `toggle-icicle-incremental-completion', ;; `toggle-icicle-literal-replacement', ;; `toggle-icicle-network-drives-as-remote', ;; `toggle-icicle-proxy-candidates', `toggle-icicle-regexp-quote', ;; `toggle-icicle-remote-file-testing', ;; `toggle-icicle-search-cleanup', ;; `toggle-icicle-search-complementing-domain', ;; `toggle-icicle-search-replace-common-match', ;; `toggle-icicle-search-replace-whole', ;; `toggle-icicle-search-whole-word', ;; `toggle-icicle-show-multi-completion', `toggle-icicle-sorting', ;; `toggle-icicle-transforming', ;; `toggle-icicle-WYSIWYG-Completions'. ;; ;; Non-interactive functions defined here: ;; ;; `icicle-all-candidates-action-1', `icicle-all-exif-data', ;; `icicle-anychar-regexp', `icicle-apply-to-saved-candidate', ;; `icicle-apropos-complete-1', `icicle-apropos-complete-2', ;; `icicle-autofile-action', ;; `icicle-backward-delete-char-untabify-magic', ;; `icicle-bind-buffer-candidate-keys', ;; `icicle-bind-file-candidate-keys', `icicle-candidate-action-1', ;; `icicle-candidate-set-retrieve-1', ;; `icicle-candidate-set-save-1', ;; `icicle-candidate-set-save-selected-1', ;; `icicle-column-wise-cand-nb', ;; `icicle-isearch-complete-past-string', ;; `icicle-Completions-popup-choice', ;; `icicle-Completions-popup-choice-1', `icicle-convert-dots', ;; `icicle-current-completion-in-Completions', ;; `icicle-current-sort-functions', `icicle-current-sort-order', ;; `icicle-delete-backward-char-magic', ;; `icicle-delete-candidate-object-1', `icicle-delete-char-magic', ;; `icicle-delete-current-candidate-object', ;; `icicle-ensure-overriding-map-is-bound', ;; `icicle-help-on-candidate-symbol', ;; `icicle-input-is-a-completion-p', ;; `icicle-insert-candidate-action', `icicle-insert-dot', ;; `icicle-insert-input', `icicle-insert-thing', ;; `icicle-keep/remove-buffer-cands-for-visible', ;; `icicle-looking-at-p', `icicle-looking-back-at-p', ;; `icicle-markers-to-readable', ;; `icicle-maybe-multi-completion-completing-p', ;; `icicle-mouse-candidate-action-1', `icicle-nb-Completions-cols', ;; `icicle-nb-of-cand-at-Completions-pos', ;; `icicle-nb-of-cand-in-Completions-horiz', ;; `icicle-prefix-complete-1', `icicle-prefix-complete-2', ;; `icicle-raise-Completions-frame', ;; `icicle-remove-cand-from-lists', ;; `icicle-remove-candidate-display-others', ;; `icicle-replace-input-w-parent-dir', ;; `icicle-retrieve-candidates-from-set', ;; `icicle-row-wise-cand-nb', `icicle-signum', ;; `icicle-split-input', `icicle-substitute-keymap-vars', ;; `icicle-successive-action', `icicle-transform-sole-candidate', ;; `icicle-transpose-chars-magic', ;; `icicle-unbind-buffer-candidate-keys', ;; `icicle-unbind-file-candidate-keys', ;; `icicle-upcase-if-ignore-case', `icicle-update-and-next'. ;; ;; Internal variables defined here: ;; ;; `overriding-map-is-bound', `saved-overriding-map'. ;; ;; ;; ***** NOTE: These EMACS PRIMITIVES have been REDEFINED HERE: ;; ;; `exit-minibuffer' - Remove *Completion* window and ;; input mismatch highlighting ;; `minibuffer-complete-and-exit' - Use Icicles prefix completion ;; ;; ;; ***** NOTE: The following function defined in `mouse.el' has ;; been REDEFINED HERE: ;; ;; `choose-completion' - Don't iconify frame or bury buffer. ;; `mouse-choose-completion' - Return the number of the completion. ;; ;; ;; ***** NOTE: The following function defined in `simple.el' has ;; been REDEFINED HERE: ;; ;; `switch-to-completions' - Always selects `*Completions*' window. ;; ;; ;; Key bindings made by Icicles: See "Key Bindings" in ;; `icicles-doc2.el'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Redefined standard commands") ;; (@> "Icicles commands") ;; (@> "Minibuffer editing commands") ;; (@> "Commands to sort completion candidates") ;; (@> "Other commands to be used mainly in the minibuffer") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (eval-when-compile (require 'cl)) ;; case, flet, lexical-let, loop ;; plus, for Emacs < 21: dolist, push (eval-when-compile (require 'filesets nil t)) ; Emacs 22+. ;; filesets-data, filesets-entry-get-files, filesets-entry-mode, filesets-entry-set-files, ;; filesets-files-equalp, filesets-init, filesets-member, filesets-set-config (eval-when-compile (or (condition-case nil (load-library "icicles-mac") ; Use load-library to ensure latest .elc. (error nil)) (require 'icicles-mac))) ; Require, so can load separately if not on `load-path'. ;; icicle-assoc-delete-all, icicle-define-sort-command (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.) ;; icicle-alternative-sort-comparer, icicle-buffer-ignore-space-prefix-flag, ;; icicle-move-Completions-frame, icicle-Completions-mouse-3-menu-entries, icicle-default-cycling-mode, ;; icicle-default-thing-insertion, icicle-expand-input-to-common-match, ;; icicle-hide-common-match-in-Completions-flag, icicle-hide-non-matching-lines-flag, ;; icicle-incremental-completion, icicle-input-string, icicle-kbd, ;; icicle-key-descriptions-use-<>-flag, icicle-regexp-quote-flag, icicle-saved-completion-sets, ;; icicle-search-cleanup-flag, icicle-search-highlight-all-current-flag, icicle-sort-comparer, ;; icicle-sort-orders-alist, icicle-TAB-shows-candidates-flag, icicle-thing-at-point-functions, ;; icicle-transform-function (eval-and-compile (require 'icicles-var)) ; (This is required anyway by `icicles-fn.el'.) ;; lacarte-menu-items-alist, icicle-buffer-name-input-p, icicle-candidate-action-fn, ;; icicle-candidate-nb, icicle-complete-keys-alist, icicle-completion-candidates, ;; icicle-current-completion-candidate-overlay, icicle-current-completion-mode, ;; icicle-current-input, icicle-current-raw-input, icicle-default-thing-insertion-flipped-p, ;; icicle-edit-update-p, icicle-general-help-string, icicle-get-alist-candidate-function, ;; icicle-ignored-extensions, icicle-ignored-extensions-regexp, icicle-incremental-completion-p, ;; icicle-insert-string-at-pt-end, `icicle-insert-string-at-pt-start, icicle-last-completion-candidate, ;; icicle-last-completion-command, icicle-last-input, icicle-last-sort-comparer, ;; icicle-last-transform-function, icicle-nb-of-other-cycle-candidates, icicle-pre-minibuffer-buffer, ;; icicle-saved-candidates-variables-obarray, icicle-saved-completion-candidates, ;; icicle-saved-ignored-extensions, icicle-successive-grab-count, icicle-thing-at-pt-fns-pointer, ;; icicle-universal-argument-map, icicle-variable-name-history (require 'icicles-fn) ;; icicle-minibuf-input-sans-dir, icicle-string-match-p, icicle-toggle-icicle-mode-twice (require 'doremi nil t) ;; (no error if not found): ;; doremi, doremi(-boost)-(up|down)-keys, doremi-limit, doremi-wrap (when (> emacs-major-version 22) (require 'help-fns+ nil t)) ;; (no error if not found): ;; help-commands-to-key-buttons (eval-when-compile (require 'fit-frame nil t)) ;; (no error if not found): fit-frame (eval-when-compile (when (> emacs-major-version 21) (require 'linkd nil t))) ;; (no error if not found): linkd-mode ;; Byte-compiling this file, you will likely get some byte-compiler warning messages. ;; These are probably benign - ignore them. Icicles is designed to work with multiple ;; versions of Emacs, and that fact provokes compiler warnings. If you get byte-compiler ;; errors (not warnings), then please report a bug, using `M-x icicle-send-bug-report'. ;; Some defvars to quiet byte-compiler a bit: (when (< emacs-major-version 22) (defvar overriding-map-is-bound) (defvar read-file-name-completion-ignore-case) ; In `minibuffer.el' (defvar read-file-name-predicate) (defvar saved-overriding-map)) (when (< emacs-major-version 23) (defvar read-buffer-completion-ignore-case) (defvar mouse-drag-copy-region)) (defvar completion-base-position) ; Emacs 23.2+. (defvar count) ; Here. (defvar doremi-boost-down-keys) ; In `doremi.el' (defvar doremi-boost-up-keys) ; In `doremi.el' (defvar doremi-down-keys) ; In `doremi.el' (defvar doremi-up-keys) ; In `doremi.el' (defvar filesets-data) ; In `filesets.el'. (defvar icicle-ido-like-mode) ; In `icicles-cmd2.el' (implicit) (defvar ignore-comments-flag) ; In `thing-cmds.el'. (defvar minibuffer-confirm-exit-commands) ; In `minibuffer.el' in Emacs 23+. (defvar minibuffer-local-filename-completion-map) ; In Emacs 22+. (defvar minibuffer-local-filename-must-match-map) ; In Emacs 23.2 (but not Emacs 24+). (defvar minibuffer-local-must-match-filename-map) ; In Emacs 22+. (defvar recentf-list) ; In `recentf.el' (Emacs 21+). (defvar to-insert) ; Here. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Redefined standard commands") ;;; Redefined standard commands -------------------------------------- ;; REPLACE ORIGINAL `next-history-element' in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Selects minibuffer contents and leaves point at its beginning. ;; (unless (fboundp 'icicle-ORIG-next-history-element) (defalias 'icicle-ORIG-next-history-element (symbol-function 'next-history-element))) (defun icicle-next-history-element (arg) ; Bound to `M-n' in minibuffer. "Insert the next element of the minibuffer history in the minibuffer. With argument N, it uses the Nth following element." (interactive "p") (icicle-ORIG-next-history-element (prefix-numeric-value arg)) (when (and icicle-mode (memq icicle-default-value '(preselect-start preselect-end))) (icicle-select-minibuffer-contents) (setq deactivate-mark nil))) ;; REPLACE ORIGINAL `exit-minibuffer' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Remove input mismatch highlighting. ;; Remove *Completion* window. ;; (unless (fboundp 'icicle-ORIG-exit-minibuffer) (defalias 'icicle-ORIG-exit-minibuffer (symbol-function 'exit-minibuffer))) (defun icicle-exit-minibuffer () ; Bound to `C-m' (`RET') in minibuffer. "Terminate this minibuffer argument. Remove `*Completions*' window. Remove Icicles minibuffer faces." ;; This removal lets users retrieve candidates that have other faces, and saves input-history space. (interactive) (when (active-minibuffer-window) (with-current-buffer (window-buffer (minibuffer-window)) (let ((pos (icicle-minibuffer-prompt-end)) (icy-minibuf-faces '(icicle-input-completion-fail icicle-input-completion-fail-lax icicle-whitespace-highlight icicle-match-highlight-minibuffer icicle-complete-input)) (keep-faces ())) (while (< pos (point-max)) (let ((faces (get-text-property pos 'face))) (when (or (and (consp faces) (cdr faces) (atom (cdr faces))) ; (background-color . "abc") (and faces (atom faces))) ; face name (setq faces (list faces))) ; No-op: (foo (background-color . "abc") (:foreground "abc")) (setq keep-faces (icicle-set-union keep-faces (icicle-set-difference faces icy-minibuf-faces)))) (setq pos (1+ pos))) ;; If KEEP-FACES is (), use `remove-text-properties' instead of just `put-text-property', ;; so we do not add a nil `face' property. (if keep-faces (put-text-property (icicle-minibuffer-prompt-end) (point-max) 'face keep-faces) (remove-text-properties (icicle-minibuffer-prompt-end) (point-max) '(face nil)))) ;; $$$$$ (let ((pos (icicle-minibuffer-prompt-end))) ;; (while (< pos (point-max)) ;; (when (memq (get-text-property pos 'face) ;; '(icicle-input-completion-fail icicle-input-completion-fail-lax)) ;; (remove-text-properties pos (point-max) '(face)) ;; (setq pos (point-max))) ;; (setq pos (1+ pos)))) )) (icicle-remove-Completions-window) (icicle-ORIG-exit-minibuffer)) ;; REPLACE ORIGINAL `minibuffer-complete-and-exit' (built-in function), ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Use Icicles completion. ;; (unless (fboundp 'icicle-ORIG-minibuffer-complete-and-exit) (defalias 'icicle-ORIG-minibuffer-complete-and-exit (symbol-function 'minibuffer-complete-and-exit))) ;; Bound to `C-m' (`RET') in must-match minibuffer completion maps. (defun icicle-minibuffer-complete-and-exit () "If the minibuffer contents is a valid completion, then exit. Otherwise try to complete it." (interactive) (let ((last-cmd last-command)) (cond ((string= "" (if (icicle-file-name-input-p) ; Empty input - exit. (icicle-minibuf-input-sans-dir) (icicle-input-from-minibuffer))) (icicle-exit-minibuffer)) ;; This case serves when property `icicle-display-string' is used. ;; What's returned is the replacement display string, not the original candidate. ;; If you want to get the original candidate back, you'll need to search the obarray for a ;; symbol that has this `icicle-display-string' value. Or put the symbol on the display ;; string as a text property. ((icicle-input-is-a-completion-p) (icicle-exit-minibuffer)) ((eq minibuffer-completion-confirm 'confirm) ; User wants it anyway? - Emacs 23+. (if (eq last-cmd this-command) (icicle-exit-minibuffer) (minibuffer-message "Confirm") nil)) ((eq minibuffer-completion-confirm 'confirm-after-completion) ; Emacs 23+. ;; Similar to `confirm', but only if trying to exit immediately ;; after completing (this catches most minibuffer typos). (if (not (memq last-cmd (and (boundp 'minibuffer-confirm-exit-commands) (append icicle-confirm-exit-commands minibuffer-confirm-exit-commands)))) (icicle-exit-minibuffer) (minibuffer-message "Confirm") nil)) (t (setq icicle-current-input (icicle-input-from-minibuffer)) (let* (;; Bind these first two to suppress (a) the throw or (b) the message, highlighting, ;; mode-line help, and the wait involved in completing again. (icicle-prefix-complete-and-exit-p t) (icicle-apropos-complete-and-exit-p t) (candidates ;; If we're not using `icicle-candidates-alist', complete the input again. ;; If we're using `icicle-candidates-alist', try filtering it against just the ;; input. ;; If the input is already complete, then we're done. If not, then filtering ;; will give nil and we will just continue to display the candidates. If there ;; are multiple matches, then the user can either cycle or complete again. (if (not icicle-candidates-alist) (if (eq icicle-current-completion-mode 'apropos) (icicle-apropos-complete-no-display 'nomsg) (icicle-prefix-complete-no-display 'nomsg)) (icicle-filter-alist icicle-candidates-alist (list icicle-current-input))))) (cond ((and (eq icicle-require-match-p t) ; Don't exit if non-nil and non-t. (icicle-input-is-a-completion-p)) (icicle-exit-minibuffer)) (t (icicle-display-candidates-in-Completions)))))))) ;;; $$$$$$ Should probably rename it. It's no longer necessarily about apropos completion. (defun icicle-apropos-complete-and-exit () ; Bound to `S-return' (`S-RET') in minibuffer completion maps. "If minibuffer content is a valid completion or has a single match, exit. If the content is not complete, try to complete it. If completion leads to a valid completion, then exit. This differs from `icicle-minibuffer-complete-and-exit' (bound to `RET' in must-match minibuffer maps) in these ways: * If there is only one completion, this completes the input, rather than accepting it uncompleted. * This does not bother with the various special cases: empty input or non-nil `minibuffer-completion-confirm' values." (interactive) (setq icicle-current-input (icicle-input-from-minibuffer)) (let* (;; Bind these first two to suppress (a) the throw or (b) the message, highlighting, ;; mode-line help, and the wait involved in completing again. (icicle-prefix-complete-and-exit-p t) (icicle-apropos-complete-and-exit-p t) (candidates ;; If we're not using `icicle-candidates-alist', complete the input again. ;; If we're using `icicle-candidates-alist', try filtering it against just the ;; input. ;; If the input is already complete, then we're done. If not, then filtering ;; will give nil and we will just continue to display the candidates. If there ;; are multiple matches, then the user can either cycle or complete again. (if (not icicle-candidates-alist) (if (eq icicle-current-completion-mode 'apropos) (icicle-apropos-complete-no-display 'nomsg) (icicle-prefix-complete-no-display 'nomsg)) (icicle-filter-alist icicle-candidates-alist (list icicle-current-input))))) (when (and candidates (null (cdr candidates))) (icicle-ORIG-exit-minibuffer)))) ; Single candidate. ;; REPLACE ORIGINAL `choose-completion' in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Return the number of the completion. ;; Do not remove text properties from candidate. ;; Respect `icicle-extra-candidates' and `icicle-extra-candidates-dir-insert-p'. ;; Adjust to `icicle-start-of-candidates-in-Completions'. ;; Do not use `completion-list-insert-choice-function'. ;; Do not iconify frame or bury buffer (in Emacs 23-24.2 code). ;; Do not quit *Completions* window (Emacs 24.3+). ;; (unless (fboundp 'icicle-ORIG-choose-completion) (defalias 'icicle-ORIG-choose-completion (symbol-function 'choose-completion))) (if (or (> emacs-major-version 23) (and (= emacs-major-version 23) (> emacs-minor-version 1))) ; Emacs 23.2+ (defun icicle-choose-completion (&optional event) "Choose the completion at point. Return the number of the candidate: 0 for first, 1 for second, ..." (interactive (list last-nonmenu-event)) ;; In case this is run via the mouse, give temporary modes such as Isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (with-current-buffer (window-buffer (posn-window (event-start event))) (let ((buffer completion-reference-buffer) (base-size completion-base-size) (choice (save-excursion (goto-char (posn-point (event-start event))) (let (beg end) (cond ((and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) ((and (>= (point) (icicle-start-of-candidates-in-Completions)) (get-text-property (max (point-min) (1- (point))) 'mouse-face)) (setq end (max (point-min) (1- (point))) beg (point))) (t (icicle-user-error "No candidate here"))) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max))) (buffer-substring beg end))))) (unless (or (not (member choice icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p) (setq base-size 0)) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos (posn-point (event-start event)))) (unless (buffer-live-p buffer) (icicle-user-error "Destination buffer is dead")) (when (and (icicle-file-name-input-p) insert-default-directory (or (not (member choice icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (let ((dir (icicle-file-name-directory-w-default icicle-current-input))) (with-current-buffer buffer (icicle-clear-minibuffer) (insert dir) (setq choice (concat dir choice) base-size 0)))) (choose-completion-string choice buffer base-size)) icicle-candidate-nb)) (defun icicle-choose-completion () ; Emacs < 23.2. "Choose the completion that point is in or next to." (interactive) (let ((buffer completion-reference-buffer) (base-size completion-base-size) beg end choice) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (when (and (>= (point) (icicle-start-of-candidates-in-Completions)) (get-text-property (max (point-min) (1- (point))) 'mouse-face)) (setq end (max (point-min) (1- (point))) beg (point))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max)) ;; $$$$ choice (buffer-substring-no-properties beg end)) choice (buffer-substring beg end)) ;; (let ((owindow (selected-window))) ;; (if (and (one-window-p t 'selected-frame) (window-dedicated-p (selected-window))) ;; (iconify-frame (selected-frame)) ; Iconify special buffer's frame ;; (or (window-dedicated-p (selected-window)) (bury-buffer))) ;; (select-window owindow)) (unless (or (not (member choice icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p) (setq base-size 0)) (unless (buffer-live-p buffer) (icicle-user-error "Destination buffer is dead")) (choose-completion-string choice buffer base-size)))) ;; REPLACE ORIGINAL `mouse-choose-completion' in `mouse.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Return the number of the completion. ;; Don't strip text properties. ;; (when (and (fboundp 'mouse-choose-completion) (not (fboundp 'icicle-ORIG-mouse-choose-completion))) (defalias 'icicle-ORIG-mouse-choose-completion (symbol-function 'mouse-choose-completion))) (unless (or (> emacs-major-version 23) (and (= emacs-major-version 23) ; < Emacs 23.2 (> emacs-minor-version 1))) (defun icicle-mouse-choose-completion (event) ; Bound to `mouse-2' in `*Completions*'. "Click a completion candidate in buffer `*Completions*', to choose it. Return the number of the candidate: 0 for first, 1 for second, ..." (interactive "e") ;; $$$$$ (unless (active-minibuffer-window) (icicle-user-error "Minibuffer is not active")) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (let ((buffer (window-buffer)) ;; $$$$$$ (icicle-orig-buff buffer) choice base-size) (with-current-buffer (window-buffer (posn-window (event-start event))) (save-excursion (when completion-reference-buffer (setq buffer completion-reference-buffer)) (setq base-size completion-base-size) (save-excursion (goto-char (posn-point (event-start event))) (let (beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max))) ;; $$$$$$ (setq choice (buffer-substring-no-properties beg end))))) (setq choice (buffer-substring beg end)))))) ;; $$$$$ (if (eq icicle-orig-buff (get-buffer "*Completions*")) ;; (icicle-remove-Completions-window) ;; (save-selected-window (icicle-remove-Completions-window))) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos (posn-point (event-start event)))) (unless (buffer-live-p buffer) (icicle-user-error "Destination buffer is dead")) (when (and (icicle-file-name-input-p) insert-default-directory (or (not (member choice icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (let ((dir (icicle-file-name-directory-w-default icicle-current-input))) (with-current-buffer buffer (icicle-clear-minibuffer) (insert dir) (setq choice (concat dir choice) base-size 0)))) (choose-completion-string choice buffer base-size)) icicle-candidate-nb)) (defun icicle-nb-of-cand-at-Completions-pos (position) "Return number of candidate at POSITION in `*Completions*'. POSITION is a buffer position." (let ((hor-nb (icicle-nb-of-cand-in-Completions-horiz position))) (save-excursion (with-current-buffer (get-buffer "*Completions*") (goto-char position) (if (memq icicle-completions-format '(horizontal nil)) hor-nb (let* ((cols (icicle-nb-Completions-cols)) (nb-cands (length icicle-completion-candidates)) (rows (/ nb-cands cols))) (unless (zerop (% nb-cands cols)) (setq rows (1+ rows))) (icicle-column-wise-cand-nb hor-nb nb-cands rows cols))))))) (defun icicle-nb-of-cand-in-Completions-horiz (position) "Return number of horizontal candidate at POSITION in `*Completions*'. POSITION is a buffer position." (let ((compl-buf (get-buffer "*Completions*"))) (unless compl-buf (error "No `*Completions*' buffer")) (save-window-excursion (set-buffer compl-buf) (goto-char position) ;; If in a completion, move to its start, and set POSITION there. (let ((prop (get-text-property (max (point-min) (1- (point))) 'mouse-face))) (when (and prop (eq prop (get-text-property (point) 'mouse-face))) (goto-char (previous-single-property-change (point) 'mouse-face nil (icicle-start-of-candidates-in-Completions))))) (setq position (point)) ;; Binary search. (let ((cand-nb (/ (length icicle-completion-candidates) 2)) (last-nb 0) (icicle-completions-format 'horizontal) delta) (goto-char (point-min)) (icicle-move-to-next-completion cand-nb t) (while (/= (point) position) (setq delta (max 1 (/ (abs (- cand-nb last-nb)) 2)) last-nb cand-nb) (cond ((< (point) position) (icicle-move-to-next-completion delta t) (setq cand-nb (+ cand-nb delta))) (t (icicle-move-to-next-completion (- delta) t) (setq cand-nb (- cand-nb delta))))) (set-buffer-modified-p nil) (1- cand-nb))))) (defun icicle-nb-Completions-cols () "Return the number of candidate columns in `*Completions*'." (let* ((start (icicle-start-of-candidates-in-Completions)) (eol (save-excursion (goto-char start) (line-end-position))) (mouse-chgs 0) mousef) (save-excursion (goto-char start) (while (< (point) eol) (setq mousef (next-single-property-change (point) 'mouse-face nil eol)) (when mousef (goto-char mousef) (setq mouse-chgs (1+ mouse-chgs))))) ;; Handle the case where the `while' loop is skipped so `mouse-chgs' is still 0. (max 1 (/ (1+ mouse-chgs) 2)))) ; Return # of columns. (defun icicle-column-wise-cand-nb (horiz-nb nb-cands rows cols) "Column-wise number of horizontal candidate number HORIZ-NB." (let ((row-lim (- rows (- (* rows cols) nb-cands))) (row (/ horiz-nb cols)) (col (mod horiz-nb cols)) nb) (setq nb (+ row (* col rows))) (when (>= row row-lim) (setq cols (1- cols) horiz-nb (- horiz-nb row-lim) row (/ horiz-nb cols) col (mod horiz-nb cols) nb (+ row (* col rows)))) nb)) (defun icicle-row-wise-cand-nb (vert-nb nb-cands rows cols) "Row-wise number of vertical candidate number VERT-NB." (let* ((row (mod vert-nb rows)) (col (/ vert-nb rows)) (nb (+ col (* row cols))) (lim (- rows (- (* rows cols) nb-cands)))) (when (> row lim) (setq nb (- nb (- row lim)))) nb)) ;; REPLACE ORIGINAL `switch-to-completions' defined in `simple.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; Selects `*Completions*' window even if on another frame. ;; (unless (fboundp 'icicle-ORIG-switch-to-completions) (defalias 'icicle-ORIG-switch-to-completions (symbol-function 'switch-to-completions))) (defun icicle-switch-to-completions () "Select the completion list window, `*Completions*'." (interactive) ;; Make sure we have a completions window. (or (get-buffer-window "*Completions*") (minibuffer-completion-help)) (let ((window (get-buffer-window "*Completions*" 0))) ; Added 0 arg. (when window (select-window window) (goto-char (icicle-start-of-candidates-in-Completions))))) ;; The branch that deletes a history element is based on Juri Linkov's ;; `delete-history-element', proposed for Emacs 22 but rejected by RMS. ;; (defun icicle-erase-minibuffer-or-history-element () ; Bound to `M-k' in minibuffer. "`icicle-erase-minibuffer' or, if using history, delete history element." (interactive) (if (not (memq last-command '(previous-history-element next-history-element icicle-erase-minibuffer-or-history-element previous-matching-history-element next-matching-history-element))) (icicle-erase-minibuffer) (let* ((curr-pos (1- minibuffer-history-position)) (current (nth curr-pos (and (boundp minibuffer-history-variable) (symbol-value minibuffer-history-variable))))) (cond ((= minibuffer-history-position 1) (set minibuffer-history-variable (and (boundp minibuffer-history-variable) (cdr (symbol-value minibuffer-history-variable))))) ((> minibuffer-history-position 1) (setcdr (nthcdr (- minibuffer-history-position 2) (and (boundp minibuffer-history-variable) (symbol-value minibuffer-history-variable))) (nthcdr minibuffer-history-position (and (boundp minibuffer-history-variable) (symbol-value minibuffer-history-variable)))))) (condition-case nil (cond ((memq last-command '(next-history-element next-matching-history-element)) (next-history-element 1) (setq this-command 'next-history-element)) ((memq last-command '(previous-history-element previous-matching-history-element)) (next-history-element 1) (previous-history-element 1) (setq this-command 'previous-history-element))) (error (icicle-condition-case-no-debug nil (cond ((memq last-command '(next-history-element next-matching-history-element)) (previous-history-element 1) (setq this-command 'previous-history-element)) ((memq last-command '(previous-history-element previous-matching-history-element)) (next-history-element 1) (setq this-command 'next-history-element))) (error nil)))) (when (and current (wholenump curr-pos)) (icicle-msg-maybe-in-minibuffer "Deleted `%s'" (icicle-propertize current 'face 'icicle-msg-emphasis)))))) ;;(@* "Icicles commands") ;;; Icicles commands ------------------------------------------------- ;;(@* "Minibuffer editing commands") ;;; Minibuffer editing commands . . . . . . . . . . . . . . . . . . . ;;; ;;; All except `icicle-erase-minibuffer' are bound in the minibuffer to whatever the same ;;; command without `icicle-' is bound to globally. (defun icicle-looking-at-p (string) "Return non-nil if STRING immediately succeeds point." (let ((len (length string))) (save-excursion (save-match-data (search-forward string (min (+ (point) len) (point-max)) t))))) (defun icicle-looking-back-at-p (string) "Return non-nil if STRING immediately precedes point." (let ((len (length string))) (save-excursion (save-match-data (search-backward string (max (- (point) len) (icicle-minibuffer-prompt-end)) t))))) ;; Used only in `icicle-transpose-chars-magic'. (defun icicle-forward-char-magic (&optional n) "Move forward N chars (backward if N is negative). Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "p") (let ((len-dot (length icicle-anychar-regexp)) (len-join (length icicle-list-join-string))) (dotimes (i (abs n)) (or (save-match-data (if (wholenump n) (search-forward icicle-anychar-regexp (min (+ (point) len-dot) (point-max)) t) (search-backward icicle-anychar-regexp (max (- (point) len-dot) (icicle-minibuffer-prompt-end)) t))) (save-match-data (if (wholenump n) (search-forward icicle-list-join-string (min (+ (point) len-join) (point-max)) t) (search-backward icicle-list-join-string (max (- (point) len-join) (icicle-minibuffer-prompt-end)) t))) (forward-char (if (wholenump n) 1 -1)))))) ;; Not used. (defun icicle-backward-char-magic (&optional n) "Move backward N chars (forward if N is negative). Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "p") (icicle-forward-char-magic (- n))) ;; Make delete-selection mode recognize it, so region is deleted. (put 'icicle-backward-delete-char-untabify 'delete-selection 'supersede) (defun icicle-backward-delete-char-untabify (n &optional killflag) "`backward-delete-char-untabify' + update `*Completions*' with matches. Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "*p\nP") (icicle-call-then-update-Completions #'icicle-backward-delete-char-untabify-magic n killflag)) (defun icicle-backward-delete-char-untabify-magic (n killflag) "`backward-delete-char-untabify', but also handle magic chars. That is, handle dots (`.') and `icicle-list-join-string'." (let ((len-dot (length icicle-anychar-regexp)) (len-join (length icicle-list-join-string))) (dotimes (i (abs n)) (cond ((icicle-looking-back-at-p icicle-anychar-regexp) (backward-delete-char-untabify len-dot killflag)) ((icicle-looking-at-p icicle-list-join-string) (backward-delete-char-untabify len-join killflag)) (t (backward-delete-char-untabify 1 killflag)))))) ;; Make delete-selection mode recognize it, so region is deleted. (put 'icicle-delete-backward-char 'delete-selection 'supersede) (defun icicle-delete-backward-char (n &optional killflag) ; Bound to `DEL' in minibuffer. "`delete-backward-char' and update `*Completions*' with input matches. Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "*p\nP") (icicle-call-then-update-Completions #'icicle-delete-backward-char-magic n killflag)) (defun icicle-delete-backward-char-magic (n killflag) "`delete-backward-char', but also handle dots (`.') and join string." (let ((len-dot (length icicle-anychar-regexp)) (len-join (length icicle-list-join-string))) (dotimes (i (abs n)) (cond ((icicle-looking-back-at-p icicle-anychar-regexp) (delete-char (- len-dot) killflag)) ((icicle-looking-back-at-p icicle-list-join-string) (delete-char (- len-join) killflag)) (t (delete-char -1 killflag)))))) ;; Make delete-selection mode recognize it, so region is deleted. (put 'icicle-delete-char 'delete-selection 'supersede) (defun icicle-delete-char (n &optional killflag) ; Bound to `C-d' in minibuffer. "`delete-char' and update `*Completions*' with input matches. Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "*p\nP") (icicle-call-then-update-Completions #'icicle-delete-char-magic n killflag)) (defun icicle-delete-char-magic (n killflag) "`delete-char', but also handle dot (`.') and `icicle-list-join-string'." (let ((len-dot (length icicle-anychar-regexp)) (len-join (length icicle-list-join-string))) (dotimes (i (abs n)) (cond ((icicle-looking-at-p icicle-anychar-regexp) (delete-char len-dot killflag)) ((icicle-looking-at-p icicle-list-join-string) (delete-char len-join killflag)) (t (delete-char 1 killflag)))))) (defun icicle-backward-kill-word (arg) ; Bound to `M-DEL' (`M-backspace') in minibuffer. "`backward-kill-word' and update `*Completions*' with input matches. See description of `backward-kill-word'." (interactive "p") (icicle-call-then-update-Completions #'backward-kill-word arg)) (defun icicle-kill-word (arg) ; Bound to `M-d' in minibuffer. "`kill-word' and update `*Completions*' with regexp input matches. See description of `kill-word'." (interactive "p") (icicle-call-then-update-Completions #'kill-word arg)) (defun icicle-backward-kill-sexp (arg) ; Bound to `C-M-backspace' in minibuffer. "`backward-kill-sexp' and update `*Completions*' with input matches. See description of `backward-kill-sexp'." (interactive "p") (icicle-call-then-update-Completions #'backward-kill-sexp arg)) (defun icicle-kill-sexp (arg) ; Bound to `C-M-delete' and `C-M-k' in minibuffer. "`kill-sexp' and update `*Completions*' with regexp input matches. See description of `kill-sexp'." (interactive "p") (icicle-call-then-update-Completions #'kill-sexp arg)) (defun icicle-backward-kill-sentence (arg) ; Bound to `C-x DEL' in minibuffer. "`backward-kill-sentence' and update `*Completions*' with input matches. See description of `backward-kill-sentence'." (interactive "p") (icicle-call-then-update-Completions #'backward-kill-sentence arg)) (defun icicle-kill-sentence (arg) "`kill-sentence' and update `*Completions*' with regexp input matches. See description of `kill-sentence'." (interactive "p") (icicle-call-then-update-Completions #'kill-sentence arg)) (defun icicle-backward-kill-paragraph (arg) ; Bound to `C-backspace' in minibuffer, except for files. "`backward-kill-paragraph' and update `*Completions*' with input matches. See description of `backward-kill-paragraph'." (interactive "p") (icicle-call-then-update-Completions #'backward-kill-paragraph arg)) (defun icicle-kill-paragraph (arg) ; Bound to `C-delete' in minibuffer. "`kill-paragraph' and update `*Completions*' with regexp input matches. See description of `kill-paragraph'." (interactive "p") (icicle-call-then-update-Completions #'kill-paragraph arg)) (defun icicle-kill-line (arg) ; Bound to `C-k' and `deleteline' in minibuffer. "`kill-line' and update `*Completions*' with regexp input matches. See description of `kill-line'." (interactive "P") (icicle-call-then-update-Completions #'kill-line arg)) (defun icicle-kill-region (beg end) ; Bound to `C-w' in minibuffer. ;; Don't bother with Emacs 22 optional 3rd arg. "`kill-region' and update `*Completions*' with regexp input matches. See description of `kill-region'." (interactive "r") (icicle-call-then-update-Completions #'kill-region beg end)) (when (fboundp 'kill-region-wimpy) (defun icicle-kill-region-wimpy (beg end) ; Bound to `C-w' in minibuffer. "`kill-region-wimpy' and update `*Completions*' with input matches. See description of `kill-region-wimpy'." (interactive "r") (icicle-call-then-update-Completions #'kill-region-wimpy beg end))) (defun icicle-make-directory (dir) ; Bound to `C-c +' in minibuffer, for file-name completion. "Create a directory." (interactive (let ((enable-recursive-minibuffers t)) (list (funcall (if (fboundp 'read-directory-name) #'read-directory-name #'read-file-name) "Create directory: " default-directory (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)))))) (setq dir (directory-file-name (expand-file-name dir))) (while (file-exists-p dir) ; This will cause Tramp to access if remote, but that's OK here. (message "%s already exists" dir) (sit-for 1) (let ((enable-recursive-minibuffers t)) (setq dir (funcall (if (fboundp 'read-directory-name) #'read-directory-name #'read-file-name) "Create directory: " default-directory (icicle-file-name-directory-w-default (icicle-input-from-minibuffer)))))) ;;(setq dir (directory-file-name (expand-file-name dir))) (if (not (y-or-n-p (format "Really create %s? " (file-name-as-directory dir)))) (message "Directory creation canceled") (make-directory dir 'PARENTS-TOO) (unless (file-accessible-directory-p dir) (error "Could not create %s" (file-name-as-directory dir))) (message "Created %s" (file-name-as-directory dir)))) (defun icicle-up-directory () ; Bound to `C-backspace' in minibuffer, for file-name completion. "Replace minibuffer input with parent directory, then upate `*Completions*'." (interactive) (icicle-call-then-update-Completions #'icicle-replace-input-w-parent-dir)) (defun icicle-replace-input-w-parent-dir () "Replace minibuffer input with the parent directory." (interactive) (goto-char (point-max)) (let ((directoryp (equal ?/ (char-before))) (bob (icicle-minibuffer-prompt-end))) (while (and (> (point) bob) (not (equal ?/ (char-before)))) (delete-char -1)) (when directoryp (delete-char -1) (while (and (> (point) bob) (not (equal ?/ (char-before)))) (delete-char -1))))) (defun icicle-file-all-tags-narrow () ; Bound to `C-x C-t *' in minibuffer, for file-name completion. "Narrow file-name candidates to those with all of the tags you specify. You are prompted for the tags. You can add and remove tags for a file during completion, using `C-x a +' and `C-x a -', respectively. See also top-level command `icicle-find-file-tagged'." (interactive) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this command")) (let* ((candidates icicle-completion-candidates) (enable-recursive-minibuffers t) (tags (bmkp-read-tags-completing nil nil current-prefix-arg)) (pred `(lambda (ff) (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every (lambda (tag) (bmkp-has-tag-p bmk tag)) ',tags)))))) (setq icicle-completion-candidates candidates) (icicle-narrow-candidates-with-predicate pred))) (defun icicle-file-all-tags-regexp-narrow () ; Bound to `C-x C-t % *' in minibuf, for file-name completion. "Narrow file-name candidates to those with all tags matching a regexp. You are prompted for the regexp. You can add and remove tags for a file during completion, using `C-x a +' and `C-x a -', respectively. See also top-level command `icicle-find-file-all-tags-regexp'." (interactive) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this command")) (bookmark-maybe-load-default-file) (let* ((candidates icicle-completion-candidates) (enable-recursive-minibuffers t) (regexp (read-string "Regexp for tags: ")) (pred `(lambda (ff) (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-every (lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs)))))) (setq icicle-completion-candidates candidates) (icicle-narrow-candidates-with-predicate pred))) (defun icicle-file-some-tags-narrow () ; Bound to `C-x C-t +' in minibuffer, for file-name completion. "Narrow file-name candidates to those with some of the tags you specify. You are prompted for the tags. You can add and remove tags for a file during completion, using `C-x a +' and `C-x a -', respectively. See also top-level command `icicle-find-file-tagged'." (interactive) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this command")) (let* ((candidates icicle-completion-candidates) (enable-recursive-minibuffers t) (tags (bmkp-read-tags-completing nil nil current-prefix-arg)) (pred `(lambda (ff) (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some (lambda (tag) (bmkp-has-tag-p bmk tag)) ',tags)))))) (setq icicle-completion-candidates candidates) (icicle-narrow-candidates-with-predicate pred))) (defun icicle-file-some-tags-regexp-narrow () ; Bound to `C-x C-t % +' in minibuf, for file-name completion. "Narrow file-name candidates to those with some tags matching a regexp. You are prompted for the regexp. You can add and remove tags for a file during completion, using `C-x a +' and `C-x a -', respectively. See also top-level command `icicle-find-file-some-tags-regexp'." (interactive) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (unless (require 'bookmark+ nil t) (icicle-user-error "You need library `Bookmark+' for this command")) (bookmark-maybe-load-default-file) (let* ((candidates icicle-completion-candidates) (enable-recursive-minibuffers t) (regexp (read-string "Regexp for tags: ")) (pred `(lambda (ff) (let* ((bmk (bmkp-get-autofile-bookmark ff)) (btgs (and bmk (bmkp-get-tags bmk)))) (and btgs (bmkp-some (lambda (tag) (string-match ',regexp (bmkp-tag-name tag))) btgs)))))) (setq icicle-completion-candidates candidates) (icicle-narrow-candidates-with-predicate pred))) ;;; (defun icicle-kill-failed-input () ; Bound to `C-M-l' in minibuffer during completion. ;;; "Kill (delete) the part of the input that does not complete. ;;; Repeat to delete more." ;;; (interactive) ;;; (goto-char (max (point-min) (1- (point)))) ;;; (while (and (not (bobp)) ;;; (memq (get-text-property (point) 'face) ;;; '(icicle-input-completion-fail icicle-input-completion-fail-lax))) ;;; (delete-char 1) ;;; (backward-char 1)) ;;; (unless (eobp) (forward-char)) ;;; (icicle-highlight-input-noncompletion)) (defun icicle-goto/kill-failed-input () ; Bound to `C-M-l' in minibuffer during completion. "Go to start of input portion that does not complete. Repeat to kill. Kill (delete) the part of the input that does not complete. Repeat to delete more." (interactive) (if (eq last-command this-command) (unless (eobp) (kill-line)) (when (and (overlayp icicle-input-completion-fail-overlay) (overlay-start icicle-input-completion-fail-overlay)) (goto-char (overlay-start icicle-input-completion-fail-overlay))))) (defun icicle-transpose-chars (arg) ; Bound to `C-t' in minibuffer. "`transpose-chars' and update `*Completions*' with regexp input matches. Handles Icicles dots (`.') and `icicle-list-join-string'." (interactive "*P") (icicle-call-then-update-Completions #'icicle-transpose-chars-magic arg)) (defun icicle-transpose-chars-magic (arg) "`transpose-chars', but handle dots (`.') and `icicle-list-join-string'." (and (null arg) (eolp) (icicle-forward-char-magic -1)) (transpose-subr 'icicle-forward-char-magic (prefix-numeric-value arg))) (defun icicle-transpose-words (arg) ; Bound to `M-t' in minibuffer. "`transpose-words' and update `*Completions*' with regexp input matches. See description of `transpose-words'." (interactive "*p") (icicle-call-then-update-Completions #'transpose-words arg)) (defun icicle-transpose-sexps (arg) ; Bound to `C-M-t' in minibuffer. "`transpose-sexps' and update `*Completions*' with regexp input matches. See description of `transpose-sexps'." (interactive "*p") (icicle-call-then-update-Completions #'transpose-sexps arg)) (defun icicle-yank (arg) ; Bound to `C-y' and `S-insert' in minibuffer. "`yank' and update `*Completions*' with regexp input matches. See description of `yank'." (interactive "*P") (icicle-call-then-update-Completions #'yank arg)) (defun icicle-yank-pop (arg) ; Bound to `M-y' and `M-insert' in minibuffer. "`yank-pop' and update `*Completions*' with regexp input matches. See description of `yank-pop'." (interactive "*p") (icicle-call-then-update-Completions #'yank-pop arg)) (eval-after-load "second-sel" '(progn (defun icicle-yank-secondary () ; Bound to `C-M-y' in minibuffer. "Insert the secondary selection at point. Move point to the end of the inserted text. Does not change mark." (interactive "*") (icicle-call-then-update-Completions #'yank-secondary)) ;; Tell `delete-selection-mode' to replace active region by yanked secondary selection. (put 'icicle-yank-secondary 'delete-selection 'yank))) ;; Tell `delete-selection-mode' to replace active region by yanked secondary selection. (put 'icicle-mouse-yank-secondary 'delete-selection 'yank) (defun icicle-mouse-yank-secondary (event) ; Bound to `M-mouse-2' in minibuffer. "Insert the secondary selection where you click. Move point to the end of the inserted text. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." (interactive "*e") (if (fboundp 'yank-secondary) ; In `mouse+.el'. (icicle-call-then-update-Completions #'mouse-yank-secondary event current-prefix-arg) (icicle-call-then-update-Completions #'mouse-yank-secondary event))) ;; Make delete-selection mode recognize self-insertion, so it replaces region text. (put 'icicle-self-insert 'delete-selection t) (defun icicle-self-insert (n) ;; Bound in minibuffer to stuff bound globally to `self-insert-command'. "`self-insert' and update `*Completions*' with regexp input matches. See description of `self-insert'." (interactive "p") (if executing-kbd-macro (funcall #'self-insert-command n) (icicle-call-then-update-Completions #'self-insert-command n))) (defun icicle-insert-a-space () "Insert a space. For convenience in the minibuffer - does the same thing as `C-q SPC'. To use this, bind it to some key sequence in keymaps `minibuffer-local-completion-map', `minibuffer-local-filename-completion-map', and `minibuffer-local-must-match-map'." (interactive) (insert ?\ )) (defun icicle-insert-dot-command (&optional arg) ; Bound to `.' in minibuffer during completion. "Insert `icicle-dot-string': either `.' or `icicle-anychar-regexp'. With a numeric prefix argument, insert the dot that many times. With a plain prefix arg (`C-u'), insert the opposite kind of dot \(once) from what is indicated by the current value of `icicle-dot-string'." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (if (consp arg) (let ((opposite (if (string= icicle-dot-string-internal ".") (icicle-anychar-regexp) (let ((strg ".")) (add-text-properties 0 1 '(icicle-user-plain-dot t rear-nonsticky (icicle-user-plain-dot)) strg) strg)))) (if executing-kbd-macro (insert opposite) (icicle-call-then-update-Completions (lambda () (insert opposite))))) (setq arg (prefix-numeric-value arg)) (if executing-kbd-macro (funcall #'icicle-insert-dot arg) (icicle-call-then-update-Completions #'icicle-insert-dot arg)))) (defun icicle-insert-dot (n) "Insert `icicle-dot-string' N times." (dotimes (i n) (if (not (string= icicle-dot-string-internal ".")) (insert (icicle-anychar-regexp)) (insert ".") (add-text-properties (max (point-min) (1- (point))) (point) '(icicle-user-plain-dot t rear-nonsticky t))))) (defun icicle-anychar-regexp () "Return a regexp that matches any single character, including newline. The value returned is like that of constant `icicle-anychar-regexp', but the `display' string is unique for each call." (let ((strg (copy-sequence "\\(.\\|[\n]\\)"))) (set-text-properties 0 (length strg) (if icicle-dot-show-regexp-flag '(face highlight rear-nonsticky t) `(display ,(copy-sequence ".") face highlight rear-nonsticky t)) strg) strg)) (defun icicle-erase-minibuffer () ; Bound to `M-S-backspace', `M-S-delete' in minibuffer. "Delete all user input in the minibuffer, then update completions." (interactive) (icicle-call-then-update-Completions #'icicle-clear-minibuffer)) ;;(@* "Commands to sort completion candidates") ;;; Commands to sort completion candidates . . . . . . . . . . . . . . ;; We don't bother to define a command for the sort functions `icicle-prefix-keys-first-p' and ;; `icicle-command-names-alphabetic-p'. They are bound in `icicle-complete-keys'. ;; The order here defines the reverse order of `icicle-sort-orders-alist'. ;; The first here is also the default sort order. Entries are traversed by `C-,' in ;; `icicle-sort-orders-alist' order. (icicle-define-sort-command "alphabetical" ; `icicle-sort-alphabetical' icicle-case-string-less-p "Sort completion candidates alphabetically. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil.") (icicle-define-sort-command "special candidates first" ; `icicle-sort-special-candidates-first' icicle-special-candidates-first-p "Sort completion candidates by putting special candidates first. Otherwise, sorting is alphabetical. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil.") (icicle-define-sort-command "extra candidates first" ; `icicle-sort-extra-candidates-first' icicle-extra-candidates-first-p "Sort completion candidates by putting extra candidates first. Otherwise, sorting is alphabetical. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil. An extra candidate is one that is a member of `icicle-extra-candidates'.") (icicle-define-sort-command "proxy candidates first" ; `icicle-sort-proxy-candidates-first' icicle-proxy-candidate-first-p "Sort completion candidates by putting proxy candidates first. Otherwise, sorting is alphabetical. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil.") (icicle-define-sort-command "case insensitive" ; `icicle-sort-case-insensitive' icicle-case-insensitive-string-less-p "Sort completion candidates alphabetically, but case-insenstively.") (icicle-define-sort-command "by 2nd parts alphabetically" ; `icicle-sort-by-2nd-parts-alphabetically' icicle-2nd-part-string-less-p "Sort multi-completion candidates alphabetically by their second parts. After that, sort alphabetically by the first parts. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil.") (icicle-define-sort-command "by last file access time" icicle-last-accessed-first-p ; `icicle-sort-by-last-file-access-time' "Sort file-name completion candidates in order of last access. If not doing file-name completion, then sort alphabetically.") (icicle-define-sort-command "by last file modification time" icicle-last-modified-first-p ; `icicle-sort-by-last-file-modification-time' "Sort file-name completion candidates in order of last modification. If not doing file-name completion, then sort alphabetically.") (icicle-define-sort-command "by file type" ; `icicle-sort-by-file-type' icicle-file-type-less-p "Sort file-name completion candidates by file type. Directories sort first, alphabetically. Then sort by file type (extension), alphabetically. Sort names that have the same extension alphabetically. If not doing file-name completion, sort candidates alphabetically.") (icicle-define-sort-command "by directories first" ; `icicle-sort-by-directories-first' icicle-dirs-first-p "Sort file-name completion candidates so that directories are first. If not doing file-name completion, then sort alphabetically.") (icicle-define-sort-command "by directories last" ; `icicle-sort-by-directories-last' icicle-dirs-last-p "Sort file-name completion candidates so that directories are last. If not doing file-name completion, then sort alphabetically.") (icicle-define-sort-command "by last use as input" ; `icicle-sort-by-last-use-as-input' icicle-most-recent-first-p "Sort completion candidates in order of last use as minibuffer input.") (icicle-define-sort-command "by previous use alphabetically" icicle-historical-alphabetic-p ; `icicle-sort-by-previous-use-alphabetically' "Sort completion candidates by previous use and alphabetically. Candidates matching previous inputs are available first. Candidates are in two groups, each of which is sorted alphabetically separately: those matching previous inputs, followed by those that have not yet been used.") (icicle-define-sort-command "by abbrev frequency" ; `icicle-sort-by-abbrev-frequency' icicle-command-abbrev-used-more-p "Sort abbrev completion candidates by frequency of use Otherwise, sort alphabetically. Ignore letter case if `completion-ignore-case' or `case-fold-search' is non-nil.") (icicle-define-sort-command "turned OFF" nil ; `icicle-sort-turned-OFF' "Do not sort completion candidates.") (defun icicle-dispatch-M-_ () ; Bound to `M-_' in minibuffer. "Do the right thing for `M-_'. During Icicles search, call `icicle-toggle-search-replace-whole'. Otherwise, call `icicle-toggle-ignored-space-prefix'. Bound to `M-_' in the minibuffer." (interactive) (if icicle-searching-p (icicle-toggle-search-replace-whole) (icicle-toggle-ignored-space-prefix))) ;;; No longer used. ;;; (defun icicle-dispatch-C-comma () ;;; "Do the right thing for `C-,'. ;;; When candidate sorting is possible, call `icicle-change-sort-order'. ;;; When searching, call `icicle-toggle-search-replace-whole'. ;;; Otherwise, do nothing. ;;; ;;; Bound to `C-,' in the minibuffer." ;;; (interactive) ;;; (cond (icicle-searching-p (icicle-toggle-search-replace-whole)) ;;; (icicle-inhibit-sort-p (message "Cannot sort candidates now")) ;;; (t (call-interactively #'icicle-change-sort-order)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-ignoring-comments 'icicle-toggle-ignoring-comments) (defun icicle-toggle-ignoring-comments () ; Bound to `C-M-;' in minibuffer. "Toggle the value of option `icicle-ignore-comments-flag'. If option `ignore-comments-flag' is defined (in library `thing-cmds.el') then it too is toggled. Bound to `C-M-;' in the minibuffer." (interactive) (setq icicle-ignore-comments-flag (not icicle-ignore-comments-flag)) (when (boundp 'ignore-comments-flag) (setq ignore-comments-flag (not ignore-comments-flag))) (icicle-msg-maybe-in-minibuffer "Ignoring comments is now %s" (icicle-propertize (if icicle-ignore-comments-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-search-replace-common-match 'icicle-toggle-search-replace-common-match) (defun icicle-toggle-search-replace-common-match () ; Bound to `M-;' in minibuffer. "Toggle the value of `icicle-search-replace-common-match-flag'. Note that that option has no effect if the value of option `icicle-expand-input-to-common-match' does not imply expansion. Bound to `M-;' in the minibuffer." (interactive) (setq icicle-search-replace-common-match-flag (not icicle-search-replace-common-match-flag)) (icicle-msg-maybe-in-minibuffer "Replacing expanded common match is now %s" (icicle-propertize (if icicle-search-replace-common-match-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-search-replace-whole 'icicle-toggle-search-replace-whole) (defun icicle-toggle-search-replace-whole () "Toggle the value of `icicle-search-replace-whole-candidate-flag'. Bound to `M-_' in the minibuffer when searching." (interactive) (setq icicle-search-replace-whole-candidate-flag (not icicle-search-replace-whole-candidate-flag)) (icicle-msg-maybe-in-minibuffer "Replacing whole search context is now %s" (icicle-propertize (if icicle-search-replace-whole-candidate-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-dot 'icicle-toggle-dot) (defalias 'toggle-icicle-. 'icicle-toggle-dot) (defalias 'icicle-toggle-. 'icicle-toggle-dot) (defun icicle-toggle-dot () ; Bound to `C-M-.' in minibuffer. "Toggle `icicle-dot-string' between `.' and `icicle-anychar-regexp'. Bound to `C-M-.' in the minibuffer." (interactive) (setq icicle-dot-string (if (string= icicle-dot-string ".") (icicle-anychar-regexp) ".")) (icicle-msg-maybe-in-minibuffer (cond ((string= icicle-dot-string ".") (icicle-convert-dots (equal icicle-current-input icicle-last-input) t) (format "`%s' now matches any char %s newline" (icicle-propertize "." 'face 'icicle-msg-emphasis) (icicle-propertize "EXCEPT" 'face 'icicle-msg-emphasis))) (t (icicle-convert-dots (equal icicle-current-input icicle-last-input)) (format "`%s' now matches any char, including %s" (icicle-propertize "." 'face 'icicle-msg-emphasis) (icicle-propertize "NEWLINE" 'face 'icicle-msg-emphasis))))) (setq icicle-dot-string-internal icicle-dot-string)) (defun icicle-convert-dots (&optional no-confirm-p plainp) "Convert existing dots. Optional arg NO-CONFIRM-P means don't ask user for confirmation. Optional arg PLAINP means convert to plain `.'. Otherwise, convert to `icicle-anychar-regexp'." (if plainp (save-excursion (when (and (goto-char (icicle-minibuffer-prompt-end)) (search-forward icicle-anychar-regexp nil t)) (goto-char (icicle-minibuffer-prompt-end)) (while (search-forward icicle-anychar-regexp nil t) (replace-match "." nil t)))) (save-excursion (when (and (goto-char (icicle-minibuffer-prompt-end)) (search-forward "." nil t)) (goto-char (icicle-minibuffer-prompt-end)) (let ((allp nil)) (while (search-forward "." nil t) ;; If we hit a plain dot inserted by user explicitly, ask if we should convert all such. (when (and (not allp) (get-text-property (match-beginning 0) 'icicle-user-plain-dot) (not no-confirm-p) (y-or-n-p "Should all dots (`.') in current input match newlines too? ")) (setq allp t)) (when (or allp (not (get-text-property (match-beginning 0) 'icicle-user-plain-dot))) (replace-match (icicle-anychar-regexp) nil t)))))))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. (when (require 'image-dired nil t) ; Emacs 22+. (defalias 'cycle-icicle-image-file-thumbnail 'icicle-toggle-show-image-file-thumbnail) (defun icicle-cycle-image-file-thumbnail () ; Bound to `C-x t' in minibuffer. "Toggle `icicle-image-files-in-Completions'. This has no effect if you do not have library `image-dired.el' (Emacs 23+). Bound to `C-x t' in the minibuffer." (interactive) (if (not (require 'image-dired nil t)) (message "No-op: this command requires library `image-dired.el'") (setq icicle-image-files-in-Completions (case icicle-image-files-in-Completions ((nil) 'image-only) (image-only t) (t nil))) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer (case icicle-image-files-in-Completions ((nil) (format "Image files in `*Completions*': showing only %s Next: only IMAGES" (icicle-propertize "NAMES" 'face 'icicle-msg-emphasis))) (image-only (format "Image files in `*Completions*': showing only %s Next: IMAGES and NAMES" (icicle-propertize "IMAGES" 'face 'icicle-msg-emphasis))) (t (format "Image files in `*Completions*': showing %s Next: only NAMES" (concat (icicle-propertize "IMAGES" 'face 'icicle-msg-emphasis) " and " (icicle-propertize "NAMES" 'face 'icicle-msg-emphasis))))))))) ;; This works hand in hand with `icicle-maybe-sort-maybe-truncate'. Update both together. ;; (defun icicle-doremi-increment-max-candidates+ (&optional increment) ; `C-x #' in minibuffer "Change `icicle-max-candidates' incrementally. Use `up', `down' or the mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-up') to increment in larger steps. You can use a numeric prefix arg to specify the increment. A plain prefix arg (`C-u') resets `icicle-max-candidates' to nil, meaning no limit." (interactive "P") (cond ((consp increment) (setq icicle-max-candidates 'RESET) ; `icicle-maybe-sort-maybe-truncate' will reset to nil. (icicle-msg-maybe-in-minibuffer "No longer any limit on number of candidates")) (t (setq increment (prefix-numeric-value increment)) (unless (require 'doremi nil t) (icicle-user-error "You need library `doremi.el' for this command")) (let ((mini (active-minibuffer-window))) (unwind-protect (save-selected-window (select-window (minibuffer-window)) (unless icicle-completion-candidates (message "Hit `TAB' or `S-TAB'")) (let ((enable-recursive-minibuffers t) (nb-cands (length icicle-completion-candidates))) (when (or (not (integerp icicle-max-candidates)) ; Not `RESET' or nil. (> icicle-max-candidates nb-cands)) (setq icicle-max-candidates nb-cands)) (when (zerop icicle-max-candidates) (setq icicle-max-candidates 10)) (doremi (lambda (new-val) (setq icicle-max-candidates (setq new-val (doremi-limit new-val 2 nil))) (unless (input-pending-p) (let ((icicle-edit-update-p t) (icicle-last-input nil)) (funcall (or icicle-last-completion-command (if (eq icicle-current-completion-mode 'prefix) #'icicle-prefix-complete #'icicle-apropos-complete))) (run-hooks 'icicle-update-input-hook))) new-val) icicle-max-candidates increment)) (setq unread-command-events ())) (unless mini (icicle-remove-Completions-window))))))) (defun icicle-doremi-increment-swank-timeout+ () ; Bound to `C-x 1' in minibuffer (swank only) "Change `icicle-swank-timeout' incrementally. Use `up', `down' or the mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-up') to increment in larger steps." (interactive) (icicle-doremi-increment-variable+ 'icicle-swank-timeout 1000)) (defun icicle-doremi-increment-swank-prefix-length+ () ; Bound to `C-x 2' in minibuffer (swank only) "Change `icicle-swank-prefix-length' incrementally. Use `up', `down' or the mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-up') to increment in larger steps." (interactive) (icicle-doremi-increment-variable+ 'icicle-swank-prefix-length 1)) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'cycle-icicle-TAB-completion-method 'icicle-next-TAB-completion-method) (defun icicle-next-TAB-completion-method (temporary-p) ; Bound to `C-(' in minibuffer. "Cycle to the next `TAB' completion method. Bound to \\`\\[icicle-next-TAB-completion-method]' \ in the minibuffer. Option `icicle-TAB-completion-methods' determines the TAB completion methods that are available. With a prefix argument, the newly chosen method is used only for the current command. More precisely, the previously active method is restored as soon as you return to the top level." (interactive "P") (unless icicle-current-TAB-method ; nil means the same as the default (first). (setq icicle-current-TAB-method (car icicle-TAB-completion-methods))) (if temporary-p (unless (get 'icicle-last-top-level-command 'icicle-current-TAB-method) (put 'icicle-last-top-level-command 'icicle-current-TAB-method icicle-current-TAB-method)) (put 'icicle-last-top-level-command 'icicle-current-TAB-method nil)) (let ((now (memq icicle-current-TAB-method icicle-TAB-completion-methods)) following) (setq icicle-current-TAB-method (or (cadr now) (car icicle-TAB-completion-methods)) following (or (cadr (memq icicle-current-TAB-method icicle-TAB-completion-methods)) (car icicle-TAB-completion-methods))) ;; Skip any method that is not currently supported. (while (or (and (eq icicle-current-TAB-method 'fuzzy) (not (featurep 'fuzzy-match))) (and (eq icicle-current-TAB-method 'vanilla) (not (boundp 'completion-styles))) (and (eq icicle-current-TAB-method 'swank) (not (featurep 'el-swank-fuzzy)))) (setq now (memq icicle-current-TAB-method icicle-TAB-completion-methods) icicle-current-TAB-method (or (cadr now) (car icicle-TAB-completion-methods)))) ;; Skip any method that is not currently supported. (while (or (and (eq following 'fuzzy) (not (featurep 'fuzzy-match))) (and (eq following 'vanilla) (not (boundp 'completion-styles))) (and (eq following 'swank) (not (featurep 'el-swank-fuzzy)))) (setq following (or (cadr (memq icicle-current-TAB-method icicle-TAB-completion-methods)) (car icicle-TAB-completion-methods)))) ;; $$$$$$ Inhibiting sorting is not correct for file-name completion, and sorting would not be ;; restored when change back to non-fuzzy. ;; (when (eq 'fuzzy icicle-current-TAB-method) (setq icicle-inhibit-sort-p t)) (icicle-msg-maybe-in-minibuffer "TAB completion is %s %s Next: %s" (icicle-propertize (icicle-upcase (symbol-name icicle-current-TAB-method)) 'face 'icicle-msg-emphasis) (if temporary-p (concat "for " (icicle-propertize "this command" 'face 'icicle-msg-emphasis)) "now.") (if temporary-p "" (icicle-upcase (symbol-name following))))) (cond ((and (eq icicle-current-TAB-method 'swank) (fboundp 'doremi)) (define-key minibuffer-local-completion-map (icicle-kbd "C-x 1") 'icicle-doremi-increment-swank-timeout+) (define-key minibuffer-local-must-match-map (icicle-kbd "C-x 1") 'icicle-doremi-increment-swank-timeout+) (define-key minibuffer-local-completion-map (icicle-kbd "C-x 2") 'icicle-doremi-increment-swank-prefix-length+) (define-key minibuffer-local-must-match-map (icicle-kbd "C-x 2") 'icicle-doremi-increment-swank-prefix-length+)) ((fboundp 'doremi) (define-key minibuffer-local-completion-map (icicle-kbd "C-x 1") nil) (define-key minibuffer-local-must-match-map (icicle-kbd "C-x 1") nil) (define-key minibuffer-local-completion-map (icicle-kbd "C-x 2") nil) (define-key minibuffer-local-must-match-map (icicle-kbd "C-x 2") nil)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'cycle-icicle-S-TAB-completion-method 'icicle-next-S-TAB-completion-method) (defun icicle-next-S-TAB-completion-method (temporary-p) ; Bound to `M-(' in minibuffer. "Cycle to the next `S-TAB' completion method. Bound to `M-(' in the minibuffer. Option `icicle-S-TAB-completion-methods-alist' customizes the available TAB completion methods. With a prefix argument, the newly chosen method is used only for the current command. More precisely, the previously active method is restored as soon as you return to the top level." (interactive "P") (if temporary-p (unless (get 'icicle-last-top-level-command 'icicle-apropos-complete-match-fn) (put 'icicle-last-top-level-command 'icicle-apropos-complete-match-fn icicle-apropos-complete-match-fn)) (put 'icicle-last-top-level-command 'icicle-apropos-complete-match-fn nil)) (let ((entry (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist)) following) (setq icicle-apropos-complete-match-fn (or (cdadr (member entry icicle-S-TAB-completion-methods-alist)) (cdar icicle-S-TAB-completion-methods-alist)) following (or (caadr (member (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist) icicle-S-TAB-completion-methods-alist)) (caar icicle-S-TAB-completion-methods-alist)) icicle-last-apropos-complete-match-fn icicle-apropos-complete-match-fn) ; Backup copy. (icicle-msg-maybe-in-minibuffer "S-TAB completion is %s%s %s Next: %s" (icicle-propertize (icicle-upcase (car (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist))) 'face 'icicle-msg-emphasis) (if (memq icicle-apropos-complete-match-fn '(icicle-levenshtein-match icicle-levenshtein-strict-match)) (icicle-propertize (format " (%d)" icicle-levenshtein-distance) 'face 'icicle-msg-emphasis) "") (if temporary-p (concat "for " (icicle-propertize "this command" 'face 'icicle-msg-emphasis)) "now.") (if temporary-p "" (icicle-upcase following))))) ;; (icicle-complete-again-update) ; No - too slow for some completion methods. ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'cycle-icicle-sort-order 'icicle-change-sort-order) (defun icicle-change-sort-order (&optional arg alternativep) ; Bound to `C-,' in minibuffer. "Choose a sort order. With a numeric prefix arg, reverse the current sort order. If plain `C-u' is used or `C-u' is not used at all: - Use completion if `icicle-change-sort-order-completion-flag' is non-nil and no prefix arg is used, or if it is nil and a prefix arg is used. - Otherwise, just cycle to the next sort order. This command updates `icicle-sort-comparer'. Non-interactively, optional arg ALTERNATIVEP means change the current alternative sort order instead, updating `icicle-alternative-sort-comparer'." (interactive "P") (setq icicle-sort-orders-alist (delq nil icicle-sort-orders-alist)) ; Purge any nil entries. (if (and (interactive-p) icicle-inhibit-sort-p) (icicle-msg-maybe-in-minibuffer "Cannot sort candidates now") (if (and arg (not (consp arg))) (icicle-reverse-sort-order) (let ((following-order nil) next-order) (cond ((or (and icicle-change-sort-order-completion-flag (not arg)) ; Use completion. (and (not icicle-change-sort-order-completion-flag) arg)) (setq next-order (let ((icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t) (icicle-must-pass-after-match-predicate nil)) (save-selected-window (completing-read (format "New %ssort order: " (if alternativep "alternative " "")) (icicle-current-sort-functions) nil t)))) (set (if alternativep 'icicle-alternative-sort-comparer 'icicle-sort-comparer) (cdr (assoc next-order icicle-sort-orders-alist)))) (t ; Cycle to next sort order. (let ((orders (mapcar #'car (icicle-current-sort-functions)))) (setq next-order (or (cadr (memq (icicle-current-sort-order alternativep) orders)) (car orders)) following-order (or (cadr (memq next-order orders)) (car orders))) (set (if alternativep 'icicle-alternative-sort-comparer 'icicle-sort-comparer) (cdr (assoc next-order icicle-sort-orders-alist)))))) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "%sorting is now %s. Reverse: `C-9 C-,'%s" (if alternativep "Alternative s" "S") (icicle-propertize (concat next-order (and icicle-reverse-sort-p ", REVERSED")) 'face 'icicle-msg-emphasis) (if following-order (format ". Next: %s" following-order) ""))) (when (fboundp 'completion--flush-all-sorted-completions) ; E.g., so Icomplete+ recomputes order. (completion--flush-all-sorted-completions))))) (defun icicle-current-sort-functions () "Subset of `icicle-sort-orders-alist' that is currently appropriate. For some common kinds of completion, remove simple sort functions (not multi-sort comparers) that are not pertinent for the current kind of completion." (icicle-remove-if (lambda (pred) (setq pred (cdr pred)) (and pred (symbolp pred) ; Do not handle multi-sort comparers. (not (eq pred icicle-allowed-sort-predicate)) (or (and (get pred 'icicle-proxy-sort-predicate) (not icicle-add-proxy-candidates-flag)) (and (get pred 'icicle-file-name-sort-predicate) (not (or (icicle-file-name-input-p) icicle-abs-file-candidates))) ;; Not really needed yet, because we only add such sorts dynamically. (and (get pred 'icicle-buffer-name-sort-predicate) ; Better than nothing. (not (eq minibuffer-history-variable 'buffer-name-history))) (and (get pred 'icicle-command-sort-predicate) (not (and (eq minibuffer-completion-table obarray) ;; But this will fail if predicate is more complex. ;; So be sure to bind `icicle-allowed-sort-predicate' ;; in that case, to avoid this restriction. (eq minibuffer-completion-predicate 'commandp)))) ;; Sort order for multi-completions. `minibuffer-completion-table' ;; could be a function (e.g. `icicle-describe-opt-of-type-complete') ;; or it could be a list of multi-completions. (and (get pred 'icicle-multi-completion-sort-predicate) (not (icicle-maybe-multi-completion-completing-p)))))) icicle-sort-orders-alist)) (defun icicle-maybe-multi-completion-completing-p () "Returns non-nil if we might currently be multi-completion completing. Note: If `minibuffer-completion-table' is a function, multi-completion is possible but not sure. Return non-nil in that case." (or (functionp minibuffer-completion-table) icicle-list-use-nth-parts)) (defun icicle-dispatch-M-comma () ; Bound to `M-,' in minibuffer. "Do the right thing for `M-,'. If sorting is possible, call `icicle-change-alternative-sort-order'. If using `icicle-search', call `icicle-search-define-replacement'. Otherwise, do nothing. Bound to `M-,' in the minibuffer." (interactive) (cond (icicle-searching-p (icicle-search-define-replacement)) (icicle-inhibit-sort-p (message "Cannot sort candidates now")) (t (icicle-change-alternative-sort-order)))) ;; Free vars here: `icicle-scan-fn-or-regexp' is bound in `icicle-search'. ;; (defun icicle-search-define-replacement () ; Bound to `M-,' in minibuffer during `icicle-search'. "Prompt user and set new value of `icicle-search-replacement'. Bound to `M-,' in the minibuffer." (interactive) (save-selected-window (icicle-remove-Completions-window)) ; Prevent incremental completion kicking in from the get-go. (setq icicle-search-replacement (let ((enable-recursive-minibuffers t) (icicle-incremental-completion t) ; Override current upgrade to `always'. (icicle-completion-candidates icicle-completion-candidates) (icicle-current-input icicle-current-input) (icicle-candidate-nb icicle-candidate-nb) (icicle-update-input-hook nil)) (icicle-completing-read-history "Replacement string: " 'icicle-search-replacement-history))) ;; Just a sanity check. Cannot really test equivalence of two regexps. (while (if icicle-search-replace-whole-candidate-flag (equal icicle-search-replacement icicle-scan-fn-or-regexp) (equal icicle-search-replacement icicle-current-input)) (setq icicle-search-replacement (let ((enable-recursive-minibuffers t) (icicle-incremental-completion t) ; Override current upgrade to `always'. (icicle-completion-candidates icicle-completion-candidates) (icicle-current-input icicle-current-input) (icicle-candidate-nb icicle-candidate-nb) (icicle-update-input-hook nil)) (icicle-completing-read-history "Replacement = replaced. Replacement string: " 'icicle-search-replacement-history))))) (defun icicle-change-alternative-sort-order (&optional arg) ; Bound to `M-,' in minibuffer (not search). "Choose an alternative sort order. Similar to command `icicle-change-sort-order', but change the alternative sort order, not the current sort order." (interactive "P") (if (and (interactive-p) icicle-inhibit-sort-p) (icicle-msg-maybe-in-minibuffer "Cannot sort candidates now") (icicle-change-sort-order arg t))) (defun icicle-current-sort-order (alternativep) "Current sort order, or nil if sorting is inactive. If ALTERNATIVEP is non-nil, the alternative sort order is returned." (car (rassq (if alternativep icicle-alternative-sort-comparer icicle-sort-comparer) icicle-sort-orders-alist))) (defun icicle-reverse-sort-order () "Reverse the current sort order." (interactive) (if (and (interactive-p) icicle-inhibit-sort-p) (icicle-msg-maybe-in-minibuffer "Cannot sort candidates now") (setq icicle-reverse-sort-p (not icicle-reverse-sort-p)) (icicle-display-candidates-in-Completions icicle-reverse-sort-p) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Sort order is %s" (icicle-propertize (concat (icicle-current-sort-order nil) (and icicle-reverse-sort-p ", REVERSED")) 'face 'icicle-msg-emphasis)))) (defun icicle-plus-saved-sort () ; Bound to `C-M-+' during completion. "Sort candidates by combining their current order with the saved order." (interactive) (let ((icicle-sort-comparer 'icicle-merge-saved-order-less-p) (cands (copy-sequence icicle-completion-candidates))) (setq icicle-completion-candidates (if (or (icicle-file-name-input-p) icicle-abs-file-candidates) (icicle-strip-ignored-files-and-sort cands) (icicle-maybe-sort-maybe-truncate cands)))) (when (get-buffer-window "*Completions*" 0) (icicle-display-candidates-in-Completions)) (when (interactive-p) (icicle-msg-maybe-in-minibuffer "Added in the saved sort order"))) ;;(@* "Other commands to be used mainly in the minibuffer") ;;; Other commands to be used mainly in the minibuffer . . . . . . . . ;; $$ Probably need to do something to work around problem of Windows ;; selecting the new frame, when `pop-up-frames' is non-nil. Need to ;; redirect focus back to the frame with the minibuffer. Leave it as ;; is, for now, in hopes Emacs will eventually fix this. ;; (defun icicle-minibuffer-help () ; Bound to `M-?' in the minibuffer. "Describe Icicles minibuffer and *Completion* buffer bindings." (interactive) (let ((cur-buf (current-buffer)) (icicles-cmd-p (or icicle-candidate-action-fn icicle-multi-completing-p))) (with-output-to-temp-buffer "*Help*" (help-setup-xref (list #'icicle-minibuffer-help) (interactive-p)) (when (icicle-completing-p) (princ (format "You are completing input%s. %s" (if icicles-cmd-p (format " for an Icicles %scommand%s" (if icicle-candidate-action-fn "multi-" "") (if icicle-multi-completing-p " that uses multi-\ncompletion" "")) "") (format "To show help on individual completion%scandidates:\n" (if icicles-cmd-p "" "\n")))) (princ " Current candidate C-M-RET, C-M-mouse-2 Next, previous candidate C-M-down, C-M-up, C-M- plus mouse wheel prefix-match candidate C-M-end, C-M-home apropos-match candidate C-M-next, C-M-prior\n\n") (when icicle-candidate-action-fn (princ "To act on individual candidates: Current candidate C-RET, C-mouse-2 Next, previous candidate C-down, C-up, C- plus mouse wheel prefix-match candidate C-end, C-home apropos-match candidate C-next, C-prior All candidates at once C-! (each) or M-! (list) Delete object named by candidate S-delete Object-action: apply a fn to candidate M-RET")) (when icicle-candidate-alt-action-fn (princ "\n\nFor alt action, use `C-S-' instead of `C-', but use `C-|' or `M-|',\n\ instead of `C-!' or `M-!', to act on all.\n"))) (if icicle-completing-p (with-current-buffer standard-output (insert (concat "\n" (icicle-help-string-completion)))) (princ (icicle-help-string-non-completion)))) ;; Don't bother to do this for Emacs 21.3. Its `help-insert-xref-button' signature is different. (when (and (> emacs-major-version 21) (require 'help-mode nil t) (fboundp 'help-insert-xref-button)) ; In `help-mode.el'. (save-excursion (with-current-buffer (get-buffer "*Help*") (let ((buffer-read-only nil)) (goto-char (point-min)) (help-insert-xref-button "[Icicles Help on the Web]" 'icicle-help-button) (insert " ") (help-insert-xref-button "[Icicles Doc, Part 1]" 'icicle-commentary1-button) (insert "\n") (help-insert-xref-button "[Icicles Options & Faces]" 'icicle-customize-button) (insert " ") (help-insert-xref-button "[Icicles Doc, Part 2]" 'icicle-commentary2-button) (insert "\n\n") (goto-char (point-max)) (insert (make-string 70 ?_)) (insert (funcall (if (fboundp 'help-commands-to-key-buttons) ; In `help-fns.el'. #'help-commands-to-key-buttons #'substitute-command-keys) "\n\nSend an Icicles bug report: `\\[icicle-send-bug-report]'.\n\n")) (help-insert-xref-button "[Icicles Help on the Web]" 'icicle-help-button) (insert " ") (help-insert-xref-button "[Icicles Doc, Part 1]" 'icicle-commentary1-button) (insert "\n") (help-insert-xref-button "[Icicles Options & Faces]" 'icicle-customize-button) (insert " ") (help-insert-xref-button "[Icicles Doc, Part 2]" 'icicle-commentary2-button) (insert "\n\n") (goto-char (point-min)))))) (when (memq cur-buf (list (window-buffer (minibuffer-window)) (get-buffer "*Completions*"))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame))))) (defun icicle-help-string-completion () "Update the bindings within the Icicles completion help string." (icicle-S-iso-lefttab-to-S-TAB (funcall (if (fboundp 'help-commands-to-key-buttons) ; In `help-fns+.el'. #'help-commands-to-key-buttons #'substitute-command-keys) (concat (format "\\ Icicles Minibuffer Completion ----------------------------- Completion indicators: Mode line `Icy' lighter (additive): red = Completion available (use `TAB' or `S-TAB' to complete) + = Multi-command completion (use `C-RET' to act on candidate) || = Multi-completion candidates (use `C-M-j' to separate parts) ... = `icicle-max-candidates' shown (use `C-x #' to change) Prompt prefix (exclusive): . = Simple completion + = Multi-command completion You can complete your minibuffer input in several ways. These are the main Icicles actions and their minibuffer key bindings: * Show Icicles minibuffer help (this). \\[icicle-minibuffer-help] For help on individual completion candidates, see \"Show help on individual completion candidates\", below. * Abandon or commit your input. Abandon input \\[icicle-abort-recursive-edit] Commit input to Emacs RET Complete partial input, then commit \\\ \\[icicle-apropos-complete-and-exit]\\ * Toggle/cycle Icicles options on the fly. Key: \tCurrently: Highlighting of past inputs \\[icicle-toggle-highlight-historical-candidates]\t%S Highlighting of saved candidates \\[icicle-toggle-highlight-saved-candidates]\t%S Removal of duplicate candidates \\[icicle-toggle-transforming]\t%s Sort order \\[icicle-change-sort-order]\t%s Alternative sort order \\[icicle-dispatch-M-comma]\t%s Swap alternative/normal sort \\[icicle-toggle-alternative-sorting] Case sensitivity \\[icicle-toggle-case-sensitivity]\t%S `.' matching newlines too (any char) \\[icicle-toggle-dot]\t%S Escaping of special regexp chars \\[icicle-toggle-regexp-quote]\t%S Incremental completion \\[icicle-cycle-incremental-completion]\t%s Input expansion to common match (toggle)\\[icicle-toggle-expand-to-common-match]\t%S Input expansion to common match (cycle) \\[icicle-cycle-expand-to-common-match]\t%s Hiding common match in `*Completions*' \\[icicle-dispatch-C-x.]\t%S Hiding no-match lines in `*Completions*' C-u \\[icicle-dispatch-C-x.]\t%s Horizontal/vertical candidate layout \\[icicle-toggle-completions-format]\t%s S-TAB completion method \\[icicle-next-S-TAB-completion-method]\t%s TAB completion method \\[icicle-next-TAB-completion-method]\t%s Showing image-file thumbnails (E22+) C-x t\t%s Showing candidate annotations \\[icicle-toggle-annotation]\t%S Inclusion of proxy candidates \\[icicle-toggle-proxy-candidates]\t%S Ignoring certain file extensions \\[icicle-dispatch-C-.]\t%S Checking for remote file names \\[icicle-dispatch-C-^]\t%S" (if icicle-highlight-historical-candidates-flag 'yes 'no) (if icicle-highlight-saved-candidates-flag 'yes 'no) (cond ((not icicle-transform-function) "no") ((or (eq icicle-transform-function 'icicle-remove-duplicates) (and icicle-extra-candidates (eq icicle-transform-function 'icicle-remove-dups-if-extras))) "yes") ((eq 'icicle-remove-dups-if-extras icicle-transform-function) "yes in general, but not now") (t icicle-transform-function)) (icicle-current-sort-order nil) (icicle-current-sort-order 'ALTERNATIVE) (if case-fold-search 'no 'yes) (if (string= icicle-dot-string icicle-anychar-regexp) 'yes 'no) (if icicle-regexp-quote-flag 'yes 'no) (case icicle-incremental-completion ((nil) "no") ((t) "yes, if *Completions* showing") (t "yes, always (eager)")) (if (eq icicle-expand-input-to-common-match 0) 'no 'yes) (case icicle-expand-input-to-common-match (0 "never") (1 "explicit completion") (2 "only one completion") (3 "`TAB' or only one") (t "always")) (if icicle-hide-common-match-in-Completions-flag 'yes 'no) (if icicle-hide-non-matching-lines-flag 'yes 'no) icicle-completions-format (car (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist)) (icicle-current-TAB-method) (case icicle-image-files-in-Completions ((nil) "no") (image "image only") (t "image and name")) (if icicle-show-annotations-flag 'yes 'no) (if icicle-add-proxy-candidates-flag 'yes 'no) (if completion-ignored-extensions 'yes 'no) (if icicle-test-for-remote-files-flag 'yes 'no)) (and (memq system-type '(ms-dos windows-nt cygwin)) ; MS Windows only. (format "\\ Considering network drives as remote \\[icicle-toggle-network-drives-as-remote]\t%S" (if icicle-network-drive-means-remote-flag 'yes 'no))) (format "\\ Ignoring space prefix for buffer names \\[icicle-dispatch-M-_]\t%S Using `C-' for multi-command actions \\[icicle-toggle-C-for-actions]\t%S Using `~' for your home directory \\[icicle-toggle-~-for-home-dir]\t%S `icicle-search' all-current highlights \\[icicle-dispatch-C-^]\t%S Whole-word searching \\[icicle-dispatch-M-q]\t%S Removal of `icicle-search' highlighting \\[icicle-dispatch-C-.]\t%S Replacement of whole search hit \\[icicle-dispatch-M-_]\t%S Replacement of expanded common match \\[icicle-toggle-search-replace-common-match]\t%S * Regexp-quote input, then apropos-complete \\[icicle-regexp-quote-input] * Change the set of completion candidates. Modify your input. Edit your input (just edit in minibuffer) Erase your input (clear minibuffer) \\[icicle-erase-minibuffer-or-history-element] Goto/kill non-matching portion of input \\[icicle-goto/kill-failed-input] Retrieve previous completion inputs \\[icicle-retrieve-previous-input], \ \\[icicle-retrieve-next-input] Match another regexp (chaining) \\[icicle-narrow-candidates] Satisfy another predicate (chaining) \\[icicle-narrow-candidates-with-predicate] Remove a candidate from set of matches delete, S-mouse-2 Yank text at cursor into minibuffer \\[icicle-insert-string-at-point] Insert text (string) from a variable \\[icicle-insert-string-from-variable] Insert `icicle-list-join-string' \\[icicle-insert-list-join-string] Insert previously entered input(s) \\[icicle-insert-history-element] Insert completion candidates(s) \\[icicle-roundup] Insert key description (key completion) \\[icicle-dispatch-M-q] * Complete your current input in the minibuffer. Apropos (regexp) completion \\[icicle-apropos-complete] Without displaying candidates \\[icicle-apropos-complete-no-display] Complete and match another regexp \\[icicle-apropos-complete-and-narrow] Prefix completion As much as possible \\[icicle-prefix-complete] Without displaying candidates \\[icicle-prefix-complete-no-display] A word at a time \\[icicle-prefix-word-complete] Complete and commit \\\ \\[icicle-apropos-complete-and-exit]\\ Complete search string using past input \\[icicle-apropos-complete] * Display/navigate completions for current input (in `*Completions*'). Show completion candidates Prefix completion \\[icicle-prefix-complete] (repeat) Apropos completion \\[icicle-apropos-complete] Move between minibuffer and list \\\ \\[icicle-insert-completion] Cycle among completion candidates right, left, \ \\[icicle-move-to-next-completion], \\[icicle-move-to-previous-completion] Within a `*Completions*' column down, up Choose a completion candidate \\[choose-completion], \ \\[mouse-choose-completion]\\ * Cycle among input candidates. Completion candidates Current mode down, up, mouse wheel Prefix completion end, home Apropos completion next, prior Minibuffer history items \\[next-history-element], \ \\[previous-history-element] Completion history items \\[icicle-retrieve-previous-input], \ \\[icicle-retrieve-next-input] * Show help on individual completion candidates. Current candidate C-M-RET, C-M-mouse-2 Next, previous candidate C-M-down, C-M-up, C-M- plus mouse wheel prefix-match candidate C-M-end, C-M-home apropos-match candidate C-M-next, C-M-prior * Choose a previous input from the minibuffer history. Complete to insert a previous input \\[icicle-insert-history-element] Complete against history items \\[icicle-history], \ \\[icicle-keep-only-past-inputs] Restrict candidates to history items \\[icicle-keep-only-past-inputs] Change to another history \\[icicle-other-history] List history items first in Completions \\[icicle-toggle-alternative-sorting] Cycle among minibuffer history items \\[next-history-element], \ \\[previous-history-element] * Delete history entries Delete current entry (cycling) \\[icicle-erase-minibuffer-or-history-element] Delete any or all entries \\[icicle-clear-current-history] * Multi-commands: Act on completion candidates. For alternative action, use `C-S-' instead of `C-', but `C-|' and `M-|' are alternative action versions of `C-!' and `M-!'. Current candidate C-RET, C-mouse-2 Next, previous candidate C-down, C-up, C- with mouse wheel prefix-match candidate C-end, C-home apropos-match candidate C-next, C-prior Act on each matching candidate, in turn C-! Act on the list of matching candidates M-! Delete object named by candidate S-delete Remove candidate from set of matches delete, S-mouse-2 Save candidate (add to those saved) insert, M-S-mouse-2 Object-action: apply a fn to candidate M-RET * Act on multiple minibuffer inputs \\[icicle-multi-inputs-act] * Search and replace (e.g. `C-c `'). See also `icicle-search'. Use action keys (prefix `C-') to navigate. Use alternative action keys (prefix `C-S-') to replace matches. Toggle input highlighting at all hits \\[icicle-dispatch-C-^] Toggle whole-word searching \\[icicle-dispatch-M-q] Toggle `.' matching newlines too \\[icicle-toggle-dot] Toggle escaping of special regexp chars \\[icicle-toggle-regexp-quote] Toggle removal of search highlighting \\[icicle-dispatch-C-.] Replace all M-| Redefine the replacement string \\[icicle-dispatch-M-comma] Toggle literal replacement \\[icicle-toggle-literal-replacement] Toggle replacement of whole search hit \\[icicle-dispatch-M-_] Toggle replacement of common match \\[icicle-toggle-search-replace-common-match] * Perform set operations on candidate sets. Remove candidate from current set delete, S-mouse-2 Add current candidate to saved set insert, M-S-mouse-2 Retrieve saved candidates from... `icicle-saved-completion-candidates' \\[icicle-candidate-set-retrieve] another variable \\[icicle-candidate-set-retrieve-from-variable] a cache file \\[icicle-candidate-set-retrieve-persistent] Retrieve more saved candidates \\[icicle-candidate-set-retrieve-more] Save candidates in current set to... `icicle-saved-completion-candidates' \\[icicle-candidate-set-save] another variable \\[icicle-candidate-set-save-to-variable] a cache file \\[icicle-candidate-set-save-persistently] Save more candidates to current set \\[icicle-candidate-set-save-more] Save, save more selected candidates \\[icicle-candidate-set-save-selected], \ \\[icicle-candidate-set-save-more-selected] with region Save multiple minibuffer inputs \\[icicle-multi-inputs-save] Clear all saved candidates \\[icicle-candidate-set-save-selected] \ with empty region Add new or update existing saved set \\[icicle-add/update-saved-completion-set] Remove a saved completion set \\[icicle-remove-saved-completion-set] Swap current and saved sets \\[icicle-candidate-set-swap] Define current set by evaluating sexp \\[icicle-candidate-set-define] Restrict candidates to history items \\[icicle-keep-only-past-inputs] Set complement \\[icicle-candidate-set-complement] Set difference \\[icicle-candidate-set-difference] Set union \\[icicle-candidate-set-union] Set intersection \\[icicle-candidate-set-intersection] Set intersection using regexp \\[icicle-narrow-candidates] Set intersection using predicate \\[icicle-narrow-candidates-with-predicate] Save current predicate to a variable \\[icicle-save-predicate-to-variable] Insert string variable as input \\[icicle-insert-string-from-variable] * Adjust Icicles options incrementally on the fly (uses Do Re Mi). `icicle-candidate-width-factor' \\[icicle-doremi-candidate-width-factor+] `icicle-max-candidates' \\[icicle-doremi-increment-max-candidates+] `icicle-swank-timeout' C-x 1 `icicle-swank-prefix-length' C-x 2 `icicle-inter-candidates-min-spaces' \\[icicle-doremi-inter-candidates-min-spaces+] Zoom `*Completions*' (not an option) C-x - (Emacs 23+) Remember: You can always input any character (e.g. \\[icicle-prefix-complete]) that is bound to a command by preceding it with \\\\[quoted-insert]. Though it has no direct connection with completion, you can use \ `\\\\[icicle-pp-eval-expression-in-minibuffer]' in the minibuffer at any time to evaluate an Emacs-Lisp expression. This calls `icicle-pp-eval-expression-in-minibuffer', which displays the result in the echo area or a popup buffer, *Pp Eval Output*. It also provides some of the Emacs-Lisp key bindings during expression editing." (if icicle-buffer-ignore-space-prefix-flag 'yes 'no) (if icicle-use-C-for-actions-flag 'yes 'no) (if icicle-use-~-for-home-dir-flag 'yes 'no) (if icicle-search-highlight-all-current-flag 'yes 'no) (if icicle-search-whole-word-flag 'yes 'no) (if icicle-search-cleanup-flag 'yes 'no) (if icicle-search-replace-whole-candidate-flag 'yes 'no) (if icicle-search-replace-common-match-flag 'yes 'no)) icicle-general-help-string " These are all of the minibuffer bindings during completion: \\{minibuffer-local-completion-map}")))) (defun icicle-help-string-non-completion () "Description of Icicles minibuffer bindings when not completing input." (icicle-S-iso-lefttab-to-S-TAB (substitute-command-keys (concat "\\\ Icicles Minibuffer Input when Not Completing -------------------------------------------- These are the main Icicles minibuffer key bindings when completion is not available: * Show this help. \\[icicle-minibuffer-help] * Abandon your input. \\[icicle-abort-recursive-edit] * Commit your input to Emacs. RET * Modify your input. Edit your input (just edit in minibuffer) Erase your input (clear minibuffer) \\[icicle-erase-minibuffer-or-history-element] Yank text at cursor into minibuffer \\[icicle-insert-string-at-point] Insert text (string) from a variable \\[icicle-insert-string-from-variable] Insert previously entered input(s) \\[icicle-insert-history-element] Insert completion candidates(s) \\[icicle-roundup] * Act on multiple minibuffer inputs \\[icicle-multi-inputs-act] * Save multiple inputs for later completion \\[icicle-multi-inputs-save] * Choose a previous input from the minibuffer history. Complete to insert a previous input \\[icicle-insert-history-element] Cycle among minibuffer history items \\[next-history-element], \ \\[previous-history-element] * Delete history entries Delete current entry (cycling) \\[icicle-erase-minibuffer-or-history-element] Delete any or all entries \\[icicle-clear-current-history] * Evaluate an Emacs-Lisp sexp on the fly \\[icicle-pp-eval-expression-in-minibuffer] Remember: You can always input any character that is bound to a command by preceding it with \\\\[quoted-insert]." icicle-general-help-string " These are the minibuffer bindings when not completing input: \\{minibuffer-local-map}")))) (when (and (> emacs-major-version 21) (require 'help-mode nil t) (get 'help-xref 'button-category-symbol)) ; In `button.el' (define-button-type 'icicle-help-button :supertype 'help-xref 'help-function (lambda () (browse-url "http://www.emacswiki.org/cgi-bin/wiki/Icicles")) 'help-echo (purecopy "mouse-2, RET: Icicles documentation on the Emacs Wiki (requires Internet access)")) (define-button-type 'icicle-commentary1-button :supertype 'help-xref 'help-function (lambda () (finder-commentary "icicles-doc1") (when (require 'linkd nil t) (linkd-mode 1)) (when (require 'fit-frame nil t) (fit-frame))) 'help-echo (purecopy "mouse-2, RET: Icicles documentation, Part 1 (no Internet needed)")) (define-button-type 'icicle-commentary2-button :supertype 'help-xref 'help-function (lambda () (finder-commentary "icicles-doc2") (when (require 'linkd nil t) (linkd-mode 1)) (when (require 'fit-frame nil t) (fit-frame))) 'help-echo (purecopy "mouse-2, RET: Icicles documentation, Part 2 (no Internet needed)")) (define-button-type 'icicle-customize-button :supertype 'help-xref 'help-function (lambda () (customize-group-other-window 'Icicles)) 'help-echo (purecopy "mouse-2, RET: Customize/Browse Icicles Options & Faces"))) ;; This is just the macro expansion of the following: ;; `(def-completion-wrapper icicle-abort-recursive-edit :minibuffer-separator)'. ;; Taken from the definition of `def-completion-wrapper' in `completion.el'. (put 'icicle-abort-recursive-edit 'completion-function 'use-completion-minibuffer-separator) (defun icicle-abort-recursive-edit () ; Bound to `C-]',`C-g' in minibuf, `C-g',`q' in `*Completions*'. "Abort command that requested this recursive edit or minibuffer input. This calls `abort-recursive-edit' after killing the `*Completions*' buffer or (if called from the minibuffer) removing its window. By default, Icicle mode remaps all key sequences that are normally bound to `abort-recursive-edit' to `icicle-abort-recursive-edit'. If you do not want this remapping, then customize option `icicle-top-level-key-bindings'." (interactive) (if (not (active-minibuffer-window)) (when (get-buffer "*Completions*") (kill-buffer (get-buffer "*Completions*"))) (when (and (boundp '1on1-fit-minibuffer-frame-flag) ; In `oneonone.el'. 1on1-fit-minibuffer-frame-flag (require 'fit-frame nil t)) (1on1-fit-minibuffer-frame 'RESET)) (icicle-remove-Completions-window 'FORCE)) (abort-recursive-edit)) (unless (fboundp 'save&set-overriding-map) ; Only Emacs 20-23 use `ensure-overriding-map-is-bound'. (defun icicle-ensure-overriding-map-is-bound () "Set `overriding-terminal-local-map' to `icicle-universal-argument-map'." (if (not (boundp 'overriding-map-is-bound)) ; Emacs 20, 21. (setq overriding-terminal-local-map icicle-universal-argument-map) (unless overriding-map-is-bound ; Emacs 22+. (setq saved-overriding-map overriding-terminal-local-map overriding-terminal-local-map icicle-universal-argument-map overriding-map-is-bound t))))) (defun icicle-digit-argument (arg) ; Bound to `C-<0-9>', `M-<0-9>', `C-M-<0-9>' in minibuffer. "`digit-argument', but also echo the prefix." (interactive "P") (let* ((char (if (integerp last-command-event) last-command-event (icicle-get-safe last-command-event 'ascii-character))) (digit (- (logand char ?\177) ?0))) (cond ((integerp arg) (setq prefix-arg (+ (* arg 10) (if (< arg 0) (- digit) digit)))) ((eq arg '-) ;; Treat -0 as just -, so that -01 will work. (setq prefix-arg (if (zerop digit) '- (- digit)))) (t (setq prefix-arg digit)))) (setq universal-argument-num-events (length (this-command-keys))) (if (fboundp 'save&set-overriding-map) ; Emacs 24+ (save&set-overriding-map icicle-universal-argument-map) (icicle-ensure-overriding-map-is-bound)) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) (defun icicle-negative-argument (arg) ; Bound to `M--', `C-M--' in minibuffer. "`negative-argument', but also echo the prefix." (interactive "P") (cond ((integerp arg) (setq prefix-arg (- arg))) ((eq arg '-) (setq prefix-arg nil)) (t (setq prefix-arg '-))) (setq universal-argument-num-events (length (this-command-keys))) (if (fboundp 'save&set-overriding-map) ; Emacs 24+ (save&set-overriding-map icicle-universal-argument-map) (icicle-ensure-overriding-map-is-bound)) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) (defun icicle-universal-argument () ; Bound to `C-u' in minibuffer. "`universal-argument', but also echo the prefix." (interactive) (setq prefix-arg (list 4) universal-argument-num-events (length (this-command-keys))) (if (fboundp 'save&set-overriding-map) ; Emacs 24+ (save&set-overriding-map icicle-universal-argument-map) (icicle-ensure-overriding-map-is-bound)) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) (defun icicle-universal-argument-more (arg) "`universal-argument-more', but also echo the prefix." (interactive "P") (universal-argument-more arg) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) (defun icicle-universal-argument-other-key (arg) "`universal-argument-other-key', but also echo the prefix." (interactive "P") (universal-argument-other-key arg) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) (defun icicle-universal-argument-minus (arg) "`universal-argument-minus', but also echo the prefix." (interactive "P") (universal-argument-minus arg) (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg)) ;; REPLACE ORIGINAL `sit-for' in `subr.el', ;; saving it for restoration when you toggle `icicle-mode'. ;; ;; 1. Ensure that `sit-for' after `C-u' in the minibuffer is immediately interrupted by user input. ;; This fix is not needed for Emacs < 23. ;; ;; 2. Bind `inhibit-quit' to t, so `C-g' is handled after `sit-for', by `icicle-abort-recursive-edit'. ;; (unless (fboundp 'icicle-ORIG-sit-for) (defalias 'icicle-ORIG-sit-for (symbol-function 'sit-for))) (when (> emacs-major-version 22) (defun icicle-sit-for (seconds &optional nodisp obsolete) "Perform redisplay, then wait for SECONDS seconds or until input is available. SECONDS may be a floating-point value. \(On operating systems that do not support waiting for fractions of a second, floating-point values are rounded down to the nearest integer.) If optional arg NODISP is t, don't redisplay, just wait for input. Redisplay does not happen if input is available before it starts. Value is t if waited the full time with no input arriving, and nil otherwise. An obsolete, but still supported form is \(sit-for SECONDS &optional MILLISECONDS NODISP) where the optional arg MILLISECONDS specifies an additional wait period, in milliseconds; this was useful when Emacs was built without floating point support." (if (numberp nodisp) (setq seconds (+ seconds (* 1e-3 nodisp)) nodisp obsolete) (if obsolete (setq nodisp obsolete))) (cond (noninteractive (sleep-for seconds) t) ((input-pending-p) nil) ((<= seconds 0) (or nodisp (redisplay))) (t (or nodisp (redisplay)) (let* ((inhibit-quit t) (read (read-event nil nil seconds))) (or (null read) (progn ;; If last command was a prefix arg, e.g. C-u, push this event onto ;; `unread-command-events' as (t . EVENT) so it will be added to ;; `this-command-keys' by `read-key-sequence'. (when (memq overriding-terminal-local-map (list universal-argument-map icicle-universal-argument-map)) (setq read (cons t read))) (push read unread-command-events) nil))))))) (defun icicle-retrieve-next-input (&optional arg) ; Bound to `C-S-l' (`C-L') in minibuffer. "Retrieve next minibuffer input. Like `icicle-retrieve-previous-input', but traverses history toward the present. You can use this command only from the minibuffer (`\\\ \\[icicle-retrieve-next-input]')." (interactive "P") (icicle-retrieve-previous-input arg 'interactive-p)) ; Must be `interactive-p'. (defun icicle-retrieve-previous-input (&optional arg reversep allow-empty-p) ; `C-l' in minibuffer. "Retrieve previous minibuffer input. The possible inputs were not necessarily those entered with `RET'. With a negative prefix arg, this just empties the completion history. Otherwise: Use completion if `icicle-C-l-uses-completion-flag' is non-nil and no prefix arg is used, or if it is nil and a prefix arg is used, or if `icicle-retrieve-previous-input' is not used interactively. Otherwise, just cycle to the previous input. Non-interactively: Non-nil argument REVERSEP means reverse the history order: return the next, not the previous, input. Non-nil ALLOW-EMPTY-P means the retrieved input can be \"\". You can use this command only from buffer *Completions or from the minibuffer (`\\\ \\[icicle-retrieve-previous-input]')." (interactive "P") (let ((interactive-p (or (interactive-p) (eq reversep 'interactive-p))) (prev-inputs-var (if (icicle-file-name-input-p) 'icicle-previous-raw-file-name-inputs 'icicle-previous-raw-non-file-name-inputs)) ;; `irpi-was-cycling-p' is used to remember, for the second `C-l' in a row, that the first ;; `C-l' came after cycling. In that case, the second `C-l' restores the current raw input. (irpi-was-cycling-p icicle-cycling-p)) (when interactive-p (icicle-barf-if-outside-Completions-and-minibuffer)) (cond ((wholenump (prefix-numeric-value arg)) (let ((input "")) (save-selected-window (select-window (minibuffer-window)) (icicle-clear-minibuffer) (let ((prev-inputs (if allow-empty-p (symbol-value prev-inputs-var) (icicle-remove-if (lambda (x) (string= "" x)) ; Exclude "". (symbol-value prev-inputs-var))))) (setq input (if (and interactive-p (or (and icicle-C-l-uses-completion-flag (not arg)) (and (not icicle-C-l-uses-completion-flag) arg))) (let ((icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t) (icicle-show-Completions-initially-flag t)) (prog1 (completing-read "Retrieve input: " (mapcar #'list prev-inputs) nil t) (setq icicle-last-input nil))) (if (or (not interactive-p) (not (memq last-command '(icicle-retrieve-next-input icicle-retrieve-previous-input)))) ;; We use this one, to exclude common-match expansions from completion ;; history, and to save the typed input only when you complete. (let ((try (if icicle-cycling-p icicle-last-input icicle-current-raw-input))) (if (or allow-empty-p (not (equal "" try))) try (car prev-inputs))) ;; You can use this one instead, if you want to include common-match ;; expansions and save the typed input even when you don't complete. ;; (or icicle-last-input icicle-current-raw-input) (let ((next (member icicle-current-raw-input prev-inputs))) (unless next (setq next prev-inputs)) (if reversep (or (let ((res ()) (inputs prev-inputs)) (while (and (consp inputs) (not (eq inputs next))) (push (pop inputs) res)) (car res)) (car (last prev-inputs))) ;; If we were cycling before the first `C-l', then need to pick up the ;; current raw input. Otherwise, we need to pick up the previous one. (prog1 (if irpi-was-cycling-p (car next) (cadr next)) (setq irpi-was-cycling-p nil))))))) ; So third `C-l' acts normally. ;; $$$$ (when input (icicle-call-then-update-Completions #'insert input)))) ;; $$$$$$ (when input (insert input)))) ;;; $$$$$$ REPLACED by previous line only. (when input (setq icicle-current-raw-input input) (insert input) (icicle-highlight-initial-whitespace input) ; (e.g. user typo). (icicle-place-cursor input 'deactivate-mark)))) ;;; (let ((icicle-edit-update-p t)) ;;; (funcall (or icicle-last-completion-command 'icicle-apropos-complete)) ;;; ;; Restore raw input. Cycling resets it to "", so `icicle-save-or-restore-input' ;;; ;; doesn't use out-of-date raw input (cycling does not necessarily follow completion ;;; ;; or completion of the same kind). ;;; (setq icicle-current-raw-input input)) (setq icicle-current-raw-input input ; So we can keep cycling. icicle-last-input nil ; So `TAB' expands it - `icicle-save-or-restore-input'. icicle-cycling-p irpi-was-cycling-p))) ; Let next `C-l' know the state. (t (set prev-inputs-var nil) (setq icicle-current-raw-input "") (icicle-msg-maybe-in-minibuffer "Cleared completion history"))))) ;; $$ No longer bound. Now we bind `icicle-retrieve-previous-input', instead, to `C-l'. ;; (defun icicle-retrieve-last-input () "Put the last real input into the minibuffer. Use this to replace a completion candidate inserted during cycling or because of input expansion due to the value of option `icicle-expand-input-to-common-match'. If you are cycling and expansion is also in effect, then use this twice in succession: once to restore the expanded common match string, and a second time to restore your unexpanded original input. You can use this command only from buffer `*Completions' or from the minibuffer." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (save-selected-window (select-window (minibuffer-window)) (icicle-clear-minibuffer) (if (and (eq last-command 'icicle-retrieve-last-input) (or (and (eq icicle-current-completion-mode 'apropos) (eq icicle-expand-input-to-common-match 4)) (and (eq icicle-current-completion-mode 'prefix) (memq icicle-expand-input-to-common-match '(3 4))))) (insert icicle-current-raw-input) (insert icicle-current-input)) ;;$$$ (when (interactive-p) (setq icicle-last-completion-command nil)) (let ((input (if (and (eq last-command this-command) (or (and (eq icicle-current-completion-mode 'apropos) (eq icicle-expand-input-to-common-match 4)) (and (eq icicle-current-completion-mode 'prefix) (memq icicle-expand-input-to-common-match '(3 4))))) icicle-current-raw-input icicle-current-input))) (icicle-highlight-initial-whitespace input) ; Highlight initial whitespace (e.g. user typo). (icicle-place-cursor input 'deactivate-mark)))) ;; $$ No longer used. It was originally used in `icicle-retrieve-last-input'. (defun icicle-insert-input (input) "Insert INPUT. Prepend the directory if appropriate." (insert (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member input icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-expand-file-or-dir-name input (icicle-file-name-directory input)) input))) (icicle-define-command icicle-insert-history-element ; Bound to `M-o' in minibuffer. "Use completion to insert previously entered inputs in the minibuffer. Insert a space character after each (but see below, to prevent this). Always available for any minibuffer input, not just during completion. With a non-negative prefix arg, wrap candidate to insert with \"...\". With a non-positive prefix arg, do not append a space char. If you use a prefix argument also for an individual candidate insertion action then that overrides any prefix argument or lack thereof that you used for this command. For example, with no prefix argument, \\`\\[icicle-insert-history-element]' \ does not wrap candidates with \"...\", but if you use, e.g., `C-u C-RET' then that candidate is so wrapped." icicle-insert-candidate-action ; Action function "Choose past input (`C-g' to end): " ; `completing-read' args (mapcar #'list hist-val) nil nil nil nil nil nil ((enable-recursive-minibuffers t) ; Bindings (hist-val (and (boundp minibuffer-history-variable) (consp (symbol-value minibuffer-history-variable)) (symbol-value minibuffer-history-variable))) (hist-val (and hist-val (icicle-remove-duplicates hist-val))) (icicle-pref-arg (and current-prefix-arg (prefix-numeric-value current-prefix-arg))) (count 0) (to-insert ())) (progn ; First code (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (when (and (consp hist-val) (not (stringp (car hist-val)))) ; Convert, e.g. `comand-history'. (setq hist-val (mapcar #'prin1-to-string hist-val))) ;; $$$$$$ (icicle-clear-minibuffer) ) nil ; Undo code (progn ; Last code (apply #'insert (nreverse to-insert)) (when (and icicle-mode (memq icicle-default-value '(preselect-start preselect-end))) (icicle-select-minibuffer-contents) (setq deactivate-mark nil)))) (icicle-define-command icicle-roundup ; Bound to `M-r' in minibuffer. "Insert one or more completion candidates in the minibuffer. Insert a space character after each (but see below, to prevent this). With a non-negative prefix arg, wrap candidate to insert with \"...\". With a non-positive prefix arg, do not append a space char. If you use a prefix argument also for an individual candidate insertion action then that overrides any prefix argument or lack thereof that you used for this command. For example, with no prefix argument, \\`\\[icicle-roundup]' \ does not wrap candidates with \"...\", but if you use, e.g., `C-u C-RET' then that candidate is so wrapped." icicle-insert-candidate-action ; Action function "Roundup - choose (`C-g' to end): " ; `completing-read' args (and icicle-completion-candidates (mapcar #'list icicle-completion-candidates)) nil nil nil nil nil nil ((enable-recursive-minibuffers t) ; Bindings (icicle-pref-arg (and current-prefix-arg (prefix-numeric-value current-prefix-arg))) (count 0) (to-insert ())) (progn ; First code (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (unless icicle-completion-candidates (icicle-user-error "No completion candidates - did you hit `TAB' or `S-TAB'?")) (icicle-clear-minibuffer)) nil ; Undo code (progn ; Last code (apply #'insert (nreverse to-insert)) (when (and icicle-mode (memq icicle-default-value '(preselect-start preselect-end))) (icicle-select-minibuffer-contents) (setq deactivate-mark nil)))) (defun icicle-insert-candidate-action (cand) "Action function for `icicle-insert-history-element' and `icicle-roundup'." ;; FREE here: TO-INSERT, COUNT. (when (and cand (not (equal cand ""))) (let ((prefix-arg (if current-prefix-arg (prefix-numeric-value current-prefix-arg) icicle-pref-arg))) (push (if (and prefix-arg (natnump prefix-arg)) (format "\"%s\"" cand) cand) to-insert) (unless (and prefix-arg (<= prefix-arg 0)) (push " " to-insert)) (message "Inserted: %s%s" (icicle-propertize (format "%d" (setq count (1+ count))) 'face 'icicle-msg-emphasis) (if (not prefix-arg) "" (format " [%s]" (concat (and (natnump prefix-arg) "\"...\"-wrapped") (and (zerop prefix-arg) " and ") (and (<= prefix-arg 0) "NOT `SPC'-separated")))))))) (defun icicle-insert-string-at-point (&optional arg) ; Bound to `M-.' in minibuffer. "Insert text at the cursor into the minibuffer. Each time this command is called, some text at or near the cursor is inserted into the minibuffer. One of two things happens, depending on the value of option `icicle-default-thing-insertion' and whether or not you use `C-u'. See the doc for option `icicle-thing-at-point-functions' for a complete description of its behavior. What follows is an overview. `icicle-thing-at-point-functions' is a cons of two parts - call them ALTERNATIVES and FORWARD-THING. If ALTERNATIVES is not nil and one of the following is true: - FORWARD-THING is nil - the value of `icicle-default-thing-insertion' is `alternatives' and you have not used plain `C-u' in this series of `M-.' - the value of `icicle-default-thing-insertion' is `more-of-the-same' and you have used plain `C-u' in this series of `M-.' then the next function in ALTERNATIVES is used to retrieve the text to be inserted. If FORWARD-THING is not nil and one of the following is true: - ALTERNATIVES is nil - the value of `icicle-default-thing-insertion' is `more-of-the-same' and you have not used `C-u' in this series of `M-.' - the value of `icicle-default-thing-insertion' is `alternatives' and you have used `C-u' in this series of `M-.' then function FORWARD-THING is used to retrieve the text to be inserted. If you use a numeric prefix arg (not just plain `C-u'), the behavior is as follows. * If a function in ALTERNATIVES is used (see above), then the text that is grabbed at or near point is read as a Lisp sexp and evaluated, and the value is inserted instead of the grabbed text. Yes, this means you need to know when the particular ALTERNATIVES function that you want is coming up next, and use, say, `C-9' just before hitting `M-.' for that alternative. So if, e.g., you want to evaluate the active region and insert the value, then you use `M-. C-9 M-.', since it is the second `M-.' that grabs the region. * If the FORWARD-THING is being used, then the prefix arg determines the number of things to grab, and the direction of grabbing.: A negative argument grabs text to the left of the cursor; a positive argument grabs text to the right. You can use this command only from the minibuffer (`\\\ \\[icicle-insert-string-at-point]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (when (consp icicle-thing-at-point-functions) ; Option should always be a cons cell. (unless (eq last-command this-command) (setq icicle-default-thing-insertion-flipped-p nil)) (let ((alt-fns (car icicle-thing-at-point-functions)) (fwd-thing-fn (cdr icicle-thing-at-point-functions)) (flipped (or icicle-default-thing-insertion-flipped-p ; Already flipped. (setq icicle-default-thing-insertion-flipped-p (consp arg))))) (cond ;; Use alternative text-grabbing functions successively. ((and alt-fns (or (if (eq 'alternatives icicle-default-thing-insertion) (not flipped) ; Normal behavior for `alternatives'. flipped) ; Flipped behavior for `more-of-the-same'. (not fwd-thing-fn))) ; No alternative. (setq icicle-successive-grab-count 1 ; In this mode, reset other mode's accumulator. icicle-thing-at-pt-fns-pointer (if (eq last-command this-command) ; If repeated, get next text-grabbing function. (mod (1+ icicle-thing-at-pt-fns-pointer) (length alt-fns)) 0)) (let ((thing "") (alt-fn (nth icicle-thing-at-pt-fns-pointer alt-fns))) (save-excursion (with-current-buffer icicle-pre-minibuffer-buffer (setq thing (funcall alt-fn)))) (setq thing (or thing "nil")) (when (and arg (atom arg)) ; Numeric prefix arg. (setq thing (condition-case err (format "%s" (eval (car (read-from-string thing)))) (error thing)))) (icicle-insert-thing thing) (icicle-msg-maybe-in-minibuffer (format "`%s'" alt-fn)))) ;; Use same text-grabbing function successively. ((and fwd-thing-fn (or (if (eq 'alternatives icicle-default-thing-insertion) flipped ; Flipped behavior for `alternatives'. (not flipped)) ; Normal behavior for `more-of-the-same'. (not alt-fns))) ; No alternative. (if (and arg (atom arg)) ;; Explicit numeric arg. If it doesn't change direction, then increment ;; existing count. Otherwise, set count absolutely. (if (eq last-command this-command) (if (= (icicle-signum icicle-successive-grab-count) ; Repeated `M-.'. (icicle-signum (prefix-numeric-value arg))) (setq icicle-successive-grab-count ; Same direction - increment count. (* (icicle-signum icicle-successive-grab-count) (+ (abs icicle-successive-grab-count) (abs (prefix-numeric-value arg))))) (setq icicle-successive-grab-count (prefix-numeric-value arg))) ; New dir - set. (setq icicle-successive-grab-count (prefix-numeric-value arg))) ; First `M-.' - set. ;; No explicit numeric arg. ;; If first `M-.' or plain `C-u', set count. Otherwise, increment count. (if (eq last-command this-command) (setq icicle-successive-grab-count ; Repeated `M-.'. (if (consp arg) ;; We're here from plain `C-u' with `alternatives' - use 1, not 4. (if (wholenump icicle-successive-grab-count) 1 -1) (if (wholenump icicle-successive-grab-count) ; Increment count. (+ icicle-successive-grab-count (abs (prefix-numeric-value arg))) (- icicle-successive-grab-count (abs (prefix-numeric-value arg)))))) (setq icicle-successive-grab-count 1))) ; First `M-.' - reset count. (let ((things "")) (save-excursion (with-current-buffer (cadr (buffer-list)) (setq things (buffer-substring-no-properties (point) (save-excursion (funcall fwd-thing-fn icicle-successive-grab-count) (point)))))) (icicle-insert-thing things))))))) (defun icicle-signum (num) "Return 1 if NUM is positive, -1 if negative, 0 if zero." (cond ((< num 0) -1) ((> num 0) 1) (t 0))) (defun icicle-insert-thing (text &optional no-replace-p) "Insert TEXT in the minibuffer. TEXT replaces the last text that was inserted, if this command repeats the last and NO-REPLACE-P is nil." (when (and (stringp text) (not (string= "" text))) (remove-text-properties 0 (length text) '(face nil) text) (when (and (eq last-command this-command) (not no-replace-p) icicle-insert-string-at-pt-start) ; Ensure that we've defined the ends. (delete-region icicle-insert-string-at-pt-start icicle-insert-string-at-pt-end)) (setq icicle-insert-string-at-pt-start (point)) (insert text) (setq icicle-insert-string-at-pt-end (point)))) (defun icicle-insert-string-from-variable (askp) ; Bound to `C-=' in minibuffer. "Insert text into the minibuffer from a variable. By default, the variable is user option `icicle-input-string'. To insert from a different variable, use a prefix argument. You are then prompted for the variable to use. Completion candidates for this include all string-valued variables. You can use command `icicle-save-string-to-variable' to save a string to a variable. Typically, you store a regexp or part of a regexp in the variable. This command is bound in the minibuffer to `C-=', by default. This is especially useful when used with command `icicle-search'. Some regexps that you might want to assign to variables: \"[A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\" ; Email address \"\\\\([0-9]+\\\.[0-9]+\\\.[0-9]+\\\.[0-9]+\\\\)\" ; IP address \"[0-9]\\\\\\\={4\\\\}-[0-9]\\\\\\\={2\\\\}-[0-9]\\\\\\\={2\\\\}\" ; Date: 2006-04-14, Time: \"^[ \\\=\\t]*[0-9]?[0-9]\\\\([:.]?[0-9][0-9]\\\\)?\\\\(am\\\\|pm\\\\|AM\\\\|PM\\\\)?\" \"`\\\\(\\\\sw\\\\sw+\\\\)'\" ; Words inside `_' \"\\\\*.*\\\\*\" ; Special buffer name: *_* Standard Emacs Lisp libraries are full of regexps that you can assign to variables for use with `C-='. See `align.el' for regexps for programming languages. See `url-dav.el' for regexps matching iso8601 dates. See `rmail.el', `sendmail.el', and `mh-show.el' for regexps matching mail-header fields. Imenu regexps occurring as parts of different values of `imenu-generic-expression' for different buffer types can be used as variable values for `C-='. They all work fine with `icicle-search', turning it into a browser or navigator for the given mode. See, for example, `generic-x.el' and `lisp-mode.el'. Here is a regexp for Javascript function definitions from `generic-x.el': \"^function\\\\s-+\\\\([A-Za-z0-9_]+\\\\)\" And `lisp-imenu-generic-expression' (in `lisp-mode.el') provides regexps for Lisp function, variable, and type definitions. Here is the variable-definition regexp: \"^\\\\s-*(\\\\(def\\\\(c\\\\(onst\\\\(ant\\\\)?\\\\|ustom\\\\)\\\\|ine-symbol-macro\\\\| parameter\\\\|var\\\\)\\\\)\\\\s-+\\\\(\\\\(\\\\sw\\\\|\\\\s_\\\\)+\\\\)\" Command `icicle-imenu' exploits this to automatically let you browse definitions. It is a specialization of `icicle-search' for Imenu. For more useful regexps, grep for `font-lock-keywords' in Emacs `lisp' directory and subdirs. You can use this command only from the minibuffer (`\\\ \\[icicle-insert-string-from-variable]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (save-selected-window (select-window (minibuffer-window)) (if askp (let* ((icicle-whole-candidate-as-text-prop-p nil) ;; If we didn't use this here we'd at least have to bind it to ;; `orig-must-pass-after-match-predicate', because of `icicle-execute-extended-command'. (icicle-must-pass-after-match-predicate (lambda (s) (let ((sym (intern-soft s))) (and sym (boundp (intern s)) (condition-case nil (icicle-var-is-of-type-p sym '(string color regexp) 'inherit-or-value) (error nil)))))) (enable-recursive-minibuffers t) (var (intern (completing-read "Insert text from variable: " obarray nil nil nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history)))) ;; Make sure we use the buffer-local value of the variable, if there is one. (text (with-current-buffer (cadr (buffer-list)) (symbol-value var)))) (icicle-insert-thing text 'no-replace)) (icicle-insert-thing icicle-input-string 'no-replace)))) (defun icicle-insert-list-join-string () ; Bound to `C-M-j' in minibuffer during completion. "Insert `icicle-list-join-string' in the minibuffer. Then, if `1on1-fit-minibuffer-frame-flag' is defined and non-nil, fit a standalone minibuffer frame to the new minibuffer contents. You need library `fit-frame.el' for the frame-fitting part." (interactive) (icicle-insert-thing icicle-list-join-string 'no-replace) (let ((len (length icicle-list-join-string))) (when (and (string= "\C-j" (substring icicle-list-join-string (1- len) len)) (boundp '1on1-fit-minibuffer-frame-flag) ; In `oneonone.el'. 1on1-fit-minibuffer-frame-flag (require 'fit-frame nil t)) (1on1-fit-minibuffer-frame)))) (defun icicle-dispatch-M-q (&optional arg) ; Bound to `M-q' in minibuffer. "Do the right thing for `M-q'. If searching, call `icicle-toggle-search-whole-word'. Otherwise, call `icicle-insert-key-description'. Bound to `M-q' in the minibuffer." (interactive "P") ; Argument is ignored for `icicle-toggle-search-whole-word'. (cond (icicle-searching-p (icicle-toggle-search-whole-word)) (t (icicle-insert-key-description arg)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-search-whole-word 'icicle-toggle-search-whole-word) (defun icicle-toggle-search-whole-word () ; Bound to `M-q' in minibuffer during Icicles search. "Toggle the value of `icicle-search-whole-word-flag'. The new value takes effect for the next Icicles search command. Bound to `M-q' in the minibuffer when searching." (interactive) (setq icicle-search-whole-word-flag (not icicle-search-whole-word-flag)) (icicle-msg-maybe-in-minibuffer "Whole-word searching is now %s, starting with next search" (icicle-propertize (if icicle-search-whole-word-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) (defun icicle-insert-key-description (toggle-angle-brackets-p) ; Bound to `M-q' in minibuffer. "Read key and insert its description. For example, if the key read is ^F, then \"C-f\" is inserted. For Emacs 21+, `icicle-key-descriptions-use-<>-flag' determines whether angle brackets (`<', `>') are used for named keys, such as function keys, but a prefix argument reverses the meaning of `icicle-key-descriptions-use-<>-flag'. Bound to `M-q' in the minibuffer during key completion (Emacs 22+)." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let* ((enable-recursive-minibuffers t) (key (progn (minibuffer-message " [Quoting key]") (read-event)))) (insert (if (< emacs-major-version 21) (single-key-description key) (single-key-description key (if toggle-angle-brackets-p icicle-key-descriptions-use-<>-flag (not icicle-key-descriptions-use-<>-flag))))))) (defun icicle-pp-eval-expression-in-minibuffer (insert-value) ; Bound to `M-:' in minibuffer. "Evaluate an Emacs-Lisp expression and pretty-print its value. This just calls `icicle-pp-eval-expression' from a recursive minibuffer." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (let ((enable-recursive-minibuffers t)) (call-interactively 'icicle-pp-eval-expression)) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame))) (defun icicle-insert-newline-in-minibuffer (arg) ; Bound to `C-j' in minibuffer. "Insert a newline character (`C-j'), in the minibuffer. Then, if `1on1-fit-minibuffer-frame-flag' is defined and non-nil, fit a standalone minibuffer frame to the new minibuffer contents. You need library `fit-frame.el' for the frame-fitting part." (interactive "p") (icicle-self-insert arg) (when (and (boundp '1on1-fit-minibuffer-frame-flag) ; In `oneonone.el'. 1on1-fit-minibuffer-frame-flag (require 'fit-frame nil t)) (1on1-fit-minibuffer-frame))) ;; Bound in minibuffer to keys in `icicle-modal-cycle-down-keys' (`down', `wheel-down'). ;; (defun icicle-next-candidate-per-mode (&optional nth) "Replace input by NTH next completion candidate. The default value of NTH is 1, meaning use the next candidate. Negative NTH means use a previous, not subsequent, candidate. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. Uses the next prefix or apropos completion command, depending on `icicle-current-completion-mode'. If that is nil and `icicle-default-cycling-mode' is non-nil, uses the next history element instead. You can use this command only from the minibuffer (`\\\ \\[icicle-next-candidate-per-mode]')." (interactive "p") (when (and current-prefix-arg (consp current-prefix-arg)) (setq icicle-candidate-nb 0 nth 0)) (unless nth (setq nth 1)) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (case icicle-current-completion-mode (prefix (setq this-command (if (wholenump nth) 'icicle-next-prefix-candidate 'icicle-previous-prefix-candidate)) (icicle-next-prefix-candidate nth)) (apropos (setq this-command (if (wholenump nth) 'icicle-next-apropos-candidate 'icicle-previous-apropos-candidate)) (icicle-next-apropos-candidate nth)) ((nil) (when icicle-default-cycling-mode (next-history-element (or nth 1)))))) ;; Bound in minibuffer to keys in `icicle-modal-cycle-up-keys' (`up', `wheel-up'). ;; (defun icicle-previous-candidate-per-mode (&optional nth) "Replace input by NTH previous completion candidate. The default value of NTH is 1, meaning use the previous candidate. Negative NTH means use a subsequent, not previous, candidate. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. Uses the previous prefix or apropos completion command, depending on `icicle-current-completion-mode'. If that is nil and `icicle-default-cycling-mode' is non-nil, uses the previous history element instead. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-candidate-per-mode]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-next-candidate-per-mode (- (or nth 1)))) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-previous-keys' (`home'). (put 'icicle-previous-prefix-candidate 'icicle-cycling-command 'backward) (put 'icicle-previous-prefix-candidate 'icicle-prefix-cycling-command 'backward) (defun icicle-previous-prefix-candidate (&optional nth) "Replace input by NTH previous prefix completion for an input. Default value of NTH is 1, meaning use the previous prefix completion. Negative NTH means use a subsequent, not previous, prefix completion. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-prefix-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-next-prefix-candidate (- (or nth 1)))) ;; Bound in minibuffer to keys in `icicle-next-cycle-previous-keys' (`end'). (put 'icicle-next-prefix-candidate 'icicle-cycling-command 'forward) (put 'icicle-next-prefix-candidate 'icicle-prefix-cycling-command 'forward) (defun icicle-next-prefix-candidate (&optional nth) "Replace input by NTH next prefix completion for an input. The default value of NTH is 1, meaning use the next prefix completion. Negative NTH means use a previous, not subsequent, prefix completion. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. You can use this command only from the minibuffer (`\\\ \\[icicle-next-prefix-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (setq icicle-current-completion-mode 'prefix icicle-next-apropos-complete-cycles-p nil) (when (and current-prefix-arg (consp current-prefix-arg)) (setq icicle-candidate-nb 0 nth 0)) (unless nth (setq nth 1)) (icicle-next-candidate nth (if (icicle-file-name-input-p) 'icicle-file-name-prefix-candidates 'icicle-prefix-candidates))) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-previous-keys' (`prior'). (put 'icicle-previous-apropos-candidate 'icicle-cycling-command 'backward) (put 'icicle-previous-apropos-candidate 'icicle-apropos-cycling-command 'backward) (defun icicle-previous-apropos-candidate (&optional nth) "Replace input by NTH previous apropos completion for an input. Default value of NTH is 1, meaning use previous apropos completion. Negative NTH means use a subsequent, not previous, apropos completion. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-apropos-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-next-apropos-candidate (- (or nth 1)))) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-next-keys' (`next'). (put 'icicle-next-apropos-candidate 'icicle-cycling-command 'forward) (put 'icicle-next-apropos-candidate 'icicle-apropos-cycling-command 'forward) (defun icicle-next-apropos-candidate (&optional nth) "Replace input by NTH next apropos completion for an input. Default value of NTH is 1, meaning use the next apropos completion. Negative NTH means use a previous, not subsequent, apropos completion. Interactively, NTH is the numeric prefix argument. A plain prefix arg (`C-u') means use the first candidate. You can use this command only from the minibuffer (`\\\ \\[icicle-next-apropos-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (setq icicle-current-completion-mode 'apropos icicle-next-prefix-complete-cycles-p nil) (when (and current-prefix-arg (consp current-prefix-arg)) (setq icicle-candidate-nb 0 nth 0)) (unless nth (setq nth 1)) (icicle-next-candidate nth (if (icicle-file-name-input-p) 'icicle-file-name-apropos-candidates 'icicle-apropos-candidates) 'regexp-p)) ;; This is not helpful or needed, because the command sets `this-command' to the proper cycling command. ;; (put 'icicle-previous-candidate-per-mode-action 'icicle-action-command t) ;; Bound in minibuffer to keys in `icicle-modal-cycle-up-action-keys' (`C-up'). ;; (defun icicle-previous-candidate-per-mode-action (&optional nth) "`icicle-previous-candidate-per-mode' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-candidate-per-mode-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-candidate-per-mode #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-modal-cycle-up-alt-action-keys' (`C-S-up'). ;; (defun icicle-previous-candidate-per-mode-alt-action (&optional nth) "`icicle-previous-candidate-per-mode' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-candidate-per-mode-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-candidate-per-mode #'icicle-candidate-alt-action nth)) ;; This is not helpful or needed, because the command sets `this-command' to the proper cycling command. ;;(put 'icicle-next-candidate-per-mode-action 'icicle-action-command t) ;; Bound in minibuffer to keys in `icicle-modal-cycle-down-action-keys' (`C-down'). ;; (defun icicle-next-candidate-per-mode-action (&optional nth) "`icicle-next-candidate-per-mode' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-candidate-per-mode-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-candidate-per-mode #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-modal-cycle-down-alt-action-keys' (`C-S-down'). ;; (defun icicle-next-candidate-per-mode-alt-action (&optional nth) "`icicle-next-candidate-per-mode' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-candidate-per-mode-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-candidate-per-mode #'icicle-candidate-alt-action nth)) ;; Bound in minibuffer to keys in `icicle-modal-cycle-up-help-keys' (`C-M-up'). ;; (defun icicle-previous-candidate-per-mode-help (&optional nth) "`icicle-previous-candidate-per-mode' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-candidate-per-mode-help]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-candidate-per-mode #'icicle-help-on-candidate nth)) ;; Bound in minibuffer to keys in `icicle-modal-cycle-down-help-keys' (`C-M-down'). ;; (defun icicle-next-candidate-per-mode-help (&optional nth) "`icicle-next-candidate-per-mode' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-candidate-per-mode'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-candidate-per-mode-help]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-candidate-per-mode #'icicle-help-on-candidate nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-previous-action-keys' (`C-home'). (put 'icicle-previous-prefix-candidate-action 'icicle-cycling-command 'backward) (put 'icicle-previous-prefix-candidate-action 'icicle-prefix-cycling-command 'backward) (put 'icicle-previous-prefix-candidate-action 'icicle-action-command t) (defun icicle-previous-prefix-candidate-action (&optional nth) "`icicle-previous-prefix-candidate' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-prefix-candidate-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-prefix-candidate #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-next-action-keys' (`C-end'). (put 'icicle-next-prefix-candidate-action 'icicle-cycling-command 'forward) (put 'icicle-next-prefix-candidate-action 'icicle-prefix-cycling-command 'forward) (put 'icicle-next-prefix-candidate-action 'icicle-action-command t) (defun icicle-next-prefix-candidate-action (&optional nth) "`icicle-next-prefix-candidate' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-prefix-candidate-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-prefix-candidate #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-previous-action-keys' (`C-prior'). (put 'icicle-previous-apropos-candidate-action 'icicle-cycling-command 'backward) (put 'icicle-previous-apropos-candidate-action 'icicle-apropos-cycling-command 'backward) (put 'icicle-previous-apropos-candidate-action 'icicle-action-command t) (defun icicle-previous-apropos-candidate-action (&optional nth) "`icicle-previous-apropos-candidate' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-apropos-candidate-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-apropos-candidate #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-next-action-keys' (`C-next'). (put 'icicle-next-apropos-candidate-action 'icicle-cycling-command 'forward) (put 'icicle-next-apropos-candidate-action 'icicle-apropos-cycling-command 'forward) (put 'icicle-next-apropos-candidate-action 'icicle-action-command t) (defun icicle-next-apropos-candidate-action (&optional nth) "`icicle-next-apropos-candidate' and `icicle-candidate-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-apropos-candidate-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-apropos-candidate #'icicle-candidate-action nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-previous-alt-action-keys' (`C-S-home'). (put 'icicle-previous-prefix-candidate-alt-action 'icicle-cycling-command 'backward) (put 'icicle-previous-prefix-candidate-alt-action 'icicle-prefix-cycling-command 'backward) (defun icicle-previous-prefix-candidate-alt-action (&optional nth) "`icicle-previous-prefix-candidate' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-prefix-candidate-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-prefix-candidate #'icicle-candidate-alt-action nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-next-alt-action-keys' (`C-S-end'). (put 'icicle-next-prefix-candidate-alt-action 'icicle-cycling-command 'forward) (put 'icicle-next-prefix-candidate-alt-action 'icicle-prefix-cycling-command 'forward) (defun icicle-next-prefix-candidate-alt-action (&optional nth) "`icicle-next-prefix-candidate' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-prefix-candidate-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-prefix-candidate #'icicle-candidate-alt-action nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-previous-alt-action-keys' (`C-S-prior'). (put 'icicle-previous-apropos-candidate-alt-action 'icicle-cycling-command 'backward) (put 'icicle-previous-apropos-candidate-alt-action 'icicle-apropos-cycling-command 'backward) (defun icicle-previous-apropos-candidate-alt-action (&optional nth) "`icicle-previous-apropos-candidate' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-previous-apropos-candidate-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-apropos-candidate #'icicle-candidate-alt-action nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-next-alt-action-keys' (`C-S-next'). (put 'icicle-next-apropos-candidate-alt-action 'icicle-cycling-command 'forward) (put 'icicle-next-apropos-candidate-alt-action 'icicle-apropos-cycling-command 'forward) (defun icicle-next-apropos-candidate-alt-action (&optional nth) "`icicle-next-apropos-candidate' and `icicle-candidate-alt-action'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-next-apropos-candidate-alt-action]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-apropos-candidate #'icicle-candidate-alt-action nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-previous-help-keys' (`C-M-home'). (put 'icicle-help-on-previous-prefix-candidate 'icicle-cycling-command 'backward) (put 'icicle-help-on-previous-prefix-candidate 'icicle-prefix-cycling-command 'backward) (defun icicle-help-on-previous-prefix-candidate (&optional nth) "`icicle-previous-prefix-candidate' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-help-on-previous-prefix-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-prefix-candidate #'icicle-help-on-candidate nth)) ;; Bound in minibuffer to keys in `icicle-prefix-cycle-next-help-keys' (`C-M-end'). (put 'icicle-help-on-next-prefix-candidate 'icicle-cycling-command 'forward) (put 'icicle-help-on-next-prefix-candidate 'icicle-prefix-cycling-command 'forward) (defun icicle-help-on-next-prefix-candidate (&optional nth) "`icicle-next-prefix-candidate' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-prefix-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-help-on-next-prefix-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-prefix-candidate #'icicle-help-on-candidate nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-previous-help-keys' (`C-M-prior'). (put 'icicle-help-on-previous-apropos-candidate 'icicle-cycling-command 'backward) (put 'icicle-help-on-previous-apropos-candidate 'icicle-apropos-cycling-command 'backward) (defun icicle-help-on-previous-apropos-candidate (&optional nth) "`icicle-previous-apropos-candidate' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-previous-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-help-on-previous-apropos-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-previous-apropos-candidate #'icicle-help-on-candidate nth)) ;; Bound in minibuffer to keys in `icicle-apropos-cycle-previous-help-keys' (`C-M-next'). (put 'icicle-help-on-next-apropos-candidate 'icicle-cycling-command 'forward) (put 'icicle-help-on-next-apropos-candidate 'icicle-apropos-cycling-command 'forward) (defun icicle-help-on-next-apropos-candidate (&optional nth) "`icicle-next-apropos-candidate' and `icicle-help-on-candidate'. Option `icicle-act-before-cycle-flag' determines which occurs first. Optional argument NTH (the numeric prefix argument) is as for `icicle-next-apropos-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-help-on-next-apropos-candidate]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-successive-action #'icicle-next-apropos-candidate #'icicle-help-on-candidate nth)) (defun icicle-successive-action (nav-fn action-fn nth) "Call NAV-FN and ACTION-FN. Pass argument NTH to NAV-FN. Set `icicle-current-completion-mode'. The order between NAV-FN and ACTION-FN respects the value of `icicle-act-before-cycle-flag'." ;; Set mode only if known. Otherwise, leave it alone (e.g. for per-mode functions). (cond ((icicle-get-safe nav-fn 'icicle-apropos-cycling-command) (setq icicle-current-completion-mode 'apropos icicle-next-prefix-complete-cycles-p nil)) ((icicle-get-safe nav-fn 'icicle-prefix-cycling-command) (setq icicle-current-completion-mode 'prefix icicle-next-apropos-complete-cycles-p nil))) ;; We bind `icicle-acting-on-next/prev' to non-nil (and the direction) while calling the action ;; function. This is used by Icicles search-and-replace (`icicle-search-highlight-and-maybe-replace') ;; to ensure the correct candidate number for a series of replacements. ;; (Not currently used for the `icicle-act-before-cycle-flag' case, but we do it there also, anyway.) (cond (icicle-act-before-cycle-flag (let ((icicle-acting-on-next/prev (icicle-get-safe nav-fn 'icicle-cycling-command))) (save-excursion (save-selected-window (funcall action-fn)))) (funcall nav-fn nth)) (t ;; Inhibit showing help in mode-line while moving to next/previous candidate ;; in `*Completions*', because help sits for `icicle-help-in-mode-line-delay' sec. ;; Display the help after we do the action. (let ((icicle-help-in-mode-line-delay 0)) (funcall nav-fn nth)) (let ((icicle-acting-on-next/prev (icicle-get-safe nav-fn 'icicle-cycling-command))) (save-excursion (save-selected-window (funcall action-fn)))) (when (stringp icicle-last-completion-candidate) (setq icicle-mode-line-help icicle-last-completion-candidate))))) ;; Bound in minibuffer to keys in `icicle-prefix-complete-keys' (`TAB'). (put 'icicle-prefix-complete 'icicle-cycling-command t) (put 'icicle-prefix-complete 'icicle-prefix-cycling-command t) (put 'icicle-prefix-complete 'icicle-completing-command t) (put 'icicle-prefix-complete 'icicle-prefix-completing-command t) (defun icicle-prefix-complete () "Complete the minibuffer contents as far as possible, as a prefix. Repeat this to cycle among candidate completions. If no characters can be completed, display the possible completions. Candidate completions are appropriate names whose prefix is the minibuffer input, where appropriateness is determined by the context \(command, variable, and so on). Return nil if there is no valid completion. Otherwise, return the list of completion candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-prefix-complete]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (unless (string= icicle-dot-string-internal ".") (icicle-convert-dots t t) (setq icicle-dot-string-internal ".")) (icicle-prefix-complete-1)) ;; Bound in minibuffer to keys in `icicle-prefix-complete-no-display-keys' (`C-M-TAB'). (put 'icicle-prefix-complete-no-display 'icicle-cycling-command t) (put 'icicle-prefix-complete-no-display 'icicle-prefix-cycling-command t) (put 'icicle-prefix-complete-no-display 'icicle-completing-command t) (put 'icicle-prefix-complete-no-display 'icicle-prefix-completing-command t) (defun icicle-prefix-complete-no-display (&optional no-msg-p) ; Bound to `C-M-TAB' in minibuffer. "Like `icicle-prefix-complete', but without displaying `*Completions*'. Optional arg NO-MSG-P non-nil means do not show a minibuffer message indicating that candidates were updated. You can use this command only from the minibuffer (`\\\ \\[icicle-prefix-complete-no-display]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-prefix-complete-1 (if no-msg-p 'no-msg 'no-display))) ;; Bound in minibuffer to keys in `icicle-word-completion-keys' (`M-SPC'). (put 'icicle-prefix-word-complete 'icicle-cycling-command t) (put 'icicle-prefix-word-complete 'icicle-prefix-cycling-command t) (put 'icicle-prefix-word-complete 'icicle-completing-command t) (put 'icicle-prefix-word-complete 'icicle-prefix-completing-command t) (defun icicle-prefix-word-complete () "Complete the minibuffer contents at most a single word. Repeating this completes additional words. Spaces and hyphens in candidates are considered word separators. If only a single candidate matches, the input is completed entirely. Return nil if there is no valid completion, else t. You can use this command only from the minibuffer (`\\\ \\[icicle-prefix-word-complete]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-prefix-complete-1 nil t)) (defun icicle-prefix-complete-1 (&optional no-display-p word-p) "Helper function for `icicle-prefix-complete(-no-display)'. Return the list of completion candidates. Optional argument NO-DISPLAY-P non-nil means do not display buffer `*Completions*'. If the value is `no-msg', then do not show any message either. NO-DISPLAY-P is passed to `icicle-display-candidates-in-Completions' as its second arg. Optional argument WORD-P non-nil means complete only a word at a time." (when (and icicle-multi-completing-p (icicle-string-match-p (regexp-quote icicle-list-join-string) (icicle-input-from-minibuffer))) (icicle-msg-maybe-in-minibuffer (substitute-command-keys "Use APROPOS completion (`S-TAB') to match multi-completions past first part"))) (let ((ipc1-was-cycling-p icicle-cycling-p)) (setq icicle-mode-line-help nil) (setq icicle-current-input (if (and icicle-last-input icicle-cycling-p (not icicle-TAB/S-TAB-only-completes-flag) (not icicle-edit-update-p) (eq icicle-current-completion-mode 'prefix) (or (not word-p) (eq this-command last-command)) (symbolp last-command) (or (get last-command 'icicle-cycling-command) (get last-command 'icicle-action-command)) icicle-completion-candidates) icicle-last-input (if (icicle-file-name-input-p) (abbreviate-file-name (icicle-input-from-minibuffer 'leave-envar)) (icicle-input-from-minibuffer))) icicle-current-completion-mode 'prefix icicle-next-apropos-complete-cycles-p nil icicle-input-fail-pos nil icicle-cycling-p nil) (when icicle-edit-update-p (setq icicle-next-prefix-complete-cycles-p nil)) (let ((word-complete-input "") (input-before-completion icicle-current-input) return-value) (unless (and (stringp icicle-current-input) (stringp icicle-last-input) (string= icicle-current-input icicle-last-input) (symbolp last-command) (or (get last-command 'icicle-prefix-completing-command) (get last-command 'icicle-action-command)) (not word-p)) (unless (or icicle-edit-update-p (get-buffer-window "*Completions*" 0) no-display-p) (message "Computing completion candidates...")) (if (not word-p) (setq icicle-completion-candidates (icicle-condition-case-no-debug nil (if (icicle-file-name-input-p) (icicle-file-name-prefix-candidates icicle-current-input) (icicle-prefix-candidates icicle-current-input)) (error icicle-completion-candidates))) ; No change if completion error. ;; Complete a word. Save input before trying to complete. ;; Update `icicle-current-input': `minibuffer-complete-word' might have completed the input ;; beyond a complete candidate - e.g. `forwar-char' to `forward-char-'. (setq word-complete-input (icicle-input-from-minibuffer) return-value (let ((temp-buffer-show-hook nil) ; Don't let it fit frame here. (completion-auto-help nil) ; Don't show `*Completions*'. (minibuffer-message-timeout 0)) ; No timeout. (icicle-clear-minibuffer) (insert icicle-current-input) (save-selected-window (minibuffer-complete-word))) icicle-current-input (icicle-input-from-minibuffer)) ; Update input. ;; If incremental compl., or completed some, or not repeated, then update input and recompute. (when (or icicle-edit-update-p (> (length icicle-current-input) (length word-complete-input)) (not (eq this-command last-command))) (setq word-complete-input icicle-current-input icicle-completion-candidates (icicle-condition-case-no-debug nil (if (icicle-file-name-input-p) (icicle-file-name-prefix-candidates icicle-current-input) (icicle-prefix-candidates icicle-current-input)) (error icicle-completion-candidates))))) (message nil)) ; Clear out "Computing completion candidates..." message. (unless word-p (setq return-value icicle-completion-candidates)) ; Word returns special value. (icicle-save-or-restore-input) (cond ((null icicle-completion-candidates) (setq icicle-nb-of-other-cycle-candidates 0) (let ((icicle-incremental-completion ; Upgrade if OK for explicit. (or (memq icicle-highlight-input-completion-failure '(explicit-strict explicit explicit-remote)) icicle-incremental-completion))) (icicle-highlight-input-noncompletion)) (save-selected-window (icicle-remove-Completions-window)) (run-hooks 'icicle-no-match-hook) (unless (eq no-display-p 'no-msg) (minibuffer-message (case (icicle-current-TAB-method) (fuzzy " [No fuzzy completions]") (vanilla " [No vanilla completions]") (swank " [No swank (fuzzy symbol) completions]") (t " [No prefix completions]"))))) ;; Single matching candidate. ((null (cdr icicle-completion-candidates)) (setq icicle-current-input (if (not (icicle-file-name-input-p)) ;; Transfer any `icicle-whole-candidate' property from ;; candidate to `icicle-current-input', so things that use ;; `icicle-candidates-alist' will work. (car icicle-completion-candidates) (if (string= "" icicle-current-input) (or (icicle-file-name-directory icicle-current-input) "") (directory-file-name (icicle-abbreviate-or-expand-file-name (car icicle-completion-candidates) (icicle-file-name-directory icicle-current-input)))))) (setq icicle-nb-of-other-cycle-candidates 0) (cond (;; Do not expand input in minibuffer - just show `*Completions*'. (and (not no-display-p) ; Always expand for NO-DISPLAY-P. (or (eq 0 icicle-expand-input-to-common-match) ; `never' (and icicle-edit-update-p ; `explicit' means no auto-expansion. (eq 1 icicle-expand-input-to-common-match)))) ; `explicit' (when icicle-incremental-completion-p (sit-for icicle-incremental-completion-delay)) (icicle-display-candidates-in-Completions)) (t ;; Expand input to sole match in minibuffer. (unless (and icicle-edit-update-p (or (not icicle-incremental-completion-p) (not (sit-for icicle-incremental-completion-delay)))) (icicle-clear-minibuffer) (let ((cand (car icicle-completion-candidates))) (if (icicle-file-name-input-p) (cond ((string= "" cand) ; This indicates an empty dir. (setq icicle-last-completion-candidate icicle-current-input)) ((eq ?\/ (aref cand (1- (length cand)))) ;; Add `/', so cycling expands dir. (setq icicle-current-input (file-name-as-directory icicle-current-input) icicle-last-completion-candidate icicle-current-input)) (t ; Non-dir - use the candidate file, but without any dir. (setq icicle-last-completion-candidate (icicle-file-name-nondirectory cand)))) (setq icicle-last-completion-candidate cand))) (let ((inserted (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member icicle-last-completion-candidate icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-abbreviate-or-expand-file-name icicle-last-completion-candidate (icicle-file-name-directory-w-default icicle-current-input)) icicle-last-completion-candidate))) (insert inserted)) (save-selected-window (icicle-remove-Completions-window)) ;; Do not transform multi-completion here. It should be done in the function that ;; acts on the chosen completion candidate. For a multi-command, that means it ;; should be done in the action function. ;; $$$$$$ (icicle-transform-sole-candidate) icicle-current-input))) (unless (boundp 'icicle-prefix-complete-and-exit-p) (icicle-highlight-complete-input) (cond ((and icicle-top-level-when-sole-completion-flag (or (and (not (and (boundp 'icicle-ido-like-mode) icicle-ido-like-mode)) (not icicle-files-ido-like-flag)) (and (not (icicle-file-name-input-p)) (not icicle-abs-file-candidates)) (string= "" (car icicle-completion-candidates)) ; Empty directory (not (eq ?\/ (aref (car icicle-completion-candidates) (1- (length (car icicle-completion-candidates))))))) (sit-for icicle-top-level-when-sole-completion-delay)) (set minibuffer-history-variable (cons icicle-current-input (symbol-value minibuffer-history-variable))) (icicle-condition-case-no-debug icicle-prefix-complete-1 (throw 'icicle-read-top (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member icicle-current-input icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (expand-file-name icicle-current-input) icicle-current-input)) (no-catch (icicle-retrieve-last-input) icicle-current-input) (error (message "%s" (error-message-string icicle-prefix-complete-1))))) ((and icicle-edit-update-p (not (eq no-display-p 'no-msg))) (minibuffer-message (format (case (icicle-current-TAB-method) (fuzzy " [One fuzzy completion: %s]") (vanilla " [One vanilla completion: %s]") (swank " [One swank (fuzzy symbol) completion: %s]") (t " [One prefix completion: %s]")) icicle-current-input)) (setq icicle-mode-line-help icicle-current-input)) ((not (eq no-display-p 'no-msg)) (minibuffer-message (case (icicle-current-TAB-method) (fuzzy " [Sole fuzzy completion]") (vanilla " [Sole vanilla completion]") (swank " [Sole swank (fuzzy symbol) completion]") (t " [Sole prefix completion]"))) (setq icicle-mode-line-help icicle-current-input))))) ;; Multiple candidates. (;; Do not expand input in minibuffer - just show `*Completions*'. (and (not no-display-p) ; Always expand for NO-DISPLAY-P. (or (eq 0 icicle-expand-input-to-common-match) ; `never' (and icicle-edit-update-p ; No autoexpansion for `explicit', `sole-match' (memq icicle-expand-input-to-common-match '(1 2))))) (when icicle-incremental-completion-p (sit-for icicle-incremental-completion-delay)) (icicle-display-candidates-in-Completions)) (t ;; Complete: expand input to match common prefix. (if icicle-edit-update-p (if (or (not icicle-incremental-completion-p) (not (sit-for icicle-incremental-completion-delay))) ;; Even though we do this unconditionally, we need to do it after the `sit-for', ;; not before, because displaying causes Emacs to think that user input might be ;; pending. (icicle-display-candidates-in-Completions nil no-display-p) (icicle-display-candidates-in-Completions nil no-display-p) (when (icicle-prefix-complete-2 word-p) (setq icicle-mode-line-help (icicle-minibuf-input-sans-dir icicle-current-input)))) (when (icicle-prefix-complete-2 word-p) (setq icicle-mode-line-help (icicle-minibuf-input-sans-dir icicle-current-input))) (cond (;; Candidates visible. If second prefix complete, cycle, else update candidates. (get-buffer-window "*Completions*" 0) (if (and (or ipc1-was-cycling-p icicle-next-prefix-complete-cycles-p) (icicle-get-safe icicle-last-completion-command 'icicle-prefix-completing-command) (if word-p ;; Word completion cycles only if both of these are true: ;; * Input is not yet complete (null `return-value'). ;; * Either last command was an edit and input does not end in `-', ;; or the current input is from cycling. ;; E.g. `M-x fo M-SPC r M-SPC' cycles among `foreground-color' etc. (and (not return-value) (or (and (not (or (icicle-get-safe last-command 'icicle-prefix-completing-command) (icicle-get-safe last-command 'icicle-action-command))) (not (eq ?- (aref icicle-current-input (1- (length icicle-current-input)))))) (not (string= icicle-last-input word-complete-input)))) (and (symbolp last-command) (or (get last-command 'icicle-prefix-completing-command) (get last-command 'icicle-action-command) ;; This is necessary because when this option is non-nil ;; `icicle-(prefix|apropos)-complete' is called from code, ;; so `last-command' has not been set to it. icicle-show-Completions-initially-flag)))) ;; Second prefix completion in a row. (if icicle-TAB/S-TAB-only-completes-flag (setq icicle-edit-update-p t) (icicle-next-candidate 1 (if (icicle-file-name-input-p) ; Cycle down. 'icicle-file-name-prefix-candidates 'icicle-prefix-candidates))) ;; User did something else (e.g. changed input). Update the candidates. (icicle-display-candidates-in-Completions nil no-display-p))) (;; No candidates shown. Could be first completion or could follow `C-M-(S-)TAB'. icicle-TAB-shows-candidates-flag (if (not (and (or ipc1-was-cycling-p icicle-next-prefix-complete-cycles-p) (icicle-get-safe icicle-last-completion-command 'icicle-prefix-completing-command) (symbolp last-command) (or (get last-command 'icicle-prefix-completing-command) (get last-command 'icicle-action-command)) (not word-p))) ;; First prefix complete is enough to update candidates. (icicle-display-candidates-in-Completions nil no-display-p) ;; Second prefix complete. If `TAB', then it follows `C-M-TAB', so show window. (unless no-display-p (icicle-display-candidates-in-Completions nil)) (icicle-next-candidate 1 (if (icicle-file-name-input-p) 'icicle-file-name-prefix-candidates 'icicle-prefix-candidates)))) (;; No candidates shown. Second prefix completion in a row. ;; If NO-DISPLAY-P and either not WORD-P or input is complete, then: ;; if `icicle-TAB/S-TAB-only-completes-flag' then set `icicle-edit-update-p' to t; ;; else cycle down. ;; Else, vanilla Emacs: second `TAB' shows candidates. (and (icicle-get-safe icicle-last-completion-command 'icicle-prefix-completing-command) (symbolp last-command) (or (get last-command 'icicle-prefix-completing-command) (get last-command 'icicle-action-command)) completion-auto-help) (if (or (not no-display-p) (and word-p (not return-value))) (icicle-display-candidates-in-Completions nil) (if icicle-TAB/S-TAB-only-completes-flag (setq icicle-edit-update-p t) (icicle-next-candidate 1 (if (icicle-file-name-input-p) 'icicle-file-name-prefix-candidates 'icicle-prefix-candidates))))) ;; Input is complete, but there are also other candidates with the same prefix. ((and (member icicle-current-input icicle-completion-candidates) (not (eq no-display-p 'no-msg))) (minibuffer-message " [Complete, but not unique]")))))) (setq icicle-last-completion-command (if word-p 'icicle-prefix-word-complete (if no-display-p 'icicle-prefix-complete-no-display 'icicle-prefix-complete)) ;; $$$$$$ Trying this - added wrapper (or (not word-p)...) icicle-next-prefix-complete-cycles-p (and (not icicle-TAB/S-TAB-only-completes-flag) (or (not word-p) (equal input-before-completion (icicle-input-from-minibuffer 'leave-envvars))))) return-value))) (defun icicle-prefix-complete-2 (word-p) "Replace minibuffer content with highlighted current input. Call `icicle-highlight-initial-whitespace'. If completing file name, set default dir based on current completion. If input is complete and we are not in the process of exiting the minibuffer, then call `icicle-highlight-complete-input'. Return the value of this condition: nil or non-nil. Non-nil WORD-P means this is word completion, so just highlight existing content (do not replace it), and set default dir." (unless word-p (icicle-clear-minibuffer) (save-window-excursion ;; Shouldn't need to explicitly select minibuffer like this, since `*Completions*' input is ;; directed there. But there seems to be an Emacs bug somewhere, because although using just ;; `insert' inserts the input in the minibuffer OK, in some cases the cursor might not follow the ;; insertion. (select-window (active-minibuffer-window)) (insert icicle-current-input)) ;; Shouldn't need to do this if it is on `post-command-hook', but it seems we need to. (when (and (boundp '1on1-fit-minibuffer-frame-flag) 1on1-fit-minibuffer-frame-flag (require 'fit-frame nil t)) (1on1-fit-minibuffer-frame))) (deactivate-mark) (icicle-highlight-initial-whitespace icicle-current-input) (let ((complete-&-not-exiting-p (and (not (boundp 'icicle-prefix-complete-and-exit-p)) (icicle-input-is-a-completion-p icicle-current-input)))) (when complete-&-not-exiting-p (icicle-highlight-complete-input)) complete-&-not-exiting-p)) (defun icicle-input-is-a-completion-p (&optional input) "Return non-nil if the input is a valid completion. Optional arg INPUT is passed to `icicle-minibuffer-input-sans-dir'. This is essentially a `member' test, except for environment vars, for which the initial `$' is ignored." (let* ((input-sans-dir (icicle-minibuf-input-sans-dir input)) (env-var-name (and (icicle-not-basic-prefix-completion-p) (> (length input-sans-dir) 0) (eq ?\$ (aref input-sans-dir 0)) (substring input-sans-dir 1)))) (unless (or icicle-last-completion-candidate input) (setq icicle-completion-candidates (funcall (if (eq icicle-current-completion-mode 'prefix) #'icicle-prefix-candidates #'icicle-apropos-candidates) input-sans-dir))) (member (icicle-upcase-if-ignore-case (or env-var-name input-sans-dir)) (mapcar #'icicle-upcase-if-ignore-case icicle-completion-candidates)))) (defun icicle-upcase-if-ignore-case (string) "Return (icicle-upcase STRING) if `completion-ignore-case', else STRING." (if completion-ignore-case (icicle-upcase string) string)) ;; Bound in minibuffer to keys in `icicle-apropos-complete-keys' (`S-TAB'). (put 'icicle-apropos-complete 'icicle-cycling-command t) (put 'icicle-apropos-complete 'icicle-apropos-cycling-command t) (put 'icicle-apropos-complete 'icicle-completing-command t) (put 'icicle-apropos-complete 'icicle-apropos-completing-command t) (defun icicle-apropos-complete () "Complete the minibuffer contents as far as possible. Repeat this to cycle among candidate completions. This uses \"apropos completion\", defined as follows: A completion contains the minibuffer input somewhere, as a substring. Display a list of possible completions in buffer `*Completions*'. Candidate completions are appropriate names that match the current input, taken as a regular expression, where appropriateness is determined by the context (command, variable, and so on). Return nil if there is no valid completion. Otherwise, return the list of completion candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-apropos-complete]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (when (and (string= icicle-dot-string icicle-anychar-regexp) (not (string= icicle-dot-string-internal icicle-anychar-regexp))) (icicle-convert-dots (equal icicle-current-input icicle-last-input)) ; No confirm if same input. (setq icicle-dot-string-internal (icicle-anychar-regexp))) (let* ((error-msg nil) ; Apropos complete. (candidates (icicle-condition-case-no-debug lossage (icicle-apropos-complete-1) (invalid-regexp (setq error-msg (cadr lossage)) (when (string-match "\\`Premature \\|\\`Unmatched \\|\\`Invalid " error-msg) (setq error-msg "incomplete input"))) (error (setq error-msg (error-message-string lossage)))))) (when error-msg (minibuffer-message (concat " " error-msg))) candidates)) ;; Bound in minibuffer to keys in `icicle-apropos-complete-no-display-keys' (`C-M-S-TAB'). (put 'icicle-apropos-complete-no-display 'icicle-cycling-command t) (put 'icicle-apropos-complete-no-display 'icicle-apropos-cycling-command t) (put 'icicle-apropos-complete-no-display 'icicle-completing-command t) (put 'icicle-apropos-complete-no-display 'icicle-apropos-completing-command t) (defun icicle-apropos-complete-no-display (&optional no-msg-p) "Like `icicle-apropos-complete', but without displaying `*Completions*'. Optional arg NO-MSG-P non-nil means do not show a minibuffer message indicating that candidates were updated. You can use this command only from the minibuffer (`\\\ \\[icicle-apropos-complete-no-display]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let* ((error-msg nil) (candidates (icicle-condition-case-no-debug lossage (icicle-apropos-complete-1 (if no-msg-p 'no-msg 'no-display)) (invalid-regexp (setq error-msg (cadr lossage)) (when (string-match "\\`Premature \\|\\`Unmatched \\|\\`Invalid " error-msg) (setq error-msg "incomplete input"))) (error (setq error-msg (error-message-string lossage)))))) (when error-msg (minibuffer-message (concat " " error-msg))) candidates)) (defun icicle-apropos-complete-1 (&optional no-display-p) "Helper function for `icicle-apropos-complete(-no-display)'. This does everything except deal with regexp-match errors. Return the list of completion candidates. Optional argument NO-DISPLAY-P non-nil means do not display buffer `*Completions*'. If the value is `no-msg', then do not show any message either. NO-DISPLAY-P is passed to `icicle-display-candidates-in-Completions' as its second arg." (let ((iac1-was-cycling-p icicle-cycling-p) input-before-completion) (setq icicle-mode-line-help nil) (setq icicle-current-input (if (and icicle-last-input icicle-cycling-p (not icicle-edit-update-p) (not icicle-TAB/S-TAB-only-completes-flag) (eq icicle-current-completion-mode 'apropos) (symbolp last-command) (or (get last-command 'icicle-cycling-command) (get last-command 'icicle-action-command)) icicle-completion-candidates) icicle-last-input (icicle-input-from-minibuffer)) icicle-current-completion-mode 'apropos icicle-next-prefix-complete-cycles-p nil icicle-input-fail-pos nil icicle-cycling-p nil) (when icicle-edit-update-p (setq icicle-next-apropos-complete-cycles-p nil)) (when (icicle-file-name-input-p) (setq icicle-current-input (abbreviate-file-name (if icicle-regexp-quote-flag (substitute-in-file-name icicle-current-input) icicle-current-input)))) (setq input-before-completion icicle-current-input) (unless (or icicle-edit-update-p (get-buffer-window "*Completions*" 0) no-display-p) (message "Computing completion candidates...")) (unless (and (stringp icicle-current-input) (stringp icicle-last-input) (string= icicle-current-input icicle-last-input) (symbolp last-command) (or (get last-command 'icicle-apropos-completing-command) (get last-command 'icicle-action-command))) (setq icicle-completion-candidates (icicle-condition-case-no-debug nil (if (icicle-file-name-input-p) (icicle-file-name-apropos-candidates icicle-current-input) (icicle-apropos-candidates icicle-current-input)) (error icicle-completion-candidates)))) ; No change if completion error. (icicle-save-or-restore-input) (cond ((null icicle-completion-candidates) (setq icicle-nb-of-other-cycle-candidates 0) (let ((icicle-incremental-completion ; Upgrade if OK for explicit. (or (memq icicle-highlight-input-completion-failure '(explicit-strict explicit explicit-remote)) icicle-incremental-completion))) (icicle-highlight-input-noncompletion)) (save-selected-window (icicle-remove-Completions-window)) (run-hooks 'icicle-no-match-hook) (unless (eq no-display-p 'no-msg) (minibuffer-message (let ((typ (car (rassq icicle-apropos-complete-match-fn icicle-S-TAB-completion-methods-alist)))) (concat " [No " typ (and typ " ") "completion]"))))) ;; Single matching candidate. ((null (cdr icicle-completion-candidates)) (setq icicle-current-input (if (not (icicle-file-name-input-p)) ;; Transfer any `icicle-whole-candidate' property from ;; candidate to `icicle-current-input', so things that use ;; `icicle-candidates-alist' will work. (car icicle-completion-candidates) (if (string= "" icicle-current-input) (or (icicle-file-name-directory icicle-current-input) "") (directory-file-name (icicle-abbreviate-or-expand-file-name (car icicle-completion-candidates) (icicle-file-name-directory icicle-current-input)))))) (setq icicle-nb-of-other-cycle-candidates 0) (cond (;; Do not expand input in minibuffer - just show `*Completions*'. (and (not no-display-p) ; Always expand for NO-DISPLAY-P. (or (eq 0 icicle-expand-input-to-common-match) ; `never' (and icicle-edit-update-p ; `explicit' means no auto-expansion. (eq 1 icicle-expand-input-to-common-match)))) ; `explicit' (when icicle-incremental-completion-p (sit-for icicle-incremental-completion-delay)) (icicle-display-candidates-in-Completions)) (t ; Expand input to sole match in minibuffer. (setq icicle-current-input (if (not (icicle-file-name-input-p)) ;; Transfer any `icicle-whole-candidate' property from ;; candidate to `icicle-current-input', so things that use ;; `icicle-candidates-alist' will work. (car icicle-completion-candidates) (if (string= "" icicle-current-input) (or (icicle-file-name-directory icicle-current-input) "") (directory-file-name (icicle-abbreviate-or-expand-file-name (car icicle-completion-candidates) (icicle-file-name-directory icicle-current-input)))))) (unless (and icicle-edit-update-p (or (not icicle-incremental-completion-p) (not (sit-for icicle-incremental-completion-delay)))) (icicle-clear-minibuffer) (let ((cand (car icicle-completion-candidates))) (if (icicle-file-name-input-p) (cond ((string= "" cand) ; This indicates an empty dir. (setq icicle-last-completion-candidate icicle-current-input)) ((eq ?\/ (aref cand (1- (length cand)))) ;; Add `/', so cycling expands dir. (setq icicle-current-input (file-name-as-directory icicle-current-input) icicle-last-completion-candidate icicle-current-input)) (t ; Non-dir - use the candidate file. (setq icicle-last-completion-candidate cand))) (setq icicle-last-completion-candidate cand))) (let ((inserted (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member icicle-last-completion-candidate icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-abbreviate-or-expand-file-name icicle-last-completion-candidate (icicle-file-name-directory-w-default icicle-current-input)) icicle-last-completion-candidate))) (insert inserted))) (save-selected-window (icicle-remove-Completions-window)) ;; Do not transform multi-completion here. It should be done in the function that acts ;; on the chosen completion candidate. For a multi-command, that means it should be ;; done in the action function. ;; $$$$$$ (icicle-transform-sole-candidate) icicle-current-input)) (unless (boundp 'icicle-apropos-complete-and-exit-p) (icicle-highlight-complete-input) (cond ((and icicle-top-level-when-sole-completion-flag (or (and (not (and (boundp 'icicle-ido-like-mode) icicle-ido-like-mode)) (not icicle-files-ido-like-flag)) (and (not (icicle-file-name-input-p)) (not icicle-abs-file-candidates)) (string= "" (car icicle-completion-candidates)) ; Empty directory (not (eq ?\/ (aref (car icicle-completion-candidates) (1- (length (car icicle-completion-candidates))))))) (sit-for icicle-top-level-when-sole-completion-delay)) (set minibuffer-history-variable (cons (car icicle-completion-candidates) (symbol-value minibuffer-history-variable))) (icicle-condition-case-no-debug icicle-apropos-complete-1 (throw 'icicle-read-top (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member (car icicle-completion-candidates) icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (expand-file-name (car icicle-completion-candidates)) (car icicle-completion-candidates))) (no-catch (setq icicle-current-input (car icicle-completion-candidates)) (icicle-retrieve-last-input) icicle-current-input) (error (message "%s" (error-message-string icicle-apropos-complete-1))))) ((and icicle-edit-update-p (not (eq no-display-p 'no-msg))) (minibuffer-message (format " [One apropos completion: %s]" (car icicle-completion-candidates))) (setq icicle-mode-line-help (car icicle-completion-candidates))) ((not (eq no-display-p 'no-msg)) (minibuffer-message " [Sole apropos completion]") (setq icicle-mode-line-help (car icicle-completion-candidates)))))) ;; Multiple candidates. (;; Do not expand input in minibuffer - just show `*Completions*'. (and (not no-display-p) ; Always expand for NO-DISPLAY-P. (or (eq 0 icicle-expand-input-to-common-match) ; `never' (and icicle-edit-update-p ; No autoexpansion for `explicit', `sole-match', `prefix' (memq icicle-expand-input-to-common-match '(1 2 3))))) (when icicle-incremental-completion-p (sit-for icicle-incremental-completion-delay)) (icicle-display-candidates-in-Completions)) (t ;; Complete: expand input to match common prefix. (if icicle-edit-update-p (if (or (not icicle-incremental-completion-p) (not (sit-for icicle-incremental-completion-delay))) ;; Even though we do this unconditionally, we need to do it after the `sit-for', ;; not before, because displaying causes Emacs to think that user input might be ;; pending. (icicle-display-candidates-in-Completions nil no-display-p) (icicle-display-candidates-in-Completions nil no-display-p) (let ((complete-input-sans-dir (icicle-apropos-complete-2))) (when complete-input-sans-dir (setq icicle-mode-line-help complete-input-sans-dir)))) (let ((complete-input-sans-dir (icicle-apropos-complete-2))) (when complete-input-sans-dir (setq icicle-mode-line-help complete-input-sans-dir))) (cond (;; Candidates visible. If second `S-TAB', cycle, else update candidates. (get-buffer-window "*Completions*" 0) (if (and (or iac1-was-cycling-p icicle-next-apropos-complete-cycles-p) (icicle-get-safe icicle-last-completion-command 'icicle-apropos-completing-command) (symbolp last-command) (or (get last-command 'icicle-apropos-completing-command) (get last-command 'icicle-action-command) ;; This is necessary because when this option is non-nil ;; `icicle-(prefix|apropos)-complete' is called from code, ;; so `last-command' has not been set to it. icicle-show-Completions-initially-flag)) ;; Second `S-TAB' in a row. (if icicle-TAB/S-TAB-only-completes-flag (setq icicle-edit-update-p t) (icicle-next-candidate 1 (if (icicle-file-name-input-p) ; Cycle down. 'icicle-file-name-apropos-candidates 'icicle-apropos-candidates) 'regexp-p)) ;; User did something else (e.g. changed input). (Possibly) update the display. (icicle-display-candidates-in-Completions nil no-display-p))) (t (if (not (and (or iac1-was-cycling-p icicle-next-apropos-complete-cycles-p) (icicle-get-safe icicle-last-completion-command 'icicle-apropos-completing-command) (symbolp last-command) (or (get last-command 'icicle-apropos-completing-command) (get last-command 'icicle-action-command)))) (icicle-display-candidates-in-Completions nil no-display-p) ;; Second apropos completion. If `S-TAB', it follows `C-M-S-TAB', so show window. (unless no-display-p (icicle-display-candidates-in-Completions nil)) (if icicle-TAB/S-TAB-only-completes-flag (setq icicle-edit-update-p t) (icicle-next-candidate 1 (if (icicle-file-name-input-p) ; Cycle down. 'icicle-file-name-apropos-candidates 'icicle-apropos-candidates) 'regexp-p)))))))) (setq icicle-last-completion-command (if no-display-p 'icicle-apropos-complete-no-display 'icicle-apropos-complete) ;; $$$$$$ Trying without the condition arg - just pass `t' ;; icicle-next-apropos-complete-cycles-p (equal input-before-completion ;; (icicle-input-from-minibuffer))) icicle-next-apropos-complete-cycles-p (not icicle-TAB/S-TAB-only-completes-flag)) icicle-completion-candidates)) (defun icicle-apropos-complete-2 () "Replace minibuffer content with highlighted current input. Call `icicle-highlight-initial-whitespace'. If completing file name, set default dir based on current completion. If input is complete and we are not in the process of exiting the minibuffer, then call `icicle-highlight-complete-input'. Return the value of this condition: nil or non-nil." (icicle-clear-minibuffer) (insert icicle-current-input) ; Update minibuffer. ;; Shouldn't need to do this if it is on `post-command-hook', but it seems we need to. (when (and (boundp '1on1-fit-minibuffer-frame-flag) 1on1-fit-minibuffer-frame-flag (require 'fit-frame nil t)) (1on1-fit-minibuffer-frame)) ; In `oneonone.el'. (deactivate-mark) (icicle-highlight-initial-whitespace icicle-current-input) (let* ((input-sans-dir (icicle-minibuf-input-sans-dir icicle-current-input)) (complete-&-not-exiting-p (and (member (icicle-upcase-if-ignore-case input-sans-dir) (mapcar #'icicle-upcase-if-ignore-case icicle-completion-candidates)) (not (boundp 'icicle-apropos-complete-and-exit-p))))) (when complete-&-not-exiting-p (icicle-highlight-complete-input)) (and complete-&-not-exiting-p input-sans-dir))) ;; Not used anymore. (defun icicle-transform-sole-candidate () "Transform matching candidate according to `icicle-list-use-nth-parts'." (when (and icicle-list-use-nth-parts icicle-current-input) ;; $$$$$$ (let ((newcand (icicle-transform-multi-completion (car icicle-completion-candidates)))) (let ((newcand (icicle-transform-multi-completion icicle-current-input))) (icicle-clear-minibuffer) (insert newcand) (setq icicle-completion-candidates (list newcand) icicle-last-completion-candidate newcand)))) (defun icicle-switch-to-Completions-buf () ; Bound to `C-insert' in minibuffer. "Select the completion list window. The cursor is placed on the first occurrence of the current minibuffer content. You can use \\\ `\\[icicle-insert-completion]' to get back to the minibuffer. You can use this command only from the minibuffer (`\\\ \\[icicle-switch-to-Completions-buf]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let ((window (get-buffer-window "*Completions*" 0)) (search-fn 'search-forward)) (unless window ; Make sure we have a completions window. (icicle-apropos-complete) (setq window (get-buffer-window "*Completions*" 0) search-fn 're-search-forward)) ; Use regexp search: input is not yet complete. (when window (select-window window) (let ((case-fold-search ;; Don't bother to detect buffer completion and check `read-buffer-completion-ignore-case'. (if (and (icicle-file-name-input-p) (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case completion-ignore-case))) (goto-char (icicle-start-of-candidates-in-Completions)) (cond (icicle-candidate-nb (icicle-move-to-next-completion icicle-candidate-nb 'NO-MINIBUFFER-FOLLOW-P)) (t (let ((inp (icicle-minibuf-input-sans-dir icicle-current-input))) (when (and (icicle-get-safe icicle-last-completion-command 'icicle-apropos-completing-command) ;; $$ Previously allowed the -action's. (not (icicle-get-safe last-command 'icicle-cycling-command))) (setq search-fn 're-search-forward)) ; Use regexp search: input is not yet complete. (while (and (not (eobp)) (save-restriction (narrow-to-region (point) (next-single-property-change (point) 'mouse-face nil (point-max))) (not (funcall search-fn inp nil 'leave-at-end)))))))) (unless (eobp) (unless icicle-candidate-nb (goto-char (match-beginning 0))) (let ((prop (get-text-property (max (point-min) (1- (point))) 'mouse-face))) ;; If in a completion, move to the start of it. (when (and prop (eq prop (get-text-property (point) 'mouse-face))) (goto-char (previous-single-property-change (point) 'mouse-face nil (point-min))))) (icicle-place-overlay (point) (next-single-property-change (point) 'mouse-face nil (point-max)) 'icicle-current-completion-candidate-overlay 'icicle-current-candidate-highlight 100 (current-buffer))))))) (defun icicle-insert-completion (&optional completion) ; Bound to `C-insert' in `*Completions*'. "Select the active minibuffer window. Insert current completion. The current candidate in `*Completions*' (under the cursor) is inserted into the minibuffer as the current input. You can use \\\ `\\[icicle-switch-to-Completions-buf]' to switch to the `*Completions*' window. You can use this command only from buffer `*Completions*' (`\\\ \\[icicle-insert-completion]'). Non-interactively, optional arg COMPLETION is the completion to insert." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions)) (when (active-minibuffer-window) (unwind-protect ; If no current completion, return to minibuffer anyway. ;; It is possible for COMPLETION to come from `icicle-candidate-set-retrieve' with a singleton set. ;; In that case, `*Completions*' has been removed. So do not assume we are in `*Completions*'. (let ((in-Completions (eq (current-buffer) (get-buffer "*Completions*")))) (setq completion (or completion (and in-Completions (icicle-current-completion-in-Completions))) icicle-last-completion-candidate completion icicle-candidate-nb (and in-Completions (icicle-nb-of-cand-at-Completions-pos (point)))) (select-window (active-minibuffer-window)) (with-current-buffer (window-buffer) ; Needed if `*Completions*' is redirected to minibuffer. (goto-char (icicle-minibuffer-prompt-end)) (icicle-clear-minibuffer) (icicle-insert-cand-in-minibuffer completion (not (eq icicle-current-completion-mode 'prefix))) (setq icicle-last-input icicle-current-input icicle-cycling-p t) (setq icicle-mode-line-help icicle-last-completion-candidate))) (select-window (active-minibuffer-window))))) (defun icicle-current-completion-in-Completions () "The completion candidate under the cursor in buffer `*Completions*'. Return the name as a string." ; See also `choose-completion' and `mouse-choose-completion'. (let ((buffer completion-reference-buffer) (base-size completion-base-size) (start-of-cands (icicle-start-of-candidates-in-Completions)) beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (when (and (> (point) start-of-cands) (get-text-property (max (point-min) (1- (point))) 'mouse-face)) (setq end (max (point-min) (1- (point))) beg (point))) (setq beg (previous-single-property-change (or beg (point)) 'mouse-face nil start-of-cands) end (next-single-property-change (or end (point)) 'mouse-face nil (point-max))) (unless beg (icicle-user-error "No completion here")) ;; $$$$ (buffer-substring-no-properties beg end))) (buffer-substring beg end))) (defun icicle-switch-to/from-minibuffer () ; Bound to `pause' in Icicle mode. "Switch to minibuffer or previous buffer, in other window. If current buffer is the minibuffer, then switch to the buffer that was previously current. Otherwise, switch to the minibuffer." (interactive) (unless (active-minibuffer-window) (icicle-user-error "Minibuffer is not active")) (if (eq (selected-window) (active-minibuffer-window)) (switch-to-buffer-other-window icicle-pre-minibuffer-buffer) (select-window (active-minibuffer-window)))) ;; Replaces `previous-completion' (defined in `simple.el'). ;; (defun icicle-move-to-previous-completion (n) ; Bound to `left', `S-TAB' in `*Completions*'. "Move to the previous item in the completion list. You can use this command only from buffer `*Completions*' (`\\\ \\[icicle-move-to-previous-completion]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-Completions)) (setq n (or n 0)) (icicle-move-to-next-completion (- n))) ;; Replaces `next-completion' (defined in `simple.el'). ;; This is similar, except: ;; 1. This highlights the current candidate. ;; 2. This wraps around from first to last and last to first. ;; 3. Properly handles completions laid out vertically. ;; (defun icicle-move-to-next-completion (n ; Bound to `right', `TAB' in `*Completions*'. &optional no-minibuffer-follow-p) "Move to the next item in the completion list. With prefix argument N, move N items (negative N means move backward). Optional second argument, if non-nil, means do not copy the completion back to the minibuffer. You can use this command only from buffer `*Completions*' (`\\\ \\[icicle-move-to-next-completion]')." (interactive "p") (when (interactive-p) (icicle-barf-if-outside-Completions)) (setq n (or n 0)) (when (eq icicle-completions-format 'vertical) (let* ((cols (icicle-nb-Completions-cols)) (nb-cands (length icicle-completion-candidates)) (rows (/ nb-cands cols))) (unless (zerop (% nb-cands cols)) (setq rows (1+ rows))) (setq n (icicle-row-wise-cand-nb n nb-cands rows cols)))) (let ((beg (icicle-start-of-candidates-in-Completions)) (end (point-max))) ;; Forward: n > 0. (while (and (> n 0) (not (eobp))) (when (get-text-property (point) 'mouse-face) ; If in a candidate, move to its end. (goto-char (next-single-property-change (point) 'mouse-face nil end))) (unless (get-text-property (point) 'mouse-face) ; Move to start of next candidate. (goto-char (or (next-single-property-change (point) 'mouse-face) beg))) ; Wrap back to first. (setq n (1- n))) ;; Backward: n < 0. (while (and (< n 0) (>= (count-lines 1 (point)) (if icicle-show-Completions-help-flag 2 0))) (let ((prop (get-text-property (max (point-min) (1- (point))) 'mouse-face))) (when (and prop (eq prop (get-text-property (point) 'mouse-face))) ; If in cand, move to start. (goto-char (previous-single-property-change (point) 'mouse-face nil beg)))) (unless (or (< (count-lines 1 (point)) ; Move to end of previous candidate. (if icicle-show-Completions-help-flag 2 0)) (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face))) (goto-char (or (previous-single-property-change (point) 'mouse-face) ;; Wrap back to end of last candidate. (Back over final space with no mouse-face.) (1- end)))) ;; Move to the start of that candidate. (goto-char (previous-single-property-change (point) 'mouse-face nil beg)) (setq n (1+ n))) (icicle-place-overlay (point) (next-single-property-change (point) 'mouse-face nil end) 'icicle-current-completion-candidate-overlay 'icicle-current-candidate-highlight 100 (current-buffer))) (unless no-minibuffer-follow-p (save-excursion (save-window-excursion (icicle-insert-completion))))) (defun icicle-previous-line () ; Bound to `up' in `*Completions*'. "Move up a line, in `*Completions*' buffer. Wrap around first to last. You can use this command only from buffer `*Completions*' (`\\\ \\[icicle-previous-line]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions)) (let ((opoint (point)) (curr-col 1) (next-line-cols 1) (eol (line-end-position))) (save-excursion (beginning-of-line) (while (and (< (point) opoint) (re-search-forward "[^ ] +" eol t)) (setq curr-col (1+ curr-col)))) (cond ((and (not icicle-show-Completions-help-flag) (<= (count-lines (icicle-start-of-candidates-in-Completions) (point)) (if (bolp) 0 1))) (goto-char (point-max)) (beginning-of-line)) ; Wrap around (t (forward-line -1) (when (and icicle-show-Completions-help-flag (< (point) (icicle-start-of-candidates-in-Completions))) (goto-char (point-max)) (beginning-of-line) ; Wrap around (unless (get-text-property (point) 'mouse-face) (forward-line -1))))) ; eobp, extra newline. (let ((eol (line-end-position))) (save-excursion (beginning-of-line) (while (re-search-forward "[^ ] +[^ ]" eol t) (setq next-line-cols (1+ next-line-cols))))) (icicle-move-to-next-completion (cond ((eq 1 curr-col) -1) ((> curr-col next-line-cols) (1- next-line-cols)) (t (1- curr-col)))))) (defun icicle-next-line () ; Bound to `down' in `*Completions*'. "Move down a line, in `*Completions*' buffer. Wrap around last to first. You can use this command only from buffer `*Completions*' (`\\\ \\[icicle-next-line]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions)) (let ((opoint (point)) (curr-col 1) (next-line-cols 1) (eol (line-end-position))) (save-excursion (beginning-of-line) (while (and (< (point) opoint) (re-search-forward "[^ ] +" eol t)) (setq curr-col (1+ curr-col)))) (forward-line 1) (when (eobp) (goto-char (icicle-start-of-candidates-in-Completions))) ; Wrap around (let ((eol (line-end-position))) (save-excursion (beginning-of-line) (while (re-search-forward "[^ ] +[^ ]" eol t) (setq next-line-cols (1+ next-line-cols))))) (icicle-move-to-next-completion (cond ((eq 1 curr-col) 1) ((> curr-col next-line-cols) (1- next-line-cols)) (t (1- curr-col)))))) ;; Same as `end-of-line+' in `misc-cmds.el'. ;; (defun icicle-end-of-line+ (&optional n) ; Bound to `C-e' in minibuffer and in `*Completions*'. "Move cursor to end of current line or end of next line if repeated. This is similar to `end-of-line', but: If called interactively with no prefix arg: If the previous command was also `end-of-line+', then move to the end of the next line. Else, move to the end of the current line. Otherwise, move to the end of the Nth next line (Nth previous line if N<0). Command `end-of-line', by contrast, moves to the end of the (N-1)th next line." (interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 0))) (unless n (setq n 0)) ; non-interactive with no arg (if (and (eq this-command last-command) (not current-prefix-arg)) (forward-line 1) (forward-line n)) (let ((inhibit-field-text-motion t)) ; Emacs 22+, so we get past the end of the prompt field. (end-of-line))) ;; Same as `beginning-of-line+' in `misc-cmds.el'. ;; (defun icicle-beginning-of-line+ (&optional n) ; Bound to `C-a' in minibuffer and in `*Completions*'. "Move cursor to beginning of current line or next line if repeated. This is the similar to `beginning-of-line', but: 1. With arg N, the direction is the opposite: this command moves backward, not forward, N lines. 2. If called interactively with no prefix arg: If the previous command was also `beginning-of-line+', then move to the beginning of the previous line. Else, move to the beginning of the current line. Otherwise, move to the beginning of the Nth previous line (Nth next line if N<0). Command `beginning-of-line', by contrast, moves to the beginning of the (N-1)th next line." (interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 0))) (unless n (setq n 0)) ; non-interactive with no arg (if (and (eq this-command last-command) (not current-prefix-arg)) (forward-line -1) (forward-line (- n))) (when (bobp) (goto-char (icicle-minibuffer-prompt-end)))) ;; Same as `resolve-file-name' in `misc-cmds.el'. ;; (defun icicle-resolve-file-name (bounds &optional killp) ; Bound to `C-x C-f' in minibuffer. "Replace the file name at/near point by its absolute, true file name. If the region is active, replace its content instead, treating it as a file name. If library `thingatpt+.el' is available then use the file name *nearest* point. Otherwise, use the file name *at* point. With a prefix arg, add both the original file name and the true name to the kill ring. Otherwise, add neither to the kill ring. (If the region was active then its content was already added to the ring.)" (interactive (let* ((regionp (and transient-mark-mode mark-active)) (thg+bnds (and (not regionp) (require 'thingatpt+ nil t) (tap-define-aliases-wo-prefix) ; Dispense with `tap-' prefix. (tap-put-thing-at-point-props) (thing-nearest-point-with-bounds 'filename))) (bnds (if regionp (cons (region-beginning) (region-end)) (if thg+bnds (cdr thg+bnds) (icicle-bounds-of-thing-at-point 'filename)))) (fname (if bnds (buffer-substring (car bnds) (cdr bnds)) (message "No file name at point")))) (list bnds current-prefix-arg))) (when bounds (let* ((file (buffer-substring (car bounds) (cdr bounds))) (absfile (expand-file-name (buffer-substring (car bounds) (cdr bounds)))) (dir (or (file-name-directory absfile) default-directory)) (true-dir (file-truename dir)) (relfile (file-name-nondirectory absfile)) (true-file (concat true-dir relfile))) (unless (equal file true-file) (cond (killp (if (and transient-mark-mode mark-active) (delete-region (car bounds) (cdr bounds)) ; Don't add it twice. (kill-region (car bounds) (cdr bounds))) (insert (kill-new true-file))) (t (delete-region (car bounds) (cdr bounds)) (insert true-file))))))) (put 'icicle-all-candidates-action 'icicle-action-command t) (defun icicle-all-candidates-action () ; Bound to `C-!' in minibuffer. "Take action on each completion candidate, in turn. Apply `icicle-candidate-action-fn' successively to each saved completion candidate (if any) or each candidate that matches the current input (a regular expression). The candidates that were not successfully acted upon are listed in buffer *Help*. If there are saved completion candidates, then they are acted on; if not, then all current matching candidates are acted on. If `icicle-candidate-action-fn' is nil but `icicle-all-candidates-list-action-fn' is not, then apply the latter to the list of candidates as a whole, instead. You can use this command only from the minibuffer (`\\\ \\[icicle-all-candidates-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (unless (or icicle-all-candidates-list-action-fn icicle-candidate-action-fn) (icicle-user-error "No action defined")) (if icicle-candidate-action-fn (icicle-all-candidates-action-1 icicle-candidate-action-fn nil) (icicle-all-candidates-action-1 icicle-all-candidates-list-action-fn 'LISTP))) (put 'icicle-all-candidates-alt-action 'icicle-action-command t) (defun icicle-all-candidates-alt-action () ; Bound to `C-|' in minibuffer. "Take alternative action on each completion candidate, in turn. Apply `icicle-candidate-alt-action-fn' successively to each saved completion candidate (if any) or each candidate that matches the current input (a regular expression). The candidates that were not successfully acted upon are listed in buffer *Help*. If there are saved completion candidates, then they are acted on; if not, then all current matching candidates are acted on. If `icicle-candidate-alt-action-fn' is nil but `icicle-all-candidates-list-alt-action-fn' is not, then apply the latter to the list of candidates as a whole, instead. You can use this command only from the minibuffer (`\\\ \\[icicle-all-candidates-alt-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (unless (or icicle-all-candidates-list-alt-action-fn icicle-candidate-alt-action-fn) (icicle-user-error "No alternative action defined")) (if icicle-candidate-alt-action-fn (icicle-all-candidates-action-1 icicle-candidate-alt-action-fn nil 'ALTP) (icicle-all-candidates-action-1 icicle-all-candidates-list-alt-action-fn 'LISTP))) (put 'icicle-all-candidates-list-action 'icicle-action-command t) (defun icicle-all-candidates-list-action () ; Bound to `M-!' in minibuffer. "Take action on the list of all completion candidates. Apply `icicle-all-candidates-list-action-fn' to the list of saved completion candidates or the list of candidates that match the current input (a regular expression). If there are saved completion candidates, then they are acted on; if not, then all current matching candidates are acted on. If `icicle-all-candidates-list-action-fn' is nil but `icicle-candidate-action-fn' is not, then apply the latter to each matching candidate in turn, and print the candidates that were not successfully acted upon in buffer *Help*. You can use this command only from the minibuffer (`\\\ \\[icicle-all-candidates-list-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (unless (or icicle-all-candidates-list-action-fn icicle-candidate-action-fn) (icicle-user-error "No action defined")) (if icicle-all-candidates-list-action-fn (icicle-all-candidates-action-1 icicle-all-candidates-list-action-fn 'LISTP) (icicle-all-candidates-action-1 icicle-candidate-action-fn nil))) (put 'icicle-all-candidates-list-alt-action 'icicle-action-command t) (defun icicle-all-candidates-list-alt-action () ; Bound to `M-|' in minibuffer. "Take alternative action on the list of all completion candidates. Apply `icicle-all-candidates-list-alt-action-fn' to the list of saved completion candidates or the list of completion candidates that match the current input (a regular expression). If there are saved completion candidates, then they are acted on; if not, then all current matching candidates are acted on. If `icicle-all-candidates-list-alt-action-fn' is nil but `icicle-candidate-alt-action-fn' is not, then apply the latter to each matching candidate in turn, and print the candidates that were not successfully acted upon in buffer *Help*. You can use this command only from the minibuffer (`\\\ \\[icicle-all-candidates-list-alt-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (unless (or icicle-all-candidates-list-alt-action-fn icicle-candidate-alt-action-fn) (icicle-user-error "No alternative action defined")) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (if icicle-all-candidates-list-alt-action-fn (icicle-all-candidates-action-1 icicle-all-candidates-list-alt-action-fn 'LISTP) (icicle-all-candidates-action-1 icicle-candidate-alt-action-fn nil 'ALTP))) (defun icicle-all-candidates-action-1 (fn-var listp &optional altp) "Helper function for `icicle-all-candidates(-alt)-action'. ALTP is used only if LISTP is nil. ALTP is passed to `icicle-candidate-action-1'." (let* ((local-saved (catch 'i-a-c-a-1 (dolist (cand icicle-saved-completion-candidates icicle-saved-completion-candidates) (unless (member cand icicle-completion-candidates) (throw 'i-a-c-a-1 nil))))) (candidates (or local-saved icicle-completion-candidates)) (failures nil) (icicle-minibuffer-message-ok-p listp) ; Avoid `icicle-msg-maybe-in-minibuffer' delays. (icicle-help-in-mode-line-delay 0) ; Avoid delays for individual candidate help. (icicle-all-candidates-action t)) (when local-saved (setq icicle-completion-candidates local-saved)) (if listp (funcall fn-var candidates) (while candidates (let ((error-msg (icicle-condition-case-no-debug act-on-each (icicle-candidate-action-1 fn-var altp (car candidates)) (error (error-message-string act-on-each))))) (when error-msg (setq failures (cons (cons (car candidates) error-msg) failures))) (setq candidates (cdr candidates)))) (when failures (with-output-to-temp-buffer "*Help*" (princ "Action failures:")(terpri)(terpri) (mapcar (lambda (entry) (princ (car entry)) (princ ":") (terpri) (princ " ") (princ (cdr entry)) (terpri)) failures)))))) ;; $$$$$$ (icicle-abort-recursive-edit)) (put 'icicle-candidate-action 'icicle-action-command t) (defun icicle-candidate-action () ; Bound to `C-return' in minibuffer. "Take action on the current minibuffer-completion candidate. If `icicle-candidate-action-fn' is non-nil, it is a function to apply to the current candidate, to perform the action. If no action is available in the current context, help on the candidate is shown - see `icicle-help-on-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-candidate-action-1 icicle-candidate-action-fn)) (put 'icicle-candidate-alt-action 'icicle-action-command t) (defun icicle-candidate-alt-action () ; Bound to `C-S-return' in minibuffer. "Take alternative action on the current completion candidate. If `icicle-candidate-alt-action-fn' is non-nil, it is a function to apply to the current candidate, to perform the action. For many Icicles commands, if `icicle-candidate-alt-action-fn' is nil, you are prompted to choose an alternative action, using completion. In any case, any alternative action defined for the current context by user option `icicle-alternative-actions-alist' always overrides `icicle-candidate-alt-action'. That is, if `icicle-alternative-actions-alist' says to use function `foo', then Icicles uses `foo' as the alternative action, regardless of the value of `icicle-candidate-alt-action'. If no alternative action is available in the current context, help on the candidate is shown - see `icicle-help-on-candidate'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-alt-action]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let ((alt-fn (or (cdr (assq icicle-cmd-reading-input icicle-alternative-actions-alist)) icicle-candidate-alt-action-fn))) (icicle-candidate-action-1 alt-fn 'alternative-p))) (defun icicle-candidate-action-1 (fn-var &optional altp cand) "Helper function for `icicle-candidate(-alt)-action'. FN-VAR is an Icicles action function or alternative action function. Optional arg ALTP non-nil means FN-VAR is alternative action function. Optional arg CAND non-nil means it is the candidate to act on." (when cand (setq icicle-last-completion-candidate cand)) (cond ((not fn-var) (icicle-help-on-candidate cand)) ; It doesn't `icicle-raise-Completions-frame'. ((icicle-require-match-p) ;; If no last candidate, then reset to first candidate matching input. (unless (stringp icicle-last-completion-candidate) (setq icicle-last-completion-candidate icicle-current-input last-command (if altp 'icicle-candidate-alt-action 'icicle-candidate-action)) (let ((icicle-help-in-mode-line-delay 0)) ; Avoid delay for candidate help. (icicle-next-candidate 1 (if (eq icicle-current-completion-mode 'prefix) 'icicle-prefix-candidates 'icicle-apropos-candidates) (not (eq icicle-current-completion-mode 'prefix))))) ;; NOTE: We no longer save and restore these things here. ;; We purposely allow an action function to modify these for subsequent actions. ;; If you need to save and restore these for a particular action function you define, ;; then you must do so in the action function itself. This might be the case, for instance, ;; if your action function does its own completion (e.g. calls `completing-read'), that is, if ;; it uses a recursive minibuffer. (But do not save and restore if you want the side effect.) (let (;; (icicle-candidate-nb icicle-candidate-nb) ; $$$$$$ ;; (icicle-last-completion-candidate icicle-last-completion-candidate) ; $$$$$$ ;; (icicle-completion-candidates icicle-completion-candidates) ; $$$$$$ ) (when icicle-completion-candidates (funcall fn-var icicle-last-completion-candidate))) (when (or icicle-use-candidates-only-once-flag (and altp icicle-use-candidates-only-once-alt-p)) (icicle-remove-candidate-display-others 'all)) (icicle-raise-Completions-frame)) (t (let ((icicle-last-input (or cand (icicle-input-from-minibuffer)))) ;; NOTE: We no longer save and restore these things here. ;; We purposely allow an action function to modify these for subsequent actions. ;; If you need to save and restore these for a particular action function you define, ;; then you must do so in the action function itself. This might be the case, for instance, ;; if your action function does its own completion (e.g. calls `completing-read'), that is, ;; uses a recursive minibuffer. (But do not save and restore if you want the side effect.) (let (;; (icicle-candidate-nb icicle-candidate-nb) ; $$$$$$ ;; (icicle-last-completion-candidate icicle-last-completion-candidate) ; $$$$$$ ;; (icicle-completion-candidates icicle-completion-candidates) ; $$$$$$ ) (funcall fn-var icicle-last-input)) (when (and (or icicle-use-candidates-only-once-flag (and altp icicle-use-candidates-only-once-alt-p)) (equal icicle-last-input (if (icicle-file-name-input-p) (expand-file-name icicle-last-completion-candidate (and icicle-last-input ; User did not use `(S-)TAB'. (icicle-file-name-directory icicle-last-input))) icicle-last-completion-candidate))) (icicle-remove-candidate-display-others 'all)) (icicle-raise-Completions-frame))))) ;; Bound to `C-down-mouse-2' (`C-mouse-2') in `*Completions*'. (put 'icicle-mouse-candidate-action 'icicle-action-command t) (defun icicle-mouse-candidate-action (event) ; `C-mouse-2' "Take action on the completion candidate clicked by `mouse-2'. If `icicle-candidate-action-fn' is non-nil, it is a function to apply to the clicked candidate, to perform the action. If `icicle-candidate-action-fn' is nil, the default action is performed: display help on the candidate - see `icicle-help-on-candidate'." (interactive "e") (icicle-mouse-candidate-action-1 event icicle-candidate-action-fn)) ; Bound to `C-S-down-mouse-2' (`C-S-mouse-2') in `*Completions*'. (put 'icicle-mouse-candidate-alt-action 'icicle-action-command t) (defun icicle-mouse-candidate-alt-action (event) ; `C-S-mouse-2' "Take alternative action on the candidate clicked by `mouse-2'. If `icicle-candidate-alt-action-fn' is non-nil, it is a function to apply to the clicked candidate, to perform the action. If `icicle-candidate-action-fn' is nil, the default action is performed: display help on the candidate - see `icicle-help-on-candidate'." (interactive "e") (icicle-mouse-candidate-action-1 event icicle-candidate-alt-action-fn)) (defun icicle-mouse-candidate-action-1 (event fn-var) "Helper function for `icicle-mouse-candidate(-alt)-action'." (run-hooks 'mouse-leave-buffer-hook) ; Give temp modes such as isearch a chance to turn off. (let ((posn-buf (window-buffer (posn-window (event-start event)))) (posn-pt (posn-point (event-start event))) (posn-col (car (posn-col-row (event-start event)))) (posn-row (cdr (posn-col-row (event-start event)))) choice) (read-event) ; Swallow mouse up event. (with-current-buffer posn-buf (save-excursion (goto-char posn-pt) (let (beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max))) (setq choice (buffer-substring beg end)) (remove-text-properties 0 (length choice) '(mouse-face nil) choice)))) (let ((icicle-last-input choice)) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos posn-pt)) (save-window-excursion (select-window (active-minibuffer-window)) (delete-region (icicle-minibuffer-prompt-end) (point-max)) (insert choice)) (if (not fn-var) (with-current-buffer (or icicle-orig-buff posn-buf) (icicle-help-on-candidate)) ; Does not `icicle-raise-Completions-frame'. ;; NOTE: We no longer save and restore these things here. ;; We purposely allow an action function to modify these for subsequent actions. ;; If you need to save and restore these for a particular action function you define, ;; then you must do so in the action function itself. This might be the case, for instance, ;; if your action function does its own completion (e.g. calls `completing-read'), that is, if ;; it uses a recursive minibuffer. (But do not save and restore if you want the side effect.) (let (;; (icicle-candidate-nb icicle-candidate-nb) ; $$$$$$ ;; (icicle-last-completion-candidate icicle-last-completion-candidate) ; $$$$$$ ;; (icicle-completion-candidates icicle-completion-candidates) ; $$$$$$ ) (funcall fn-var icicle-last-input)) (when (and icicle-use-candidates-only-once-flag (equal icicle-last-input (if (icicle-file-name-input-p) (expand-file-name icicle-last-completion-candidate (and icicle-last-input ; User did not use `(S-)TAB'. (icicle-file-name-directory icicle-last-input))) icicle-last-completion-candidate))) (icicle-remove-candidate-display-others 'all)) (icicle-raise-Completions-frame posn-col posn-row))))) (put 'icicle-multi-inputs-act 'icicle-action-command t) (defun icicle-multi-inputs-act (&optional arg) ; Bound to `M-R' in minibuffer. "Act on multiple candidates in the minibuffer. Parse minibuffer contents into a list of candidates, then act on each candidate, in order. The action applied is that defined by `icicle-multi-inputs-action-fn', if non-nil, or by `icicle-candidate-action-fn', if nil. The minibuffer input is split into string candidates using `icicle-split-input', passing the raw prefix arg as its ARG. You can use this command only from the minibuffer (`\\\ \\[icicle-multi-inputs-act]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let ((candidates (icicle-split-input arg)) (act-fn (or icicle-multi-inputs-action-fn icicle-candidate-action-fn))) (unless act-fn (icicle-user-error "No multi-inputs action defined")) (dolist (cand candidates) (funcall act-fn cand)))) (defun icicle-multi-inputs-save (&optional arg) ; Bound to `M-S' in minibuffer. "Add candidates in the minibuffer to the current saved candidates set. Parse minibuffer contents into a list of candidates, then add them to those already saved in `icicle-saved-completion-candidates'. \(To empty `icicle-saved-completion-candidates' first, use `\\[icicle-candidate-set-save-selected]'.) The minibuffer input is split into string candidates using `icicle-split-input', passing the raw prefix arg as its ARG. You can use this command only from the minibuffer (`\\\ \\[icicle-multi-inputs-save]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let ((candidates (icicle-split-input arg))) (icicle-candidate-set-save-1 candidates nil t))) (defun icicle-split-input (arg) "Split minibuffer input into multiple candidates. For file-name input, expand candidates using `expand-file-name'. Return the list of candidates. If ARG is nil then candidates are assumed to be separated by whitespace. If ARG is non-nil then candidates are read from the input as Lisp sexps using `read'. Any non-string sexp read is converted to a string using `format' with format string \"%s\". Typically, a non-nil ARG is used with candidates that are wrapped by \"...\". Examples: * With nil ARG and input `aaa bbbb cc ddd eeee', the candidates are `aaa', `bbbb', `cc', `ddd', and `eeee'. * With non-nil ARG and input `\"aaa bbbb\" \"cc\"\"ddd\"eeee', the candidates are `aaa bbbb', `cc', and `ddd' and `eeee'." (let ((input (icicle-input-from-minibuffer)) (cands ())) (if arg (condition-case nil (save-excursion (goto-char (icicle-minibuffer-prompt-end)) (let (cand) (while (not (eobp)) (setq cand (read (current-buffer))) (unless (stringp cand) (setq cand (format "%s" cand))) (when (icicle-file-name-input-p) (setq cand (expand-file-name cand))) (push cand cands)) (setq cands (nreverse cands)))) (error nil)) (setq cands (split-string input))) cands)) ;; $$$$$ ??? (put 'icicle-remove-candidate 'icicle-action-command t) ;; (defun icicle-remove-candidate () ; Bound to `delete' in minibuffer during completion. "Remove current completion candidate from the set of candidates. This has no effect on the object, if any, represented by the candidate; in particular, that object is not deleted. Note: For Emacs versions prior to 22, this does not really remove a file-name candidate as a possible candidate. If you use \\\ \\[icicle-prefix-complete] or \\[icicle-apropos-complete], it will reappear as a possible candidate. You can use this command only from the minibuffer (`\\[icicle-remove-candidate]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (icicle-remove-candidate-display-others)) ;; $$$$$ ??? (put 'icicle-mouse-remove-candidate 'icicle-action-command t) ;; (defun icicle-mouse-remove-candidate (event) ; Bound to `S-mouse-2' in `*Completions*'. "Remove clicked completion candidate from the set of candidates. This has no effect on the object, if any, represented by the candidate; in particular, that object is not deleted. See `icicle-remove-candidate' for more information." (interactive "e") (run-hooks 'mouse-leave-buffer-hook) ; Give temp modes such as isearch a chance to turn off. (let ((posn-buf (window-buffer (posn-window (event-start event)))) (posn-pt (posn-point (event-start event))) beg end) (read-event) ; Swallow mouse up event. (with-current-buffer posn-buf (save-excursion (goto-char posn-pt) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max))) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos posn-pt) icicle-last-completion-candidate (buffer-substring beg end))))) (icicle-remove-candidate-display-others)) (defun icicle-remove-candidate-display-others (&optional allp) "Remove current completion candidate from list of possible candidates. Redisplay `*Completions*', unless there is only one candidate left. Non-nil optional argument ALLP means remove all occurrences of the current candidate. Otherwise (nil) means remove only the current occurrence." (unless (stringp icicle-last-completion-candidate) (setq icicle-last-completion-candidate icicle-current-input last-command 'icicle-delete-candidate-object) (let ((icicle-help-in-mode-line-delay 0)) ; Avoid delay for candidate help. (icicle-next-candidate 1 (if (eq icicle-current-completion-mode 'prefix) 'icicle-prefix-candidates 'icicle-apropos-candidates) (not (eq icicle-current-completion-mode 'prefix))))) (let ((maybe-mct-cand (cond ((consp minibuffer-completion-table) (icicle-mctized-display-candidate icicle-last-completion-candidate)) ((arrayp minibuffer-completion-table) (intern icicle-last-completion-candidate)) (t icicle-last-completion-candidate)))) (icicle-remove-cand-from-lists icicle-last-completion-candidate maybe-mct-cand allp)) (icicle-update-and-next)) (put 'icicle-delete-candidate-object 'icicle-action-command t) (defun icicle-delete-candidate-object (&optional allp) ; Bound to `S-delete' in minibuffer. "Delete the object named by the current completion candidate. With a prefix argument, delete *ALL* objects named by the current set of candidates, after confirmation. Do nothing if `icicle-deletion-action-flag' is nil. Otherwise: * If the value of variable `icicle-delete-candidate-object' is a function, then apply it to the current completion candidate. This should delete some object named by the completion candidate. * If `icicle-delete-candidate-object' is not a function, then it should be a symbol bound to an alist. In this case, invoke `icicle-delete-candidate-object' to delete the object named by the current completion candidate from that alist. You can use this command only from the minibuffer (`\\\ \\[icicle-delete-candidate-object]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (when icicle-deletion-action-flag (if (null icicle-completion-candidates) (message "Nothing to delete - use `S-TAB', `TAB', or a cycle key") (if allp (if (not (let ((icicle-completion-candidates icicle-completion-candidates)) (yes-or-no-p "Are you SURE you want to DELETE ALL of the matching objects? "))) (message "OK, nothing deleted") (dolist (cand icicle-completion-candidates) (icicle-delete-candidate-object-1 cand t)) (icicle-erase-minibuffer)) ;; If no last candidate, then reset to first candidate matching input. (unless (stringp icicle-last-completion-candidate) (setq icicle-last-completion-candidate icicle-current-input last-command 'icicle-delete-candidate-object) (let ((icicle-help-in-mode-line-delay 0)) ; Avoid delay for candidate help. (icicle-next-candidate 1 (if (eq icicle-current-completion-mode 'prefix) 'icicle-prefix-candidates 'icicle-apropos-candidates) (not (eq icicle-current-completion-mode 'prefix))))) (icicle-delete-candidate-object-1 icicle-last-completion-candidate))))) (defun icicle-delete-candidate-object-1 (cand &optional no-display-p) "Helper function for `icicle-delete-candidate-object'. Delete object named CAND. Optional arg NO-DISPLAY-P non-nil means don't update `*Completions*'." (let ((display-cand cand) ; Use local vars: values might change. (maybe-mct-cand (cond ((consp minibuffer-completion-table) (icicle-mctized-display-candidate cand)) ((arrayp minibuffer-completion-table) (intern cand)) (t cand)))) (save-selected-window (let ((icicle-completion-candidates icicle-completion-candidates)) ; In case recursive minibuf. (if (functionp icicle-delete-candidate-object) (funcall icicle-delete-candidate-object cand) (icicle-delete-current-candidate-object cand)))) (icicle-remove-cand-from-lists display-cand maybe-mct-cand nil) ; Use local vars. (unless no-display-p (message "Deleted object named: `%s'" display-cand) (sit-for 1.0))) (unless no-display-p (icicle-update-and-next)) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame))) (defun icicle-delete-current-candidate-object (&optional cand) "Delete the object(s) corresponding to the current completion candidate. The value of `icicle-delete-candidate-object' must be a symbol \(variable) that is bound to a list of completion-candidate objects. The entries in the list must be completion candidates for the current call to `completing-read', but the list itself need not be the COLLECTION argument to `completing-read'. For example, the list might be a list of symbols, and the COLLECTION argument might be an obarray that contains those symbols. The list can be an alist, a list of strings, or a list of symbols. Delete, from this list, the objects that correspond to the current completion candidate. If the variable is also a user option, then save the option, after deleting the candidate object. The full candidate object is what is deleted. If the list contains multiple identical objects that correspond to the current completion candidate, they are all deleted." (setq cand (or cand icicle-last-completion-candidate)) (let ((val (and (symbolp icicle-delete-candidate-object) (symbol-value icicle-delete-candidate-object)))) ;; The message could more accurately say "Value of `icicle-delete-candidate-object' must be ;; a symbol bound to a list", but this makes more sense. (unless (and val (consp val)) (icicle-user-error "Cannot delete candidate objects now")) (set icicle-delete-candidate-object ; Update the variable. (cond ((or icicle-whole-candidate-as-text-prop-p icicle-candidates-alist) (delete (funcall icicle-get-alist-candidate-function cand) val)) ((consp (car val)) (icicle-assoc-delete-all cand val)) ((stringp (car val)) (delete cand val)) ((symbolp (car val)) (delete (intern cand) val)) (t (error "Entry in list value of `icicle-delete-candidate-object' is \ not a cons, string, or symbol"))))) (when (user-variable-p icicle-delete-candidate-object) ; Save the new user-option value. (funcall icicle-customize-save-variable-function icicle-delete-candidate-object (symbol-value icicle-delete-candidate-object)))) (defun icicle-remove-cand-from-lists (disp-cand mct-cand allp) "Delete first occurence or all occurences of candidate. The appropriate form of the candidate is removed from each of these: `icicle-candidates-alist' `icicle-completion-candidates' `minibuffer-completion-table' (if it is an alist) DISP-CAND is the display form of the candidate to delete. MCT-CAND is the MCT alist candidate that corresponds to DISP-CAND. If any of these conditions is true, remove all occurrences of CAND: * ALLP is non-nil * `icicle-transform-function' is `icicle-remove-duplicates' * `icicle-transform-function' is `icicle-remove-dups-if-extras' and `icicle-extra-candidates' is non-nil" (setq allp (or allp (eq icicle-transform-function 'icicle-remove-duplicates) (and icicle-extra-candidates (eq icicle-transform-function 'icicle-remove-dups-if-extras)))) (when icicle-candidates-alist (setq icicle-candidates-alist (if allp (icicle-assoc-delete-all disp-cand icicle-candidates-alist) (delete (funcall icicle-get-alist-candidate-function disp-cand) icicle-candidates-alist)))) (when (consp icicle-completion-candidates) (setq icicle-completion-candidates (if allp ; Delete only the first occurrence, or all if ALLP. (delete disp-cand icicle-completion-candidates) (icicle-delete-count disp-cand icicle-completion-candidates 1)))) ;; Update `minibuffer-completion-predicate' or `read-file-name-predicate' to effectively remove this cand. ;; The logic here is essentially the same as for `icicle-narrow-candidates-with-predicate'. (cond (;; File name input, Emacs 22+. ;; Update `read-file-name-predicate' if prior to Emacs 23.2, ;; else update `minibuffer-completion-predicate'. (and (icicle-file-name-input-p) (> emacs-major-version 21)) (let ((var (if (or (> emacs-major-version 23) (and (= emacs-major-version 23) (> emacs-minor-version 1))) 'minibuffer-completion-predicate 'read-file-name-predicate))) (set var (if (symbol-value var) (lexical-let ((curr-pred (symbol-value var))) `(lambda (file-cand) (and (not (equal ',disp-cand file-cand)) (funcall ',curr-pred file-cand)))) `(lambda (file-cand) (not (equal ',disp-cand file-cand))))))) ;; File name input, Emacs 20 or 21. We cannot do anything for file names. ;; `TAB' or `S-TAB' will unfortunately bring it back as a candidate. ((icicle-file-name-input-p)) ;; Non-file name input, all versions. Update `minibuffer-completion-predicate'. (t (setq minibuffer-completion-predicate (if minibuffer-completion-predicate ;; Add excluding of candidate to the existing predicate. (lexical-let ((curr-pred minibuffer-completion-predicate)) `(lambda (cand) (and (not (equal cand ',mct-cand)) (funcall ',curr-pred cand)))) ;; Set predicate to exclude the candidate. `(lambda (cand) (not (equal cand ',mct-cand)))))))) ;; $$$$$$$$$$$$ COULD USE THIS INSTEAD of updating the predicate, ;; but it works only when `minibuffer-completion-table' is an alist. ;; (when (consp minibuffer-completion-table) ;; (setq minibuffer-completion-table ;; (if allp ;; (delete mct-cand minibuffer-completion-table) ;; (icicle-delete-count mct-cand minibuffer-completion-table 1))))) (defun icicle-update-and-next () "Update `*Completions*' and make next candidate current. If we don't know which candidate number this is, just display." (cond ((and icicle-completion-candidates (cdr icicle-completion-candidates) ; > 1 candidates left. (not (input-pending-p))) ; Do nothing if user hit another key. (icicle-maybe-sort-and-strip-candidates) (message "Displaying completion candidates...") (save-selected-window (icicle-display-candidates-in-Completions)) (when (wholenump icicle-candidate-nb) (with-current-buffer "*Completions*" (goto-char (icicle-start-of-candidates-in-Completions)) (icicle-move-to-next-completion (mod icicle-candidate-nb (length icicle-completion-candidates))) (set-window-point (get-buffer-window "*Completions*" 0) (point)) (setq icicle-last-completion-candidate (icicle-current-completion-in-Completions)) (set-buffer-modified-p nil)))) (icicle-completion-candidates ; Single candidate left (save-selected-window (icicle-remove-Completions-window)) (let ((completion (icicle-transform-multi-completion (car icicle-completion-candidates)))) (select-window (active-minibuffer-window)) (with-current-buffer (window-buffer) ; Needed if `*Completions*' redirected to minibuffer. (goto-char (icicle-minibuffer-prompt-end)) (icicle-clear-minibuffer) (insert (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member icicle-current-input icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-file-name-directory-w-default icicle-current-input) "") completion)))) (t ; No candidates left ;; $$$$$$$$ `icicle-abort-recursive-edit' and `exit-recursive-edit' don't work, ;; because they take us back to top level. ;; $$$$ DO NOTHING? Do (icicle-remove-Completions-window)? Do (icicle-erase-minibuffer)? (icicle-erase-minibuffer)))) (defun icicle-autofile-action (action) "Return a function that creates/sets an autofile or adds/removes tags. If ACTION is: `add', the function prompts for tags to add, then adds them `remove', the function prompts for tags to remove, then removes them Anything else, the function just creates/sets an autofile bookmark If `icicle-full-cand-fn' is non-nil and `icicle-file-name-input-p' is nil, then update the current candidate to reflect the tag changes. Then update `*Completions*' and make the next candidate current. The candidate is updated as follows: 1. Apply `icicle-transform-multi-completion' to it. 2. Apply `icicle-full-cand-fn' to the result of #1. 3. Mctize the result of #2. That is, make it usable for `minibuffer-completion-table'." `(lambda () (interactive) (if (not icicle-last-completion-candidate) (icicle-msg-maybe-in-minibuffer "No current candidate - cycle to one") (let ((mct-cand (icicle-mctized-display-candidate icicle-last-completion-candidate)) (cand (icicle-transform-multi-completion icicle-last-completion-candidate)) (tags (and (memq ',action '(add remove)) (let ((enable-recursive-minibuffers t) ; Save and restore all of this. (minibuffer-completion-predicate minibuffer-completion-predicate) (icicle-candidate-nb icicle-candidate-nb) (icicle-last-completion-candidate icicle-last-completion-candidate) (icicle-completion-candidates icicle-completion-candidates) (icicle-current-input icicle-current-input)) (bmkp-read-tags-completing))))) (if (memq ',action '(add remove)) (funcall ',(if (eq 'add action) 'bmkp-autofile-add-tags 'bmkp-autofile-remove-tags) cand tags nil nil nil 'MSG) (bmkp-bookmark-a-file cand nil nil nil 'MSG)) (when (and icicle-full-cand-fn (not (icicle-file-name-input-p))) (icicle-replace-mct-cand-in-mct mct-cand (icicle-mctized-full-candidate (funcall icicle-full-cand-fn cand))) (let ((icicle-edit-update-p t)) ; Update the display to show changed candidate. (funcall (or icicle-last-completion-command (if (eq icicle-current-completion-mode 'prefix) #'icicle-prefix-complete #'icicle-apropos-complete))))))))) (put 'icicle-mouse-help-on-candidate 'icicle-action-command t) (defun icicle-mouse-help-on-candidate (event) ; Bound to `C-M-mouse-2' in minibuffer. "Display help on the minibuffer-completion candidate clicked by mouse." (interactive "e") (let ((icicle-candidate-action-fn nil)) (icicle-mouse-candidate-action event))) ;; Free vars here: `icicle-orig-buff' is bound in `icicle-complete-keys'. ;; `icicle-complete-keys-alist' is bound in `icicles-var.el'. (put 'icicle-help-on-candidate 'icicle-action-command t) (defun icicle-help-on-candidate (&optional cand) ; Bound to `C-M-return', `C-help', `C-M-help', ; `C-f1', and `C-M-f1' in minibuffer and in *Completions. "Display help on the current minibuffer-completion candidate. The help displayed depends on the type of candidate, as follows: menu item - the corresponding command is described using `describe-function' (only if `lacarte.el' is loaded) command or other function - described using `describe-function' keymap variable - described using `describe-keymap' (if available - see library `help-fns+.el') user option or other variable - described using `describe-variable' face - described using `describe-face' command abbreviation - described using `apropos-command' for matches property list - described using `apropos-describe-plist' buffer name - modes described using `describe-mode' (Emacs > 20) file name - file properties described If the same candidate names a function, a variable, and a face, or any two of these, then all such documentation is shown (Emacs 22+). In the minibuffer, you can also use `C-M-down', `C-M-up', `C-M-wheel-down', `C-M-wheel-up', `C-M-next', `C-M-prior', `C-M-end', and `C-M-home', to display help on the candidate and then move to the next or previous candidate. See, for example, `icicle-help-on-next-apropos-candidate'. You can use this command only from the minibuffer or `*Completions*' \(`\\[icicle-help-on-candidate]')." (interactive) ; Interactively, just describes itself. (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (let ((frame-with-focus (selected-frame)) (cand-symb nil) transformed-cand) (cond (cand (setq icicle-last-completion-candidate cand)) ((eq (current-buffer) (get-buffer "*Completions*")) (setq icicle-last-completion-candidate (icicle-current-completion-in-Completions))) ;; If no last candidate, then reset to first candidate matching input. ((not (stringp icicle-last-completion-candidate)) (setq icicle-last-completion-candidate icicle-current-input last-command 'icicle-help-on-candidate) (let ((icicle-help-in-mode-line-delay 0)) ; Avoid delay for candidate help. (icicle-next-candidate 1 (if (eq icicle-current-completion-mode 'prefix) 'icicle-prefix-candidates 'icicle-apropos-candidates) (not (eq icicle-current-completion-mode 'prefix)))))) (cond (;; Use special help function. icicle-candidate-help-fn ;; We do not transform a multi-completion candidate before passing it to ;; `icicle-candidate-help-fn'. It is that function that should do that (using ;; `icicle-transform-multi-completion'). We thus give that function access to the full, ;; untransformed candidate so that it can transform it anyway it wants. (funcall icicle-candidate-help-fn icicle-last-completion-candidate)) (;; Call to `lacarte-execute(-menu)-command' (defined in `lacarte.el'). ;; Use command associated with menu item. (consp lacarte-menu-items-alist) ; `lacarte-menu-items-alist' is in `lacarte.el'. (setq cand-symb (cdr (assoc icicle-last-completion-candidate lacarte-menu-items-alist))) (if cand-symb (icicle-help-on-candidate-symbol cand-symb) (icicle-msg-maybe-in-minibuffer "No help"))) ; Menu item with lambda definition. (;; A key-completion candidate. Get the true command from the candidate. icicle-completing-keys-p (save-match-data (string-match "\\(.+\\) = \\(.+\\)" icicle-last-completion-candidate) (setq cand-symb (intern-soft (substring icicle-last-completion-candidate (match-beginning 2) (match-end 2)))) (cond ((eq '\.\.\. cand-symb) ; Prefix key - describe its binding. (with-current-buffer (or icicle-orig-buff (current-buffer)) (describe-key (car-safe (cdr-safe (assq (intern-soft (substring icicle-last-completion-candidate (match-beginning 0) (match-end 0))) icicle-complete-keys-alist)))))) (cand-symb (icicle-help-on-candidate-symbol cand-symb)) ; Describe key's command. (t (icicle-msg-maybe-in-minibuffer "No help"))))) (t;; Transform candidate, in case it's a multi-completion. (setq transformed-cand (icicle-transform-multi-completion icicle-last-completion-candidate)) ;; If buffer or file, describe its properties. Otherwise, create symbol and get its help. (cond ((and (bufferp (get-buffer transformed-cand)) (with-current-buffer transformed-cand (if (fboundp 'describe-buffer) ; Defined in `help-fns+.el', Emacs 23+. (describe-buffer) (describe-mode)) t))) ((or (icicle-file-remote-p transformed-cand) ; Don't let Tramp try to access it. (file-exists-p transformed-cand)) (icicle-describe-file transformed-cand current-prefix-arg 'NO-ERROR-P)) (t (icicle-help-on-candidate-symbol (intern transformed-cand)))))) ;;$$$ (icicle-raise-Completions-frame) ;; This is a hack for MS Windows - otherwise, we can't continue to get more candidates, ;; because the *Help* frame takes the focus away from the minibuffer frame. ;; MS Windows always gives focus to a newly created frame - in this case, *Help*. (let* ((help-window (get-buffer-window "*Help*" 0)) (help-frame (and help-window (window-frame help-window)))) (when help-frame (redirect-frame-focus help-frame frame-with-focus)))) (message nil)) ; Let minibuffer contents show immediately. (defun icicle-help-on-candidate-symbol (symb) "Helper function for `icicle-help-on-candidate'. The arg is a symbol." (cond ((and (fboundp 'describe-keymap) (boundp symb) (keymapp (symbol-value symb))) (describe-keymap symb)) ((and (fboundp 'help-follow-symbol) ; Emacs 22+ (or (fboundp symb) (boundp symb) (facep symb))) (with-current-buffer (get-buffer-create "*Help*") ;; $$$$$$ (let ((help-xref-following t)) (help-xref-interned symb))) (help-xref-interned symb)) (when (fboundp 'fit-frame-if-one-window) (save-selected-window (select-window (get-buffer-window "*Help*" 'visible)) (fit-frame-if-one-window)))) ((fboundp symb) (describe-function symb)) ((boundp symb) (describe-variable symb)) ((facep symb) (describe-face symb)) ((assq symb (mapcar #'cdr icicle-command-abbrev-alist)) (let ((regexp (icicle-command-abbrev-regexp symb)) (sel-fr (selected-frame))) (unwind-protect (apropos-command regexp) (select-frame-set-input-focus sel-fr)))) ((symbol-plist symb) (apropos-describe-plist symb)) (t (setq symb (symbol-name symb)) ; Convert symbol to string, and try some more. (cond ((and (bufferp (get-buffer symb)) (with-current-buffer (get-buffer symb) (if (fboundp 'describe-buffer) ; Defined in `help-fns+.el', Emacs 23+. (describe-buffer) (describe-mode)) t))) ((or (icicle-file-remote-p symb) ; Don't let Tramp try to access it. (file-exists-p symb)) (icicle-describe-file symb current-prefix-arg 'NO-ERROR-P)) (t (icicle-msg-maybe-in-minibuffer "No help")))))) ;; This is the same as `describe-file' in `help-fns+.el', but we avoid requiring that library. ;; This is a top-level command, but we put it here to avoid library require cycles. (if (and (not (fboundp 'icicle-describe-file)) (fboundp 'describe-file)) (defalias 'icicle-describe-file (symbol-function 'describe-file)) (defun icicle-describe-file (filename &optional internal-form-p no-error-p) ; Suggestion: bind to `C-h M-f'. "Describe the file named FILENAME. If FILENAME is nil, describe current directory (`default-directory'). Starting with Emacs 22, if the file is an image file then: * Show a thumbnail of the image as well. * If you have command-line tool `exiftool' installed and in your `$PATH' or `exec-path', then show EXIF data (metadata) about the image. See standard Emacs library `image-dired.el' for more information about `exiftool'. If FILENAME is the name of an autofile bookmark and you use library `Bookmark+', then show also the bookmark information (tags etc.). In this case, a prefix arg shows the internal form of the bookmark. In Lisp code: Non-nil optional arg INTERNAL-FORM-P shows the internal form. Non-nil optional arg NO-ERROR-P prints an error message but does not raise an error." (interactive "FDescribe file: \nP") (unless filename (setq filename default-directory)) (help-setup-xref `(icicle-describe-file ,filename ,internal-form-p ,no-error-p) (interactive-p)) (let ((attrs (file-attributes filename)) ;; Functions `bmkp-*' are defined in `bookmark+.el'. (bmk (and (fboundp 'bmkp-get-autofile-bookmark) (bmkp-get-autofile-bookmark filename)))) (if (not attrs) (if no-error-p (message "Cannot open file `%s'" filename) (error "Cannot open file `%s'" filename)) (let* ((type (nth 0 attrs)) (numlinks (nth 1 attrs)) (uid (nth 2 attrs)) (gid (nth 3 attrs)) (last-access (nth 4 attrs)) (last-mod (nth 5 attrs)) (last-status-chg (nth 6 attrs)) (size (nth 7 attrs)) (permissions (nth 8 attrs)) ;; Skip 9: t iff file's gid would change if file were deleted and recreated. (inode (nth 10 attrs)) (device (nth 11 attrs)) (thumb-string (and (fboundp 'image-file-name-regexp) ; In `image-file.el' (Emacs 22+). (icicle-string-match-p (image-file-name-regexp) filename) (if (fboundp 'display-graphic-p) (display-graphic-p) window-system) (require 'image-dired nil t) (image-dired-get-thumbnail-image filename) (apply #'propertize "XXXX" `(display ,(append (image-dired-get-thumbnail-image filename) '(:margin 10)) rear-nonsticky (display) mouse-face highlight follow-link t help-echo "`mouse-2' or `RET': Show full image" keymap (keymap (mouse-2 . (lambda (e) (interactive "e") (find-file ,filename))) (13 . (lambda () (interactive) (find-file ,filename)))))))) (image-info (and (require 'image-dired nil t) (fboundp 'image-file-name-regexp) (icicle-string-match-p (image-file-name-regexp) filename) (progn (message "Gathering image data...") t) (icicle-condition-case-no-debug nil (let ((all (icicle-all-exif-data (expand-file-name filename)))) (concat (and all (not (zerop (length all))) (format "\nImage Data (EXIF)\n-----------------\n%s" all)))) (error nil)))) (help-text (concat (format "`%s'\n%s\n\n" filename (make-string (+ 2 (length filename)) ?-)) (format "File Type: %s\n" (cond ((eq t type) "Directory") ((stringp type) (format "Symbolic link to `%s'" type)) (t "Normal file"))) (format "Permissions: %s\n" permissions) (and (not (eq t type)) (format "Size in bytes: %g\n" size)) (format-time-string "Time of last access: %a %b %e %T %Y (%Z)\n" last-access) (format-time-string "Time of last modification: %a %b %e %T %Y (%Z)\n" last-mod) (format-time-string "Time of last status change: %a %b %e %T %Y (%Z)\n" last-status-chg) (format "Number of links: %d\n" numlinks) (format "User ID (UID): %s\n" uid) (format "Group ID (GID): %s\n" gid) (format "Inode: %S\n" inode) (format "Device number: %s\n" device) image-info))) (with-output-to-temp-buffer "*Help*" (when bmk (if internal-form-p (let* ((bname (bookmark-name-from-full-record bmk)) (bmk-defn (format "Bookmark `%s'\n%s\n\n%s" bname (make-string (+ 11 (length bname)) ?-) (pp-to-string bmk)))) (princ bmk-defn) (terpri) (terpri)) (princ (bmkp-bookmark-description bmk 'NO-IMAGE)) (terpri) (terpri))) (princ help-text)) (when thumb-string (with-current-buffer "*Help*" (save-excursion (goto-char (point-min)) (let ((buffer-read-only nil)) (when (re-search-forward "Device number:.+\n" nil t) (insert thumb-string)))))) help-text))))) ; Return displayed text. ;; This is the same as `help-all-exif-data' in `help-fns+.el', but we avoid requiring that library. (defun icicle-all-exif-data (file) "Return all EXIF data from FILE, using command-line tool `exiftool'." (with-temp-buffer (delete-region (point-min) (point-max)) (unless (eq 0 (call-process shell-file-name nil t nil shell-command-switch (format "exiftool -All \"%s\"" file))) (error "Could not get EXIF data for image")) (buffer-substring (point-min) (point-max)))) (defun icicle-candidate-read-fn-invoke () ; Bound to `M-return' in minibuffer. "Read function name. Invoke function on current completion candidate. Set `icicle-candidate-action-fn' to the interned name. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-read-fn-invoke]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) ;; If no last candidate, then reset to first candidate matching input. (unless (stringp icicle-last-completion-candidate) (setq icicle-last-completion-candidate icicle-current-input last-command 'icicle-candidate-action) (let ((icicle-help-in-mode-line-delay 0)) ; Avoid delay for candidate help. (icicle-next-candidate 1 (if (eq icicle-current-completion-mode 'prefix) 'icicle-prefix-candidates 'icicle-apropos-candidates) (not (eq icicle-current-completion-mode 'prefix))))) (let ((icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t) (icicle-must-pass-after-match-predicate (lambda (s) (functionp (intern s)))) (icicle-saved-completion-candidate icicle-last-completion-candidate) (icicle-candidate-action-fn 'icicle-apply-to-saved-candidate)) (icicle-apply-to-saved-candidate (completing-read (format "Function to apply to `%s': " icicle-saved-completion-candidate) obarray)))) (defun icicle-mouse-candidate-read-fn-invoke (event) ; Bound to `M-mouse-2' in `*Completions*'. "Read function name. Invoke function on candidate clicked by mouse." (interactive "e") (run-hooks 'mouse-leave-buffer-hook) ; Give temp modes such as isearch a chance to turn off. (let (;;$$$$$$ (buffer (window-buffer)) (posn-win (posn-window (event-start event))) (posn-col (car (posn-col-row (event-start event)))) (posn-row (cdr (posn-col-row (event-start event)))) choice base-size) ;; (read-event) ; Swallow mouse up event. $$ Not needed if bound to up event. (with-current-buffer (window-buffer posn-win) (save-excursion ;; $$$$$$ (when completion-reference-buffer (setq buffer completion-reference-buffer)) (setq base-size completion-base-size) (goto-char (posn-point (event-start event))) (let (beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max)) choice (buffer-substring-no-properties beg end))))) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos (posn-point (event-start event))) icicle-last-completion-candidate choice) (let ((icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t) (icicle-must-pass-after-match-predicate (lambda (s) (functionp (intern s)))) (icicle-saved-completion-candidate icicle-last-completion-candidate) (icicle-candidate-action-fn 'icicle-apply-to-saved-candidate)) (icicle-apply-to-saved-candidate (completing-read (format "Function to apply to `%s': " icicle-saved-completion-candidate) obarray))))) (defun icicle-apply-to-saved-candidate (function &optional use-icicle-candidates-alist-p type) "Apply FUNCTION to `icicle-saved-completion-candidate'. If `current-prefix-arg' is non-nil, then pretty-print the result using `icicle-pp-eval-expression'. The string FUNCTION is read to obtain the real function to apply. If optional arg USE-ICICLE-CANDIDATES-ALIST-P is non-nil, then try to get the real function using `icicle-get-alist-candidate-function'. If that returns nil, then read string FUNCTION. Optional arg TYPE is the type of object that FUNCTION applies to." (let ((real-fn (or (and use-icicle-candidates-alist-p (cdr (funcall icicle-get-alist-candidate-function function 'no-error-no-msg))) (car (read-from-string function)))) (real-obj (if (equal type "buffer") ; $$$$$$$ Eventually, perhaps look up TYPE in a list etc. (get-buffer icicle-saved-completion-candidate) icicle-saved-completion-candidate))) ;; Actually, we should test more than `functionp', to rule out macros and special forms. (unless (functionp real-fn) (error "Not a function: `%S'" real-fn)) (icicle-condition-case-no-debug icicle-apply-to-saved-candidate (if current-prefix-arg (icicle-pp-eval-expression '(funcall real-fn real-obj)) (funcall real-fn real-obj) (when (and (not icicle-all-candidates-action) (current-message)) (sit-for 3))) ; In case the function displays a message. (error (message "ERROR invoking `%S' on `%s': %s" real-fn icicle-saved-completion-candidate (error-message-string icicle-apply-to-saved-candidate)) (sleep-for 6))) (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) (icicle-raise-Completions-frame))) (defun icicle-raise-Completions-frame (&optional mouse-col mouse-row) "Raise `*Completions*' frame, if displayed. This helps keep `*Completions*' on top. If `icicle-move-Completions-frame' is non-nil and `*Completions*' is in its own frame, then move that frame to the display edge, out of the way. Non-nil optional args MOUSE-COL and MOUSE-ROW move the mouse pointer to column MOUSE-COL and row MOUSE-ROW. Do this because `icicle-candidate-action-fn' can call `select-frame-set-input-focus', which can position mouse pointer on a standalone minibuffer frame." ;; Raise `*Completions*' frame, if displayed. This helps keep `*Completions*' on top. (let ((compl-win (get-buffer-window "*Completions*" 'visible))) (when compl-win (save-window-excursion (select-window compl-win) ;; Move frame to the right, out of the way. (when (and (one-window-p t) icicle-move-Completions-frame) (modify-frame-parameters (selected-frame) ; Hard-code 7 here - what does it depend on? (if (eq icicle-move-Completions-frame 'left) '((left . 0)) `((left . ,(- (x-display-pixel-width) (+ (frame-pixel-width) 7)))))) (raise-frame) (when (and (integerp mouse-col) (integerp mouse-row)) (set-mouse-position (selected-frame) mouse-col mouse-row))))))) (defun icicle-Completions-mouse-3-menu (event) ; Bound to `C-mouse-3' in `*Completions*'. "Pop-up menu on `C-mouse-3' for the current candidate in `*Completions*'." (interactive "e") (run-hooks 'mouse-leave-buffer-hook) ; Give temp modes such as isearch a chance to turn off. (let (;; $$$$$$ (buffer (window-buffer)) (posn-win (posn-window (event-start event))) (posn-col (car (posn-col-row (event-start event)))) (posn-row (cdr (posn-col-row (event-start event)))) candidate base-size) ;; (read-event) ; Swallow mouse up event. $$ Not needed if bound to up event. (with-current-buffer (window-buffer posn-win) (save-excursion ;; $$$$$$ (when completion-reference-buffer (setq buffer completion-reference-buffer)) (setq base-size completion-base-size) (goto-char (posn-point (event-start event))) (let (beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max)) candidate (buffer-substring-no-properties beg end))))) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos (posn-point (event-start event))) icicle-last-completion-candidate candidate) (let* ((menus `((keymap "Completion" ,@(icicle-substitute-keymap-vars icicle-Completions-mouse-3-menu-entries)))) (choice (x-popup-menu event menus))) (icicle-Completions-popup-choice menus choice)))) (defun icicle-substitute-keymap-vars (menu-entries) "In MENU-ENTRIES, replace keymap vars by their values." (let ((new ())) (dolist (jj menu-entries) (cond ((and (symbolp jj) (boundp 'jj) (keymapp (symbol-value jj))) ; Just a keymap var. (setq jj (symbol-value jj)) (dolist (ii jj) (push ii new))) ;; (SYMBOL menu-item NAME MENU-KEYMAP . KEYWORDS), with a keymap var. ((and (consp jj) (symbolp (car jj)) (eq 'menu-item (cadr jj)) (stringp (car (cddr jj))) (symbolp (car (cdr (cddr jj)))) (not (commandp (car (cdr (cddr jj))))) (boundp (car (cdr (cddr jj)))) (keymapp (symbol-value (car (cdr (cddr jj)))))) (setq jj `(,(car jj) menu-item ,(car (cddr jj)) ,(symbol-value (car (cdr (cddr jj)))) ; Replace keymap var by its value. ,@(cdr (cdr (cddr jj))))) ; Keywords. (push jj new)) ((and (consp jj) (symbolp (car jj)) (stringp (cadr jj)) ; (SYMBOL NAME . MENU-KEYMAP) (symbolp (cddr jj)) (boundp (cddr jj)) (keymapp (symbol-value (cddr jj)))) (setq jj `(,(car jj) ,(cadr jj) ,@(symbol-value (cddr jj)))) ; Replace keymap var by val. (push jj new)) (t (push jj new)))) (nreverse new))) ;; This is the same as `mouse3-region-popup-choice' in `mouse3.el'. (if (require 'mouse3 nil t) (defalias 'icicle-Completions-popup-choice 'mouse3-region-popup-choice) (defun icicle-Completions-popup-choice (menus choice) "Invoke the command from MENUS that is represented by user's CHOICE. MENUS is a list that is acceptable as the second argument for `x-popup-menu'. That is, it is one of the following, where MENU-TITLE is the menu title and PANE-TITLE is a submenu title. * a keymap - MENU-TITLE is its `keymap-prompt' * a list of keymaps - MENU-TITLE is the first keymap's `keymap-prompt' * a menu of multiple panes, which has this form: (MENU-TITLE PANE...), where each PANE has this form: (PANE-TITLE ITEM...), where each ITEM has one of these forms: - STRING - an unselectable menu item - (STRING . COMMAND) - a selectable item that invokes COMMAND" (catch 'icicle-Completions-popup-choice (icicle-Completions-popup-choice-1 menus choice)))) ;; This is the same as `mouse3-region-popup-choice-1' in `mouse3.el'. (if (require 'mouse3 nil t) (defalias 'icicle-Completions-popup-choice-1 'mouse3-region-popup-choice-1) (defun icicle-Completions-popup-choice-1 (menus choice) "Helper function for `icicle-Completions-popup-choice'." (cond((keymapp menus) ;; Look up each ITEM-LIST entry in keymap MENUS. ;; If what is found is a keymap, use that as MENUS for next iteration. ;; If what is found is a command, invoke it (done). (let (binding) (while choice (setq binding (lookup-key menus (vector (car choice)))) (cond ((keymapp binding) (setq menus binding choice (cdr choice))) ((commandp binding) ;; You get only one. (throw 'icicle-Completions-popup-choice (call-interactively binding))) (t (error "`icicle-Completions-popup-choice', binding: %s" binding)))))) ((consp menus) ; A list of keymaps or panes. (dolist (menu menus) (if (keymapp menu) (icicle-Completions-popup-choice-1 menu choice) (when choice ; MENU is a pane. (throw 'icicle-Completions-popup-choice (call-interactively choice))))))))) (put 'icicle-widen-candidates 'icicle-completing-command t) (put 'icicle-widen-candidates 'icicle-apropos-completing-command t) (defun icicle-widen-candidates () ; Bound to `M-+' in minibuffer. "Complete, allowing also candidates that match an alternative regexp. You are prompted for the alternative input pattern. Use `RET' to enter it. To (apropos) complete using a wider set of candidates, you use this command after you have completed (`TAB' or `S-TAB'). A shortcut is to use `\\\\[icicle-apropos-complete-and-widen]' - \ it is the same as `S-TAB' followed by `\\[icicle-widen-candidates]'." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (unless icicle-completion-candidates (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) (let* ((raw-input (icicle-minibuf-input-sans-dir icicle-current-raw-input)) (enable-recursive-minibuffers t) (new-regexp (icicle-read-string "Or match alternative (use RET): " nil regexp-history))) (setq icicle-current-raw-input (concat (if (< emacs-major-version 22) "\\(" "\\(?:") raw-input "\\|" new-regexp "\\)"))) (icicle-clear-minibuffer) (insert icicle-current-raw-input) (let ((icicle-edit-update-p t) (icicle-expand-input-to-common-match 2)) ; Only explicit `TAB' or `S-TAB' or sole match. (icicle-apropos-complete))) (put 'icicle-narrow-candidates 'icicle-completing-command t) (put 'icicle-narrow-candidates 'icicle-apropos-completing-command t) (defun icicle-narrow-candidates () ; Bound to `M-*' in minibuffer. "Narrow the set of completion candidates using another input regexp. This, in effect, performs a set intersection operation on 1) the set of candidates in effect before the operation and 2) the set of candidates that match the current input. You can repeatedly use this command to continue intersecting candidate sets, progressively narrowing the set of matches. You can use this command only from the minibuffer (`\\\ \\[icicle-narrow-candidates]')." ;; We handle `no-catch' errors here because `icicle-ORIG-completing-read' and ;; `icicle-ORIG-read-file-file-name' can still be called in Icicle mode by, for instance, an ;; `interactive' spec (e.g. (interactive "bBuffer: ")). In that case, we throw to a ;; non-existant catch. After doing that, we just insert the result, to pass it to the ;; next-higher recursive minibuffer. (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (setq icicle-current-completion-mode 'apropos) (let (;; Restore match function, in case it was bound to nil, e.g., by `C-h C-o'. (icicle-apropos-complete-match-fn icicle-last-apropos-complete-match-fn) (icicle-progressive-completing-p t) ; Inhibit completion by `icicle-minibuffer-setup'. (enable-recursive-minibuffers t)) (cond ((and icicle-completion-candidates (null (cdr icicle-completion-candidates))) (if (not (and icicle-top-level-when-sole-completion-flag (sit-for icicle-top-level-when-sole-completion-delay))) (minibuffer-message " [Sole completion]") (set minibuffer-history-variable (cons (car icicle-completion-candidates) (symbol-value minibuffer-history-variable))) ;; $$$$$$ Should this use `icicle-current-input' instead of ;; (car icicle-completion-candidates), for PCM? (icicle-condition-case-no-debug i-narrow-candidates (throw 'icicle-read-top (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member (car icicle-completion-candidates) icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (expand-file-name (car icicle-completion-candidates)) (car icicle-completion-candidates))) (no-catch (setq icicle-current-input (car icicle-completion-candidates)) (icicle-retrieve-last-input) icicle-current-input) (error (message "%s" (error-message-string i-narrow-candidates)))))) (t (let* ((minibuffer-setup-hook (cons ; Make sure new minibuffer is completion reference buf. (lambda () (with-current-buffer (get-buffer-create "*Completions*") (set (make-local-variable 'completion-reference-buffer) (window-buffer (active-minibuffer-window))))) minibuffer-setup-hook)) (icicle-cands-to-narrow icicle-completion-candidates) (icicle-narrow-regexp (and icicle-compute-narrowing-regexp-p ;; (regexp-opt ()) returns nil in older Emacs versions. icicle-cands-to-narrow (regexp-opt icicle-cands-to-narrow))) ;; Handle all Emacs versions the same way for file-name completion. We can do that ;; because we use `icicle-must-pass-predicate', so we do not depend on `read-file-name' ;; needing a PREDICATE arg. ;; ;; The choice between `icicle-must-pass-predicate' and ;; `icicle-must-pass-after-match-predicate' could be per-command, by binding a variable. ;; Without such a conditional choice, the former is better, because matching can be ;; complex (costly). (result (cond ((icicle-file-name-input-p) (let ((icicle-must-pass-predicate `(lambda (c) (member c ',icicle-cands-to-narrow)))) (read-file-name "Match also (regexp): " (icicle-file-name-directory-w-default icicle-current-input) nil icicle-require-match-p))) ((functionp minibuffer-completion-table) (let ((icicle-must-pass-predicate `(lambda (c) (member c ',icicle-cands-to-narrow)))) (completing-read "Match also (regexp): " minibuffer-completion-table nil icicle-require-match-p nil minibuffer-history-variable))) (t ; cons, obarray, etc. (completing-read "Match also (regexp): " (if icicle-whole-candidate-as-text-prop-p (mapcar (lambda (cand) (funcall icicle-get-alist-candidate-function (car cand))) (icicle-filter-alist minibuffer-completion-table icicle-completion-candidates)) (mapcar #'list icicle-completion-candidates)) nil icicle-require-match-p nil minibuffer-history-variable))))) ;; Normally, `icicle-narrow-candidates' is called from the minibuffer. ;; If not, just return the result read. (if (> (minibuffer-depth) 0) (icicle-condition-case-no-debug i-narrow-candidates (throw 'icicle-read-top result) (no-catch (setq icicle-current-input result) (icicle-retrieve-last-input) icicle-current-input) (error (message "%s" (error-message-string i-narrow-candidates)))) result)))))) (put 'icicle-apropos-complete-and-widen 'icicle-completing-command t) (put 'icicle-apropos-complete-and-widen 'icicle-apropos-completing-command t) (defun icicle-apropos-complete-and-widen () ; Bound to `S-backspace' in minibuffer. "Apropos complete, then `icicle-widen-candidates'. You must enter the new, alternative input pattern using `RET'. You can use this command only from the minibuffer (`\\\ \\[icicle-apropos-complete-and-widen]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) ;; $$$$$ (let ((icicle-top-level-when-sole-completion-flag t)) (when (and (eq icicle-current-completion-mode 'prefix) (eq (icicle-current-TAB-method) 'basic) icicle-last-input) (let ((icicle-incremental-completion-p nil) (regexp-quoted-input (regexp-quote icicle-last-input))) (setq regexp-quoted-input (if (icicle-file-name-input-p) (concat (icicle-file-name-directory regexp-quoted-input) "^" (file-name-nondirectory regexp-quoted-input)) (concat "^" regexp-quoted-input))) (icicle-erase-minibuffer) (insert regexp-quoted-input))) (if (eq icicle-last-completion-command 'icicle-apropos-complete-no-display) (icicle-apropos-complete-no-display) (icicle-apropos-complete)) (icicle-widen-candidates)) (put 'icicle-apropos-complete-and-narrow 'icicle-completing-command t) (put 'icicle-apropos-complete-and-narrow 'icicle-apropos-completing-command t) (defun icicle-apropos-complete-and-narrow () ; Bound to `S-SPC' in minibuffer. "Apropos complete, then `icicle-narrow-candidates'. You can use this command only from the minibuffer (`\\\ \\[icicle-apropos-complete-and-narrow]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) ;; $$$$$ (let ((icicle-top-level-when-sole-completion-flag t)) (when (and (eq icicle-current-completion-mode 'prefix) (eq (icicle-current-TAB-method) 'basic) icicle-last-input) (let ((icicle-incremental-completion-p nil) (regexp-quoted-input (regexp-quote icicle-last-input))) (setq regexp-quoted-input (if (icicle-file-name-input-p) (concat (icicle-file-name-directory regexp-quoted-input) "^" (file-name-nondirectory regexp-quoted-input)) (concat "^" regexp-quoted-input))) (icicle-erase-minibuffer) (insert regexp-quoted-input))) (setq icicle-next-apropos-complete-cycles-p nil) (if (eq icicle-last-completion-command 'icicle-apropos-complete-no-display) (icicle-apropos-complete-no-display) (icicle-apropos-complete)) (icicle-narrow-candidates)) (defun icicle-narrow-candidates-with-predicate (&optional predicate) ; Bound to `M-&' in minibuffer. "Narrow the set of completion candidates by applying a predicate. You can repeatedly use this command to apply additional predicates, progressively narrowing the set of candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-narrow-candidates-with-predicate]'). When called from Lisp with non-nil arg PREDICATE, use that to narrow." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (let (;; Restore match function, in case it was bound to nil, e.g., by `C-h C-o'. (icicle-apropos-complete-match-fn icicle-last-apropos-complete-match-fn) (icicle-progressive-completing-p t) ; Inhibit completion by `icicle-minibuffer-setup'. (last-completion-cmd (or icicle-last-completion-command 'icicle-apropos-complete)) (enable-recursive-minibuffers t)) (cond ((null icicle-completion-candidates) (icicle-user-error "No completion candidates. Did you use `TAB' or `S-TAB'?")) ((null (cdr icicle-completion-candidates)) (if (not (and icicle-top-level-when-sole-completion-flag (sit-for icicle-top-level-when-sole-completion-delay))) (minibuffer-message " [Sole completion]") (set minibuffer-history-variable (cons (car icicle-completion-candidates) (symbol-value minibuffer-history-variable))) ;; $$$$$$ Should this now use `icicle-current-input' ;; instead of (car icicle-completion-candidates), for PCM? (icicle-condition-case-no-debug i-narrow-candidates (throw 'icicle-read-top (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member (car icicle-completion-candidates) icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (expand-file-name (car icicle-completion-candidates)) (car icicle-completion-candidates))) (no-catch (setq icicle-current-input (car icicle-completion-candidates)) (icicle-retrieve-last-input) icicle-current-input) (error (message "%s" (error-message-string i-narrow-candidates)))))) (t ; Read new predicate and incorporate it. (let ((pred (or predicate (icicle-read-from-minibuf-nil-default "Additional predicate to apply: " nil read-expression-map t (if (boundp 'function-name-history) 'function-name-history 'icicle-function-name-history))))) ;; Update `minibuffer-completion-predicate' or `read-file-name-predicate' to also use new ;; predicate, PRED. The logic here is like that for `icicle-remove-cand-from-lists'. (cond (;; File name input, Emacs 22+. ;; Update `read-file-name-predicate' if prior to Emacs 23.2. ;; Else update `minibuffer-completion-predicate'. (and (icicle-file-name-input-p) (> emacs-major-version 21)) (let ((var (if (or (> emacs-major-version 23) (and (= emacs-major-version 23) (> emacs-minor-version 1))) 'minibuffer-completion-predicate 'read-file-name-predicate))) (set var (if (symbol-value var) (lexical-let ((curr-pred (symbol-value var))) `(lambda (file-cand) (and (funcall ',curr-pred file-cand) (funcall ',pred file-cand)))) pred)))) ;; File name input, Emacs 20 or 21. We cannot do anything for file names. ;; `TAB' or `S-TAB' will unfortunately bring it back as a candidate. ((icicle-file-name-input-p)) ;; Non-file name input, all versions. Update `minibuffer-completion-predicate'. (t (setq minibuffer-completion-predicate (if minibuffer-completion-predicate ;; Add PRED to the existing predicate. (lexical-let ((curr-pred minibuffer-completion-predicate)) `(lambda (cand) (and (funcall ',curr-pred cand) (funcall ',pred cand)))) ;; Set predicate to PRED. pred))))))) (funcall last-completion-cmd))) (defun icicle-save-predicate-to-variable (askp) ; Bound to `C-M-&' in minibuffer. "Save the current completion predicate to a variable. By default, the variable is `icicle-input-string'. If you use a prefix argument, then you are prompted for the variable to use. You can retrieve the saved predicate as a string using `\\\ \\[icicle-insert-string-from-variable]'. You can use this command only from the minibuffer (`\\\ \\[icicle-save-predicate-to-variable]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (let* ((pred minibuffer-completion-predicate) (icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t) (icicle-must-pass-after-match-predicate (lambda (s) (boundp (intern s)))) (var (if askp (intern (completing-read "Save candidates in variable: " obarray nil nil nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history))) 'icicle-input-string))) (set var (prin1-to-string pred)) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message (format " [Predicate SAVED to `%s']" var))))) (defun icicle-completing-read+insert () ; Bound to `C-M-S-c' (`C-M-C') in minibuffer. "Read something with completion, and insert it. Be sure to bind `icicle-completing-read+insert-candidates' to the set of candidates. Option `icicle-completing-read+insert-keys' controls which keys are bound to this command. Return the string that was inserted." (interactive) (if icicle-completing-read+insert-candidates (let ((enable-recursive-minibuffers t) (use-dialog-box nil) (result (icicle-completing-read "Choose: " icicle-completing-read+insert-candidates))) (insert result) result) (icicle-msg-maybe-in-minibuffer "On-demand completion not available"))) (defun icicle-read+insert-file-name (dir-too-p) ; Bound to `C-M-S-f' (`C-M-F') in minibuffer. "Read a file name and insert it, without its directory, by default. With a prefix argument, insert its directory also. Option `icicle-read+insert-file-name-keys' controls which keys are bound to this command. Return the string that was inserted." (interactive "P") (let ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) (enable-recursive-minibuffers t) (use-dialog-box nil) (minibuffer-local-completion-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-completion-map) (define-key map (icicle-kbd "C-backspace") 'icicle-up-directory) ; `C-backspace' (define-key map (icicle-kbd "C-c +") 'icicle-make-directory) ; `C-c +' map)) (minibuffer-local-must-match-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-must-match-map) (define-key map (icicle-kbd "C-backspace") 'icicle-up-directory) (define-key map (icicle-kbd "C-c +") 'icicle-make-directory) map)) (icicle-must-pass-after-match-predicate nil) result) (setq result (icicle-read-file-name "Choose file: ")) (unless dir-too-p ; Remove parent dir. (setq result (if (file-directory-p result) (file-name-as-directory (file-name-nondirectory (directory-file-name result))) (file-name-nondirectory result)))) (insert result) result)) (defun icicle-bind-buffer-candidate-keys () ; Use in first code of buffer-candidate commands. "Bind specific keys for acting on the current buffer-name candidate. The bindings made are those defined by option `icicle-buffer-candidate-key-bindings'." (dolist (map (list minibuffer-local-completion-map minibuffer-local-must-match-map)) (dolist (entry icicle-buffer-candidate-key-bindings) (when (car (cddr entry)) (define-key map (car entry) (cadr entry)))))) (defun icicle-unbind-buffer-candidate-keys () ; Use in last code of buffer-candidate commands. "Unbind specific keys for acting on the current buffer-name candidate. The bindings removed are those defined by option `icicle-buffer-candidate-key-bindings'." (dolist (map (list minibuffer-local-completion-map minibuffer-local-must-match-map)) (dolist (entry icicle-buffer-candidate-key-bindings) (define-key map (car entry) (cadr entry))))) ;; `minibuffer-local-filename-completion-map' and `minibuffer-local-must-match-filename-map' ;; were introduced in Emacs 22, and they inherit from `minibuffer-local-completion' and ;; `minibuffer-local-must-match-map', respectively. For Emacs 23.1, ;; `minibuffer-local-must-match-filename-map' is an alias for ;; `minibuffer-local-filename-must-match-map'. But for Emacs 23.2, there is no such alias! ;; And for Emacs 24+, there is no longer a `minibuffer-local-filename-must-match-map', and file-name maps ;; are merged with either `minibuffer-local-completion-map' or `minibuffer-local-must-match-map'. ;; ;; We add the bindings for absolute file-name completion also. It uses only ;; `minibuffer-local-completion-map' or `minibuffer-local-must-match-map'. ;; (defun icicle-bind-file-candidate-keys () "Bind specific keys for acting on the current file-name candidate." (let ((maps (delq nil (list minibuffer-local-completion-map minibuffer-local-must-match-map (and (< emacs-major-version 24) (boundp 'minibuffer-local-filename-completion-map) (not (eq minibuffer-local-completion-map (keymap-parent minibuffer-local-filename-completion-map))) minibuffer-local-filename-completion-map) (and (< emacs-major-version 24) (boundp 'minibuffer-local-filename-must-match-map) (not (eq minibuffer-local-must-match-map (keymap-parent minibuffer-local-filename-must-match-map))) minibuffer-local-filename-must-match-map) (and (< emacs-major-version 24) (boundp 'minibuffer-local-must-match-filename-map) (not (eq minibuffer-local-must-match-map (keymap-parent minibuffer-local-must-match-filename-map))) minibuffer-local-must-match-filename-map))))) (dolist (map maps) (define-key map (icicle-kbd "C-backspace") 'icicle-up-directory) ; `C-backspace' (define-key map (icicle-kbd "C-c +") 'icicle-make-directory) ; `C-c +' (when (require 'bookmark+ nil t) (define-key map (icicle-kbd "C-x m") 'icicle-bookmark-file-other-window) ; `C-x m' (define-key map (icicle-kbd "C-x a +") (icicle-autofile-action 'add)) ; `C-x a +' (define-key map (icicle-kbd "C-x a -") (icicle-autofile-action 'remove)) ; `C-x a -' (define-key map (icicle-kbd "C-x a a") (icicle-autofile-action 'create/set)) ; `C-x a a' (define-key map (icicle-kbd "C-x C-t *") 'icicle-file-all-tags-narrow) ; `C-x C-t *' (define-key map (icicle-kbd "C-x C-t +") 'icicle-file-some-tags-narrow) ; `C-x C-t +' (define-key map (icicle-kbd "C-x C-t % *") 'icicle-file-all-tags-regexp-narrow) ; `C-x C-t % *' (define-key map (icicle-kbd "C-x C-t % +") 'icicle-file-some-tags-regexp-narrow))))) ; `C-x C-t % +' (defun icicle-unbind-file-candidate-keys () "Unbind specific keys for acting on the current file-name candidate." (let ((maps (delq nil (list minibuffer-local-completion-map minibuffer-local-must-match-map (and (< emacs-major-version 24) (boundp 'minibuffer-local-filename-completion-map) (not (eq minibuffer-local-completion-map (keymap-parent minibuffer-local-filename-completion-map))) minibuffer-local-filename-completion-map) (and (< emacs-major-version 24) (boundp 'minibuffer-local-filename-must-match-map) (not (eq minibuffer-local-must-match-map (keymap-parent minibuffer-local-filename-must-match-map))) minibuffer-local-filename-must-match-map) (and (< emacs-major-version 24) (boundp 'minibuffer-local-must-match-filename-map) (not (eq minibuffer-local-must-match-map (keymap-parent minibuffer-local-must-match-filename-map))) minibuffer-local-must-match-filename-map))))) (dolist (map maps) (define-key map (icicle-kbd "C-backspace") nil) (define-key map (icicle-kbd "C-c +") nil) (define-key map (icicle-kbd "C-x m") nil) (define-key map (icicle-kbd "C-x a") nil) ; Prefix (define-key map (icicle-kbd "C-x a +") nil) (define-key map (icicle-kbd "C-x a -") nil) (define-key map (icicle-kbd "C-x a a") nil) (define-key map (icicle-kbd "C-x C-t") nil) ; Prefix (define-key map (icicle-kbd "C-x C-t *") nil) (define-key map (icicle-kbd "C-x C-t +") nil) (define-key map (icicle-kbd "C-x C-t %") nil) ; Prefix (define-key map (icicle-kbd "C-x C-t % *") nil) (define-key map (icicle-kbd "C-x C-t % +") nil)))) (defun icicle-candidate-set-swap () ; Bound to `C-%' in minibuffer. "Swap the saved set and current sets of completion candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-swap]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (setq icicle-saved-completion-candidates (prog1 icicle-completion-candidates (setq icicle-completion-candidates icicle-saved-completion-candidates))) (minibuffer-message " [Saved set of candidates SWAPPED with current]")) (defun icicle-candidate-set-define () ; Bound to `C-:' in minibuffer. "Define the set of current completion candidates by evaluating a sexp. The Lisp sexp must evaluate to a list of strings, such as is returned by `all-completions'. You can use this command at top level or from the minibuffer (`\\\ \\[icicle-candidate-set-define]')." (interactive) (let* ((enable-recursive-minibuffers t) (evald-sexp (eval-minibuffer "Set the completion candidates to sexp (eval): "))) (when (and evald-sexp (or (atom evald-sexp) (not (stringp (car evald-sexp))))) (icicle-user-error "Sexp did not evaluate to a list of strings: %S" evald-sexp)) (setq icicle-completion-candidates evald-sexp)) (icicle-maybe-sort-and-strip-candidates) (message "List of completion candidates DEFINED: %S" icicle-completion-candidates) (when (> (minibuffer-depth) 0) (message "Displaying completion candidates...") (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates)) (icicle-narrow-candidates))) (defun icicle-candidate-set-difference () ; Bound to `C--' in minibuffer. "Take the set difference between the current and saved candidates. The new set of candidates is the set of candidates prior to executing this command minus the saved set of candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-difference]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (message "Computing set difference: current minus saved candidates...") (icicle-candidate-set-1 'icicle-set-difference " [saved set of candidates SUBTRACTED]")) (defun icicle-candidate-set-union () ; Bound to `C-+' in minibuffer. "Take the set union between the current and saved candidates. The new set of candidates is the union of the saved set of candidates and the set of candidates prior to executing this command. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-union]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (message "Computing set union: current plus saved candidates...") (icicle-candidate-set-1 'icicle-set-union " [saved set of candidates ADDED]")) (defun icicle-candidate-set-intersection () ; Bound to `C-*' in minibuffer. "Take the set intersection between the current and saved candidates. The new set of candidates is the intersection of the saved set of candidates and the set of candidates prior to executing this command. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-intersection]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (message "Computing set intersection: current and saved candidates...") (icicle-candidate-set-1 'icicle-set-intersection " [INTERSECTION of saved and current sets of candidates]")) (defun icicle-candidate-set-complement () ; Bound to `C-~' in minibuffer. "Complement the set of current completion candidates. The new set of candidates is the set of all candidates in the initial completion domain minus the set of matching candidates prior to executing this command - that is, all possible completions of the appropriate type, except for those that are in the current set of completions. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-complement]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (message "Complementing current set of candidates...") (let ((initial-cands (icicle-all-completions "" minibuffer-completion-table minibuffer-completion-predicate (and icicle-buffer-name-input-p ; Used only by Emacs < 23.2. icicle-buffer-ignore-space-prefix-flag)))) ;; Depending on the type of `minibuffer-completion-table', narrowing can read again with ;; `icicle-must-pass-predicate' bound, in which case we must here filter the display candidates ;; using that predicate. ;; ;; The choice between `icicle-must-pass-predicate' and ;; `icicle-must-pass-after-match-predicate' could be per-command, by binding a variable. ;; Without such a conditional choice, the former is better, because matching can be ;; complex (costly). ;; ;; This is essentially the same comment as the one in `icicle-narrow-candidates'. ;; If we change the code in one then we probably need to change it in the other. (when icicle-must-pass-predicate (setq initial-cands (remove-if-not icicle-must-pass-predicate initial-cands))) (setq icicle-completion-candidates (icicle-set-difference (if icicle-must-pass-after-match-predicate (icicle-remove-if-not icicle-must-pass-after-match-predicate initial-cands) initial-cands) icicle-completion-candidates))) (icicle-maybe-sort-and-strip-candidates) (message "Displaying completion candidates...") (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates)) (minibuffer-message " [Set of candidates COMPLEMENTED]") ;; This part of the code is similar to part of `icicle-candidate-set-retrieve-1'. (cond ((and (consp icicle-completion-candidates) (null (cdr icicle-completion-candidates))) ;; $$$$$$ Should this now use `icicle-current-input' ;; instead of (car icicle-completion-candidates), for PCM? (icicle-remove-Completions-window) (icicle-insert-completion (car icicle-completion-candidates)) ; Insert sole cand. (minibuffer-message " [Sole candidate restored]") (save-selected-window (select-window (minibuffer-window)) (icicle-highlight-complete-input)) (setq icicle-mode-line-help (car icicle-completion-candidates))) ((consp icicle-completion-candidates) (deactivate-mark) (icicle-display-candidates-in-Completions) (let ((icicle-minibuffer-setup-hook ; Pre-complete (cons (if (eq icicle-last-completion-command 'icicle-apropos-complete-no-display) 'icicle-apropos-complete-no-display 'icicle-apropos-complete) icicle-minibuffer-setup-hook))) (icicle-narrow-candidates))))) (defun icicle-candidate-set-truncate (n) ; Bound to `M-$' in minibuffer. "Trim the set of current completion candidates at the end. The first N candidates are kept. N is read." ;; Ugly hack: `icicle-saved-completion-candidates-internal'. No way to bind a variable ;; in `interactive' and have the binding be active in the function body. (interactive (list (let ((enable-recursive-minibuffers t)) (setq icicle-saved-completion-candidates-internal icicle-completion-candidates) (if current-prefix-arg (prefix-numeric-value current-prefix-arg) (read-number "Number of candidates to keep: "))))) (setq icicle-completion-candidates icicle-saved-completion-candidates-internal) (setcdr (nthcdr (1- n) icicle-completion-candidates) nil) (icicle-maybe-sort-and-strip-candidates) (message "Displaying completion candidates...") (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates)) (message (format " [Set of candidates TRUNCATED to %d]" n)) (icicle-narrow-candidates)) (defun icicle-candidate-set-retrieve (&optional arg) ; Bound to `C-M-<' in minibuffer. "Retrieve a saved set of completion candidates, making it current. This retrieves candidates saved with `\\\ \\[icicle-save/unsave-candidate]', `M-S-mouse-2', `\\\\[icicle-candidate-set-save]', \ `\\[icicle-candidate-set-save-to-variable]', or `\\[icicle-candidate-set-save-persistently]'. With no prefix arg, retrieve candidates from variable `icicle-saved-completion-candidates'. With a numeric prefix arg, retrieve candidates from another variable. With a plain prefix arg (`C-u'), retrieve candidates from a cache file or, if option `icicle-filesets-as-saved-completion-sets-flag' is non-nil, an Emacs fileset name (Emacs 22 or later). To use filesets, you must also load library `filesets' and use `(filesets-init)'. Completion is available when you are prompted for a cache file, fileset, or variable name. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-retrieve]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (icicle-candidate-set-retrieve-1 arg)) (defun icicle-candidate-set-retrieve-1 (arg &optional morep) "Helper function for `icicle-candidate-set-retrieve(-more)'. ARG is the same as the raw prefix arg for `icicle-candidate-set-retrieve'. MOREP non-nil means add the saved candidates, don't replace existing." (let ((name nil) (variablep (and arg (atom arg))) (curr-cands icicle-completion-candidates) saved-cands) (if arg (let ((icicle-whole-candidate-as-text-prop-p nil) (enable-recursive-minibuffers t)) (if variablep ;; Retrieve from a variable. Prompt user for the variable to use. (setq saved-cands (append (and morep curr-cands) (symbol-value (setq name (intern (completing-read ; Variable name. "Retrieve candidates from variable: " icicle-saved-candidates-variables-obarray nil nil nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history))))))) ;; Retrieve from a persistent set (and save to `icicle-saved-completion-candidates'). (setq name (completing-read "Retrieve candidates from persistent set: " (if (and icicle-filesets-as-saved-completion-sets-flag (featurep 'filesets) filesets-data) (append filesets-data icicle-saved-completion-sets) icicle-saved-completion-sets) nil nil nil 'icicle-completion-set-history)) (icicle-retrieve-candidates-from-set name) (setq saved-cands (append (and morep curr-cands) icicle-saved-completion-candidates)))) ;; Retrieve from the default variable, `icicle-saved-completion-candidates'. (setq saved-cands (append (and morep curr-cands) icicle-saved-completion-candidates))) ;; This part of the code is similar to part of `icicle-candidate-set-complement'. (cond ((null saved-cands) (deactivate-mark) (icicle-display-candidates-in-Completions) (message "No saved candidates to restore") (sit-for 2)) (t (setq icicle-completion-candidates ; Remove directories if completing file names (if (icicle-file-name-input-p) ; using `read-file-name'. (mapcar #'file-name-nondirectory saved-cands) saved-cands)) (cond ((and (consp icicle-completion-candidates) (null (cdr icicle-completion-candidates))) ;; $$$$$$ Should this now use `icicle-current-input' ;; instead of (car icicle-completion-candidates), for PCM? (icicle-remove-Completions-window) (icicle-insert-completion (car icicle-completion-candidates)) ; Insert sole cand. (minibuffer-message " [Sole candidate restored]") (save-selected-window (select-window (minibuffer-window)) (icicle-highlight-complete-input)) (setq icicle-mode-line-help (car icicle-completion-candidates))) ((consp icicle-completion-candidates) (deactivate-mark) (icicle-display-candidates-in-Completions) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message (if name (format " [Saved candidates RESTORED from %s `%s']" (if variablep "variable" "cache file") name) " [Saved candidates RESTORED]"))) (let ((icicle-minibuffer-setup-hook ; Pre-complete (cons (if (eq icicle-last-completion-command 'icicle-apropos-complete-no-display) 'icicle-apropos-complete-no-display 'icicle-apropos-complete) icicle-minibuffer-setup-hook))) (icicle-narrow-candidates)))))))) (defun icicle-candidate-set-retrieve-more (&optional arg) ; Bound to `C-<' in minibuffer. "Retrieve a saved set of completion candidates. The saved candidates are added to those already current. A prefix argument acts as for `icicle-candidate-set-retrieve'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-retrieve-more]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (icicle-candidate-set-retrieve-1 arg t)) (defun icicle-candidate-set-retrieve-from-variable () ; Bound to `C-M-{' in minibuffer. "Retrieve a saved set of completion candidates, making it current. This retrieves candidates saved with `\\\ \\[icicle-save/unsave-candidate]', `M-S-mouse-2', or `\\[icicle-candidate-set-save-to-variable]' (or `\\[icicle-candidate-set-save]' with a numeric \ prefix arg). You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-retrieve-from-variable]')." (interactive) (icicle-candidate-set-retrieve 99)) (defun icicle-candidate-set-retrieve-persistent () ; Bound to `C-{' in minibuffer. "Retrieve a saved set of completion candidates, making it current. This retrieves candidates saved with `\\\ \\[icicle-candidate-set-save-persistently]' or `C-u \\[icicle-candidate-set-save]'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-retrieve-persistent]')." (interactive) (icicle-candidate-set-retrieve '(1))) (defun icicle-retrieve-candidates-from-set (set-name) "Retrieve the saved set of completion candidates named SET-NAME. SET-NAME names an Icicles saved completion set or, if `icicle-filesets-as-saved-completion-sets-flag' is non-nil, an Emacs fileset. If that option is non-nil and SET-NAME names a saved completion set that contains Emacs filesets, then the files specified for the filesets are also retrieved. The candidates are retrieved to `icicle-saved-completion-candidates', and `icicle-candidates-alist' is updated." (setq icicle-saved-completion-candidates (icicle-get-candidates-from-saved-set set-name)) (when icicle-candidates-alist ; Redefine `icicle-candidates-alist'. (let ((icicle-whole-candidate-as-text-prop-p t)) (setq icicle-candidates-alist (mapcar icicle-get-alist-candidate-function icicle-saved-completion-candidates))))) (defun icicle-save/unsave-candidate () ; Bound to `insert' in minibuffer. "Add/remove current candidate to/from `icicle-saved-completion-candidates'. If the candidate is already saved, then unsave it; otherwise, save it. You can use this command only from the minibuffer (`\\\ \\[icicle-save/unsave-candidate]')." (interactive) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (if (not (wholenump icicle-candidate-nb)) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [No current candidate]")) (let ((cand (elt icicle-completion-candidates icicle-candidate-nb))) (cond ((member cand icicle-saved-completion-candidates) (setq icicle-saved-completion-candidates (delete icicle-last-completion-candidate icicle-saved-completion-candidates)) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [Candidate UNsaved]"))) (t (push cand icicle-saved-completion-candidates) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [Candidate SAVED]"))))))) (defun icicle-mouse-save/unsave-candidate (event) ; Bound to `M-S-mouse-2' in *Completions. "Add/remove clicked candidate to/from `icicle-saved-completion-candidates'. If the candidate is already saved, then unsave it; otherwise, save it." (interactive "e") (run-hooks 'mouse-leave-buffer-hook) ; Give temp modes such as isearch a chance to turn off. (let (;; $$$$$$ (buffer (window-buffer)) (posn-win (posn-window (event-start event))) (posn-col (car (posn-col-row (event-start event)))) (posn-row (cdr (posn-col-row (event-start event)))) choice base-size) (read-event) ; Swallow mouse up event. (with-current-buffer (window-buffer posn-win) (save-excursion ;; $$$$$$ (when completion-reference-buffer (setq buffer completion-reference-buffer)) (setq base-size completion-base-size) (goto-char (posn-point (event-start event))) (let (beg end) (when (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (unless beg (icicle-user-error "No completion here")) (setq beg (previous-single-property-change beg 'mouse-face) end (or (next-single-property-change end 'mouse-face) (point-max)) choice (buffer-substring-no-properties beg end))))) (setq icicle-candidate-nb (icicle-nb-of-cand-at-Completions-pos (posn-point (event-start event))) icicle-last-completion-candidate choice) (cond ((member icicle-last-completion-candidate icicle-saved-completion-candidates) (setq icicle-saved-completion-candidates (delete icicle-last-completion-candidate icicle-saved-completion-candidates)) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [Candidate UNsaved]"))) (t (push icicle-last-completion-candidate icicle-saved-completion-candidates) (save-selected-window (select-window (minibuffer-window)) (minibuffer-message " [Candidate SAVED]")))) (deactivate-mark) (icicle-display-candidates-in-Completions) (icicle-raise-Completions-frame posn-col posn-row))) (defun icicle-mouse-candidate-set-save (ignore &optional arg) ; `M-S-mouse-3' in `*Completions*'. "`icicle-candidate-set-save(-selected)'. If the region is active in `*Completions*', then `icicle-candidate-set-save-selected'. Otherwise, `icicle-candidate-set-save'." (interactive "e\nP") (if (and (get-buffer "*Completions*") (save-current-buffer (set-buffer (get-buffer "*Completions*")) (and mark-active (mark) (/= (point) (mark))))) (icicle-candidate-set-save-selected arg) (icicle-candidate-set-save arg))) (defun icicle-mouse-candidate-set-save-more (ignore &optional arg) ; `M-mouse-3' in `*Completions*'. "`icicle-candidate-set-save-more(-selected)'. If the region is active in `*Completions*', then `icicle-candidate-set-save-more-selected'. Otherwise, `icicle-candidate-set-save-more'." (interactive "e\nP") (if (and (get-buffer "*Completions*") (save-current-buffer (set-buffer (get-buffer "*Completions*")) (and mark-active (mark) (/= (point) (mark))))) (icicle-candidate-set-save-more-selected arg) (icicle-candidate-set-save-more arg))) ;;; `mouse-3' in `*Completions*'. (cond ((require 'mouse3 nil t) (defun icicle-mouse-save-then-kill (click &optional arg) "`mouse-save-then-kill', but click same place saves selected candidates." (interactive "e\nP") (let ((mouse3-save-then-kill-command `(lambda (event prefix-arg) (icicle-mouse-candidate-set-save-more nil ,arg)))) (mouse-save-then-kill click)) (setq this-command 'mouse-save-then-kill))) ((< emacs-major-version 24) (defun icicle-mouse-save-then-kill (click &optional arg) "`mouse-save-then-kill', but click same place saves selected candidates." (interactive "e\nP") (flet ((mouse-save-then-kill-delete-region (beg end) (icicle-mouse-candidate-set-save-more nil arg))) (mouse-save-then-kill click)) (setq this-command 'mouse-save-then-kill))) (t ;; The only thing Icicles-specific here is replacing killing or deleting the region by a call to ;; `icicle-mouse-candidate-set-save-more'. Otherwise, this is just `mouse-save-then-kill'. (defun icicle-mouse-save-then-kill (click &optional arg) ; `mouse-3' in `*Completions*'. "`mouse-save-then-kill', but click same place saves selected candidates." (interactive "e\nP") (mouse-minibuffer-check click) (let* ((posn (event-start click)) (click-pt (posn-point posn)) (window (posn-window posn)) (buf (window-buffer window)) (this-command this-command) ; Don't let subsequent kill cmd append to this one. ;; Check if the user has multi-clicked to select words/lines. (click-count (if (and (eq mouse-selection-click-count-buffer buf) (with-current-buffer buf (mark t))) mouse-selection-click-count 0))) (cond ((not (numberp click-pt)) nil) ((and (eq last-command 'icicle-mouse-save-then-kill) ; User clicked at same position. (eq click-pt mouse-save-then-kill-posn) (eq window (selected-window))) ;; Here is the Icicles difference from vanilla `mouse-save-then-kill'. ;; Instead of killing/deleting the region, save the selected candidates. (icicle-mouse-candidate-set-save-more nil arg) (setq mouse-selection-click-count 0 mouse-save-then-kill-posn nil)) ;; If there is a suitable region, adjust it by moving the closest end to CLICK-PT. ((or (with-current-buffer buf (region-active-p)) (and (eq window (selected-window)) (mark t) (or (and (eq last-command 'icicle-mouse-save-then-kill) mouse-save-then-kill-posn) (and (memq last-command '(mouse-drag-region mouse-set-region)) (or mark-even-if-inactive (not transient-mark-mode)))))) (select-window window) (let* ((range (mouse-start-end click-pt click-pt click-count))) (if (< (abs (- click-pt (mark t))) (abs (- click-pt (point)))) (set-mark (car range)) (goto-char (nth 1 range))) (setq deactivate-mark nil) (mouse-set-region-1) (when mouse-drag-copy-region ;; Previous region was copied to kill-ring, so replace with adjusted region. (kill-new (filter-buffer-substring (mark t) (point)) t)) (setq mouse-save-then-kill-posn click-pt))) ; Repeated `mouse-3' kills region. (t ; Set the mark where point is and move to CLICK-PT. (select-window window) (mouse-set-mark-fast click) (let ((before-scroll (with-current-buffer buf point-before-scroll))) (when before-scroll (goto-char before-scroll))) (exchange-point-and-mark) (mouse-set-region-1) (when mouse-drag-copy-region (kill-new (filter-buffer-substring (mark t) (point)))) (setq mouse-save-then-kill-posn click-pt))))))) (defun icicle-candidate-set-save (&optional arg) ; Bound to `C-M->' in minibuffer. "Save the set of current completion candidates, for later recall. Saves candidates in variable `icicle-saved-completion-candidates', by default. With a plain prefix arg (`C-u'), save candidates in a cache file. With a non-zero numeric prefix arg (`C-u N'), save candidates in a variable for which you are prompted. With a zero prefix arg (`C-0'), save candidates in a fileset (Emacs 22 or later). Use this only for file-name candidates, obviously. To subsequently use a fileset for candidate retrieval, option `icicle-filesets-as-saved-completion-sets-flag' must be non-nil. You can retrieve the saved set of candidates with `\\\ \\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (icicle-candidate-set-save-1 icicle-completion-candidates arg)) (defun icicle-candidate-set-save-more (&optional arg) ; Bound to `C->' in minibuffer. "Add current completion candidates to saved candidates set. The current candidates are added to those already saved. A prefix argument acts the same as for `icicle-candidate-set-save'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save-more]')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (icicle-candidate-set-save-1 icicle-completion-candidates arg t)) (defun icicle-candidate-set-save-selected (&optional arg) ; Bound to `C-M-)' in minibuffer. "`icicle-candidate-set-save', but only for the selected candidates. Candidates at least partially in the region are saved. A prefix argument acts the same as for `icicle-candidate-set-save'. As a special case, if no candidates are selected, then this empties the current set of saved candidates. That is, it UNsaves all saved candidates. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save-selected]')." (interactive "P") (icicle-candidate-set-save-selected-1 arg nil 'no-error)) (defun icicle-candidate-set-save-more-selected (&optional arg) ; Bound to `C-)' in minibuffer. "`icicle-candidate-set-save-more', but only for the selected candidates. Candidates at least partially in the region are added to those saved. A prefix argument acts the same as for `icicle-candidate-set-save'. You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save-more-selected]')." (interactive "P") (icicle-candidate-set-save-selected-1 arg t)) ;; $$$$$$$ Maybe should also allow rectangle selection. (defun icicle-candidate-set-save-selected-1 (arg &optional morep no-error-p) "Helper function for `icicle-candidate-set-save(-more)(-region)'." (when (or (get-buffer-window "*Completions*" 0) no-error-p) (let ((beg-cand-nb 0) (end-cand-nb 0) (candidates ()) (icicle-orig-buff (current-buffer))) (when (get-buffer-window "*Completions*" 0) ; Do nothing if not displayed. (with-current-buffer "*Completions*" (when (and mark-active (mark) (/= (point) (mark)) icicle-completion-candidates) (let ((bob (icicle-start-of-candidates-in-Completions)) (eob (point-max)) (beg (region-beginning)) (end (region-end)) temp) ;; Extend region ends to include all of first and last selected candidates. (unless (get-text-property beg 'mouse-face) (if (setq temp (next-single-property-change beg 'mouse-face)) (setq beg temp) (setq beg (next-single-property-change temp 'mouse-face)))) (when (> beg end) (icicle-user-error "No candidates selected")) ; Active region but none selected. (unless (get-text-property end 'mouse-face) (if (setq temp (previous-single-property-change end 'mouse-face)) (setq end temp) (setq end (previous-single-property-change temp 'mouse-face)))) (when (> beg end) (setq beg (prog1 end (setq end beg)))) ; Swap them. (while (and (>= beg bob) (get-text-property beg 'mouse-face)) (setq beg (1- beg))) (while (and (<= end eob) (get-text-property end 'mouse-face)) (setq end (1+ end))) (setq beg (1+ beg) end (1- end) beg-cand-nb (icicle-nb-of-cand-at-Completions-pos beg) end-cand-nb (icicle-nb-of-cand-at-Completions-pos end)) (when (> beg-cand-nb end-cand-nb) ; Swap them (setq beg-cand-nb (prog1 end-cand-nb (setq end-cand-nb beg-cand-nb)))) (while (<= beg-cand-nb end-cand-nb) (push (elt icicle-completion-candidates beg-cand-nb) candidates) (setq beg-cand-nb (1+ beg-cand-nb))))))) (when (and morep (null candidates)) (icicle-user-error "No candidates selected")) ; Need selection for MOREP. (setq candidates (nreverse candidates)) (icicle-candidate-set-save-1 candidates arg morep t no-error-p) (let ((win (get-buffer-window icicle-orig-buff 'visible))) (when win (select-window win)))))) ;;; Note: This can be called from the minibuffer or top level. ;;; It cannot make any assumptions about the selected window being the active minibuffer etc. ;;; (defun icicle-candidate-set-save-1 (new-cands arg &optional morep only-selected-p no-error-p) "Helper function for `icicle-candidate-set-save*' functions. NEW-CANDS are the candidates to save. ARG is the same as the raw prefix arg for `icicle-candidate-set-save'. MOREP non-nil means add the candidates, do not replace existing set. ONLY-SELECTED-P non-nil means NEW-CANDS are those selected in `*Completions*'. NO-ERROR-P non-nil means don't raise an error if NEW-CANDS is nil." (unless (or new-cands no-error-p) (icicle-user-error "Cannot save empty candidates set - did you use `S-TAB' or `TAB'?")) (let ((in-minibuf-p (minibuffer-window-active-p (minibuffer-window))) where) (if arg (let ((enable-recursive-minibuffers t)) (cond ((consp arg) ;; Save to cache file (and to `icicle-saved-completion-candidates'). (let* ((file-name (prog1 (let ((icicle-completion-candidates icicle-completion-candidates)) (icicle-add/update-saved-completion-set)) (when in-minibuf-p (with-output-to-temp-buffer "*Completions*" ; Redisplay. (display-completion-list icicle-completion-candidates))))) ;;; $$$$$$ (select-window (minibuffer-window)) (list-buf (and morep (find-file-noselect file-name 'nowarn 'raw))) (old-cands ())) (when morep (unwind-protect (condition-case nil (setq old-cands (read list-buf)) (end-of-file (icicle-msg-maybe-in-minibuffer "No completion candidates in file `%s'" file-name))) (kill-buffer list-buf))) ;; Convert to readable alist form, from propertized text. Convert any markers ;; to the form (icicle-file-marker FILE POS) or (icicle-marker BUFFER POS). (when (and new-cands (get-text-property 0 'icicle-whole-candidate (car new-cands))) (setq new-cands (mapcar (lambda (cand) (icicle-markers-to-readable (or (funcall icicle-get-alist-candidate-function cand) cand))) new-cands))) (setq icicle-saved-completion-candidates (append new-cands old-cands) where (format "cache file `%s'" file-name)) (with-temp-message (format "Writing candidates to cache file `%s'..." file-name) (condition-case err (with-temp-file file-name (prin1 icicle-saved-completion-candidates (current-buffer))) (error (error "Could not write to cache file. %s" (error-message-string err))))))) ((zerop (prefix-numeric-value arg)) ;; Save to a fileset (and to `icicle-saved-completion-candidates'). (unless (require 'filesets nil t) (error "Cannot save to a fileset - feature `filesets' not provided")) (filesets-init) (let ((icicle-completion-candidates icicle-completion-candidates)) (setq where (completing-read "Save to fileset: " filesets-data))) (unless (assoc where filesets-data) (if (not (y-or-n-p (format "Fileset `%s' does not exist. Create it? " where))) (icicle-user-error "Operation cancelled - no fileset") (add-to-list 'filesets-data (list where (list :files))) (icicle-msg-maybe-in-minibuffer "Fileset created. Use `M-x filesets-save-config' to save it."))) (dolist (cand new-cands) (icicle-add-file-to-fileset cand where)) (when in-minibuf-p (with-output-to-temp-buffer "*Completions*" ; Redisplay. (display-completion-list icicle-completion-candidates))) ;; $$$$$$ (select-window (minibuffer-window)) (setq where (format "`%s'" where))) (t ; Save to a variable. Prompt for the variable to use. (let* ((varname (prog1 (let ((icicle-completion-candidates icicle-completion-candidates) (icicle-whole-candidate-as-text-prop-p nil)) (completing-read (if morep "Add candidates to variable: " "Save candidates in variable: ") icicle-saved-candidates-variables-obarray nil nil nil (if (boundp 'variable-name-history) 'variable-name-history 'icicle-variable-name-history) "icicle-saved-completion-candidates")) (when in-minibuf-p (with-output-to-temp-buffer "*Completions*" (display-completion-list icicle-completion-candidates))))) ;; $$$$$$ (select-window (minibuffer-window)) (var (intern varname))) ; Intern in standard `obarray'. (intern varname icicle-saved-candidates-variables-obarray) ; For completion. (set var (if (and morep (boundp var) (listp (symbol-value var))) (append new-cands (symbol-value var)) new-cands)) (setq where (format "`%s'" var)))))) ;; Save to default variable, `icicle-saved-completion-candidates'. (setq where "`icicle-saved-completion-candidates'" icicle-saved-completion-candidates (if (and morep (listp icicle-saved-completion-candidates)) (append new-cands icicle-saved-completion-candidates) new-cands))) (deactivate-mark) (when (and in-minibuf-p (get-buffer-window "*Completions*" 'visible)) (icicle-display-candidates-in-Completions)) (icicle-msg-maybe-in-minibuffer (if morep (if new-cands (format "%sandidates ADDED to %s" (if only-selected-p "Selected c" "C") where) " [NO candidates selected to add]") (if new-cands (format "%sandidates SAVED to %s" (if only-selected-p "Selected c" "C") where) "Saved candidates reset to NONE"))))) ;; This is actually a top-level command, but it is in this file because it is used by ;; `icicle-candidate-set-save-1'. ;; ;; We don't define this using `icicle-define-add-to-alist-command', because we want to ;; return the cache-file name. ;; (defun icicle-add/update-saved-completion-set () "Add or update an entry in `icicle-saved-completion-sets'. That is, create a new saved completion set or update an existing one. You are prompted for the name of a set of completion candidates and its cache file. By default, the cache file name is the set name without spaces, and with file extension `icy'. List `icicle-saved-completion-sets' is updated to have an entry with these set and file names. Return the cache-file name." (interactive) (let* ((icicle-whole-candidate-as-text-prop-p nil) (set-name (icicle-substring-no-properties (completing-read "Saved completion set: " icicle-saved-completion-sets nil nil nil 'icicle-completion-set-history))) (file-name "")) (setq file-name (expand-file-name (read-file-name "Cache file for the set: " default-directory nil nil (concat (icicle-delete-whitespace-from-string set-name) ".icy")))) (while (not (icicle-file-writable-p file-name)) (setq file-name (expand-file-name (read-file-name "Cannot write to that file. Cache file: " default-directory nil nil (concat (icicle-delete-whitespace-from-string set-name) ".icy"))))) (setq icicle-saved-completion-sets ; Remove any old definition of this set. (icicle-assoc-delete-all set-name icicle-saved-completion-sets)) (push (cons set-name file-name) icicle-saved-completion-sets) ; Add new set definition. (funcall icicle-customize-save-variable-function 'icicle-saved-completion-sets icicle-saved-completion-sets) (message "Added set to `icicle-saved-completion-sets': `%s'" set-name) file-name)) ; Return cache-file name. ;; Similar to `filesets-add-buffer', but that insists on a buffer. This is actually a top-level ;; command, but it is in this file because it is used by `icicle-candidate-set-save-1'. ;; (defun icicle-add-file-to-fileset (&optional file name) "Add FILE to the fileset called NAME. If FILE is nil, use file of current buffer. If NAME is nil, prompt for the fileset." (interactive) (unless (require 'filesets nil t) (error "Cannot find library `filesets'")) (setq file (or file (buffer-file-name) (and (interactive-p) (read-file-name "File to add: " nil nil t)) (icicle-user-error "Current buffer has no associated file")) name (or name (and (interactive-p) (completing-read (format "Add `%s' to fileset: " file) filesets-data)) (error "No fileset"))) (let ((entry (or (assoc name filesets-data) (and (interactive-p) (when (y-or-n-p (format "Fileset `%s' does not exist. Create it? " name)) (add-to-list 'filesets-data (list name (list :files))) (message "Fileset created. Use `M-x filesets-save-config' to save it.") (car filesets-data)))))) (if (not entry) (when (interactive-p) (message "Operation cancelled - no fileset")) (let* ((files (filesets-entry-get-files entry))) (cond ((filesets-member file files :test 'filesets-files-equalp) (message "`%s' is already in fileset `%s'" file name)) ((and file (eq (filesets-entry-mode entry) ':files)) (filesets-entry-set-files entry (cons file files) t) (filesets-set-config name 'filesets-data filesets-data)) (t (error "Cannot add file. Fileset `%s' is not of type Files (:files)" name))))))) (defun icicle-markers-to-readable (cand) "Convert (serialize) candidate CAND to Lisp-readable representation. CAND is a full completion candidate (collection alist entry). A Lisp-readable candidate uses one of the following forms to represent a marker: (icicle-file-marker FILE-NAME MARKER-POSITION) (icicle-marker BUFFER-NAME MARKER-POSITION)" (if (atom cand) (if (markerp cand) (let ((buf (marker-buffer cand))) (unless buf (error "Marker in no buffer")) (list (if (buffer-file-name buf) 'icicle-file-marker 'icicle-marker) (or (buffer-file-name buf) (buffer-name buf)) (marker-position cand))) cand) (cons (icicle-markers-to-readable (car cand)) (icicle-markers-to-readable (cdr cand))))) (defun icicle-candidate-set-save-to-variable () ; Bound to `C-M-}' in minibuffer. "Save the set of current completion candidates in a variable you choose. You can retrieve the saved set of candidates with `\\\ \\[icicle-candidate-set-retrieve-from-variable]' (or `\\[icicle-candidate-set-retrieve]' with a numeric prefix arg). You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save-to-variable]')." (interactive) (icicle-candidate-set-save 99)) (defun icicle-candidate-set-save-persistently (filesetp) ; Bound to `C-}' in minibuffer. "Save the set of current completion candidates persistently. With no prefix arg, save in a cache file. With a prefix arg, save in an Emacs fileset (Emacs 22 or later). You can retrieve the saved set of candidates with `\\\ \\[icicle-candidate-set-retrieve-persistent]' or `C-u \\[icicle-candidate-set-retrieve]'. You can use the saved set of candidates for operations such as \\ `icicle-candidate-set-union' (`\\[icicle-candidate-set-union]'), `icicle-candidate-set-intersection' (`\\[icicle-candidate-set-intersection]'), and `icicle-candidate-set-difference' (`\\[icicle-candidate-set-difference]'). You can use this command only from the minibuffer (`\\\ \\[icicle-candidate-set-save-persistently]')." (interactive "P") (icicle-candidate-set-save (if filesetp 0 '(1)))) (defun icicle-keep-only-past-inputs (&optional recent-first) ; Bound to`M-pause' in minibuffer. "Narrow completion candidates to those that have been used previously. This filters the set of current completion candidates, keeping only those that have been used before. (You must first use `TAB' or `S-TAB' to establish an explicit candidate set.) With a prefix arg, the previous inputs are sorted chronologically, most recent first. Note that whatever completion mode (prefix or apropos) was in effect before you use `\\\ \\[icicle-keep-only-past-inputs]' remains in \ effect for `icicle-keep-only-past-inputs'. This command does not use a recursive minibuffer; it simply co-opts the current completion, changing it to completion against the history. You can use this command only from the minibuffer \ \(`\\[icicle-keep-only-past-inputs]'). See also `\\[icicle-history]' (`icicle-history')." (interactive "P") (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (if (and recent-first (interactive-p) icicle-inhibit-sort-p) (icicle-msg-maybe-in-minibuffer "Cannot sort candidates now") (let ((icicle-sort-comparer (if recent-first 'icicle-most-recent-first-p icicle-sort-comparer))) (when (or recent-first (eq icicle-last-completion-command 'icicle-keep-only-past-inputs)) (icicle-complete-again-update 'no-display)) (if (null icicle-completion-candidates) (minibuffer-message " [No completion candidates to filter]") (unless (boundp minibuffer-history-variable) (set minibuffer-history-variable nil)) (when (consp (symbol-value minibuffer-history-variable)) (setq icicle-completion-candidates (lexical-let* ((filep (or (icicle-file-name-input-p) icicle-abs-file-candidates)) (dir (and filep icicle-last-input (icicle-file-name-directory icicle-last-input))) (histvar (and (symbolp minibuffer-history-variable) (boundp minibuffer-history-variable) minibuffer-history-variable)) (hist (and histvar (if filep (let ((default-directory dir)) (mapcar #'expand-file-name (symbol-value histvar))) (symbol-value histvar))))) (icicle-remove-if-not (lambda (candidate) (if filep (let ((default-directory dir)) (member (expand-file-name candidate) hist)) (member candidate hist))) icicle-completion-candidates))) (cond ((null icicle-completion-candidates) (save-selected-window (icicle-remove-Completions-window)) (minibuffer-message " [None of the completions have been used before]")) (t (cond ((icicle-get-safe last-command 'icicle-cycling-command) (setq icicle-current-input icicle-last-input) (icicle-retrieve-last-input)) (t (setq icicle-current-input (icicle-input-from-minibuffer)))) (cond ((null icicle-completion-candidates) (setq icicle-nb-of-other-cycle-candidates 0) (save-selected-window (icicle-remove-Completions-window)) (minibuffer-message " [No matching history element]")) ((null (cdr icicle-completion-candidates)) ; Single cand. Update minibuffer. (setq icicle-nb-of-other-cycle-candidates 0) (icicle-clear-minibuffer) (setq icicle-last-completion-candidate (car icicle-completion-candidates)) (let ((inserted (if (and (icicle-file-name-input-p) insert-default-directory (or (not (member icicle-last-completion-candidate icicle-extra-candidates)) icicle-extra-candidates-dir-insert-p)) (icicle-abbreviate-or-expand-file-name icicle-last-completion-candidate (icicle-file-name-directory-w-default icicle-current-input)) icicle-last-completion-candidate))) (insert inserted)) (save-selected-window (icicle-remove-Completions-window)) (icicle-highlight-complete-input) (setq icicle-mode-line-help icicle-last-completion-candidate) (minibuffer-message (format " [One matching history element]"))) (t (when (member icicle-current-input icicle-completion-candidates) (icicle-highlight-complete-input) (setq icicle-mode-line-help icicle-current-input)) (icicle-display-candidates-in-Completions) (save-window-excursion (select-window (active-minibuffer-window)) (minibuffer-message (concat " [Filtered to (matching) historical candidates" (and recent-first ", most recent first") "]"))))) (setq icicle-last-completion-command 'icicle-keep-only-past-inputs))))) icicle-completion-candidates))) (defun icicle-other-history (arg) ; Bound to `C-M-pause' in minibuffer. "Choose a history, or complete against `icicle-interactive-history'. For Emacs 23 or later, if no prefix arg and you are completing a command, abbrev, or keyboard macro name, then complete against \(non-nil) `icicle-interactive-history'. Otherwise, prompt with completion for a minibuffer history to use. The history choice lasts only for the current (main) minibuffer reading. You can then cycle through that history or use \ \\`\\[icicle-insert-history-element]' to complete against it." (interactive "P") (if (and (> emacs-major-version 22) (memq minibuffer-history-variable '(extended-command-history icicle-command-abbrev-history icicle-kmacro-history)) (not arg) icicle-interactive-history) (icicle-use-interactive-command-history) (call-interactively #'icicle-change-history-variable))) (defun icicle-use-interactive-command-history () "Complete input against `icicle-interactive-history'. This is a history of all Emacs commands called interactively. This history is available only for Emacs 23 and later, and only if option `icicle-populate-interactive-history-flag' is not nil." (interactive) (icicle-change-history-variable "icicle-interactive-history") (icicle-history)) (defun icicle-change-history-variable (hist-var) "Choose a history variable to use now for `minibuffer-history-variable'. Use completion to choose the history to use. The choice lasts only for the current (main) completion. Non-interactively, arg HIST-VAR is the (string) name of a history var." (interactive (let ((enable-recursive-minibuffers t) (icicle-hist-vars `((,(symbol-name minibuffer-history-variable)) (,(symbol-name 'icicle-previous-raw-file-name-inputs)) (,(symbol-name 'icicle-previous-raw-non-file-name-inputs))))) (when (and (boundp 'icicle-populate-interactive-history-flag) ; Emacs 23+. icicle-populate-interactive-history-flag) (push (symbol-name 'icicle-interactive-history) icicle-hist-vars)) (mapatoms (lambda (x) (when (and (boundp x) (consp (symbol-value x)) (stringp (car (symbol-value x))) (string-match "-\\(history\\|ring\\)\\'" (symbol-name x))) (push (list (symbol-name x)) icicle-hist-vars)))) (list (completing-read "Use history: " icicle-hist-vars nil t nil nil nil)))) (when (interactive-p) (icicle-barf-if-outside-Completions-and-minibuffer)) (setq minibuffer-history-variable (intern hist-var))) (defun icicle-scroll-forward (&optional arg) ; `C-M-v' in minibuffer. "Scroll `icicle-other-window' forward." (interactive "P") (let ((win (if (window-live-p icicle-other-window) icicle-other-window (if (window-live-p icicle-orig-window) icicle-orig-window (get-buffer-window "*Completions*" 0))))) (when win (save-selected-window (select-window win) (scroll-up arg))))) (defun icicle-scroll-backward (&optional arg) ; `C-M-S-v' (aka `C-M-V') in minibuffer. "Scroll `icicle-other-window' backward." (interactive "P") (let ((win (if (window-live-p icicle-other-window) icicle-other-window (if (window-live-p icicle-orig-window) icicle-orig-window (get-buffer-window "*Completions*" 0))))) (when win (save-selected-window (select-window win) (scroll-down arg))))) (defun icicle-scroll-Completions-forward (&optional reverse) ; `C-v' minib; `wheel-down' *Completions*. "Scroll the `*Completions*' window forward. With a prefix argument, or if `icicle-scroll-Completions-reverse-p' is non-nil, scroll backward." (interactive "P") (when (get-buffer-window "*Completions*" 0) (save-selected-window (select-window (get-buffer-window "*Completions*" 0)) (when (if (interactive-p) reverse current-prefix-arg) ; Non-interactive use is for `TAB', `S-TAB'. (setq icicle-scroll-Completions-reverse-p (not icicle-scroll-Completions-reverse-p))) (cond (icicle-scroll-Completions-reverse-p (if (not (= (window-start) (point-min))) (scroll-down nil) (unless (= (window-end) (point-max)) (goto-char (point-max)) (scroll-down (1- (/ (window-height) 2))) (beginning-of-line)))) (t (if (not (= (window-end) (point-max))) (scroll-up nil) (unless (= (window-start) (point-min)) (goto-char (icicle-start-of-candidates-in-Completions))))))))) (defun icicle-scroll-Completions-backward () ; `M-v' in minibuf; `wheel-up' in `*Completions*'. "Scroll the `*Completions*' window backward. If `icicle-scroll-Completions-reverse-p' is non-nil, scroll forward." (interactive) (let ((icicle-scroll-Completions-reverse-p (not icicle-scroll-Completions-reverse-p))) (icicle-scroll-Completions-forward))) ;; Consider `icicle-history' as both kinds of completion command, ;; so that a first `TAB' or `S-TAB' cycles, depending on `icicle-default-cycling-mode'. (put 'icicle-history 'icicle-cycling-command t) (put 'icicle-history 'icicle-prefix-completing-command t) (put 'icicle-history 'icicle-apropos-completing-command t) (defun icicle-history () ; Bound to `M-h' in minibuffer. "Access the appropriate history list using completion or cycling. Complete the current minibuffer input against items in the history list that is in use for the current command. NOTE: 1. If the required input is a file or directory name, then the entire minibuffer input is what is matched against the history list. The reason for this is that file names in the history list are usually absolute. This is unlike the case for normal file-name completion, which assumes the default directory. Keep this in mind for apropos (regexp) completion; it means that to match a file-name using a substring you must, in the minibuffer, either not specify a directory or explicitly use \".*\" before the file-name substring. For example, `/foo/bar/lph' will not apropos-match the previously input file name `/foo/bar/alphabet-soup.el'; you should use either `/foo/bar/.*lph' or `lph' (no directory). 2. This also represents a difference in behavior compared to the similar command `icicle-keep-only-past-inputs' \ \(`\\\ \\[icicle-keep-only-past-inputs]' in the minibuffer). That command simply filters the current set of completion candidates, which in the case of file-name completion is a set of relative file names. 3. Whatever completion mode (prefix or apropos) was in effect before you use `\\\ \\[icicle-history]' remains in \ effect for `icicle-history'. This command does not use a recursive minibuffer; it simply co-opts the current completion, changing it to completion against the history. You can use this command only from the minibuffer \ \(`\\[icicle-history]'). See also `\\[icicle-keep-only-past-inputs]' (`icicle-keep-only-past-inputs')." (interactive) (when (interactive-p) (icicle-barf-if-outside-minibuffer)) (when (icicle-file-name-input-p) (setq minibuffer-completion-predicate nil minibuffer-completing-file-name nil)) (when (and (arrayp minibuffer-completion-table) minibuffer-completion-predicate) (setq minibuffer-completion-predicate `(lambda (elt) (funcall ',minibuffer-completion-predicate (intern (if (consp elt) (car elt) elt)))))) (when (and (boundp minibuffer-history-variable) (consp (symbol-value minibuffer-history-variable))) (setq minibuffer-completion-table (mapcar #'list (icicle-remove-duplicates ;; `command-history' is an exception: its entries are not strings. (if (eq 'command-history minibuffer-history-variable) (mapcar #'prin1-to-string (symbol-value minibuffer-history-variable)) (symbol-value minibuffer-history-variable)))))) (save-selected-window (unless icicle-last-completion-command (setq icicle-last-completion-command (case icicle-default-cycling-mode (apropos 'icicle-apropos-complete) (otherwise 'icicle-prefix-complete))) ; Prefix, by default. (funcall icicle-last-completion-command))) (cond (icicle-cycling-p;; $$$ (icicle-get-safe last-command 'icicle-cycling-command) (setq icicle-current-input icicle-last-input) (icicle-retrieve-last-input)) (t (setq icicle-current-input (icicle-input-from-minibuffer) icicle-last-input nil ; So `icicle-save-or-restore-input' thinks input has changed. ;; $$$$ last-command 'icicle-history ) (funcall icicle-last-completion-command)))) ;; This is not shadowed by any `icicle-mode-map' binding, since `isearch-mode-map' is also a minor mode map. ;; (defun icicle-isearch-complete () ; Bound to `M-TAB', `C-M-TAB' in `isearch-mode-map'. "Complete the search string using candidates from the search ring." (interactive) (cond ((icicle-completing-p) ; Cannot use the var here, since not sure to be in minibuf. (setq isearch-string (if (fboundp 'field-string) (field-string) (buffer-string))) (when (icicle-isearch-complete-past-string) (if (fboundp 'delete-field) (delete-field) (erase-buffer)) (insert isearch-string))) (t (icicle-isearch-complete-past-string) (setq isearch-message (mapconcat 'isearch-text-char-description isearch-string "")) (isearch-edit-string)))) (defun icicle-isearch-complete-past-string () "Set `isearch-string' to a past search string chosen by completion." (isearch-done 'nopush) (let ((icicle-whole-candidate-as-text-prop-p nil) (completion-ignore-case case-fold-search) (enable-recursive-minibuffers t)) (setq isearch-string (completing-read "Search string (completing): " (mapcar #'list (icicle-remove-duplicates (symbol-value (if isearch-regexp 'regexp-search-ring 'search-ring)))) nil nil isearch-string (if isearch-regexp 'regexp-search-ring 'search-ring))))) (defun icicle-isearch-history-insert () ; Bound to `M-o' in `isearch-mode-map'. "Append previous isearch strings, using completion to choose them. This is similar to `icicle-insert-history-element' (\\\ \\[icicle-insert-history-element] in the minibuffer), except that a prefix argument has no effect here: no candidate is wrapped with \"...\", and no space char is appended." (interactive) (cond ((icicle-completing-p) ; Cannot use the var here, since not sure to be in minibuf. (setq isearch-string (if (fboundp 'field-string) (field-string) (buffer-string))) (when (icicle-isearch-history-complete) (if (fboundp 'delete-field) (delete-field) (erase-buffer)) (insert isearch-string))) (t (icicle-isearch-history-complete) (setq isearch-message (mapconcat 'isearch-text-char-description isearch-string "")) (isearch-edit-string)))) (icicle-define-command icicle-isearch-history-complete ; Not bound - used during Isearch `M-o'. "Use completion to append previous search string(s) to the current. This is similar to \\`\\[icicle-insert-history-element]', but it ignores \ a prefix argument." icicle-insert-candidate-action ; Action function "Append past search strings (`C-g' to end): " ; `completing-read' args cands nil nil nil (if isearch-regexp 'regexp-search-ring 'search-ring) nil nil ((icicle-whole-candidate-as-text-prop-p nil) ; Bindings (enable-recursive-minibuffers t) (current-prefix-arg -1) ; Do not append a space char. (completion-ignore-case case-fold-search) (cands (mapcar #'list (icicle-remove-duplicates (symbol-value (if isearch-regexp 'regexp-search-ring 'search-ring))))) (icicle-pref-arg (and current-prefix-arg (prefix-numeric-value current-prefix-arg))) (count 0) (to-insert ())) (isearch-done 'nopush) ; First code nil ; Undo code (setq isearch-string (format "%s%s" isearch-string ; Last code (apply #'concat (nreverse to-insert))))) (when (fboundp 'text-scale-increase) ; Bound to `C-x -' in the minibuffer (Emacs 23+). (defun icicle-doremi-zoom-Completions+ (&optional increment) "Zoom the text in buffer `*Completions*' incrementally. Use `=', `-', or the mouse wheel to increase or decrease text size. You can use the `Meta' key (`M-=' or `M--') to increment in larger steps." (interactive "p") (unless (require 'doremi-frm nil t) (icicle-user-error "You need library `doremi-frm.el' for this command")) (unless (get-buffer-window "*Completions*" 'visible) (if icicle-completion-candidates (icicle-display-candidates-in-Completions) (icicle-msg-maybe-in-minibuffer "Did you hit `TAB' or `S-TAB'?"))) (let ((mini (active-minibuffer-window))) (unwind-protect (save-selected-window (select-window (get-buffer-window "*Completions*" 'visible)) (let ((enable-recursive-minibuffers t) (doremi-up-keys '(?=)) (doremi-down-keys '(?-)) (doremi-boost-up-keys '(?\M-=)) (doremi-boost-down-keys '(?\M--))) (doremi-buffer-font-size+ increment)) (setq unread-command-events ())) (unless mini (icicle-remove-Completions-window)))))) (defun icicle-doremi-candidate-width-factor+ (&optional increment) ; Bound to `C-x w' in minibuffer. "Change `icicle-candidate-width-factor' incrementally. Use `right', `left' or mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-right') to increment in larger steps. Use `up', `down', or the mouse wheel to adjust `icicle-inter-candidates-min-spaces'." (interactive "p") (unless (require 'doremi nil t) (icicle-user-error "You need library `doremi.el' for this command")) (let ((mini (active-minibuffer-window))) (unwind-protect (save-selected-window (select-window (minibuffer-window)) (unless icicle-completion-candidates (message "Hit `TAB' or `S-TAB'")) (let ((enable-recursive-minibuffers t) (doremi-up-keys '(left)) ; Rebind, so more intuitive for width. (doremi-boost-up-keys '(M-left)) (doremi-down-keys '(right)) (doremi-boost-down-keys '(M-right))) (doremi (lambda (new-val) (setq new-val (doremi-wrap new-val 1 100) icicle-candidate-width-factor new-val) (icicle-display-candidates-in-Completions) new-val) icicle-candidate-width-factor (- increment))) ; Reverse, so arrows correspond. (when (member (car unread-command-events) (append doremi-up-keys doremi-boost-up-keys doremi-down-keys doremi-boost-down-keys)) (icicle-doremi-inter-candidates-min-spaces+ increment)) (setq unread-command-events ())) (unless mini (icicle-remove-Completions-window))))) (defun icicle-doremi-inter-candidates-min-spaces+ (&optional increment) ; Bound to `C-x |' in minibuf. "Change `icicle-inter-candidates-min-spaces' incrementally. Use `up', `down' or the mouse wheel to increase or decrease. You can use the `Meta' key (e.g. `M-right') to increment in larger steps. Use `left', `right', or the mouse wheel to adjust `icicle-candidate-width-factor'." (interactive "p") (unless (require 'doremi nil t) (icicle-user-error "You need library `doremi.el' for this command")) (let ((mini (active-minibuffer-window))) (unwind-protect (save-selected-window (select-window (minibuffer-window)) (unless icicle-completion-candidates (message "Hit `TAB' or `S-TAB'")) (let* ((enable-recursive-minibuffers t)) (doremi (lambda (new-val) (setq new-val (doremi-limit new-val 1 nil) icicle-inter-candidates-min-spaces new-val) (icicle-display-candidates-in-Completions) new-val) icicle-inter-candidates-min-spaces increment)) (when (member (car unread-command-events)'(left right M-left M-right)) (icicle-doremi-candidate-width-factor+ increment)) (setq unread-command-events ())) (unless mini (icicle-remove-Completions-window))))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-WYSIWYG-Completions 'icicle-toggle-WYSIWYG-Completions) (defun icicle-toggle-WYSIWYG-Completions () "Toggle the value of option `icicle-WYSIWYG-Completions-flag'." (interactive) (setq icicle-WYSIWYG-Completions-flag (not icicle-WYSIWYG-Completions-flag)) (icicle-msg-maybe-in-minibuffer "Using WYSIWYG for `*Completions*' display is now %s" (icicle-propertize (if icicle-WYSIWYG-Completions-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-~-for-home-dir 'icicle-toggle-~-for-home-dir) (defun icicle-toggle-~-for-home-dir () ; Bound to `M-~' in minibuffer. "Toggle the value of option `icicle-use-~-for-home-dir-flag'. Bound to `M-~' in the minibuffer." (interactive) (setq icicle-use-~-for-home-dir-flag (not icicle-use-~-for-home-dir-flag)) (icicle-msg-maybe-in-minibuffer "Using `~' for home directory is now %s" (icicle-propertize (if icicle-use-~-for-home-dir-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-C-for-actions 'icicle-toggle-C-for-actions) (defun icicle-toggle-C-for-actions () ; Bound to `M-g' in minibuffer. "Toggle the value of option `icicle-use-C-for-actions-flag'. Bound to `M-g' in the minibuffer." (interactive) (setq icicle-use-C-for-actions-flag (not icicle-use-C-for-actions-flag)) (icicle-toggle-icicle-mode-twice) (icicle-msg-maybe-in-minibuffer "Using `C-' prefix for multi-command actions is now %s" (icicle-propertize (if icicle-use-C-for-actions-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-alternative-sorting 'icicle-toggle-alternative-sorting) (defun icicle-toggle-alternative-sorting () ; Bound to `C-M-,' in minibuffer. "Toggle alternative sorting of minibuffer completion candidates. This swaps `icicle-alternative-sort-comparer' and `icicle-sort-comparer'. Bound to `C-M-,' in the minibuffer." (interactive) (let ((alt-sort-fn icicle-alternative-sort-comparer)) (setq icicle-alternative-sort-comparer (or icicle-sort-comparer icicle-last-sort-comparer) icicle-sort-comparer (or alt-sort-fn icicle-last-sort-comparer)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Sorting: `%s', Alternative: `%s'" (icicle-propertize icicle-sort-comparer 'face 'icicle-msg-emphasis) (icicle-propertize icicle-alternative-sort-comparer 'face 'icicle-msg-emphasis)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-sorting 'icicle-toggle-sorting) (defun icicle-toggle-sorting () ; Not bound to a key. "Toggle sorting of minibuffer completion candidates. When sorting is active, comparison is done by `icicle-sort-comparer'." (interactive) (if (and (interactive-p) icicle-inhibit-sort-p) (icicle-msg-maybe-in-minibuffer "Cannot sort candidates now") (if icicle-sort-comparer (setq icicle-last-sort-comparer icicle-sort-comparer ; Save it, for restoring. icicle-sort-comparer nil) (setq icicle-sort-comparer icicle-last-sort-comparer)) ; Restore it. (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Completion-candidate sorting is now %s" (icicle-propertize (if icicle-sort-comparer "ON" "OFF") 'face 'icicle-msg-emphasis)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-angle-brackets 'icicle-toggle-angle-brackets) (defun icicle-toggle-angle-brackets () "Toggle `icicle-key-descriptions-use-<>-flag'." (interactive) (setq icicle-key-descriptions-use-<>-flag (not icicle-key-descriptions-use-<>-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer (if (< emacs-major-version 21) "This command has no effect prior to Emacs 21" "Displaying <...> in key descriptions is now %s" (icicle-propertize (if icicle-key-descriptions-use-<>-flag "ON" "OFF") 'face 'icicle-msg-emphasis)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-annotation 'icicle-toggle-annotation) (defun icicle-toggle-annotation () ; Bound to `C-x C-a' in minibuffer. "Toggle `icicle-show-annotations-flag'. Bound to `\\\\[icicle-toggle-annotation]' in the minibuffer." (interactive) (setq icicle-show-annotations-flag (not icicle-show-annotations-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Displaying candidate annotations is now %s" (icicle-propertize (if icicle-show-annotations-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-proxy-candidates 'icicle-toggle-proxy-candidates) (defun icicle-toggle-proxy-candidates () ; Bound to `C-M-_' in minibuffer. "Toggle `icicle-add-proxy-candidates-flag'. Bound to `\\\\[icicle-toggle-proxy-candidates]' in the minibuffer. With some commands, you must re-invoke the command for the new value to take effect. (This is for performance reasons.)" (interactive) (setq icicle-add-proxy-candidates-flag (not icicle-add-proxy-candidates-flag) icicle-saved-proxy-candidates (prog1 icicle-proxy-candidates (setq icicle-proxy-candidates icicle-saved-proxy-candidates))) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Including proxy candidates is now %s" (icicle-propertize (if icicle-add-proxy-candidates-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-transforming 'icicle-toggle-transforming) (defun icicle-toggle-transforming () ; Bound to `C-$' in minibuffer. "Toggle transforming of minibuffer completion candidates. When transforming is active, it is done by `icicle-transform-function'. Bound to `C-$' in the minibuffer. See the doc for individual commands, for how `C-$' might affect them." (interactive) (let ((dups-fns '(icicle-remove-duplicates icicle-remove-dups-if-extras))) ;; 1. If either is one of the DUPS-FNS, set the other to it and set it to nil. ;; 2. Else if both are other functions (and different), swap them, so you can toggle between them. ;; 3. Else if either is a function, set the other to it and set it to nil. ;; 4. Else (both are nil), set last to remove-dups and set this to nil. ;; ;; #1 is needed because we do not want to just swap them (#2) in that case. ;; (cond ((memq icicle-transform-function dups-fns) ; Swap with nil (setq icicle-last-transform-function icicle-transform-function icicle-transform-function nil)) ((memq icicle-last-transform-function dups-fns) ; Swap with nil (setq icicle-transform-function icicle-last-transform-function icicle-last-transform-function nil)) ((and icicle-transform-function icicle-last-transform-function (not (eq icicle-transform-function icicle-last-transform-function))) ; Swap them (setq icicle-transform-function (prog1 icicle-last-transform-function (setq icicle-last-transform-function icicle-transform-function)))) (icicle-transform-function ; Swap with nil (setq icicle-last-transform-function icicle-transform-function icicle-transform-function nil)) (icicle-last-transform-function ; Swap with nil (setq icicle-transform-function icicle-last-transform-function icicle-last-transform-function nil)) (t ; Default: last removes dups, this does nothing. (setq icicle-last-transform-function 'icicle-remove-duplicates icicle-transform-function nil))) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer icicle-toggle-transforming-message (icicle-propertize (if icicle-transform-function "ON" "OFF") 'face 'icicle-msg-emphasis)))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'cycle-icicle-incremental-completion 'icicle-cycle-incremental-completion) (defun icicle-cycle-incremental-completion () ; Bound to `C-#' in minibuffer. "Cycle the value of option `icicle-incremental-completion'. If the current value is nil then it is set to t. If the current value is t then it is set to `always'. If the current value is `always' then it is set to nil. Bound to `C-#' in the minibuffer." (interactive) (setq icicle-incremental-completion (case icicle-incremental-completion ((nil) t) ((t) 'always) (otherwise nil)) icicle-incremental-completion-p icicle-incremental-completion) (icicle-msg-maybe-in-minibuffer "Incremental completion is now %s" (icicle-propertize (case icicle-incremental-completion ((nil) "OFF") ((t) "ON") (otherwise "EAGER")) 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'cycle-icicle-expand-to-common-match 'icicle-cycle-expand-to-common-match) (defun icicle-cycle-expand-to-common-match () ; Bound to `C-M-"' in minibuffer. "Cycle the value of option `icicle-expand-input-to-common-match'. Bound to \\\ `\\[icicle-cycle-expand-to-common-match]' in the minibuffer. This cycles among all possible values of the option. See also `icicle-toggle-expand-to-common-match' (\\\ `\\[icicle-toggle-expand-to-common-match]' in the minibuffer)." (interactive) (setq icicle-expand-input-to-common-match (mod (1+ icicle-expand-input-to-common-match) 5)) (icicle-msg-maybe-in-minibuffer "Expanding input to common match is now %s" (icicle-propertize (case icicle-expand-input-to-common-match (0 "0 - NEVER") (1 "1 - `TAB', `S-TAB' ONLY") (2 "2 - SOLE MATCH") (3 "3 - PREFIX OR SOLE MATCH") (t "4 - ALWAYS")) 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-expand-to-common-match 'icicle-toggle-expand-to-common-match) (defun icicle-toggle-expand-to-common-match () ; Bound to `C-"' in minibuffer. "Toggle the value of option `icicle-expand-input-to-common-match'. The alternative values are those of that option and option `icicle-expand-input-to-common-match-alt'. Bound to \\\ `\\[icicle-toggle-expand-to-common-match]' in the minibuffer." (interactive) (setq icicle-expand-input-to-common-match (prog1 icicle-expand-input-to-common-match-alt (setq icicle-expand-input-to-common-match-alt icicle-expand-input-to-common-match))) (icicle-msg-maybe-in-minibuffer "Expanding input to common match is now %s" (icicle-propertize (case icicle-expand-input-to-common-match (0 "0 - NEVER") (1 "1 - `TAB', `S-TAB' ONLY") (2 "2 - SOLE MATCH") (3 "3 - PREFIX OR SOLE MATCH") (t "4 - ALWAYS")) 'face 'icicle-msg-emphasis))) (defun icicle-dispatch-C-^ () ; Bound to `C-^' in minibuffer. "Do the right thing for `C-^' When Icicles searching, call `icicle-toggle-highlight-all-current'. Otherwise, call `icicle-toggle-remote-file-testing'. Bound to `C-^' in the minibuffer." (interactive) (if icicle-searching-p (icicle-toggle-highlight-all-current) (icicle-toggle-remote-file-testing))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-remote-file-testing 'icicle-toggle-remote-file-testing) (defun icicle-toggle-remote-file-testing () ; Bound to `C-^' in minibuffer. "Toggle `icicle-test-for-remote-files-flag'. If you use Tramp for accessing remote files, then turning this off also turns off Tramp file-name completion. Therefore, if you use this command to turn off testing of remote file names, then use it also to turn testing back on (instead of just setting the option to non-nil). Bound to `C-^' in the minibuffer, except during Icicles searching." (interactive) (setq icicle-test-for-remote-files-flag (not icicle-test-for-remote-files-flag)) (when (require 'tramp nil t) (if (not icicle-test-for-remote-files-flag) (tramp-unload-file-name-handlers) ; Turn off Tramp remote file-name completion. ;; Bind `partial-completion-mode' to force Tramp file-name handlers unconditionally, for older ;; Tramp versions than 2.1 (ugly HACK). This code should work for all Tramp versions. (let ((non-essential t) ; Emacs 23.2+ (partial-completion-mode t)) (condition-case nil (tramp-register-file-name-handlers) ; Emacs 22+ (void-function (tramp-register-file-name-handler) ; The order of these two matters. (tramp-register-completion-file-name-handler)))))) (message "Updating completions...") (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Testing remote file names is now %s" (icicle-propertize (if icicle-test-for-remote-files-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (when (memq system-type '(ms-dos windows-nt cygwin)) (defalias 'toggle-icicle-network-drives-as-remote 'icicle-toggle-network-drives-as-remote) (defun icicle-toggle-network-drives-as-remote () ; Bound to `C-x :' in minibuffer. "Toggle `icicle-network-drive-means-remote-flag'. Bound to `C-x :' in the minibuffer." (interactive) (setq icicle-network-drive-means-remote-flag (not icicle-network-drive-means-remote-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "MS Windows network drives are now considered %s" (icicle-propertize (if icicle-network-drive-means-remote-flag "REMOTE" "LOCAL") 'face 'icicle-msg-emphasis)))) ;; NOT a top-level command (most toggle commands can be used at top-level). ;; (defalias 'toggle-icicle-highlight-all-current 'icicle-toggle-highlight-all-current) (defun icicle-toggle-highlight-all-current () ; Bound to `C-^' in minibuffer. "Toggle `icicle-search-highlight-all-current-flag'. Bound to `C-^' in the minibuffer during Icicles searching (only)." (interactive) (icicle-barf-if-outside-Completions-and-minibuffer) (setq icicle-search-highlight-all-current-flag (not icicle-search-highlight-all-current-flag)) ;; Rehighlight to see effect of toggle. (let ((icicle-candidate-nb icicle-candidate-nb)) (let ((icicle-current-input icicle-current-input) (icicle-incremental-completion-p nil)) (icicle-erase-minibuffer)) (icicle-retrieve-last-input) (funcall (or icicle-last-completion-command (if (eq icicle-current-completion-mode 'prefix) #'icicle-prefix-complete #'icicle-apropos-complete)))) (icicle-search-highlight-all-input-matches icicle-current-input) (when icicle-candidate-nb (icicle-search-action "DUMMY")) ; Get back to current. (select-window (minibuffer-window)) (select-frame-set-input-focus (selected-frame)) (icicle-msg-maybe-in-minibuffer "Highlighting current input match in each main search hit is now %s" (icicle-propertize (if icicle-search-highlight-all-current-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) (defun icicle-dispatch-C-x. (arg) ; Bound to `C-x .' in minibuffer. "Do the right thing for `C-x .'. With a prefix arg, call `icicle-toggle-hiding-non-matching-lines'. With no prefix arg, call `icicle-toggle-hiding-common-match'. Bound to `C-x .' in the minibuffer." (interactive "P") (if arg (icicle-toggle-hiding-non-matching-lines) (icicle-toggle-hiding-common-match))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-hiding-common-match 'icicle-toggle-hiding-common-match) (defun icicle-toggle-hiding-common-match () ; Bound to `C-x .' in minibuf, via `icicle-dispatch-C-x.'. "Toggle `icicle-hide-common-match-in-Completions-flag'. Bound to `C-x .' (no prefix arg) in the minibuffer. See also option `icicle-hide-non-matching-lines-flag'." (interactive) (setq icicle-hide-common-match-in-Completions-flag (not icicle-hide-common-match-in-Completions-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Hiding common match in `*Completions*' is now %s" (icicle-propertize (if icicle-hide-common-match-in-Completions-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-hiding-non-matching-lines 'icicle-toggle-hiding-non-matching-lines) (defun icicle-toggle-hiding-non-matching-lines () ; Bound to `C-u C-x .' in minibuffer. "Toggle `icicle-hide-non-matching-lines-flag'. Bound to `C-u C-x .' in the minibuffer. See also option `icicle-hide-common-match-in-Completions-flag'." (interactive) (setq icicle-hide-non-matching-lines-flag (not icicle-hide-non-matching-lines-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Hiding non-matching candidate lines in `*Completions*' is now %s" (icicle-propertize (if icicle-hide-non-matching-lines-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-show-multi-completion 'icicle-toggle-show-multi-completion) (defun icicle-toggle-show-multi-completion () ; Bound to `M-m' in minibuffer. "Toggle `icicle-show-multi-completion-flag'. Bound to `M-m' in the minibuffer." (interactive) (setq icicle-show-multi-completion-flag (not icicle-show-multi-completion-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Showing multi-completions (when available) is now %s" (icicle-propertize (if icicle-show-multi-completion-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-highlight-historical-candidates 'icicle-toggle-highlight-historical-candidates) (defun icicle-toggle-highlight-historical-candidates () ; Bound to `C-pause' in minibuffer. "Toggle `icicle-highlight-historical-candidates-flag'. Bound to `C-pause' in the minibuffer." (interactive) (setq icicle-highlight-historical-candidates-flag (not icicle-highlight-historical-candidates-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Highlighting previously used inputs in `*Completions*' is now %s" (icicle-propertize (if icicle-highlight-historical-candidates-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-highlight-saved-candidates 'icicle-toggle-highlight-saved-candidates) (defun icicle-toggle-highlight-saved-candidates () ; Bound to `S-pause' in minibuffer. "Toggle `icicle-highlight-saved-candidates-flag'. Bound to `S-pause' in the minibuffer." (interactive) (setq icicle-highlight-saved-candidates-flag (not icicle-highlight-saved-candidates-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Highlighting saved candidates in `*Completions*' is now %s" (icicle-propertize (if icicle-highlight-saved-candidates-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-completions-format 'icicle-toggle-completions-format) (defun icicle-toggle-completions-format () ; Bound to `C-M-^' in minibuffer. "Toggle `icicle-completions-format' between vertical and horizontal. Bound to `C-M-^' in the minibuffer." (interactive) (setq icicle-completions-format (if (eq 'vertical icicle-completions-format) 'horizontal 'vertical)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Layout of candidates in `*Completions*' is now %s" (icicle-propertize (if (eq 'vertical icicle-completions-format) "VERTICAL" "HORIZONTAL") 'face 'icicle-msg-emphasis))) (defun icicle-dispatch-C-. () ; Bound to `C-.' in minibuffer. "Do the right thing for `C-.'. When using Icicles search (`icicle-search' and similar commands), call `icicle-toggle-search-cleanup'. Otherwise, call `icicle-toggle-ignored-extensions'. Bound to `C-.' in the minibuffer." (interactive) (if icicle-searching-p (icicle-toggle-search-cleanup) (icicle-toggle-ignored-extensions))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-ignored-extensions 'icicle-toggle-ignored-extensions) (defun icicle-toggle-ignored-extensions () ; Bound to `C-.' in minibuffer except in Icicles search. "Toggle respect of `completion-ignored-extensions'. Bound to `C-.' in minibuffer during file-name input." (interactive) (if (consp completion-ignored-extensions) (setq icicle-saved-ignored-extensions completion-ignored-extensions ; Save it. completion-ignored-extensions () icicle-ignored-extensions-regexp nil) (setq completion-ignored-extensions icicle-saved-ignored-extensions ; Restore it. icicle-ignored-extensions-regexp ; Make regexp for ignored file extensions. (concat "\\(" (mapconcat #'regexp-quote completion-ignored-extensions "$\\|") "$\\)\\'"))) ;; Flag to prevent updating `icicle-ignored-extensions-regexp' unless ;; `completion-ignored-extensions' changes. (setq icicle-ignored-extensions completion-ignored-extensions) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Ignoring selected file extensions is now %s" (icicle-propertize (if completion-ignored-extensions "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-ignored-space-prefix 'icicle-toggle-ignored-space-prefix) (defun icicle-toggle-ignored-space-prefix () ; Bound to `M-_' in minibuffer, except when searching. "Toggle `icicle-buffer-ignore-space-prefix-flag'. Bound to `M-_' in the minibuffer, except during Icicles searching." (interactive) (setq icicle-buffer-ignore-space-prefix-flag (not icicle-buffer-ignore-space-prefix-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Ignoring space prefix in buffer names is now %s" (icicle-propertize (if icicle-buffer-ignore-space-prefix-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-include-cached-files 'icicle-toggle-include-cached-files) (defun icicle-toggle-include-cached-files (&optional newval) ; Bound to `C-x F' in minibuffer for buffers. "Toggle the sign of option `icicle-buffer-include-cached-files-nflag'. A prefix arg sets the option value to the numeric prefix value. Bound to `C-x F' in the minibuffer during buffer-name completion." (interactive "P") (setq newval (and newval (prefix-numeric-value newval))) (setq icicle-buffer-include-cached-files-nflag (or newval (- icicle-buffer-include-cached-files-nflag))) ;; Just in case someone uses setq instead of Customize. (when (zerop icicle-buffer-include-cached-files-nflag) (setq icicle-buffer-include-cached-files-nflag 20)) (when (> icicle-buffer-include-cached-files-nflag 0) (unless (require 'filecache nil t) (error "Option toggled, but you need library `filecache.el' to use it"))) (icicle-msg-maybe-in-minibuffer "Including cached file names for buffer completion is now %s (max: %s)" (icicle-propertize (if (> icicle-buffer-include-cached-files-nflag 0) "ON" "OFF") 'face 'icicle-msg-emphasis) (icicle-propertize (format "%d" icicle-buffer-include-cached-files-nflag) 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-include-recent-files 'icicle-toggle-include-recent-files) (defun icicle-toggle-include-recent-files (&optional newval) ; Bound to `C-x R' in minibuffer for buffers. "Toggle the sign of option `icicle-buffer-include-recent-files-nflag'. A prefix arg sets the option value to the numeric prefix value. Bound to `C-x R' in the minibuffer during buffer-name completion." (interactive "P") (setq newval (and newval (prefix-numeric-value newval))) (setq icicle-buffer-include-recent-files-nflag (or newval (- icicle-buffer-include-recent-files-nflag))) ;; Just in case someone uses setq instead of Customize. (when (zerop icicle-buffer-include-recent-files-nflag) (setq icicle-buffer-include-recent-files-nflag 20)) (when (> icicle-buffer-include-recent-files-nflag 0) (if (require 'recentf nil t) (unless recentf-list (recentf-load-list)) (icicle-user-error "Option toggled, but you need library `recentf.el' to use it"))) (icicle-msg-maybe-in-minibuffer "Including recent file names for buffer completion is now %s (max: %s)" (icicle-propertize (if (> icicle-buffer-include-recent-files-nflag 0) "ON" "OFF") 'face 'icicle-msg-emphasis) (icicle-propertize (format "%d" icicle-buffer-include-recent-files-nflag) 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-search-cleanup 'icicle-toggle-search-cleanup) (defun icicle-toggle-search-cleanup () ; Bound to `C-.' in minibuffer during Icicles search. "Toggle removal of `icicle-search' highlighting after a search. This toggles option `icicle-search-cleanup-flag'. Bound to `C-.' in the minibuffer during Icicles search." (interactive) (setq icicle-search-cleanup-flag (not icicle-search-cleanup-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Removal of Icicles search highlighting is now %s" (icicle-propertize (if icicle-search-cleanup-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-search-complementing-domain 'icicle-toggle-search-complementing-domain) (defun icicle-toggle-search-complementing-domain () ; Bound to `C-M-~' in minibuffer. "Toggle searching the complements of the normal search contexts. This toggles internal variable `icicle-search-complement-domain-p'. If toggled during search it affects the next, not the current, search. Bound to `C-M-~' in the minibuffer." (interactive) (setq icicle-search-complement-domain-p (not icicle-search-complement-domain-p)) (icicle-msg-maybe-in-minibuffer "Future Icicles searches %suse the %s of the search domain" (if icicle-search-complement-domain-p "" (concat "do " (icicle-propertize "NOT " 'face 'icicle-msg-emphasis))) (if icicle-search-complement-domain-p "COMPLEMENT" (icicle-propertize "COMPLEMENT" 'face 'icicle-msg-emphasis)))) ;;$$$ (defun icicle-dispatch-C-backquote () ; Bound to `C-`' in minibuffer. ;; "Do the right thing for `C-`'. ;; When searching, call `icicle-toggle-literal-replacement'. ;; Otherwise, call `icicle-toggle-regexp-quote'. ;; Bound to `C-`' in the minibuffer." ;; (interactive) ;; (if icicle-searching-p (icicle-toggle-literal-replacement) (icicle-toggle-regexp-quote))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-regexp-quote 'icicle-toggle-regexp-quote) (defun icicle-toggle-regexp-quote () ; Bound to `C-`' in minibuffer. "Toggle escaping of regexp special chars (`icicle-regexp-quote-flag'). Bound to `C-`' in the minibuffer." (interactive) (setq icicle-regexp-quote-flag (not icicle-regexp-quote-flag)) (icicle-complete-again-update) (icicle-msg-maybe-in-minibuffer "Escaping of regexp special characters is now %s" (icicle-propertize (if icicle-regexp-quote-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) (put 'icicle-regexp-quote-input 'icicle-completing-command t) (put 'icicle-regexp-quote-input 'icicle-apropos-completing-command t) (defun icicle-regexp-quote-input (beg end) ; Bound to `M-%' in minibuffer. "Regexp quote current input or its active region, then apropos-complete. Use this if you want to literally match all of what is currently in the minibuffer or selected text there, but you also want to use that literal text as part of a regexp for apropos completion. Bound to `M-%' in the minibuffer." (interactive (if (and mark-active (mark)) (list (region-beginning) (region-end)) (list (point-max) (point-max)))) (icicle-barf-if-outside-Completions-and-minibuffer) (let ((regionp (and mark-active (mark) (/= (point) (mark)))) quoted-part) (save-excursion (save-restriction (narrow-to-region (if regionp beg (icicle-minibuffer-prompt-end)) (if regionp end (point-max))) (setq quoted-part (regexp-quote (icicle-input-from-minibuffer))) (delete-region (icicle-minibuffer-prompt-end) (point-max)) (insert quoted-part)))) (setq icicle-current-input (icicle-input-from-minibuffer)) (let ((icicle-edit-update-p t) (icicle-expand-input-to-common-match 2)) ; Only explicit `TAB'/`S-TAB' or sole candidate match. (icicle-apropos-complete))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-literal-replacement 'icicle-toggle-literal-replacement) (defun icicle-toggle-literal-replacement () ; Bound to `C-M-`' in minibuffer. "Toggle escaping of regexp special chars in replacement text. This toggles option `icicle-search-replace-literally-flag'. Bound to `C-M-`' in the minibuffer." (interactive) (setq icicle-search-replace-literally-flag (not icicle-search-replace-literally-flag)) (icicle-msg-maybe-in-minibuffer "Replacement of text literally is now %s" (icicle-propertize (if icicle-search-replace-literally-flag "ON" "OFF") 'face 'icicle-msg-emphasis))) ;; Top-level commands. Could instead be in `icicles-cmd2.el'. ;; (defalias 'toggle-icicle-case-sensitivity 'icicle-toggle-case-sensitivity) (defun icicle-toggle-case-sensitivity (file+buff-p) ; Bound to `C-S-a' in minibuffer, i.e., `C-A'. "Toggle case sensitivity. This toggles `case-fold-search' and `completion-ignore-case'. With a prefix arg, it also toggles `read-file-name-completion-ignore-case' \(Emacs 22 and later) and `read-buffer-completion-ignore-case' (Emacs 23 and later). More precisely, this command first toggles the default value of `case-fold-search', and then it sets the other variables to the value of `case-fold-search'. Note: 1. This toggles the default value of `case-fold-search'. This means that it does not matter which buffer is current when you call this command - all buffers are affected henceforth. 2. Some Icicles commands bind one or more of these variables, so invoking this command during command execution will not necessarily toggle the global values of all of the variables. Bound to `C-A' in the minibuffer, that is, `C-S-a'." (interactive "P") (setq-default case-fold-search (not case-fold-search) completion-ignore-case case-fold-search) (when file+buff-p (when (boundp 'read-file-name-completion-ignore-case) ; Emacs 22+ (setq read-file-name-completion-ignore-case case-fold-search)) (when (boundp 'read-buffer-completion-ignore-case) ; Emacs 23+ (setq read-buffer-completion-ignore-case case-fold-search))) (icicle-complete-again-update) (icicle-highlight-lighter) (icicle-msg-maybe-in-minibuffer "Case-sensitive comparison is now %s" (cond ((and case-fold-search (or (not (boundp 'read-file-name-completion-ignore-case)) read-file-name-completion-ignore-case) (or (not (boundp 'read-buffer-completion-ignore-case)) read-buffer-completion-ignore-case)) (concat (icicle-propertize "OFF" 'face 'icicle-msg-emphasis) ", everywhere")) (case-fold-search (concat (icicle-propertize "OFF" 'face 'icicle-msg-emphasis) ", " (icicle-propertize "except" 'face 'icicle-msg-emphasis) " for files and buffers")) (t (concat (icicle-propertize "ON" 'face 'icicle-msg-emphasis) ", everywhere"))))) ;; `icicle-delete-window' (`C-x 0') does this in minibuffer. ;; `icicle-abort-recursive-edit' call this with non-nil FORCE. ;; (defun icicle-remove-Completions-window (&optional force) "Remove the `*Completions*' window. If not called interactively and `*Completions*' is the selected window, then do not remove it unless optional arg FORCE is non-nil." (interactive) ;; We do nothing if `*Completions*' is the selected window ;; or the minibuffer window is selected and `*Completions*' window was selected just before. (let ((swin (selected-window))) ;; Emacs 20-21 has no `minibuffer-selected-window' function, but we just ignore that. (when (and (window-minibuffer-p swin) (fboundp 'minibuffer-selected-window)) (setq swin (minibuffer-selected-window))) (cond (;; `*Completions*' is shown in the selected frame. (and (get-buffer-window "*Completions*") (or force ; Let user use `C-g' to get rid of it even if selected. (and (window-live-p swin) ; Not sure needed. (not (eq (window-buffer swin) (get-buffer "*Completions*")))) (interactive-p))) ;; Ignore error, in particular, "Attempt to delete the sole visible or iconified frame". (condition-case nil (delete-window (get-buffer-window "*Completions*")) (error nil)) (bury-buffer (get-buffer "*Completions*"))) (;; `*Completions*' is shown in a different frame. (and (get-buffer-window "*Completions*" 'visible) (or force ; Let user use `C-g' to get rid of it even if selected. (and (window-live-p swin) (not (eq (window-buffer swin) (get-buffer "*Completions*")))) (interactive-p))) ;; Ignore error, in particular, "Attempt to delete the sole visible or iconified frame". (when (window-dedicated-p (get-buffer-window "*Completions*" 'visible)) (condition-case nil (icicle-delete-windows-on "*Completions*") (error nil))) (bury-buffer (get-buffer "*Completions*")))))) ;; This is actually a top-level command, but it is in this file because it is used by ;; `icicle-remove-Completions-window'. ;; (defun icicle-delete-windows-on (buffer) "Delete all windows showing BUFFER. If such a window is alone in its frame, then delete the frame - unless it is the only frame or a standalone minibuffer frame." (interactive (list (let ((enable-recursive-minibuffers t)) (read-buffer "Remove all windows showing buffer: " (current-buffer) 'existing)))) (setq buffer (get-buffer buffer)) ; Convert to buffer. (when buffer ; Do nothing if null BUFFER. ;; Avoid error message "Attempt to delete minibuffer or sole ordinary window". (let* ((this-buffer-frames (icicle-frames-on buffer t)) (this-frame (car this-buffer-frames))) (unless (and this-frame (frame-visible-p this-frame) (null (cdr this-buffer-frames)) ; Only one frame shows BUFFER. (eq (cdr (assoc 'minibuffer (frame-parameters this-frame))) (active-minibuffer-window)) ; Has an active minibuffer. (save-window-excursion (select-frame this-frame) (one-window-p t 'SELECTED-FRAME-ONLY))) ; Only one window. (let (win) (dolist (fr this-buffer-frames) (setq win (get-buffer-window buffer fr)) (select-window win) (if (and (one-window-p t) (cdr (visible-frame-list))) ; Sole window but not sole frame. (delete-frame) (delete-window (selected-window))))))))) (defun icicle-top-level () "Remove `*Completions*' window and call `top-level'." (interactive) (icicle-remove-Completions-window 'FORCE) (top-level)) ;; Free var here: `icicle-bufflist' is bound by `icicle-buffer-bindings'. (defun icicle-remove-buffer-cands-for-mode (&optional derivedp keep-p) "Prompt for a major mode, then remove buffer candidates with that mode. Repeat this to progressively remove buffers with different modes. Non-nil DERIVEDP (prefix arg) means remove buffers with or derived from the mode. Non-nil KEEP-P means do the opposite: keep only such buffer candidates, instead of removing them." (interactive "P") (save-selected-window (icicle-remove-Completions-window)) (let* ((orig-buff icicle-pre-minibuffer-buffer) (enable-recursive-minibuffers t) (buffer-modes (icicle-remove-duplicates (mapcar (lambda (buf) (with-current-buffer buf (list (symbol-name major-mode)))) icicle-bufflist))) (mode (let ((icicle-must-pass-after-match-predicate nil)) (intern (completing-read (format "%s candidates %s mode: " (if keep-p "Keep only" "Remove") (if derivedp "derived from" "with")) (if derivedp (let ((modes buffer-modes) parent ancestors) (dolist (buf icicle-bufflist) (setq ancestors () parent (get (with-current-buffer buf major-mode) 'derived-mode-parent)) (while parent (add-to-list 'modes (list (symbol-name parent))) (setq parent (icicle-get-safe parent 'derived-mode-parent)))) modes) buffer-modes) nil t)))) (new-pred (if (and derivedp (fboundp 'derived-mode-p)) (if keep-p `(lambda (buf) (with-current-buffer buf (derived-mode-p ',mode))) `(lambda (buf) (not (with-current-buffer buf (derived-mode-p ',mode))))) (if keep-p `(lambda (buf) (with-current-buffer buf (eq major-mode ',mode))) `(lambda (buf) (with-current-buffer buf (not (eq major-mode ',mode)))))))) (setq icicle-must-pass-after-match-predicate (if icicle-must-pass-after-match-predicate (lexical-let ((curr-pred icicle-must-pass-after-match-predicate)) `(lambda (buf) (and (funcall ',curr-pred buf) (funcall ',new-pred buf)))) new-pred))) (icicle-complete-again-update)) (defun icicle-remove-buffer-cands-for-derived-mode () "Prompt for a major mode, then remove buffer candidates derived from it. Repeat this to progressively remove buffers with different modes." (interactive) (icicle-remove-buffer-cands-for-mode 'DERIVEDP)) (defun icicle-keep-only-buffer-cands-for-mode (&optional derivedp) "Prompt for a major mode. Keep only buffer candidates with that mode. Non-nil DERIVEDP (prefix arg) means keep only buffers with or derived from the mode." (interactive "P") (icicle-remove-buffer-cands-for-mode derivedp 'KEEP-P)) (defun icicle-keep-only-buffer-cands-for-derived-mode () "Prompt for a major mode. Keep only buffer candidates derived from it." (interactive) (icicle-remove-buffer-cands-for-mode 'DERIVEDP 'KEEP-P)) (defun icicle-keep/remove-buffer-cands-for-visible (&optional keep-p) "Keep/remove buffer-name candidates for visible buffers. This includes buffers in iconified frames. Non-nil KEEP-P means keep only such candidates. Else remove them." (let ((new-pred (if keep-p `(lambda (buf) (get-buffer-window buf 0)) `(lambda (buf) (not (get-buffer-window buf 0)))))) (setq icicle-must-pass-after-match-predicate (if icicle-must-pass-after-match-predicate (lexical-let ((curr-pred icicle-must-pass-after-match-predicate)) `(lambda (buf) (and (funcall ',curr-pred buf) (funcall ',new-pred buf)))) new-pred))) (icicle-complete-again-update)) (defun icicle-remove-buffer-cands-for-visible () "Remove buffer-name candidates for visible buffers. This includes buffers in iconified frames." (interactive) (icicle-keep/remove-buffer-cands-for-visible)) (defun icicle-keep-only-buffer-cands-for-visible () "Keep only buffer-name candidates for visible buffers. This includes buffers in iconified frames." (interactive) (icicle-keep/remove-buffer-cands-for-visible 'KEEP-P)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-mcmd) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-mcmd.el ends here icicles-2013.04.23.23400/icicles-mode.el000066400000000000000000006756021214003072700170630ustar00rootroot00000000000000;;; icicles-mode.el --- Icicle Mode definition for Icicles ;; ;; Filename: icicles-mode.el ;; Description: Icicle Mode definition for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 10:21:10 2006 ;; Version: 22.0 ;; Last-Updated: Wed Apr 24 09:20:03 2013 (-0700) ;; By: dradams ;; Update #: 9733 ;; URL: http://www.emacswiki.org/icicles-mode.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `advice', `advice-preload', `apropos', `apropos+', ;; `apropos-fn+var', `avoid', `bookmark', `bookmark+', ;; `bookmark+-1', `bookmark+-bmu', `bookmark+-key', ;; `bookmark+-lit', `cl', `cus-edit', `cus-face', `cus-load', ;; `cus-start', `dired', `dired+', `dired-aux', `dired-x', ;; `doremi', `easymenu', `el-swank-fuzzy', `ffap', `ffap-', ;; `fit-frame', `frame-cmds', `frame-fns', `fuzzy', `fuzzy-match', ;; `help+20', `hexrgb', `icicles-cmd1', `icicles-cmd2', ;; `icicles-fn', `icicles-mcmd', `icicles-opt', `icicles-var', ;; `image-dired', `info', `info+', `kmacro', `levenshtein', ;; `menu-bar', `menu-bar+', `misc-cmds', `misc-fns', `mouse3', ;; `mwheel', `naked', `pp', `pp+', `regexp-opt', `ring', `ring+', ;; `second-sel', `strings', `subr-21', `thingatpt', `thingatpt+', ;; `unaccent', `w32-browser', `w32browser-dlgopen', `wid-edit', ;; `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines the ;; command `icicle-mode'. For Icicles documentation, see ;; `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Commands defined here: ;; ;; `icicle-handle-switch-frame', `icicle-mode', `icy-mode', ;; `icicle-ORIG-bbdb-complete-mail', ;; `icicle-ORIG-bbdb-complete-name', ;; `icicle-ORIG-comint-dynamic-complete', ;; `icicle-ORIG-comint-dynamic-complete-filename', ;; `icicle-ORIG-comint-replace-by-expanded-filename', ;; `icicle-ORIG-dired-read-shell-command', ;; `icicle-ORIG-ess-complete-object-name', ;; `icicle-ORIG-gud-gdb-complete-command', ;; `icicle-ORIG-read-file-name', `icicle-ORIG-read-shell-command', ;; `icicle-skip-this-command'. ;; ;; Non-interactive functions defined here: ;; ;; `icicle-activate-mark', `icicle-add-menu-item-to-cmd-history', ;; `icicle-bind-completion-keys', ;; `icicle-bind-custom-minibuffer-keys', ;; `icicle-bind-isearch-keys', ;; `icicle-bind-key-completion-keys-for-map-var', ;; `icicle-bind-key-completion-keys-in-keymaps-from', ;; `icicle-bind-other-keymap-keys', ;; `icicle-cancel-Help-redirection', `icicle-define-cycling-keys', ;; `icicle-define-icicle-maps', `icicle-define-minibuffer-maps', ;; `icicle-minibuffer-setup', `icicle-rebind-global', ;; `icicle-redefine-standard-functions', ;; `icicle-redefine-standard-options', ;; `icicle-redefine-std-completion-fns', ;; `icicle-restore-completion-keys', ;; `icicle-restore-custom-minibuffer-keys', ;; `icicle-restore-other-keymap-keys', ;; `icicle-restore-region-face', ;; `icicle-restore-standard-functions', ;; `icicle-restore-standard-options', ;; `icicle-restore-std-completion-fns', ;; `icicle-run-icicle-post-command-hook', ;; `icicle-run-icicle-pre-command-hook', ;; `icicle-select-minibuffer-contents', `icicle-set-calling-cmd', ;; `icicle-show-current-help-in-mode-line', ;; `icicle-S-iso-lefttab-to-S-TAB', `icicle-top-level-prep', ;; `icicle-unbind-isearch-keys', ;; `icicle-unbind-key-completion-keys-for-map-var', ;; `icicle-unbind-key-completion-keys-in-keymaps-from', ;; `icicle-undo-std-completion-faces', `icicle-unmap', ;; `icicle-update-ignored-extensions-regexp'. ;; ;; User options defined here (in Custom group `Icicles'): ;; ;; `icicle-mode', `icicle-mode-hook'. ;; ;; Internal variables defined here: ;; ;; `icicle-bookmark-menu-map', `icicle-custom-menu-map', ;; `icicle-describe-menu-map', `icicle-dired-multiple-menu-map', ;; `icicle-dired-recursive-marked-menu-map', ;; `icicle-edit-menu-map', `icicle-file-menu-map', ;; `icicle-frames-menu-map', `icicle-info-menu-map', ;; `icicle-mode-map', `icicle-options-menu-map', ;; `icicle-search-menu-map', `icicle-search-tags-menu-map'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "User Options (alphabetical)") ;; (@> "Internal variables (alphabetical)") ;; (@> "Icicle mode command") ;; (@> "Other Icicles functions that define Icicle mode") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (eval-when-compile (require 'cl)) ;; flet, pushnew, case ;; plus, for Emacs < 21: push, dolist (require 'advice) ;; ad-activate, ad-copy-advice-info, ad-deactivate, ad-disable-advice, ad-enable-advice, ;; ad-find-some-advice, ad-get-arg, ad-is-active, ad-set-advice-info, defadvice (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.) ;; icicle-buffer-configs, icicle-buffer-extras, icicle-change-region-background-flag, ;; icicle-default-cycling-mode, icicle-incremental-completion, icicle-default-value, icicle-kbd, ;; icicle-kmacro-ring-max, icicle-minibuffer-setup-hook, icicle-modal-cycle-down-keys, ;; icicle-modal-cycle-up-keys, icicle-functions-to-redefine, icicle-regexp-search-ring-max, ;; icicle-region-background, icicle-search-ring-max, icicle-show-Completions-initially-flag, ;; icicle-top-level-key-bindings, icicle-touche-pas-aux-menus-flag, icicle-word-completion-keys (require 'icicles-fn) ; (This is required anyway by `icicles-cmd1.el'.) ;; icicle-completing-p, icicle-toggle-icicle-mode-twice, icicle-unhighlight-lighter (require 'icicles-var) ; (This is required anyway by `icicles-fn.el'.) ;; icicle-candidate-action-fn, icicle-candidate-nb, icicle-cmd-calling-for-completion, ;; icicle-completing-p, icicle-completion-candidates, icicle-current-completion-mode, ;; icicle-ignored-extensions, icicle-ignored-extensions-regexp, icicle-incremental-completion-p, ;; icicle-initial-value, icicle-last-completion-candidate, icicle-last-completion-command, ;; icicle-last-input, icicle-menu-map, icicle-pre-minibuffer-buffer, icicle-minor-mode-map-entry, ;; icicle-saved-completion-candidates, icicle-saved-kmacro-ring-max, ;; icicle-saved-regexp-search-ring-max, icicle-saved-region-background, icicle-saved-search-ring-max, ;; icicle-search-current-overlay, icicle-search-overlays, icicle-search-refined-overlays (require 'icicles-cmd1) ; (This is required anyway by `icicles-cmd2.el'.) ;; icicle-add-buffer-candidate, icicle-add-buffer-config, icicle-customize-face-other-window, ;; icicle-select-bookmarked-region (require 'icicles-cmd2) ;; icicle-imenu, icicle-imenu-command, icicle-imenu-command-full, icicle-imenu-face, ;; icicle-imenu-face-full, icicle-imenu-full, icicle-imenu-key-explicit-map, ;; icicle-imenu-key-explicit-map-full, icicle-imenu-key-implicit-map, ;; icicle-imenu-key-implicit-map-full, icicle-imenu-macro, icicle-imenu-macro-full, ;; icicle-imenu-non-interactive-function, icicle-imenu-non-interactive-function-full, ;; icicle-imenu-user-option, icicle-imenu-user-option-full, icicle-imenu-variable, ;; icicle-imenu-variable-full, icicle-occur, icicle-search, icicle-search-all-tags-bookmark, ;; icicle-search-all-tags-regexp-bookmark, icicle-search-autofile-bookmark, ;; icicle-search-autonamed-bookmark, icicle-search-bookmark, icicle-search-bookmark-list-bookmark, ;; icicle-search-bookmark-list-marked, icicle-search-bookmarks-together, icicle-search-buffer, ;; icicle-search-buff-menu-marked, icicle-search-char-property, icicle-search-dired-bookmark, ;; icicle-search-dired-marked-recursive, icicle-search-file, icicle-search-file-bookmark, ;; icicle-search-gnus-bookmark, icicle-search-highlight-cleanup, icicle-search-ibuffer-marked, ;; icicle-search-info-bookmark, icicle-search-keywords, icicle-search-local-file-bookmark, ;; icicle-search-man-bookmark, icicle-search-non-file-bookmark, icicle-search-overlay-property, ;; icicle-search-pages, icicle-search-paragraphs, icicle-search-region-bookmark, ;; icicle-search-remote-file-bookmark, icicle-search-sentences, icicle-search-some-tags-bookmark, ;; icicle-search-some-tags-regexp-bookmark, icicle-search-specific-buffers-bookmark, ;; icicle-search-specific-files-bookmark, icicle-search-temporary-bookmark, ;; icicle-search-text-property, icicle-search-thing, icicle-search-this-buffer-bookmark, ;; icicle-search-url-bookmark, icicle-search-w3m-bookmark, icicle-search-w-isearch-string, ;; icicle-search-word, icicle-search-xml-element, icicle-search-xml-element-text-node ;; Use `condition-case' because if `mb-depth.el' can't be found, `mb-depth+.el' is not provided. (when (>= emacs-major-version 22) (condition-case nil (require 'mb-depth+ nil t) (error nil))) ;; (no error if not found): minibuffer-depth-indicate-mode (require 'dired+ nil t) ;; (no error if not found): ;; diredp-menu-bar-operate-menu, diredp-menu-bar-recursive-marked-menu, ;; diredp-menu-bar-subdir-menu (require 'dired) ;; dired-mode-map (require 'menu-bar+ nil t) ;; (no error if not found): ;; menu-bar-apropos-menu, menu-bar-describe-menu, menu-bar-edit-menu, menu-bar-file-menu, ;; menu-bar-frames-menu, menu-bar-options-menu, menu-bar-search-tags-menu ;; `icicle-apropos-complete' is used here. It is defined in `icicles-mcmd.el'. ;; `icicle-file-name-input-p' is used here. It is defined in `icicles-fn.el'. ;;; Defvars to quiet byte-compiler: (when (< emacs-major-version 22) (defvar kmacro-ring-max) (defvar minibuffer-local-filename-completion-map) (defvar minibuffer-local-must-match-filename-map) (defvar minibuffer-local-filename-must-match-map) (defvar mouse-wheel-down-event) (defvar mouse-wheel-up-event) (defvar read-file-name-function)) (defvar Buffer-menu-mode-map) ; In `buff-menu.el'. (defvar comint-mode-map) ; In `comint.el'. (defvar crm-local-completion-map) ; In `crm.el'. (defvar crm-local-must-match-map) ; In `crm.el'. (defvar dired-mode-map) ; In `dired.el'. (defvar gud-minibuffer-local-map) ; In `gud.el'. (defvar ibuffer-mode-map) ; In `ibuffer.el'. (defvar ibuffer-mode-operate-map) ; In `ibuffer.el'. (defvar icicle-crm-local-completion-map) ; In `icicles-fn.el' after load `crm.el'. (defvar icicle-crm-local-must-match-map) ; In `icicles-fn.el' after load `crm.el'. (defvar icicle-kmacro-ring-max) ; In `icicles-opt.el' for Emacs 22+. (defvar icicle-ORIG-crm-local-completion-map) ; In `icicles-fn.el' after load `crm.el'. (defvar icicle-ORIG-crm-local-must-match-map) ; In `icicles-fn.el' after load `crm.el'. (defvar icicle-saved-kmacro-ring-max) ; In `icicles-var.el' for Emacs 22+. (defvar ielm-map) ; In `ielm.el'. (defvar inferior-tcl-mode-map) ; In `tcl.el'. (defvar Info-mode-map) ; In `info.el'. (defvar isearch-mode-map) ; In `isearch.el'. (defvar menu-bar-buffers-menu-command-entries) ; In `menu-bar.el' for Emacs 24+. (defvar menu-bar-goto-menu) ; In `menu-bar.el'. (defvar savehist-minibuffer-history-variables) ; In `savehist.el' (defvar shell-mode-map) ; In `shell.el'. (defvar sh-mode-map) ; In `sh-script.el'. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "User Options (alphabetical)") ;;; User Options (alphabetical) -------------------------------------- ;; Emacs 20 only (unless (fboundp 'define-minor-mode) (defcustom icicle-mode nil "*Non-nil means use Icicles minibuffer input completion and cycling. Setting this variable directly does not take effect; use either \\[customize] or command `icy-mode' (aka `icicle-mode')." :set (lambda (symbol value) (icicle-mode (if value 1 -1))) :initialize 'custom-initialize-default :type 'boolean :group 'Icicles-Miscellaneous :require 'icicles)) (defcustom icicle-mode-hook nil "*Functions run after entering and exiting Icicle mode." :type 'hook :group 'Icicles-Miscellaneous) ;;(@* "Internal variables (alphabetical)") ;;; Internal variables (alphabetical) -------------------------------- (defvar icicle-mode-map nil "Keymap for Icicle mode. These are top-level key bindings. See also `icicle-define-minibuffer-maps' for minibuffer bindings and bindings in `*Completions*'.") ;;(@* "Icicle mode command") ;;; Icicle mode command ---------------------------------------------- ;; Main command. Inspired from `icomplete-mode'. (defalias 'icy-mode 'icicle-mode) (when (fboundp 'define-minor-mode) ; Emacs 21+ ------------ (when (> emacs-major-version 22) (defadvice call-interactively (after icicle-save-to-history disable activate) "Save command to `icicle-interactive-history'." ;; If command's input is not a parameterized (e.g. mouse) event, record it. (let* ((fn (ad-get-arg 0)) (int (interactive-form fn))) (when (and (symbolp fn) (consp int) (or (not (stringp (cadr int))) (string= (cadr int) "") (not (eq ?e (aref (cadr int) 0))))) (pushnew (symbol-name fn) icicle-interactive-history)))) (when (boundp 'savehist-save-hook) ; Do not save `icicle-interactive-history' (too large). (add-hook 'savehist-save-hook (lambda () (setq savehist-minibuffer-history-variables (delq 'icicle-interactive-history savehist-minibuffer-history-variables))))) ;; Just replace the original ESS definitions so that the new ones use Icicles completion. (defadvice ess-internal-complete-object-name (around icicle-ess-internal-complete-object-name disable activate) "`ess-internal-complete-object-name', but in Icicle mode use Icicles completion." (flet ((comint-dynamic-simple-complete (stub candidates) (icicle-comint-dynamic-simple-complete stub candidates))) ad-do-it)) (defadvice ess-complete-filename (around icicle-ess-complete-filename disable activate) "`ess-complete-filename', but in Icicle mode use Icicles completion." (flet ((comint-dynamic-complete-filename (&optional replace-to-eol-p) (icicle-comint-dynamic-complete-filename replace-to-eol-p)) (comint-replace-by-expanded-filename () ; This one is not used for recent ESS versions. (icicle-comint-replace-by-expanded-filename))) ad-do-it)) (defadvice ess-R-complete-object-name (around icicle-ess-R-complete-object-name disable activate) "`ess-R-complete-object-name', but in Icicle mode use Icicles completion." (flet ((comint-dynamic-simple-complete (stub candidates) (icicle-comint-dynamic-simple-complete stub candidates))) ad-do-it)) (defadvice ess-completing-read (around icicle-ess-completing-read disable activate) "Make `ess-completing-read' use Icicles completion in Icicle mode." (let ((ess-use-ido (or icicle-ess-use-ido nil))) ad-do-it))) (when (> emacs-major-version 21) (defadvice describe-face (before icicle-respect-WYSIWYG activate) "`read-face-name' respects `icicle-WYSIWYG-Completions-flag'. If non-nil, then it does not use `completing-read-multiple' (which cannot take advantage of WYSIWYG)." (interactive (list (read-face-name "Describe face" "= `default' face" (not icicle-WYSIWYG-Completions-flag)))))) ;; Eval this so that even if the library is byte-compiled with Emacs 20, ;; loading it into Emacs 21+ will define variable `icicle-mode'. (eval '(define-minor-mode icicle-mode "Icicle mode: Toggle minibuffer input completion and cycling. Non-nil prefix ARG turns mode on if ARG > 0, else turns it off. Icicle mode is a global minor mode. It binds keys in the minibuffer. You can use `customize-group Icicles' or `C-u customize-mode icicle-mode' to customize Icicles options and faces. For more information, use `\\\\[icicle-minibuffer-help]' \ when the minibuffer is active. Depending on your platform, if you use Icicles in a text terminal \(that is, without a window system/manager), you might need to change some of the key bindings if some of the default bindings are not available to you. Icicle mode defines many top-level commands. For a list, see the Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'." :global t :group 'Icicles :lighter " Icy" :init-value nil (cond (icicle-mode ;; (when (interactive-p) ;; (unless (or window-system (and (fboundp 'daemonp) (daemonp))) ;; (with-output-to-temp-buffer "*Attention*" ;; (princ "You are using Icicles in a text terminal (no window ") ;; (princ "system/manager).\n\nIcicles makes use of many keys that are ") ;; (princ "unavailable when running\nEmacs in a text terminal. You will ") ;; (princ "want to rebind those keys.\n") ;; (princ "See the Icicles doc, section Key Bindings.\n")) ;; (message "Icicles uses keys that might not be suitable for a text terminal") ;; (sit-for 5))) (icicle-define-icicle-maps) (icicle-bind-other-keymap-keys) (add-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup) (add-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection) (add-hook 'minibuffer-exit-hook 'icicle-restore-region-face) (add-hook 'minibuffer-exit-hook 'icicle-unhighlight-lighter) (add-hook 'icicle-post-command-hook 'icicle-activate-mark 'append) (add-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line 'append) (add-hook 'completion-setup-hook 'icicle-set-calling-cmd 'append) (when icicle-customize-save-flag (add-hook 'kill-emacs-hook 'icicle-command-abbrev-save)) (add-hook 'comint-mode-hook 'icicle-comint-hook-fn) (add-hook 'compilation-mode-hook 'icicle-compilation-hook-fn) (add-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn) ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now. ;; $$$$$$ (add-hook 'temp-buffer-show-hook 'icicle-fit-completions-window) (icicle-undo-std-completion-faces) (icicle-redefine-std-completion-fns) (icicle-redefine-standard-functions) (icicle-redefine-standard-options) (icicle-redefine-standard-widgets) (when (ad-find-some-advice 'describe-face 'before 'icicle-respect-WYSIWYG) (ad-enable-advice 'describe-face 'before 'icicle-respect-WYSIWYG) (unless (ad-is-active 'describe-face) (ad-activate 'describe-face))) (when (ad-find-some-advice 'ess-internal-complete-object-name 'around 'icicle-ess-internal-complete-object-name) (ad-enable-advice 'ess-internal-complete-object-name 'around 'icicle-ess-internal-complete-object-name) (unless (ad-is-active 'ess-internal-complete-object-name) (ad-activate 'ess-internal-complete-object-name))) (when (ad-find-some-advice 'ess-complete-filename 'around 'icicle-ess-complete-filename) (ad-enable-advice 'ess-complete-filename 'around 'icicle-ess-complete-filename) (unless (ad-is-active 'ess-complete-filename) (ad-activate 'ess-complete-filename))) (when (ad-find-some-advice 'ess-R-complete-object-name 'around 'icicle-ess-R-complete-object-name) (ad-enable-advice 'ess-R-complete-object-name 'around 'icicle-ess-R-complete-object-name) (unless (ad-is-active 'ess-R-complete-object-name) (ad-activate 'ess-R-complete-object-name))) (when (ad-find-some-advice 'ess-completing-read 'around 'icicle-ess-completing-read) (ad-enable-advice 'ess-completing-read 'around 'icicle-ess-completing-read) (unless (ad-is-active 'ess-completing-read) (ad-activate 'ess-completing-read))) (when (fboundp 'minibuffer-depth-indicate-mode) ; In `mb-depth(+).el' (minibuffer-depth-indicate-mode 99)) (if icicle-menu-items-to-history-flag (add-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history) (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)) (when (> emacs-major-version 22) (when icicle-populate-interactive-history-flag (ad-enable-advice 'call-interactively 'after 'icicle-save-to-history)) (ad-activate 'call-interactively)) (dolist (fn icicle-inhibit-advice-functions) (when (and (fboundp fn) (ad-is-active fn)) (push (cons fn (ad-copy-advice-info fn)) icicle-advice-info-list) (ad-deactivate fn)))) (t (makunbound 'icicle-mode-map) (icicle-restore-other-keymap-keys) (remove-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup) (remove-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection) (remove-hook 'minibuffer-exit-hook 'icicle-restore-region-face) (remove-hook 'icicle-post-command-hook 'icicle-activate-mark) (remove-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line) ;; The pre- and post-command hooks are local to the minibuffer, ;; So they are added in `icicle-minibuffer-setup', not here. ;; Nevertheless, they are removed here when Icicle mode is exited. (remove-hook 'pre-command-hook 'icicle-top-level-prep) (remove-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook t) (remove-hook 'post-command-hook 'icicle-run-icicle-post-command-hook t) (remove-hook 'completion-setup-hook 'icicle-set-calling-cmd) (remove-hook 'kill-emacs-hook 'icicle-command-abbrev-save) (remove-hook 'comint-mode-hook 'icicle-comint-hook-fn) (remove-hook 'compilation-mode-hook 'icicle-compilation-hook-fn) (remove-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn) ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now. ;; $$$$$$ (remove-hook 'temp-buffer-show-hook 'icicle-fit-completions-window) ;; $$ Should restore standard completion faces here. (icicle-restore-std-completion-fns) (icicle-restore-standard-functions) (icicle-restore-standard-options) (icicle-restore-standard-widgets) (when (ad-find-some-advice 'describe-face 'before 'icicle-respect-WYSIWYG) (ad-disable-advice 'describe-face 'before 'icicle-respect-WYSIWYG)) (when (ad-find-some-advice 'ess-internal-complete-object-name 'around 'icicle-ess-internal-complete-object-name) (ad-disable-advice 'ess-internal-complete-object-name 'around 'icicle-ess-internal-complete-object-name)) (when (ad-find-some-advice 'ess-complete-filename 'around 'icicle-ess-complete-filename) (ad-disable-advice 'ess-complete-filename 'around 'icicle-ess-complete-filename)) (when (ad-find-some-advice 'ess-R-complete-object-name 'around 'icicle-ess-R-complete-object-name) (ad-disable-advice 'ess-R-complete-object-name 'around 'icicle-ess-R-complete-object-name)) (when (ad-find-some-advice 'ess-completing-read 'around 'icicle-ess-completing-read) (ad-disable-advice 'ess-completing-read 'around 'icicle-ess-completing-read)) (when (fboundp 'minibuffer-depth-indicate-mode) (minibuffer-depth-indicate-mode -99)) (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history) (when (> emacs-major-version 22) (ad-disable-advice 'call-interactively 'after 'icicle-save-to-history) (ad-activate 'call-interactively)) (dolist (fn icicle-inhibit-advice-functions) (let ((info (memq fn icicle-advice-info-list))) (when (and (fboundp fn) info) (ad-set-advice-info fn info) (when (ad-is-active fn) (ad-activate fn))))))) (unless (eq icicle-guess-commands-in-path 'load) (setq icicle-shell-command-candidates-cache ())) ; Reset - toggle Icy to update. (message "Turning %s Icicle mode..." (icicle-propertize (if icicle-mode "ON" "OFF") 'face 'icicle-msg-emphasis)) (icicle-define-minibuffer-maps icicle-mode) (run-hooks 'icicle-mode-hook) (message "Turning %s Icicle mode...done" (icicle-propertize (if icicle-mode "ON" "OFF") 'face 'icicle-msg-emphasis)))) ;; Do this so users can do `C-u customize-mode icicle-mode'. See Emacs bugs #11299 and #11301. (put 'icicle-mode 'custom-mode-group 'Icicles)) (unless (fboundp 'define-minor-mode) ; Emacs 20 ------------ (defun icicle-mode (&optional arg) "Icicle mode: Toggle minibuffer input completion and cycling. Non-nil prefix ARG turns mode on if ARG > 0, else turns it off. Icicle mode is a global minor mode. It binds keys in the minibuffer. For more information, use `\\\\[icicle-minibuffer-help]' \ when the minibuffer is active. Depending on your platform, if you use Icicles in a text terminal \(that is, without a window system/manager), you might need to change some of the key bindings if some of the default bindings are not available to you. Icicle mode defines many top-level commands. For a list, see the Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'." (interactive "P") (setq icicle-mode (if arg (> (prefix-numeric-value arg) 0) (not icicle-mode))) (icicle-define-minibuffer-maps icicle-mode) (cond (icicle-mode ;; (when (interactive-p) ;; (unless (or window-system (and (fboundp 'daemonp) (daemonp))) ;; (with-output-to-temp-buffer "*Attention*" ;; (princ "You are using Icicles in a text terminal (no window ") ;; (princ "system/manager).\n\nIcicles makes use of many keys that are ") ;; (princ "unavailable when running\nEmacs in a text terminal. You will ") ;; (princ "want to rebind those keys.\n") ;; (princ "See the Icicles doc, section Key Bindings.\n")) ;; (message "Icicles uses keys that might not be suitable for a text terminal") ;; (sit-for 5))) (icicle-define-icicle-maps) (icicle-bind-other-keymap-keys) ;; This is not really necessary after the first time - no great loss. (add-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup) (add-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection) (add-hook 'minibuffer-exit-hook 'icicle-restore-region-face) (add-hook 'minibuffer-exit-hook 'icicle-unhighlight-lighter) (add-hook 'icicle-post-command-hook 'icicle-activate-mark 'append) (add-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line 'append) (add-hook 'completion-setup-hook 'icicle-set-calling-cmd 'append) (when icicle-customize-save-flag (add-hook 'kill-emacs-hook 'icicle-command-abbrev-save)) (add-hook 'comint-mode-hook 'icicle-comint-hook-fn) (add-hook 'compilation-mode-hook 'icicle-compilation-hook-fn) (add-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn) ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now. ;; $$$$$$ (add-hook 'temp-buffer-show-hook 'icicle-fit-completions-window) (icicle-redefine-std-completion-fns) (icicle-redefine-standard-functions) (icicle-redefine-standard-options) (icicle-redefine-standard-widgets) (if icicle-menu-items-to-history-flag (add-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history) (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)) (dolist (fn icicle-inhibit-advice-functions) (when (and (fboundp fn) (ad-is-active fn)) (push (cons fn (ad-copy-advice-info fn)) icicle-advice-info-list) (ad-deactivate fn))) (run-hooks 'icicle-mode-hook) (message "Icicle mode is now ON")) (t (makunbound 'icicle-mode-map) (icicle-restore-other-keymap-keys) (remove-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup) (remove-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection) (remove-hook 'minibuffer-exit-hook 'icicle-restore-region-face) (remove-hook 'icicle-post-command-hook 'icicle-activate-mark) (remove-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line) ;; The pre- and post-command hooks are local to the minibuffer, ;; So they are added in `icicle-minibuffer-setup', not here. ;; Nevertheless, they are removed here when Icicle mode is exited. (remove-hook 'pre-command-hook 'icicle-top-level-prep) (remove-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook t) (remove-hook 'post-command-hook 'icicle-run-icicle-post-command-hook t) (remove-hook 'completion-setup-hook 'icicle-set-calling-cmd) (remove-hook 'kill-emacs-hook 'icicle-command-abbrev-save) (remove-hook 'comint-mode-hook 'icicle-comint-hook-fn) (remove-hook 'compilation-mode-hook 'icicle-compilation-hook-fn) (remove-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn) ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now. ;; $$$$$$ (remove-hook 'temp-buffer-show-hook 'icicle-fit-completions-window) (icicle-restore-std-completion-fns) (icicle-restore-standard-functions) (icicle-restore-standard-options) (icicle-restore-standard-widgets) (unless (eq icicle-guess-commands-in-path 'load) (setq icicle-shell-command-candidates-cache ())) ; Reset - toggle Icy to update. (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history) (dolist (fn icicle-inhibit-advice-functions) (let ((info (memq fn icicle-advice-info-list))) (when (and (fboundp fn) info) (ad-set-advice-info fn info) (when (ad-is-active fn) (ad-activate fn))))) (run-hooks 'icicle-mode-hook) (message "Icicle mode is now OFF"))) (add-to-list 'minor-mode-alist '(icicle-mode " Icy")))) ;; `Minibuf' > `Save/Retrieve Candidates' Menu------------------------ (defvar icicle-minibuf-save-retrieve-menu-map (make-sparse-keymap) "`Minibuf' > `Save/Retrieve Candidates' submenu.") (define-key icicle-minibuf-save-retrieve-menu-map [icicle-saved-completion-candidates] '(menu-item "Swap Saved and Current Sets" icicle-candidate-set-swap :enable icicle-saved-completion-candidates :help "Swap the saved and current sets of completion candidates")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save-more-selected] '(menu-item "Save More Selected (Region) Candidates" icicle-candidate-set-save-more-selected :help "Add the candidates in the region to the saved candidates")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save-selected] '(menu-item "Save Selected (Region) Candidates" icicle-candidate-set-save-selected :help "Save the candidates in the region, for later recall")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save-more] '(menu-item "Save More Candidates" icicle-candidate-set-save-more :help "Add current completion candidates to saved candidates set")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save-persistently] '(menu-item " to Cache File..." icicle-candidate-set-save-persistently :help "Save current completion candidates to a cache file, for later recall")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save-to-variable] '(menu-item " to Variable..." icicle-candidate-set-save-to-variable :help "Save current completion candidates to a variable, for later recall")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-save] '(menu-item "Save Candidates" icicle-candidate-set-save :help "Save the set of current completion candidates, for later recall")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-retrieve-more] '(menu-item "Retrieve More Saved Candidates" icicle-candidate-set-retrieve-more :help "Add saved candidates to current completion candidates")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-retrieve-persistent] '(menu-item " from Cache File..." icicle-candidate-set-retrieve-persistent :help "Retrieve saved completion candidates from a cache file, making them current")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-retrieve-from-variable] '(menu-item " from Variable..." icicle-candidate-set-retrieve-from-variable :help "Retrieve saved completion candidates from variable, making them current")) (define-key icicle-minibuf-save-retrieve-menu-map [icicle-candidate-set-retrieve] '(menu-item "Retrieve Saved Candidates" icicle-candidate-set-retrieve :enable icicle-saved-completion-candidates :help "Retrieve the saved set of completion candidates, making it current")) ;; `Minibuf' > `Candidate Set' Menu----------------------------------- (defvar icicle-minibuf-candidate-set-menu-map (make-sparse-keymap) "`Minibuf' > `Candidate Set' submenu.") (define-key icicle-minibuf-candidate-set-menu-map [icicle-candidate-set-define] '(menu-item "Define Candidates by Lisp Sexp" icicle-candidate-set-define :help "Define the set of current completion candidates by evaluating a sexp")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-keep-only-past-inputs] '(menu-item "Keep Only Previously Entered" icicle-keep-only-past-inputs :enable (and icicle-completion-candidates (consp (symbol-value minibuffer-history-variable))) :help "Removed candidates that you have not previously chosen and entered")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-candidate-set-union] '(menu-item "Add (Union) Saved Candidate Set" icicle-candidate-set-union :enable icicle-saved-completion-candidates :help "Set union between the current and saved completion candidates")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-candidate-set-difference] '(menu-item "Subtract Saved Candidate Set" icicle-candidate-set-difference :enable icicle-saved-completion-candidates :help "Set difference between the current and saved completion candidates")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-candidate-set-intersection] '(menu-item "Intersect Saved Candidate Set" icicle-candidate-set-intersection :enable icicle-saved-completion-candidates :help "Set intersection between the current and saved candidates")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-save-predicate-to-variable] '(menu-item "Save Predicate to Variable" icicle-save-predicate-to-variable :help "Save the current completion predicate to a variable")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-narrow-candidates-with-predicate] '(menu-item "Satisfy Also Predicate..." icicle-narrow-candidates-with-predicate :help "Match another input pattern (narrow completions set)" :enable icicle-completion-candidates)) (define-key icicle-minibuf-candidate-set-menu-map [icicle-narrow-candidates] '(menu-item "Match Also Regexp..." icicle-narrow-candidates :enable icicle-completion-candidates :help "Match another input pattern (narrow completions set)")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-widen-candidates] '(menu-item "Match Alternative..." icicle-widen-candidates :enable icicle-completion-candidates :help "Match alternative input pattern (widen completions set)")) (define-key icicle-minibuf-candidate-set-menu-map [icicle-candidate-set-complement] '(menu-item "Complement Candidates" icicle-candidate-set-complement :help "Complement the set of current completion candidates")) ;; `Minibuf' > `Act on All Candidates' Menu--------------------------- (defvar icicle-minibuf-act-on-all-menu-map (make-sparse-keymap) "`Minibuf' > `Act on All Candidates' submenu.") (define-key icicle-minibuf-act-on-all-menu-map [icicle-all-candidates-list-alt-action] '(menu-item "Alternate Act on List" icicle-all-candidates-list-alt-action :help "Apply the alternative action to the list of matching completion candidates" :enable icicle-all-candidates-list-alt-action-fn)) (define-key icicle-minibuf-act-on-all-menu-map [icicle-all-candidates-alt-action] '(menu-item "Alternate Act on Each" icicle-all-candidates-alt-action :help "Apply the alternative action to each matching completion candidates" :enable icicle-candidate-alt-action-fn)) (define-key icicle-minibuf-act-on-all-menu-map [separator-alt] '("--")) (define-key icicle-minibuf-act-on-all-menu-map [icicle-all-candidates-list-action] '(menu-item "Act on List" icicle-all-candidates-list-action :help "Apply the command action to the list of matching completion candidates" :enable icicle-all-candidates-list-action-fn)) (define-key icicle-minibuf-act-on-all-menu-map [icicle-all-candidates-action] '(menu-item "Act on Each" icicle-all-candidates-action :help "Apply the command action to each matching completion candidates" :enable icicle-candidate-action-fn)) ;; `Minibuf' > `History' Menu-------------------------------------------- (defvar icicle-minibuf-history-menu-map (make-sparse-keymap) "`Minibuf' > `History' submenu.") (define-key icicle-minibuf-history-menu-map [icicle-clear-current-history] '(menu-item "Clear History Entries" icicle-clear-current-history :help "Clear current minibuffer history of selected entries")) (define-key icicle-minibuf-history-menu-map [icicle-erase-minibuffer] '(menu-item "Delete from History" icicle-erase-minibuffer-or-history-element :visible (memq last-command '(previous-history-element next-history-element icicle-erase-minibuffer-or-history-element previous-matching-history-element next-matching-history-element)) :help "Delete current history element (in minibuffer now)" :keys "M-k")) (define-key icicle-minibuf-history-menu-map [history-isearch-forward] '(menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward")) (define-key icicle-minibuf-history-menu-map [history-isearch-backward] '(menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward")) (define-key icicle-minibuf-history-menu-map [history-next] '(menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer")) (define-key icicle-minibuf-history-menu-map [history-previous] '(menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer")) ;; `Minibuf' > `Edit' Menu-------------------------------------------- (defvar icicle-minibuf-edit-menu-map (make-sparse-keymap) "`Minibuf' > `Edit' submenu.") (define-key icicle-minibuf-edit-menu-map [icicle-delete-history-element] '(menu-item "Clear (Erase) Minibuffer" icicle-erase-minibuffer-or-history-element :visible (not (memq last-command '(previous-history-element next-history-element icicle-erase-minibuffer-or-history-element previous-matching-history-element next-matching-history-element))) :help "Erase the Minibuffer" :keys "M-k")) (define-key icicle-minibuf-edit-menu-map [icicle-goto/kill-failed-input] '(menu-item "Cursor to Mismatch (Repeat: Kill)" icicle-goto/kill-failed-input :visible icicle-completing-p :enable (and (overlayp icicle-input-completion-fail-overlay) (overlay-start icicle-input-completion-fail-overlay)) :help "Put cursor where input fails to complete - repeat to kill mismatch")) (define-key icicle-minibuf-edit-menu-map [icicle-retrieve-next-input] '(menu-item "Restore Next Completion Input" icicle-retrieve-next-input :visible icicle-completing-p :enable (consp (symbol-value (if (icicle-file-name-input-p) 'icicle-previous-raw-file-name-inputs 'icicle-previous-raw-non-file-name-inputs))) :help "Cycle forward to insert a previous completion input in the minibuffer (`C-u': \ complete)")) (define-key icicle-minibuf-edit-menu-map [icicle-retrieve-previous-input] '(menu-item "Restore Previous Completion Input" icicle-retrieve-previous-input :visible icicle-completing-p :enable (consp (symbol-value (if (icicle-file-name-input-p) 'icicle-previous-raw-file-name-inputs 'icicle-previous-raw-non-file-name-inputs))) :help "Cycle backward to insert a previous completion input in the minibuffer (`C-u': \ complete)")) (define-key icicle-minibuf-edit-menu-map [icicle-regexp-quote-input] '(menu-item "Regexp-Quote Input" icicle-regexp-quote-input :enable (with-current-buffer (window-buffer (minibuffer-window)) (goto-char (icicle-minibuffer-prompt-end)) (not (eobp))) :help "Regexp-quote current input or its active region, then apropos-complete" :keys "M-%")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-key-description] '(menu-item "Insert Key Description" icicle-insert-key-description :visible (not icicle-searching-p) :keys "M-q" :help "Read key and insert its description - e.g., reading ^F inserts `C-f'")) (define-key icicle-minibuf-edit-menu-map [icicle-roundup] '(menu-item "Insert Completion Candidate(s)" icicle-roundup :visible icicle-completing-p :enable icicle-completion-candidates :help "Insert one or more completion candidates in the minibuffer" :keys "M-r")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-string-from-a-var] '(menu-item "Insert String from a Variable..." icicle-insert-string-from-variable :visible current-prefix-arg :keys "C-=" :help "Read a variable name and insert its string value into the minibuffer")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-string-from-std-var] '(menu-item "Insert `icicle-input-string'" icicle-insert-string-from-variable :visible (not current-prefix-arg) :keys "C-=" :help "Insert text from variable `icicle-input-string' into the minibuffer")) (define-key icicle-minibuf-edit-menu-map [icicle-completing-read+insert] '(menu-item "Insert On-Demand Completion" icicle-completing-read+insert :visible (consp icicle-completing-read+insert-candidates) :help "Read and insert something using (lax) completion")) (define-key icicle-minibuf-edit-menu-map [icicle-read+insert-file-name] '(menu-item "Insert File Name" icicle-read+insert-file-name :help "Read and insert a file name using (lax) completion")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-history-element] '(menu-item "Insert Past Input(s) using Completion" icicle-insert-history-element :enable (consp (symbol-value minibuffer-history-variable)) :help "Use completion to insert a previous input into the minibuffer")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-list-join-string] '(menu-item "Insert Join-String" icicle-insert-list-join-string :visible icicle-multi-completing-p :help "Insert `icicle-list-join-string' into the minibuffer" :keys "C-M-j")) (define-key icicle-minibuf-edit-menu-map [icicle-insert-string-at-point] '(menu-item "Insert Text from Point" icicle-insert-string-at-point :help "Insert text at or near the cursor into the minibuffer")) (defun icicle-add-menu-item-to-cmd-history () "Add `this-command' to command history, if it is a menu item. Menu items that are not associated with a command symbol are ignored. Used on `pre-command-hook'." (condition-case nil ; Just in case, since this is on `pre-command-hook'. (when (and (> (length (this-command-keys-vector)) 0) (equal '(menu-bar) (elt (this-command-keys-vector) 0)) ;; Exclude uninterned symbols such as `menu-function-356'. (symbolp this-command) (or (< emacs-major-version 21) (intern-soft this-command))) (pushnew (symbol-name this-command) extended-command-history)) (error nil))) (defun icicle-top-level-prep () "Do top-level stuff. Used in `pre-command-hook'." ;; Reset `icicle-current-TAB-method' and `icicle-apropos-complete-match-fn' if temporary. ;; Save this top-level command as `icicle-last-top-level-command' ;; Reset `icicle-candidates-alist' to (). (when (= 0 (recursion-depth)) (let ((TAB-method (get 'icicle-last-top-level-command 'icicle-current-TAB-method)) (apropos-fn (get 'icicle-last-top-level-command 'icicle-apropos-complete-match-fn))) (when TAB-method (setq icicle-current-TAB-method TAB-method)) (when apropos-fn (setq icicle-apropos-complete-match-fn apropos-fn))) (setq icicle-last-top-level-command this-command icicle-candidates-alist ()))) (defun icicle-define-icicle-maps () "Define `icicle-mode-map' and `icicle-menu-map'." (setq icicle-mode-map (make-sparse-keymap)) ; Recreate it each time, to capture latest bindings. ;; Define `Icicles' menu-bar menu. Create it only once: sacrifice any new bindings for speed. (unless icicle-menu-map (setq icicle-menu-map (make-sparse-keymap "Icicles")) ;; End of `Icicles' menu ----------------------------------------- (define-key icicle-menu-map [icicle-report-bug] '(menu-item "Send Icicles Bug Report" icicle-send-bug-report)) (define-key icicle-menu-map [icicle-customize-icicles-group] '(menu-item "Customize Icicles" icicle-customize-icicles-group)) (define-key icicle-menu-map [icicle-help] '(menu-item "Icicles Help" icicle-minibuffer-help :help "Display help for minibuffer input and completion" :keys "M-? in minibuf")) ;; `Options' ----------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-options-menu-map (make-sparse-keymap) "`Options' > `Icicles' submenu.") (define-key menu-bar-options-menu [icicles] (list 'menu-item "Icicles" icicle-options-menu-map :visible 'icicle-mode))) (t (defvar icicle-options-menu-map (make-sparse-keymap) "`Icicles' > `Icicles Options' submenu.") (define-key icicle-menu-map [options] (list 'menu-item "Icicles Options" icicle-options-menu-map)))) (define-key icicle-options-menu-map [icicle-set-option-to-t] '(menu-item "+ Turn On Any Option..." icicle-set-option-to-t :help "Set boolean option to `t' (C-u: any user option, C--: any var)")) (define-key icicle-options-menu-map [icicle-reset-option-to-nil] '(menu-item "+ Turn Off Any Option..." icicle-reset-option-to-nil :help "Reset an option to `nil' (C-u: reset any variable)")) (define-key icicle-options-menu-map [icicle-toggle-option] '(menu-item "+ Toggle Any Option..." icicle-toggle-option :help "Toggle boolean option (C-u: any user option, C--: any var)")) (define-key icicle-options-menu-map [icicle-toggle-C-for-actions] '(menu-item "Toggle Using `C-' for Actions" icicle-toggle-C-for-actions :keys "M-g" :help "Toggle option `icicle-use-C-for-actions-flag'")) (define-key icicle-options-menu-map [icicle-toggle-~-for-home-dir] '(menu-item "Toggle Using `~' for $HOME" icicle-toggle-~-for-home-dir :keys "M-~" :help "Toggle option `icicle-use-~-for-home-dir-flag'")) (define-key icicle-options-menu-map [icicle-toggle-WYSIWYG-Completions] '(menu-item "Toggle WYSIWYG For `*Completions*'" icicle-toggle-WYSIWYG-Completions :help "Toggle option `icicle-WYSIWYG-Completions-flag'")) (define-key icicle-options-menu-map [icicle-next-TAB-completion-method] '(menu-item "Next `TAB' Completion Method" icicle-next-TAB-completion-method :keys "C-(" :help "Cycle to the next `TAB' completion method (C-u: ONE-OFF)")) (define-key icicle-options-menu-map [icicle-next-S-TAB-completion-method] '(menu-item "Next `S-TAB' Completion Method" icicle-next-S-TAB-completion-method :keys "M-(" :help "Cycle to the next `S-TAB' completion method (C-u: ONE-OFF)")) (when (fboundp 'icicle-cycle-image-file-thumbnail) (define-key icicle-options-menu-map [icicle-cycle-image-file-thumbnail] '(menu-item "Next Image-File Thumbnail Setting" icicle-cycle-image-file-thumbnail :keys "C-x t" :help "Cycle Thumbnail Image File Setting"))) (define-key icicle-options-menu-map [icicle-toggle-search-cleanup] '(menu-item "Toggle Icicle-Search Highlighting Cleanup" icicle-toggle-search-cleanup :keys "C-." :help "Toggle option `icicle-search-cleanup-flag'")) (define-key icicle-options-menu-map [icicle-toggle-search-replace-common-match] '(menu-item "Toggle Replacing Longest Common Match" icicle-toggle-search-replace-common-match :enable icicle-searching-p :keys "M-;" :help "Toggle option `icicle-search-replace-common-match-flag'")) (define-key icicle-options-menu-map [icicle-toggle-search-replace-whole] '(menu-item "Toggle Replacing Whole Search Hit" icicle-toggle-search-replace-whole :enable icicle-searching-p :keys "M-_" :help "Toggle option `icicle-search-replace-whole-candidate-flag'")) (define-key icicle-options-menu-map [icicle-toggle-search-whole-word] '(menu-item "Toggle Whole-Word Searching (Icicles Search)" icicle-toggle-search-whole-word :enable icicle-searching-p :keys "M-q" :help "Toggle `icicle-search-whole-word-flag'")) (define-key icicle-options-menu-map [icicle-toggle-regexp-quote] '(menu-item "Toggle Escaping Special Chars" icicle-toggle-regexp-quote :keys "C-`" :help "Toggle option `icicle-regexp-quote-flag'")) (define-key icicle-options-menu-map [icicle-toggle-dot] '(menu-item "Toggle `.' Matching Newlines Too" icicle-toggle-dot :keys "C-M-." :help "Toggle `icicle-dot-string' between `.' and `icicle-anychar-regexp'")) (define-key icicle-options-menu-map [icicle-cycle-incremental-completion] '(menu-item "Cycle Incremental Completion" icicle-cycle-incremental-completion :keys "C-#" :help "Cycle option `icicle-incremental-completion'")) (define-key icicle-options-menu-map [icicle-toggle-show-multi-completion] '(menu-item "Toggle Showing Multi-Completions" icicle-toggle-show-multi-completion :help "Toggle option `icicle-show-multi-completion-flag'")) (define-key icicle-options-menu-map [icicle-toggle-completions-format] '(menu-item "Toggle Horizontal/Vertical Layout" icicle-toggle-completions-format :help "Toggle option `icicle-hide-non-matching-lines-flag'")) (define-key icicle-options-menu-map [icicle-toggle-hiding-non-matching-lines] '(menu-item "Toggle Hiding Non-Matching Lines" icicle-toggle-hiding-non-matching-lines :keys "C-u C-x ." :help "Toggle option `icicle-hide-non-matching-lines-flag'")) (define-key icicle-options-menu-map [icicle-toggle-hiding-common-match] '(menu-item "Toggle Hiding Common Match" icicle-toggle-hiding-common-match :keys "C-x ." :help "Toggle option `icicle-hide-common-match-in-Completions-flag'")) (define-key icicle-options-menu-map [icicle-toggle-expand-to-common-match] '(menu-item "Toggle Expansion to Common Match" icicle-toggle-expand-to-common-match :keys "C-\"" :help "Toggle option `icicle-expand-input-to-common-match'")) (define-key icicle-options-menu-map [icicle-toggle-ignoring-comments] '(menu-item "Toggle Ignoring Comments" icicle-toggle-ignoring-comments :keys "C-M-;" :help "Toggle option `icicle-ignore-comments-flag'")) (define-key icicle-options-menu-map [icicle-toggle-ignored-space-prefix] '(menu-item "Toggle Ignoring Space Prefix" icicle-toggle-ignored-space-prefix :keys "M-_" :help "Toggle option `icicle-buffer-ignore-space-prefix-flag'")) (define-key icicle-options-menu-map [icicle-toggle-ignored-extensions] '(menu-item "Toggle Ignored File Extensions" icicle-toggle-ignored-extensions :keys "C-." :help "Toggle respect of `completion-ignored-extensions'")) (define-key icicle-options-menu-map [icicle-toggle-remote-file-testing] '(menu-item "Toggle Remote File Handling" icicle-toggle-remote-file-testing :enable (not icicle-searching-p) :keys "C-^" :help "Toggle option `icicle-test-for-remote-files-flag'")) (when (> emacs-major-version 20) (define-key icicle-options-menu-map [icicle-toggle-angle-brackets] '(menu-item "Toggle Angle Brackets" icicle-toggle-angle-brackets :help "Toggle option `icicle-key-descriptions-use-<>-flag'"))) (define-key icicle-options-menu-map [icicle-toggle-annotation] '(menu-item "Toggle Candidate Annotation" icicle-toggle-annotation :keys "C-x C-a" :help "Toggle option `icicle-show-annotations-flag': hide/show annotations")) (define-key icicle-options-menu-map [icicle-toggle-highlight-saved-candidates] '(menu-item "Toggle Highlighting Saved Candidates" icicle-toggle-highlight-saved-candidates :keys "S-pause" :help "Toggle option `icicle-highlight-saved-candidates-flag'")) (define-key icicle-options-menu-map [icicle-toggle-highlight-historical-candidates] '(menu-item "Toggle Highlighting Past Inputs" icicle-toggle-highlight-historical-candidates :keys "C-pause" :help "Toggle option `icicle-highlight-historical-candidates-flag'")) (define-key icicle-options-menu-map [icicle-toggle-case-sensitivity] '(menu-item "Toggle Case Sensitivity" icicle-toggle-case-sensitivity :keys "C-A" :help "Toggle `case-fold-search', `completion-ignore-case' (C-u: file & buffer too)")) (define-key icicle-options-menu-map [icicle-toggle-proxy-candidates] '(menu-item "Toggle Including Proxy Candidates" icicle-toggle-proxy-candidates :keys "C-M-_" :help "Toggle option `icicle-add-proxy-candidates-flag'")) (define-key icicle-options-menu-map [icicle-toggle-transforming] '(menu-item "Toggle Duplicate Removal" icicle-toggle-transforming :keys "C-$" :help "Toggle use of `icicle-transform-function' (default: remove dups)")) (define-key icicle-options-menu-map [icicle-toggle-alternative-sorting] '(menu-item "Swap Alternative Sort" icicle-toggle-alternative-sorting :keys "C-M-," :help "Swap current sort order for current alternative sort order")) (define-key icicle-options-menu-map [icicle-change-alternative-sort-order] '(menu-item "Change Alternative Sort Order" icicle-change-alternative-sort-order :keys "M-," :help "Choose alt sort order (C-9: reverse, C-u: cyle/complete)")) (define-key icicle-options-menu-map [icicle-change-sort-order] '(menu-item "Change Sort Order" icicle-change-sort-order :enable (not icicle-inhibit-sort-p) :keys "C-," :help "Choose sort order (C-9: reverse, C-u: cyle/complete)")) (when (fboundp 'doremi) (when (fboundp 'text-scale-increase) ; Emacs 23+. (define-key icicle-options-menu-map [icicle-doremi-zoom-Completions+] '(menu-item "*Completions* Zoom Factor - Do Re Mi" icicle-doremi-zoom-Completions+ :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x -" :help "Zoom text in `*Completions*' incrementally"))) (define-key icicle-options-menu-map [icicle-doremi-inter-candidates-min-spaces+] '(menu-item "*Completions* Candidate Spacing - Do Re Mi" icicle-doremi-inter-candidates-min-spaces+ :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x |" :help "Change `icicle-inter-candidates-min-spaces' incrementally")) (define-key icicle-options-menu-map [icicle-doremi-candidate-width-factor+] '(menu-item "*Completions* Column Width - Do Re Mi" icicle-doremi-candidate-width-factor+ :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x w" :help "Change `icicle-candidate-width-factor' incrementally")) (define-key icicle-options-menu-map [icicle-doremi-increment-swank-prefix-length+] '(menu-item "Swank Min Match Chars - Do Re Mi" icicle-doremi-increment-swank-prefix-length+ :visible (eq (icicle-current-TAB-method) 'swank) :keys "C-x 2" :help "Change `icicle-swank-prefix-length' incrementally")) (define-key icicle-options-menu-map [icicle-doremi-increment-swank-timeout+] '(menu-item "Swank Timeout - Do Re Mi" icicle-doremi-increment-swank-timeout+ :visible (eq (icicle-current-TAB-method) 'swank) :keys "C-x 1" :help "Change `icicle-swank-timeout' incrementally")) (define-key icicle-options-menu-map [icicle-doremi-increment-max-candidates+] '(menu-item "Max # of Completions - Do Re Mi" icicle-doremi-increment-max-candidates+ :visible (active-minibuffer-window) :keys "C-x #" :help "Change `icicle-max-candidates' incrementally"))) ;; Beginning of non-submenu `Icicles' menu ----------------------- (define-key icicle-menu-map [icicle-separator-help] '("--")) (define-key icicle-menu-map [icicle-mode] '(menu-item "Turn Off Icicle Mode" icicle-mode)) (define-key icicle-menu-map [icicle-top-level] '(menu-item "Top Level (Cancel All Minibuffers)" icicle-top-level :enable (active-minibuffer-window) :help "Cancel all minibuffers and return to the top level" :keys "C-M-T")) (define-key icicle-menu-map [icicle-abort] '(menu-item "Cancel This Minibuffer" icicle-abort-recursive-edit :enable (active-minibuffer-window) :help "Cancel this minibuffer and return to the next higher level")) (define-key icicle-menu-map [icicle-separator-levels] '("--")) (define-key icicle-menu-map [icicle-apply] '(menu-item "+ Apply Function to Alist Items..." icicle-apply :help "Selectively apply a function to elements in an alist")) (define-key icicle-menu-map [icicle-save-string-to-variable] '(menu-item "Save String to Variable..." icicle-save-string-to-variable :help "Save a string (text) you are prompted for to a variable")) (define-key icicle-menu-map [icicle-color-theme] '(menu-item "+ Choose Color Theme..." icicle-color-theme :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Change color theme (cycling etc.)")) (define-key icicle-menu-map [icicle-remove-saved-completion-set] '(menu-item "+ Remove Saved Candidate Set..." icicle-remove-saved-completion-set :enable icicle-saved-completion-sets :help "Remove an entry from `icicle-saved-completion-sets'")) (define-key icicle-menu-map [icicle-add/update-saved-completion-set] '(menu-item "Add/Update Saved Candidate Set..." icicle-add/update-saved-completion-set :help "Add or update an entry in `icicle-saved-completion-sets'")) (when (fboundp 'icicle-kmacro) (define-key icicle-menu-map [icicle-kmacro] '(menu-item "+ Execute Nth Keyboard Macro..." icicle-kmacro :enable (or (kmacro-ring-head) kmacro-ring) :help "Execute a keyboard macro according to its position in `kmacro-ring'"))) (define-key icicle-menu-map [icicle-execute-named-keyboard-macro] '(menu-item "+ Execute Named Keyboard Macro..." icicle-execute-named-keyboard-macro :help "Read the name of a keyboard macro, then execute it")) ;; `Customize' --------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-custom-menu-map (make-sparse-keymap) "`Customize Emacs' > `Icicles' submenu.") (define-key menu-bar-custom-menu [icicles] (list 'menu-item "Icicles" icicle-custom-menu-map :visible 'icicle-mode))) (t (defvar icicle-custom-menu-map (make-sparse-keymap) "`Icicles' > `Customize' submenu.") (define-key icicle-menu-map [customize] (list 'menu-item "Customize" icicle-custom-menu-map)))) (define-key icicle-custom-menu-map [icicle-customize-apropos] '(menu-item "Groups, Faces & Options Matching..." icicle-customize-apropos :help "Customize groups, faces, and options that match a regexp")) (define-key icicle-custom-menu-map [icicle-customize-face-other-window] '(menu-item "+ Face..." icicle-customize-face-other-window :help "Customize any number of faces (`C-RET')")) (define-key icicle-custom-menu-map [icicle-customize-apropos-faces] '(menu-item "Faces Matching..." icicle-customize-apropos-faces :help "Customize faces that match a regexp")) (define-key icicle-custom-menu-map [icicle-customize-apropos-opts-w-val-satisfying] '(menu-item "Options Matching with a Value Satisfying..." icicle-customize-apropos-opts-w-val-satisfying :help "Customize options whose values satisfy a predicate that match a regexp")) (define-key icicle-custom-menu-map [icicle-customize-apropos-options-of-type] '(menu-item "Options of Type Matching..." icicle-customize-apropos-options-of-type :help "Customize user options of a given type that match a regexp")) (define-key icicle-custom-menu-map [icicle-customize-apropos-options] '(menu-item "Options Matching..." icicle-customize-apropos-options :help "Customize user options that match a regexp")) (define-key icicle-custom-menu-map [icicle-customize-apropos-groups] '(menu-item "Groups Matching..." icicle-customize-apropos-groups :help "Customize customization groups that match a regexp")) ;; `Apropos' ----------------------------------------------------- (cond ((and (not icicle-touche-pas-aux-menus-flag) (boundp 'menu-bar-apropos-menu)) (defvar icicle-apropos-menu-map (make-sparse-keymap) "`Help' > `Apropos' > `Icicles' submenu.") (define-key menu-bar-apropos-menu [icicles] (list 'menu-item "Icicles" icicle-apropos-menu-map :visible 'icicle-mode))) (t (defvar icicle-apropos-menu-map (make-sparse-keymap) "`Icicles' > `Apropos' submenu.") (define-key icicle-menu-map [apropos] (list 'menu-item "Apropos" icicle-apropos-menu-map)))) (define-key icicle-apropos-menu-map [icicle-apropos-zippy] '(menu-item "Zippy..." icicle-apropos-zippy :help "Show all Zippy quotes matching a regular-expression")) (cond ((fboundp 'apropos-option) (define-key icicle-apropos-menu-map [icicle-apropos] '(menu-item "Symbols..." icicle-apropos :help "Like `apropos', but lets you see the list of matches (with `S-TAB')")) (define-key icicle-apropos-menu-map [icicle-apropos-vars-w-val-satisfying] '(menu-item "Variables with a Value Satisfying..." icicle-apropos-vars-w-val-satisfying :help "Show variables whose values satisfy a given predicate")) (define-key icicle-apropos-menu-map [icicle-apropos-value] '(menu-item "Variables with Values..." icicle-apropos-value :help "Show variables that match by name and/or value")) (define-key icicle-apropos-menu-map [icicle-apropos-variable] '(menu-item "Variables..." icicle-apropos-variable :help "Show variables that match PATTERN")) (define-key icicle-apropos-menu-map [icicle-apropos-options-of-type] '(menu-item "Options of Type..." icicle-apropos-options-of-type :help "Show user options (variables) of a given `defcustom' type")) (define-key icicle-apropos-menu-map [icicle-apropos-option] '(menu-item "Options..." icicle-apropos-option :help "Show user options (variables) that match PATTERN")) (define-key icicle-apropos-menu-map [icicle-apropos-function] '(menu-item "Functions..." icicle-apropos-function :help "Show functions that match PATTERN")) (define-key icicle-apropos-menu-map [icicle-apropos-command] '(menu-item "Commands..." icicle-apropos-command :help "Show commands that match PATTERN"))) (t (define-key icicle-apropos-menu-map [icicle-apropos-vars-w-val-satisfying] '(menu-item "Variables with a Value Satisfying..." icicle-apropos-vars-w-val-satisfying :help "Show variables whose values satisfy a given predicate")) (define-key icicle-apropos-menu-map [icicle-apropos-value] '(menu-item "Variables with Values..." icicle-apropos-value :help "Show variables that match by name and/or value")) (define-key icicle-apropos-menu-map [icicle-apropos-variable] '(menu-item "Variables..." icicle-apropos-variable :help "Show variables that match PATTERN")) (define-key icicle-apropos-menu-map [icicle-apropos-command] '(menu-item "Commands..." icicle-apropos-command :help "Show commands that match PATTERN")))) ;; `Describe' ---------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-describe-menu-map (make-sparse-keymap) "`Describe' > `Icicles' submenu.") (define-key menu-bar-describe-menu [icicles] (list 'menu-item "Icicles" icicle-describe-menu-map :visible 'icicle-mode))) (t (defvar icicle-describe-menu-map (make-sparse-keymap) "`Icicles' > `Describe' submenu.") (define-key icicle-menu-map [describe] (list 'menu-item "Describe" icicle-describe-menu-map :visible 'icicle-mode)))) (define-key icicle-describe-menu-map [icicle-plist] '(menu-item "+ Symbol with Property List..." icicle-plist :help "Choose a symbol and its property list")) (define-key icicle-describe-menu-map [icicle-doc] '(menu-item "+ Doc of Fun, Var, or Face..." icicle-doc :help "Choose documentation for a symbol")) (define-key icicle-describe-menu-map [icicle-fundoc] '(menu-item "+ Function with Name, Doc..." icicle-fundoc :help "Choose a function description")) (define-key icicle-describe-menu-map [icicle-vardoc] '(menu-item "+ Variable with Name, Doc..." icicle-vardoc :help "Choose a variable description")) (define-key icicle-describe-menu-map [icicle-describe-var-w-val-satisfying] '(menu-item "+ Variable with Value Satifying..." icicle-describe-var-w-val-satisfying :help "Describe a variable that satisfies a given predicate")) (define-key icicle-describe-menu-map [icicle-describe-option-of-type] '(menu-item "+ Option of Type..." icicle-describe-option-of-type :help "Describe a user option that was defined with a given `defcustom' type")) (define-key icicle-describe-menu-map [icicle-where-is] '(menu-item "+ Where Is..." icicle-where-is :help "Show keyboard/menu/mouse sequences that invoke specified command")) (when icicle-touche-pas-aux-menus-flag (define-key icicle-menu-map [icicle-separator-about] '("--"))) ;; `Search' and `Emacs Tags' (or `Tags') ------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (cond ((boundp 'menu-bar-search-tags-menu) ; `Tags' menu defined in `menu-bar+.el'. (defvar icicle-search-menu-map (make-sparse-keymap) "`Search' > `Icicles' menu.") (define-key menu-bar-search-menu [icicles] (list 'menu-item "Icicles" icicle-search-menu-map :visible 'icicle-mode)) (defvar icicle-search-tags-menu-map (make-sparse-keymap) "`Search' > `Tags' > `Icicles' menu.") (define-key menu-bar-search-tags-menu [icicles] (list 'menu-item "Icicles" icicle-search-tags-menu-map :visible 'icicle-mode))) (t (defvar icicle-search-menu-map (make-sparse-keymap) "`Search' > `Icicles' menu.") (define-key menu-bar-search-menu [icicles] (list 'menu-item "Icicles" icicle-search-menu-map :visible 'icicle-mode)) (defvar icicle-search-tags-menu-map (make-sparse-keymap) "`Search' > `Icicles' > `Emacs Tags' menu.") (define-key icicle-search-menu-map [emacs-tags] (list 'menu-item "Emacs Tags" icicle-search-tags-menu-map :visible 'icicle-mode))))) (t (defvar icicle-search-menu-map (make-sparse-keymap) "`Icicles' > `Search' menu.") (define-key icicle-menu-map [search] (list 'menu-item "Search" icicle-search-menu-map)) (defvar icicle-search-tags-menu-map (make-sparse-keymap) "`Icicles' > `Search' > `Emacs Tags' menu.") (define-key icicle-search-menu-map [emacs-tags] (list 'menu-item "Emacs Tags" icicle-search-tags-menu-map :visible 'icicle-mode)))) ;; `Go To' ------------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (cond ((boundp 'menu-bar-goto-menu) (defvar icicle-search-goto-menu-map (make-sparse-keymap) "`Go To' > `Icicles' menu.") (define-key menu-bar-goto-menu [icicles] (list 'menu-item "Icicles" icicle-search-goto-menu-map))) (t (defvar icicle-search-goto-menu-map (make-sparse-keymap) "Icicles `Go To' submenu of `Search' menu.") (define-key icicle-search-menu-map [goto] (list 'menu-item "Go To" icicle-search-goto-menu-map))))) (t (defvar icicle-search-goto-menu-map (make-sparse-keymap) "`Icicles' > `Go To' menu.") (define-key icicle-menu-map [search] (list 'menu-item "Go To" icicle-search-menu-map)))) (define-key icicle-search-goto-menu-map [icicle-goto-global-marker] '(menu-item "+ Global Marker..." icicle-goto-global-marker :enable (consp (icicle-markers global-mark-ring)) :keys "C-- C-x C-SPC" :help "Go to a global marker, choosing it by the line that includes it")) (define-key icicle-search-goto-menu-map [icicle-goto-marker] '(menu-item "+ Marker..." icicle-goto-marker :enable (mark t) :keys "C-- C-SPC" :help "Go to a marker in this buffer, choosing it by the line that includes it")) (define-key icicle-search-goto-menu-map [icicle-select-bookmarked-region] '(menu-item "+ Select Bookmarked Region..." icicle-select-bookmarked-region :enable (featurep 'bookmark+) :keys "C-u C-x C-x" :help "Jump to a bookmarked region in other window, and select (activate) it")) ;; `Go To' > `Definition' menu. (defvar icicle-search-goto-imenu-menu-map (make-sparse-keymap) "Icicles `Definition' submenu of `Go To' menu.") (define-key icicle-search-goto-menu-map [imenu] (list 'menu-item "Definition" icicle-search-goto-imenu-menu-map :visible 'imenu-generic-expression)) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-key-explicit-map] '(menu-item "+ Key in Map..." icicle-imenu-key-explicit-map :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a key definition in some map, using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-key-implicit-map] '(menu-item "+ Key..." icicle-imenu-key-implicit-map :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a (global) key definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-variable] '(menu-item "+ Variable..." icicle-imenu-variable :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a variable definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-user-option] '(menu-item "+ User Option..." icicle-imenu-user-option :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to an option definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-face] '(menu-item "+ Face..." icicle-imenu-face :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a face definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-macro] '(menu-item "+ Macro..." icicle-imenu-macro :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a Lisp macro definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-non-interactive-function] '(menu-item "+ Non-Interactive Function..." icicle-imenu-non-interactive-function :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a non-command function definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-command] '(menu-item "+ Command..." icicle-imenu-command :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Go to a command definition using `icicle-search'")) (define-key icicle-search-goto-imenu-menu-map [icicle-imenu] '(menu-item "+ Any..." icicle-imenu :enable imenu-generic-expression :help "Go to a definition using `icicle-search'")) ;; `Search' > `Emacs Tags' (or `Tags') menu (define-key icicle-search-tags-menu-map [icicle-tags-search] '(menu-item "+ Search Tagged Files ..." icicle-tags-search :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Search all source files listed in tags tables for matches for a regexp")) (define-key icicle-search-tags-menu-map [icicle-pop-tag-mark] '(menu-item "+ Back (Pop Tag Mark)" icicle-pop-tag-mark :enable (and (boundp 'find-tag-marker-ring) (not (ring-empty-p find-tag-marker-ring)) (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))) :help "Pop back to where `M-.' was last invoked")) (define-key icicle-search-tags-menu-map [icicle-find-first-tag-other-window] '(menu-item "+ Find First Tag ..." icicle-find-first-tag-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Find first tag in current tags table whose name matches your input")) (define-key icicle-search-tags-menu-map [icicle-find-tag] '(menu-item "+ Find Tag ..." icicle-find-tag :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Navigate among all tags that match a regexp")) ;; `Search' menu (define-key icicle-search-menu-map [icicle-search-highlight-cleanup] '(menu-item "Remove Icicle-Search Highlighting..." icicle-search-highlight-cleanup :enable (or icicle-search-overlays (overlayp icicle-search-current-overlay) (overlayp icicle-search-refined-overlays) icicle-search-refined-overlays) :help "Remove all highlighting from the last use of `icicle-search'")) (define-key icicle-search-menu-map [icicle-search-define-replacement] '(menu-item "Define Replacement String..." icicle-search-define-replacement :help "Set the replacement string for use in `icicle-search'")) (define-key icicle-search-menu-map [separator-search-1] '("--")) (define-key icicle-search-menu-map [icicle-compilation-search] '(menu-item "+ Search Compilation/Grep Hits (Regexp)..." icicle-compilation-search :visible (and (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) (condition-case nil (eq (current-buffer) (compilation-find-buffer)) (error nil))) :keys "C-`" :help "Icicles search, showing the matching compilation-buffer hit")) (define-key icicle-search-menu-map [icicle-grep-saved-file-candidates] '(menu-item "Grep Saved File-Name Candidates..." icicle-grep-saved-file-candidates :enable icicle-saved-completion-candidates :help "Run `grep' on the set of completion candidates saved using `C-M->'")) (define-key icicle-search-menu-map [icicle-tags-search] '(menu-item "+ Search Tagged Files ..." icicle-tags-search :help "Search all source files listed in tags tables for matches for a regexp")) (define-key icicle-search-menu-map [icicle-search-file] '(menu-item "+ Search Files (Regexp)..." icicle-search-file :help "Search multiple files completely")) (define-key icicle-search-menu-map [icicle-search-buffer] '(menu-item "+ Search Buffers (Regexp)..." icicle-search-buffer :help "Search multiple buffers completely")) (define-key icicle-search-menu-map [separator-search-2] '("--")) (define-key icicle-search-menu-map [icicle-search-overlay-property] '(menu-item "+ Search Overlay Property..." icicle-search-overlay-property :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Search for an overlay that has a property with a certain value")) (define-key icicle-search-menu-map [icicle-search-char-property] '(menu-item "+ Search Character Property..." icicle-search-char-property :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Search for text that has a property with a certain value")) (define-key icicle-search-menu-map [icicle-search-text-property] '(menu-item "+ Search Text Property..." icicle-search-text-property :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Search for text or overlay that has a property with a certain value")) (define-key icicle-search-menu-map [separator-search-3] '("--")) (define-key icicle-search-menu-map [icicle-search-xml-element-text-node] '(menu-item "+ Search XML text() Nodes..." icicle-search-xml-element-text-node :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with text() nodes of ELEMENTs as search contexts")) (define-key icicle-search-menu-map [icicle-search-xml-element] '(menu-item "+ Search XML Elements..." icicle-search-xml-element :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with XML ELEMENTs as search contexts - you are prompted for ELEMENT")) (define-key icicle-search-menu-map [icicle-search-pages] '(menu-item "+ Search Pages..." icicle-search-pages :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with pages as search contexts")) (define-key icicle-search-menu-map [icicle-search-paragraphs] '(menu-item "+ Search Paragraphs..." icicle-search-paragraphs :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with paragraphs as search contexts")) (define-key icicle-search-menu-map [icicle-search-sentences] '(menu-item "+ Search Sentences..." icicle-search-sentences :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with sentences as search contexts")) (define-key icicle-search-menu-map [icicle-occur] '(menu-item "+ Search Lines (`icicle-occur')..." icicle-occur :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with lines as search contexts")) (define-key icicle-search-menu-map [icicle-search-thing] '(menu-item "+ Search Things..." icicle-search-thing :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with THINGs as search contexts - you are prompted for THING")) (define-key icicle-search-menu-map [separator-search-4] '("--")) (define-key icicle-search-menu-map [icicle-search-word] '(menu-item "+ Search for Word..." icicle-search-word :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Whole-word Icicles search")) (define-key icicle-search-menu-map [icicle-search-w-isearch-string] '(menu-item "+ Search with Isearch Contexts..." icicle-search-w-isearch-string :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with search contexts that match a previous Isearch string")) (define-key icicle-search-menu-map [icicle-search-keywords] '(menu-item "+ Search with Keywords (Regexps)..." icicle-search-keywords :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Icicles search with one or more keywords, which can each be a regexp")) (define-key icicle-search-menu-map [icicle-search] '(menu-item "+ Search (Regexp)..." icicle-search :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :keys "C-`" :help "Icicles search for regexp matches, with completion, cycling, & hit replacement")) ;; `M-s M-s m' - mode-specific search (define-key icicle-search-menu-map [icicle-search-dired-marked-recursive] '(menu-item "+ Search Marked, Here and Below..." icicle-search-dired-marked-recursive :help "Search the marked files, including those in marked subdirs" :visible (eq major-mode 'dired-mode))) (define-key icicle-search-menu-map [icicle-search-bookmark-list-marked] '(menu-item "+ Search Marked..." icicle-search-bookmark-list-marked :help "Search the target files of the marked bookmarks" :visible (eq major-mode 'bookmark-bmenu-mode))) (define-key icicle-search-menu-map [icicle-search-ibuffer-marked] '(menu-item "+ Search Marked..." icicle-search-ibuffer-marked :help "Search the marked files" :visible (eq major-mode 'ibuffer-mode))) (define-key icicle-search-menu-map [icicle-search-buff-menu-marked] '(menu-item "+ Search Marked..." icicle-search-buff-menu-marked :help "Search the marked files" :visible (eq major-mode 'Buffer-menu-mode))) ;; `Search' > `Bookmarks' menu. (defvar icicle-search-bookmarks-menu-map (make-sparse-keymap) "Icicles `Bookmarks' submenu of `Search' menu.") (define-key icicle-search-menu-map [bookmarks] (list 'menu-item "Bookmarks" icicle-search-bookmarks-menu-map :visible 'icicle-mode)) (define-key icicle-search-bookmarks-menu-map [icicle-search-w3m-bookmark] '(menu-item "+ W3M Bookmarks..." icicle-search-w3m-bookmark :visible (featurep 'bookmark+) :help "Search text of W3M bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-url-bookmark] '(menu-item "+ URL Bookmarks..." icicle-search-url-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks whose targets are defined by URLs")) (define-key icicle-search-bookmarks-menu-map [icicle-search-gnus-bookmark] '(menu-item "+ Gnus Bookmarks..." icicle-search-gnus-bookmark :visible (featurep 'bookmark+) :help "Search text of Gnus bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-man-bookmark] '(menu-item "+ Man Bookmarks..." icicle-search-man-bookmark :visible (featurep 'bookmark+) :help "Search text of `man' bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-info-bookmark] '(menu-item "+ Info Bookmarks..." icicle-search-info-bookmark :visible (featurep 'bookmark+) :help "Search text of Info (manual) bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmark-list-bookmark] '(menu-item "+ Bookmark-List Bookmarks..." icicle-search-bookmark-list-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmark-list bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-dired-bookmark] '(menu-item "+ Dired Bookmarks..." icicle-search-dired-bookmark :visible (featurep 'bookmark+) :help "Search buffers of Dired bookmarks")) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-6] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [icicle-search-some-tags-regexp-bookmark] '(menu-item "+ Bookmarks Tagged Some Regexp..." icicle-search-some-tags-regexp-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks some of whose tags matches a regexp")) (define-key icicle-search-bookmarks-menu-map [icicle-search-all-tags-regexp-bookmark] '(menu-item "+ Bookmarks Tagged All Regexp..." icicle-search-all-tags-regexp-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks all of whose tags match a regexp")) (define-key icicle-search-bookmarks-menu-map [icicle-search-some-tags-bookmark] '(menu-item "+ Bookmarks Tagged Some..." icicle-search-some-tags-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks some of whose tags are among those tags you choose")) (define-key icicle-search-bookmarks-menu-map [icicle-search-all-tags-bookmark] '(menu-item "+ Bookmarks Tagged All..." icicle-search-all-tags-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks all of whose tags are among those tags you choose")) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-5] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-5] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [icicle-search-non-file-bookmark] '(menu-item "+ Non-File Bookmarks..." icicle-search-non-file-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks whose targets are not files - e.g., buffers")) (define-key icicle-search-bookmarks-menu-map [icicle-search-remote-file-bookmark] '(menu-item "+ Remote File Bookmarks..." icicle-search-remote-file-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks whose targets are remote files")) (define-key icicle-search-bookmarks-menu-map [icicle-search-local-file-bookmark] '(menu-item "+ Local File Bookmarks..." icicle-search-local-file-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks whose targets are local files")) (define-key icicle-search-bookmarks-menu-map [icicle-search-file-bookmark] '(menu-item "+ File Bookmarks..." icicle-search-file-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks whose targets are files")) (define-key icicle-search-bookmarks-menu-map [icicle-search-autofile-bookmark] '(menu-item "+ Autofile Bookmarks..." icicle-search-autofile-bookmark :visible (featurep 'bookmark+) :help "Search text of autofile bookmarks: files bookmarked under their own names")) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-3] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [icicle-search-specific-files-bookmark] '(menu-item "+ Bookmarks for Specific Files..." icicle-search-specific-files-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks defined for specific files that you choose")) (define-key icicle-search-bookmarks-menu-map [icicle-search-specific-buffers-bookmark] '(menu-item "+ Bookmarks for Specific Buffers..." icicle-search-specific-buffers-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks defined for specific buffers that you choose")) (define-key icicle-search-bookmarks-menu-map [icicle-search-this-buffer-bookmark] '(menu-item "+ Bookmarks for This Buffer..." icicle-search-this-buffer-bookmark :visible (featurep 'bookmark+) :help "Search text of bookmarks defined for this buffer")) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-2] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [icicle-search-temporary-bookmark] '(menu-item "+ Temporary Bookmarks..." icicle-search-temporary-bookmark :visible (featurep 'bookmark+) :help "Search text of temporary bookmarks")) (define-key icicle-search-bookmarks-menu-map [icicle-search-autonamed-bookmark] '(menu-item "+ Autonamed Bookmarks..." icicle-search-autonamed-bookmark :visible (featurep 'bookmark+) :help "Search text of autonamed bookmarks")) (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-1] '(menu-item "--" nil :visible (featurep 'bookmark+))) (define-key icicle-search-bookmarks-menu-map [icicle-search-region-bookmark] '(menu-item "+ Bookmarked Regions..." icicle-search-region-bookmark :visible (featurep 'bookmark+) :help "Search bookmarked regions")) (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmark] '(menu-item "+ Bookmarks..." icicle-search-bookmark :help "Search bookmarked text")) (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmarks-together] '(menu-item "+ Bookmarks Together..." icicle-search-bookmarks-together :help "Search text of bookmarks, taken together" :keys "C-u C-`")) ;; `Search' > `Definitions' menu. (defvar icicle-search-imenu-menu-map (make-sparse-keymap) "Icicles `Definitions' submenu of `Search' menu.") (define-key icicle-search-menu-map [imenu] (list 'menu-item "Definitions" icicle-search-imenu-menu-map :visible 'imenu-generic-expression)) (define-key icicle-search-imenu-menu-map [icicle-imenu-key-explicit-map-full] '(menu-item "+ Key in Map..." icicle-imenu-key-explicit-map-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a key definition in some map, using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-key-implicit-map-full] '(menu-item "+ Key..." icicle-imenu-key-implicit-map-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a global key definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-variable-full] '(menu-item "+ Variable..." icicle-imenu-variable-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a variable definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-user-option-full] '(menu-item "+ User Option..." icicle-imenu-user-option-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search an option definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-face-full] '(menu-item "+ Face..." icicle-imenu-face-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a face definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-macro-full] '(menu-item "+ Macro..." icicle-imenu-macro-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a Lisp macro definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-non-interactive-function-full] '(menu-item "+ Non-Interactive Function..." icicle-imenu-non-interactive-function-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a non-command function definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-command-full] '(menu-item "+ Command..." icicle-imenu-command-full :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode)) :help "Search a command definition using `icicle-search'")) (define-key icicle-search-imenu-menu-map [icicle-imenu-full] '(menu-item "+ Any..." icicle-imenu-full :enable imenu-generic-expression :help "Search a definition using `icicle-search'")) ;; `Frames' ---------------------------------------------------- (cond ((and (not icicle-touche-pas-aux-menus-flag) (boundp 'menu-bar-frames-menu)) ; Use `Frames' menu, defined in `menu-bar+.el'. (defvar icicle-frames-menu-map (make-sparse-keymap) "`Frames' > `Icicles' submenu.") (define-key menu-bar-frames-menu [icicles] (list 'menu-item "Icicles" icicle-frames-menu-map :visible 'icicle-mode))) (t (defvar icicle-frames-menu-map (make-sparse-keymap) "`Icicles' > `Frames' submenu.") (define-key icicle-menu-map [frames] (list 'menu-item "Frames" icicle-frames-menu-map)))) (define-key icicle-frames-menu-map [icicle-font] '(menu-item "+ Change Font of Frame..." icicle-font :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Change font of current frame.")) (define-key icicle-frames-menu-map [icicle-frame-fg] '(menu-item "+ Change Foreground of Frame..." icicle-frame-fg :visible (fboundp 'icicle-frame-fg) ; Requires `hexrgb.el' :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Change foreground of current frame.")) (define-key icicle-frames-menu-map [icicle-frame-bg] '(menu-item "+ Change Background of Frame..." icicle-frame-bg :visible (fboundp 'icicle-frame-bg) ; Requires `hexrgb.el' :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Change background of current frame.")) ;; `Bookmarks' --------------------------------------------------- (require 'bookmark) ; `bookmark-buffer-name' is not autoloaded. (cond ((not icicle-touche-pas-aux-menus-flag) (cond ((boundp 'bmkp-jump-menu) ;; Bookmark+: `Bookmarks' > `Jump To'. ;; Use `copy-keymap' so that turning off Icicle mode restores the ordinary commands. (defvar icicle-bookmark-menu-map (copy-keymap bmkp-jump-menu) "`Bookmarks' > `Jump To' > `Icicles' submenu.") ;; Bookmark+: `Bookmarks' > `Jump To' > `With Tags'. ;; Use `copy-keymap' so that turning off Icicle mode restores the ordinary commands. (defvar icicle-bookmark-with-tags-menu-map (copy-keymap bmkp-jump-tags-menu) "`Bookmarks' > `Jump To' > `With Tags' > `Icicles' submenu.")) (t ; Vanilla `bookmark.el' only, not Bookmark+. (defvar icicle-bookmark-menu-map (make-sparse-keymap) "`Bookmarks' > `Icicles' submenu.") (define-key menu-bar-bookmark-map [icicles] (list 'menu-item "Icicles" icicle-bookmark-menu-map :visible 'icicle-mode)) (defvar icicle-bookmark-with-tags-menu-map (make-sparse-keymap) "For tags commands on `icicle-bookmark-menu-map'.") (setq icicle-bookmark-with-tags-menu-map icicle-bookmark-menu-map)))) (t (defvar icicle-bookmark-menu-map (make-sparse-keymap) "`Icicles' > `Bookmarks' submenu.") (define-key icicle-menu-map [bookmarks] (list 'menu-item "Bookmarks" icicle-bookmark-menu-map)) (defvar icicle-bookmark-with-tags-menu-map (make-sparse-keymap) "For tags commands on `icicle-bookmark-menu-map'.") (setq icicle-bookmark-with-tags-menu-map icicle-bookmark-menu-map))) (when (featurep 'bookmark+) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-all-tags-regexp-jump-other-window] '(menu-item "File This Dir, All Tags Matching Regexp..." icicle-bookmark-file-this-dir-all-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file bookmark for this dir, where each tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-some-tags-regexp-jump-other-window] '(menu-item "File This Dir, Any Tag Matching Regexp..." icicle-bookmark-file-this-dir-some-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file bookmark for this dir, where some tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-all-tags-jump-other-window] '(menu-item "File This Dir, All Tags in Set..." icicle-bookmark-file-this-dir-all-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file bookmark for this dir, which has all of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-some-tags-jump-other-window] '(menu-item "File This Dir, Any Tag in Set..." icicle-bookmark-file-this-dir-some-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file bookmark for this dir, which has some of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-all-tags-regexp-jump-other-window] '(menu-item "File, All Tags Matching Regexp..." icicle-bookmark-file-all-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file or dir bookmark where each tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-some-tags-regexp-jump-other-window] '(menu-item "File, Any Tag Matching Regexp..." icicle-bookmark-file-some-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file or dir bookmark where at least one tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-all-tags-jump-other-window] '(menu-item "File, All Tags in Set..." icicle-bookmark-file-all-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file or dir bookmark that has all of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-some-tags-jump-other-window] '(menu-item "File, Any Tag in Set..." icicle-bookmark-file-some-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file or dir bookmark that has some of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-all-tags-regexp-jump-other-window] '(menu-item "Autofile, All Tags Matching Regexp..." icicle-bookmark-autofile-all-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autofile bookmark where each tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-some-tags-regexp-jump-other-window] '(menu-item "Autofile, Any Tag Matching Regexp..." icicle-bookmark-autofile-some-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autofile bookmark where at least one tag matches a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-all-tags-jump-other-window] '(menu-item "Autofile, All Tags in Set..." icicle-bookmark-autofile-all-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autofile bookmark that has all of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-some-tags-jump-other-window] '(menu-item "Autofile, Any Tag in Set..." icicle-bookmark-autofile-some-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autofile bookmark that has some of a set of tags")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-all-tags-regexp-jump-other-window] '(menu-item "All Tags Matching Regexp..." icicle-bookmark-all-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark that has each tag matching a regexp that you enter")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-some-tags-regexp-jump-other-window] '(menu-item "Any Tag Matching Regexp..." icicle-bookmark-some-tags-regexp-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark with at least one tag matching a regexp")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-all-tags-jump-other-window] '(menu-item "All Tags in Set..." icicle-bookmark-all-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark that has all of a set of tags that you enter")) (define-key icicle-bookmark-with-tags-menu-map [bmkp-some-tags-jump-other-window] '(menu-item "Any Tag in Set..." icicle-bookmark-some-tags-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark that has some of a set of tags that you enter")) (define-key icicle-bookmark-menu-map [bmkp-temporary-jump-other-window] '(menu-item "+ Jump to Temporary Bookmark..." icicle-bookmark-temporary-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a temporary bookmark")) (define-key icicle-bookmark-menu-map [bmkp-autofile-jump-other-window] '(menu-item "+ Jump to Autofile Bookmark..." icicle-bookmark-autofile-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autofile bookmark")) (define-key icicle-bookmark-menu-map [bmkp-autonamed-this-buffer-jump] '(menu-item "+ Jump to Autonamed Bookmark for This Buffer..." icicle-bookmark-autonamed-this-buffer-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autonamed bookmark for this buffer")) (define-key icicle-bookmark-menu-map [bmkp-autonamed-jump-other-window] '(menu-item "+ Jump to Autonamed Bookmark..." icicle-bookmark-autonamed-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an autonamed bookmark")) (define-key icicle-bookmark-menu-map [bmkp-specific-files-jump-other-window] '(menu-item "+ Jump to Bookmark for Specific Files..." icicle-bookmark-specific-files-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to bookmarks for specific files that you choose")) (define-key icicle-bookmark-menu-map [bmkp-specific-buffers-jump-other-window] '(menu-item "+ Jump to Bookmark for Specific Buffers..." icicle-bookmark-specific-buffers-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to bookmarks for specific buffers that you choose")) (define-key icicle-bookmark-menu-map [bmkp-this-buffer-jump] '(menu-item "+ Jump to Bookmark for This Buffer..." icicle-bookmark-this-buffer-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark for this buffer")) (define-key icicle-bookmark-menu-map [bmkp-url-jump-other-window] '(menu-item "+ Jump to URL Bookmark..." icicle-bookmark-url-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a URL bookmark")) (define-key icicle-bookmark-menu-map [bmkp-gnus-jump-other-window] '(menu-item "+ Jump to Gnus Bookmark..." icicle-bookmark-gnus-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a Gnus bookmark")) (define-key icicle-bookmark-menu-map [bmkp-man-jump-other-window] '(menu-item "+ Jump to `man' Bookmark..." icicle-bookmark-man-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a `man'-page bookmark")) (define-key icicle-bookmark-menu-map [bmkp-info-jump-other-window] '(menu-item "+ Jump to Info Bookmark..." icicle-bookmark-info-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an Info bookmark")) (define-key icicle-bookmark-menu-map [bmkp-image-jump-other-window] '(menu-item "+ Jump to Image Bookmark..." icicle-bookmark-image-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an image bookmark")) (define-key icicle-bookmark-menu-map [bmkp-non-file-jump-other-window] '(menu-item "+ Jump to Buffer (Non-File) Bookmark..." icicle-bookmark-non-file-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a buffer (i.e., a non-file) bookmark")) (define-key icicle-bookmark-menu-map [bmkp-region-jump-other-window] '(menu-item "+ Jump to Region Bookmark..." icicle-bookmark-region-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark and activate its recorded region")) (define-key icicle-bookmark-menu-map [bmkp-remote-file-jump-other-window] '(menu-item "+ Jump to Remote-File Bookmark..." icicle-bookmark-remote-file-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a remote-file bookmark")) (define-key icicle-bookmark-menu-map [bmkp-local-file-jump-other-window] '(menu-item "+ Jump to Local-File Bookmark..." icicle-bookmark-local-file-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a local-file bookmark")) (define-key icicle-bookmark-menu-map [bmkp-file-jump-other-window] '(menu-item "+ Jump to File Bookmark..." icicle-bookmark-file-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a file bookmark")) (define-key icicle-bookmark-menu-map [bmkp-dired-jump-other-window] '(menu-item "+ Jump to Dired Bookmark..." icicle-bookmark-dired-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a Dired bookmark")) (define-key icicle-bookmark-menu-map [bmkp-bookmark-file-jump] '(menu-item "+ Jump to Bookmark-File Bookmark..." icicle-bookmark-bookmark-file :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark-file bookmark")) (define-key icicle-bookmark-menu-map [bmkp-bookmark-list-jump] '(menu-item "+ Jump to Bookmark-List Bookmark..." icicle-bookmark-bookmark-list :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark-list bookmark")) (define-key icicle-bookmark-menu-map [bmkp-desktop-jump] '(menu-item "+ Jump to Desktop Bookmark..." icicle-bookmark-desktop :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to an Emacs desktop bookmark"))) (define-key icicle-bookmark-menu-map [bookmark-jump-other-window] '(menu-item "+ Jump to Bookmark..." icicle-bookmark-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark (C-u: reverse `icicle-bookmark-refresh-cache-flag')")) (define-key icicle-bookmark-menu-map [bookmark-jump] '(menu-item "+ Jump to Bookmark (Same Window)..." icicle-bookmark :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Jump to a bookmark (C-u: reverse `icicle-bookmark-refresh-cache-flag')")) ;; `Edit' -------------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-edit-menu-map (make-sparse-keymap) "`Edit' > `Icicles' submenu.") (define-key menu-bar-edit-menu [icicles] (list 'menu-item "Icicles" icicle-edit-menu-map :visible 'icicle-mode))) (t (defvar icicle-edit-menu-map (make-sparse-keymap) "`Icicles' > `Edit' submenu.") (define-key icicle-menu-map [Edit] (list 'menu-item "Edit" icicle-edit-menu-map)))) (define-key icicle-edit-menu-map [icicle-complete-thesaurus-entry] '(menu-item "Complete with Thesaurus..." icicle-complete-thesaurus-entry :enable (and (not buffer-read-only) (boundp 'synonyms-obarray)) :help "Complete a word to an entry from a thesaurus")) (define-key icicle-edit-menu-map [icicle-insert-thesaurus-entry] '(menu-item "+ Insert Thesaurus Entry..." icicle-insert-thesaurus-entry :enable (and (not buffer-read-only) (boundp 'synonyms-obarray)) :help "Insert an entry from a thesaurus")) (define-key icicle-edit-menu-map [icicle-completing-yank] '(menu-item "+ Paste Copied Text..." icicle-completing-yank :enable (not buffer-read-only) :keys "C-- C-y" :help "Yank an entry from the `kill-ring', choosing it using completion")) ;; `File' -------------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-file-menu-map (make-sparse-keymap) "`File' > `Icicles' submenu.") (define-key menu-bar-file-menu [icicles] (list 'menu-item "Icicles" icicle-file-menu-map :visible 'icicle-mode))) (t (defvar icicle-file-menu-map (make-sparse-keymap) "`Icicles' > `File' submenu.") (define-key icicle-menu-map [file] (list 'menu-item "File" icicle-file-menu-map :visible 'icicle-mode)))) (define-key icicle-file-menu-map [icicle-delete-file] '(menu-item "+ Delete File..." icicle-delete-file :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Delete a file or directory")) (when (featurep 'recentf) (define-key icicle-file-menu-map [icicle-remove-file-from-recentf-list] '(menu-item "+ Remove from Recent Files List..." icicle-remove-file-from-recentf-list :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Remove file from `recentf-list' - the list of recently used files")) (define-key icicle-file-menu-map [icicle-recent-file-other-window] '(menu-item "+ Open Recent File (Other Window)..." icicle-recent-file-other-window :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Open a recently used file in another window")) (define-key icicle-file-menu-map [icicle-recent-file] '(menu-item "+ Open Recent File..." icicle-recent-file :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Open a recently used file"))) (define-key icicle-file-menu-map [icicle-dired-saved-file-candidates-other-window] '(menu-item "Open Dired for Chosen Files..." icicle-dired-saved-file-candidates-other-window :visible icicle-mode :enable (and icicle-saved-completion-candidates (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))) :help "Open Dired on a set of files & directories of your choice")) (define-key icicle-file-menu-map [icicle-dired-project-other-window] '(menu-item "Open Dired for Project..." icicle-dired-project-other-window :visible icicle-mode :enable (and icicle-saved-completion-sets (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))) :help "Open Dired on a saved project (in another window)")) (define-key icicle-file-menu-map [icicle-locate-file-other-window] '(menu-item "+ Open File Under Directory (Other Window)..." icicle-locate-file-other-window :visible icicle-mode :help "Visit a file within a directory or its subdirectories, in another window")) (define-key icicle-file-menu-map [icicle-locate-file] '(menu-item "+ Open File Under Directory..." icicle-locate-file :visible icicle-mode :help "Visit a file within a directory or its subdirectories")) (define-key icicle-file-menu-map [icicle-file-other-window] '(menu-item "+ Open File or Directory (Other Window)..." icicle-file-other-window :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Visit a file or directory in another window")) (define-key icicle-file-menu-map [icicle-file] '(menu-item "+ Open File or Directory..." icicle-file :visible icicle-mode :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Visit a file or directory (C-u absolute, C-- absolute by date)")) ;; `Buffers' ----------------------------------------------------- (cond ((not icicle-touche-pas-aux-menus-flag) (cond ((boundp 'menu-bar-buffers-menu-command-entries) ; Emacs 22+. (defvar icicle-buffers-menu-map (make-sparse-keymap) "`Buffers' > `Icicles' submenu.") (setq menu-bar-buffers-menu-command-entries (cons (list 'Icicles 'menu-item "Icicles" icicle-buffers-menu-map) menu-bar-buffers-menu-command-entries))) (t (defvar icicle-buffers-menu-map (make-sparse-keymap) "`File' > `Icicles' > `Buffers' submenu.") (define-key icicle-file-menu-map [buffers] (list 'menu-item "Buffers" icicle-buffers-menu-map))))) (t (defvar icicle-buffers-menu-map (make-sparse-keymap) "`Icicles' > `Buffers' submenu.") (define-key icicle-menu-map [buffers] (list 'menu-item "Buffers" icicle-buffers-menu-map)))) (define-key icicle-buffers-menu-map [icicle-buffer-list] '(menu-item "+ Buffer List..." icicle-buffer-list :help "Choose a list of buffer names")) (define-key icicle-buffers-menu-map [icicle-remove-buffer-config] '(menu-item "+ Remove Buffer Configuration..." icicle-remove-buffer-config :enable icicle-buffer-configs :help "Remove buffer configuration from `icicle-buffer-configs'")) (define-key icicle-buffers-menu-map [icicle-add-buffer-config] '(menu-item "New Buffer Configuration..." icicle-add-buffer-config :help "Add buffer configuration to `icicle-buffer-configs'")) (define-key icicle-buffers-menu-map [icicle-buffer-config] '(menu-item "+ Choose Buffer Configuration..." icicle-buffer-config :enable icicle-buffer-configs :help "Choose a configuration of user options for `icicle-buffer'")) (define-key icicle-buffers-menu-map [icicle-remove-buffer-candidate] '(menu-item "+ Don't Always Include Buffer..." icicle-remove-buffer-candidate :enable icicle-buffer-extras :help "Remove buffer as an always-show completion candidate")) (define-key icicle-buffers-menu-map [icicle-add-buffer-candidate] '(menu-item "+ Always Include Buffer..." icicle-add-buffer-candidate :help "Add buffer as an always-show completion candidate")) (define-key icicle-buffers-menu-map [icicle-kill-buffer] '(menu-item "+ Kill Buffer..." icicle-kill-buffer :help "Kill a buffer (C-0: same-mode, C-9: file, C-- this-frame")) (define-key icicle-buffers-menu-map [icicle-insert-buffer] '(menu-item "+ Insert Buffer..." icicle-insert-buffer :help "Multi-command version of `insert-buffer'")) (define-key icicle-buffers-menu-map [icicle-delete-windows] '(menu-item "+ Delete Windows on Buffer..." icicle-delete-windows :keys "C-u C-x 0" :help "Delete windows showing a buffer, anywhere")) (define-key icicle-buffers-menu-map [icicle-buffer-other-window] '(menu-item "+ Switch to Buffer (Other Window)..." icicle-buffer-other-window :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))))) (define-key icicle-buffers-menu-map [icicle-buffer] '(menu-item "+ Switch to Buffer..." icicle-buffer :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Switch to a buffer (C-0: same mode, C-9: file buffer, C--: same frame")) ;; `Dired Marked' ------------------------------------------------ (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-dired-multiple-menu-map (make-sparse-keymap) "`Icicles' submenu for Dired's `Multiple' (or `Operate') menu.") (if (boundp 'diredp-menu-bar-operate-menu) ; In `dired+.el'. (define-key diredp-menu-bar-operate-menu [icicles] (list 'menu-item "Icicles" icicle-dired-multiple-menu-map :visible 'icicle-mode)) (define-key dired-mode-map [menu-bar operate icicles] (list 'menu-item "Icicles" icicle-dired-multiple-menu-map :visible 'icicle-mode))) (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el' (defvar icicle-dired-recursive-marked-menu-map (make-sparse-keymap) "`Icicles' submenu for Dired+'s `Multiple' > `Marked Here and Below' menu.") (define-key diredp-menu-bar-recursive-marked-menu [icicles] (list 'menu-item "Icicles" icicle-dired-recursive-marked-menu-map :visible 'icicle-mode)))) (t (defvar icicle-dired-multiple-menu-map (make-sparse-keymap) "`Icicles' > `Dired Marked' submenu, in Dired mode.") (define-key icicle-menu-map [dired-marked] (list 'menu-item "Dired Marked" icicle-dired-multiple-menu-map :visible '(eq major-mode 'dired-mode))) (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el' (defvar icicle-dired-recursive-marked-menu-map (make-sparse-keymap) "`Icicles' > `Dired Marked Here and Below' menu.") (define-key icicle-dired-multiple-menu-map [here-and-below] (list 'menu-item "Here and Below" icicle-dired-recursive-marked-menu-map :visible '(eq major-mode 'dired-mode)))))) (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-as-project] '(menu-item "Save Names Persistently (Project)" icicle-dired-save-marked-as-project :help "Save the marked names as a persistent set")) (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-to-variable] '(menu-item "Save Names to Variable" icicle-dired-save-marked-to-variable :help "Save the marked names to a variable")) (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-more] '(menu-item "Add to Saved Candidates" icicle-dired-save-marked-more :help "Add the marked names to the saved completion-candidates set")) (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked] '(menu-item "Save Names as Completion Candidates" icicle-dired-save-marked :help "Save the marked names as a set of completion candidates")) (define-key icicle-dired-multiple-menu-map [separator-dired-multiple-1] '(menu-item "--" nil)) (define-key icicle-dired-multiple-menu-map [icicle-visit-marked-file-of-content-other-window] '(menu-item "Open File of Content (Other Window)" icicle-visit-marked-file-of-content-other-window :help "Visit a marked file whose content matches a regexp, in another window" :enable (condition-case nil ; Avoid an Emacs 22 error with cursor on ./ or ../ (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file)))) (error nil)))) (define-key icicle-dired-multiple-menu-map [icicle-visit-marked-file-of-content] '(menu-item "Open File of Content" icicle-visit-marked-file-of-content :help "Visit a marked file whose content matches a regexp" :enable (condition-case nil ; Avoid an Emacs 22 error with cursor on ./ or ../ (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file)))) (error nil)))) (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el' (define-key icicle-dired-recursive-marked-menu-map [icicle-search-dired-marked-recursive] '(menu-item "Icicles Search (and Replace)..." icicle-search-dired-marked-recursive :help "Search the marked files, including those in marked subdirs")) (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-to-fileset-recursive] '(menu-item "Save Names to Fileset" icicle-dired-save-marked-to-fileset-recursive :help "Save marked names, including those in marked subdirs, to an Emacs fileset")) (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-to-cache-file-recursive] '(menu-item "Save Names to Cache File" icicle-dired-save-marked-to-cache-file-recursive :help "Save marked names, including those in marked subdirs, to an Icicles cache file")) (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-to-variable-recursive] '(menu-item "Save Names to Variable" icicle-dired-save-marked-to-variable-recursive :help "Save marked names, including those in marked subdirs, to a variable")) (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-more-recursive] '(menu-item "Add to Saved Candidates" icicle-dired-save-marked-more-recursive :help "Add marked files, including those in marked subdirs, to saved candidates")) (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-recursive] '(menu-item "Save Names as Completion Candidates" icicle-dired-save-marked-recursive :help "Save the marked file names in Dired, including those in marked subdirs"))) ;; `Dired Dirs' ------------------------------------------------ (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-dired-dir-menu-map (make-sparse-keymap) "`Icicles' submenu for Dired's `Dir' (or `Subdir') menu.") (if (boundp 'diredp-menu-bar-subdir-menu) ; In `dired+.el'. (define-key diredp-menu-bar-subdir-menu [icicles] (list 'menu-item "Icicles" icicle-dired-dir-menu-map :visible 'icicle-mode)) (define-key dired-mode-map [menu-bar subdir icicles] (list 'menu-item "Icicles" icicle-dired-dir-menu-map :visible 'icicle-mode)))) (t (defvar icicle-dired-dir-menu-map (make-sparse-keymap) "`Icicles' > `Dired Dirs' submenu, in Dired mode.") (define-key icicle-menu-map [dired-dirs] (list 'menu-item "Dired Dirs" icicle-dired-dir-menu-map :visible '(eq major-mode 'dired-mode))))) (when (fboundp 'icicle-dired-insert-as-subdir) ; Emacs 21+ (define-key icicle-dired-dir-menu-map [icicle-dired-insert-as-subdir] '(menu-item "Insert Dir into Ancestor Dired..." icicle-dired-insert-as-subdir :help "Insert a directory into a Dired ancestor directory listing"))) (define-key icicle-dired-dir-menu-map [icicle-dired-saved-file-candidates-other-window] '(menu-item "Open Dired for Chosen Files..." icicle-dired-saved-file-candidates-other-window :enable icicle-saved-completion-candidates :help "Open Dired on a set of files & directories of your choice")) (define-key icicle-dired-dir-menu-map [icicle-dired-project-other-window] '(menu-item "Open Dired for Project..." icicle-dired-project-other-window :enable icicle-saved-completion-sets :help "Open Dired on a saved project")) ;; `Info' -------------------------------------------------------- (require 'info) ; `Info-mode-menu' is not preloaded. (cond ((not icicle-touche-pas-aux-menus-flag) (defvar icicle-info-menu-map (make-sparse-keymap) "`Info' > `Icicles' submenu.") (define-key Info-mode-menu [icicles] (list 'menu-item "Icicles" icicle-info-menu-map :visible 'icicle-mode))) (t (defvar icicle-info-menu-map (make-sparse-keymap) "`Icicles' > `Info' submenu, in Info mode.") (define-key icicle-menu-map [info] (list 'menu-item "Info Mode" icicle-info-menu-map :visible '(eq major-mode 'Info-mode))))) (when (fboundp 'icicle-Info-virtual-book) (define-key icicle-info-menu-map [icicle-Info-virtual-book] '(menu-item "Virtual Book" icicle-Info-virtual-book :help "Open Info on a virtual book of saved Info nodes"))) (define-key icicle-info-menu-map [icicle-Info-goto-node] '(menu-item "+ Go to Node..." icicle-Info-goto-node :help "Go to an Info node by name")) (define-key icicle-info-menu-map [icicle-Info-menu] '(menu-item "+ Go to Menu Node..." icicle-Info-menu :help "Choose a menu node by name")) (define-key icicle-info-menu-map [icicle-Info-index] '(menu-item "+ Look Up in Index..." icicle-Info-index :help "Go to an indexed topic - multi-command version of `Info-index'")) ;; `Bookmark+', in buffer `*Bookmark List*' ---------------------- ;; ;; Do this regardless of `icicle-touche-pas-aux-menus-flag', since `Bookmark+' is my menu. (when (boundp 'bmkp-bmenu-menubar-menu) ; In `bookmark+-bmu.el'. (defvar icicle-bookmark+-menu-map (make-sparse-keymap) "`Bookmark+' > `Icicles' submenu.") (define-key bmkp-bmenu-menubar-menu [icicles] (list 'menu-item "Icicles" icicle-bookmark+-menu-map :visible 'icicle-mode)) (define-key icicle-bookmark+-menu-map [icicle-search-bookmark-list-marked] '(menu-item "Search & Replace in Marked Files..." icicle-search-bookmark-list-marked :help "Search the files of the marked bookmarks")) (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files-more] '(menu-item "Save File Names of Marked as More Candidates..." icicle-bookmark-save-marked-files-more :help "Add file names of marked bookmarks to saved file-completion candidates")) (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files] '(menu-item "Save File Names of Marked as Candidates..." icicle-bookmark-save-marked-files :help "Save file names of marked bookmarks as a set of file-completion candidates")) (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files-as-project] '(menu-item "Save Marked as Project" icicle-bookmark-save-marked-files-as-project :help "Save the file names of the marked bookmarks as a persistent set"))) ) ;; Install `Icicles' menu-bar menu. (define-key icicle-mode-map [menu-bar icicles] (cons "Icicles" icicle-menu-map)) ;; Optional `icicle-mode-map' bindings - governed by `icicle-top-level-key-bindings'. (icicle-bind-top-level-commands) ;; Put all Icicles search commands on a common prefix key, `icicle-search-key-prefix'. (define-key icicle-mode-map icicle-search-key-prefix icicle-search-map) ;; Install or update `icicle-mode-map'. (if icicle-minor-mode-map-entry (setcdr icicle-minor-mode-map-entry icicle-mode-map) (setq icicle-minor-mode-map-entry (cons 'icicle-mode icicle-mode-map)) (add-to-list 'minor-mode-map-alist icicle-minor-mode-map-entry))) (defun icicle-S-iso-lefttab-to-S-TAB (strg) "Return string STRG, but with \"S-iso-lefttab\" replaced by \"S-TAB\"." (replace-regexp-in-string "S-iso-lefttab" "S-TAB" strg)) (defun icicle-bind-other-keymap-keys () "Bind some keys in maps other than minibuffer maps and `icicle-mode-map'" ;; Bind Isearch keys. (icicle-bind-isearch-keys) ;; Bind keys in Comint mode. (when (boundp 'comint-mode-map) (define-key comint-mode-map (icicle-kbd "C-c C-i") 'icicle-comint-command) ; `C-c TAB' (define-key comint-mode-map (icicle-kbd "C-c tab") 'icicle-comint-command)) ; `C-c TAB' ;; Bind keys in Shell mode. (when (and (boundp 'shell-mode-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine)) (define-key shell-mode-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete)) ;; Bind keys in Shell Script mode. (when (and (boundp 'sh-mode-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine)) (icicle-remap 'comint-dynamic-complete 'icicle-comint-dynamic-complete sh-mode-map)) ;; Bind keys in Ielm mode. (when (and (boundp 'ielm-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine)) (define-key ielm-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete)) ;; Bind keys in Tcl mode. (when (and (boundp 'inferior-tcl-mode-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine)) (define-key inferior-tcl-mode-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete)) ;; Bind keys in GUD (Debugger) mode. (when (and (boundp 'gud-minibuffer-local-map) (memq 'comint-dynamic-complete-filename icicle-functions-to-redefine)) (define-key gud-minibuffer-local-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete-filename)) ;; Bind some keys in `bookmark-bmenu-mode' mode (*Bookmark List*) - requires Bookmark+. (when (and (featurep 'bookmark+) (boundp 'bookmark-bmenu-mode-map)) (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-M->")) ; *Bookmark List* `C-M->' (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M->") 'icicle-bookmark-save-marked-files)) (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C->")) ; *Bookmark List* `C->' (define-key bookmark-bmenu-mode-map (icicle-kbd "C->") 'icicle-bookmark-save-marked-files-more)) (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}")) ; *Bookmark List* `C-M-}' (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}") 'icicle-bookmark-save-marked-files-to-variable)) (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-}")) ; *Bookmark List* `C-}' (define-key bookmark-bmenu-mode-map (icicle-kbd "C-}") 'icicle-bookmark-save-marked-files-as-project)) (let* ((key (apply 'vector (append (listify-key-sequence icicle-search-key-prefix) (listify-key-sequence (icicle-kbd "m"))))) ; `M-s M-s m' (def (lookup-key bookmark-bmenu-mode-map key))) (unless (and def (not (integerp def))) (define-key bookmark-bmenu-mode-map key 'icicle-search-bookmark-list-marked)))) ;; Bind some keys in Dired mode. (when (boundp 'dired-mode-map) (unless (lookup-key dired-mode-map (icicle-kbd "C-M-<")) ; Dired `C-M-<' (define-key dired-mode-map (icicle-kbd "C-M-<") 'icicle-dired-saved-file-candidates-other-window)) (unless (lookup-key dired-mode-map (icicle-kbd "C-{")) ; Dired `C-{' (define-key dired-mode-map (icicle-kbd "C-{") 'icicle-dired-project-other-window)) (unless (lookup-key dired-mode-map (icicle-kbd "C-M->")) ; Dired `C-M->' (define-key dired-mode-map (icicle-kbd "C-M->") 'icicle-dired-save-marked)) (unless (lookup-key dired-mode-map (icicle-kbd "C->")) ; Dired `C->' (define-key dired-mode-map (icicle-kbd "C->") 'icicle-dired-save-marked-more)) (unless (lookup-key dired-mode-map (icicle-kbd "C-M-}")) ; Dired `C-M-}' (define-key dired-mode-map (icicle-kbd "C-M-}") 'icicle-dired-save-marked-to-variable)) (unless (lookup-key dired-mode-map (icicle-kbd "C-}")) ; Dired `C-}' (define-key dired-mode-map (icicle-kbd "C-}") 'icicle-dired-save-marked-as-project)) (unless (lookup-key dired-mode-map (icicle-kbd "C-S-f")) ; Dired `C-S-f', aka `C-F' (define-key dired-mode-map (icicle-kbd "C-S-f") 'icicle-visit-marked-file-of-content)) (unless (lookup-key dired-mode-map (icicle-kbd "C-S-o")) ; Dired `C-S-o', aka `C-O' (define-key dired-mode-map (icicle-kbd "C-S-o") 'icicle-visit-marked-file-of-content-other-window))) ;; More Dired keys, but these require `dired+.el'. (when (boundp 'diredp-recursive-map) (let* ((key (apply 'vector ; `M-s M-s m' (append (listify-key-sequence icicle-search-key-prefix) (listify-key-sequence (icicle-kbd "m"))))) (def (lookup-key dired-mode-map key))) (unless (and def (not (integerp def))) (define-key dired-mode-map key 'icicle-search-dired-marked-recursive))) (define-key diredp-recursive-map (icicle-kbd "M-s M-s") ; `M-+ M-s M-s' 'icicle-search-dired-marked-recursive) (define-key diredp-recursive-map (icicle-kbd "C-{") ; `M-+ C-{' 'icicle-dired-project-other-window) (define-key diredp-recursive-map (icicle-kbd "C-M->") ; `M-+ C-M->' 'icicle-dired-save-marked-recursive) (define-key diredp-recursive-map (icicle-kbd "C->") ; `M-+ C->' 'icicle-dired-save-marked-more-recursive) (define-key diredp-recursive-map (icicle-kbd "C-M-}") ; `M-+ C-M-}' 'icicle-dired-save-marked-to-variable-recursive) (define-key diredp-recursive-map (icicle-kbd "C-}") ; `M-+ C-}' 'icicle-dired-save-marked-to-cache-file-recursive)) ;; Bind keys in Ibuffer mode. (when (boundp 'ibuffer-mode-map) (let* ((key (apply 'vector ; Ibuffer `M-s M-s m' (append (listify-key-sequence icicle-search-key-prefix) (listify-key-sequence (icicle-kbd "m"))))) (def (lookup-key ibuffer-mode-map icicle-search-key-prefix))) (unless (and def (not (integerp def))) (define-key ibuffer-mode-map key 'icicle-search-ibuffer-marked)) (unless icicle-touche-pas-aux-menus-flag ; Use Ibuffer's `Operate' menu. (define-key ibuffer-mode-operate-map [icicle-search-ibuffer-marked] '(menu-item "Icicles Search (and Replace)..." icicle-search-ibuffer-marked :visible icicle-mode :enable (eq major-mode 'ibuffer-mode)))))) ;; Bind keys in Buffer Menu mode. (when (boundp 'Buffer-menu-mode-map) (let* ((key (apply 'vector ; Buffer-Menu `M-s M-s m' (append (listify-key-sequence icicle-search-key-prefix) (listify-key-sequence (icicle-kbd "m"))))) (def (lookup-key Buffer-menu-mode-map icicle-search-key-prefix))) (unless (and def (not (integerp def))) (define-key Buffer-menu-mode-map key 'icicle-search-buff-menu-marked)))) ;; Bind `S-TAB' in major maps, for key completion. (when (fboundp 'map-keymap) ; Emacs 22+. (icicle-bind-key-completion-keys-in-keymaps-from (current-global-map)) (mapcar #'icicle-bind-key-completion-keys-for-map-var icicle-keymaps-for-key-completion)) ;; Bind `M-S-TAB' in `minibuffer-local-map', for key completion. (when (fboundp 'map-keymap) ; Emacs 22+. (icicle-bind-key-completion-keys-for-map-var 'minibuffer-local-map icicle-key-complete-keys-for-minibuffer)) ;; Prevent `this-command' from being set to `handle-switch-frame'. (define-key global-map [handle-switch-frame] 'icicle-skip-this-command) (define-key global-map [switch-frame] 'icicle-handle-switch-frame)) (defun icicle-bind-isearch-keys () "Bind Icicles Isearch commands." (dolist (key icicle-search-from-isearch-keys) (define-key isearch-mode-map key 'icicle-search-w-isearch-string)) ; In `icicles-cmd2.el'. (dolist (key icicle-isearch-complete-keys) (define-key isearch-mode-map key 'icicle-isearch-complete)) (dolist (key icicle-isearch-history-insert-keys) (define-key isearch-mode-map key 'icicle-isearch-history-insert)) (cond ((fboundp 'isearch-moccur) ; In `moccur.el'. (define-key isearch-mode-map (icicle-kbd "C-o") 'isearch-moccur)) ; `C-s C-o' ((fboundp 'isearch-occur) ; In `occur-schroeder.el'. (define-key isearch-mode-map (icicle-kbd "C-o") 'isearch-occur)))) ; `C-s C-o' (defun icicle-bind-key-completion-keys-for-map-var (keymap-var &optional keys) "Bind `S-TAB' in keymaps accessible from keymap KEYMAP-VAR. KEYMAP-VAR should be bound to a keymap that has at least one prefix keymap. If KEYMAP-VAR is not bound to a keymap, it is ignored. Actually, by default, it is the keys in `icicle-key-complete-keys' that are bound, not `S-TAB'. And if optional arg KEYS is non-nil then it, not `icicle-key-complete-keys', is the list of keys that are bound." (let ((temp keymap-var)) (when (boundp temp) (setq temp (symbol-value temp)) (when (keymapp temp) (icicle-bind-key-completion-keys-in-keymaps-from temp keys))))) (defun icicle-bind-key-completion-keys-in-keymaps-from (map &optional keys) "Bind keys in `icicle-key-complete-keys' to `icicle-complete-keys'. Each key in `icicle-complete-keys' (or optional arg KEYS, if non-nil) is bound in all keymaps accessible from keymap MAP." (dolist (key+map (accessible-keymaps map)) (let ((map (cdr key+map))) ;; We could try to exclude menu maps, by testing (not (keymap-prompt map)). ;; But we want to include at least some menu maps - those, such as `facemenu-keymap', ;; that are bound to keyboard keys. (when (and (keymapp map) (not (keymap-prompt map)))...) (when (keymapp map) (dolist (key (or keys icicle-key-complete-keys)) (when (or icicle-complete-key-anyway-flag (not (lookup-key map key))) (condition-case nil (define-key map key 'icicle-complete-keys) (error nil)))))))) (defun icicle-restore-other-keymap-keys () "Restore some bindings changed by `icicle-bind-other-keymap-keys'." ;; Unbind Isearch keys. (icicle-unbind-isearch-keys) ;; Unbind keys in Comint mode. (when (boundp 'comint-mode-map) (define-key comint-mode-map (icicle-kbd "C-c C-i") nil) (define-key comint-mode-map (icicle-kbd "C-c tab") nil)) ;; Unbind keys in Shell mode. (when (and (boundp 'shell-mode-map) (memq 'icicle-comint-dynamic-complete icicle-functions-to-redefine)) (define-key shell-mode-map (icicle-kbd "C-i") (if (> emacs-major-version 23) 'completion-at-point 'comint-dynamic-complete))) ;; Unbind keys in Shell Script mode. (when (and (boundp 'sh-mode-map) (memq 'icicle-comint-dynamic-complete icicle-functions-to-redefine)) (icicle-unmap 'comint-dynamic-complete sh-mode-map 'icicle-comint-dynamic-complete)) ;; Unbind keys in Ielm mode. (when (and (boundp 'ielm-map) (memq 'icicle-comint-dynamic-complete icicle-functions-to-redefine)) (define-key ielm-map (icicle-kbd "C-i") 'comint-dynamic-complete)) ;; Unbind keys in Tcl mode. (when (and (boundp 'inferior-tcl-mode-map) (memq 'icicle-comint-dynamic-complete icicle-functions-to-redefine)) (define-key inferior-tcl-mode-map (icicle-kbd "C-i") 'comint-dynamic-complete)) ;; Bind keys in GUD (Debugger) mode. (when (and (boundp 'gud-minibuffer-local-map) (memq 'icicle-comint-dynamic-complete-filename icicle-functions-to-redefine)) (define-key gud-minibuffer-local-map (icicle-kbd "C-i") 'comint-dynamic-complete-filename)) ;; Unbind keys in `bookmark-bmenu-mode' mode (*Bookmark List*) - requires Bookmark+. (when (and (featurep 'bookmark+) (boundp 'bookmark-bmenu-mode-map)) (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M->") nil) (define-key bookmark-bmenu-mode-map (icicle-kbd "C->") nil) (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}") nil) (define-key bookmark-bmenu-mode-map (icicle-kbd "C-}") nil) (define-key bookmark-bmenu-mode-map icicle-search-key-prefix nil)) ;; Unbind keys in Dired mode. (when (boundp 'dired-mode-map) (define-key dired-mode-map (icicle-kbd "C-M-<") nil) (define-key dired-mode-map (icicle-kbd "C-{") nil) (define-key dired-mode-map (icicle-kbd "C-M->") nil) (define-key dired-mode-map (icicle-kbd "C->") nil) (define-key dired-mode-map (icicle-kbd "C-M-}") nil) (define-key dired-mode-map (icicle-kbd "C-}") nil) (define-key dired-mode-map (icicle-kbd "C-S-f") nil) (define-key dired-mode-map (icicle-kbd "C-S-o") nil) (define-key dired-mode-map icicle-search-key-prefix nil)) ;; Unbind keys in Ibuffer mode. (when (boundp 'ibuffer-mode-map) (define-key ibuffer-mode-map icicle-search-key-prefix nil)) ;; Unbind keys in Buffer Menu mode. (when (boundp 'Buffer-menu-mode-map) (define-key Buffer-menu-mode-map icicle-search-key-prefix nil)) ;; Unbind `S-TAB' in major maps. (when (fboundp 'map-keymap) ; Emacs 22+. (icicle-unbind-key-completion-keys-in-keymaps-from (current-global-map)) (mapcar #'icicle-unbind-key-completion-keys-for-map-var icicle-keymaps-for-key-completion)) ;; Unbind `M-S-TAB' in `minibuffer-local-map'. (when (fboundp 'map-keymap) ; Emacs 22+. (icicle-unbind-key-completion-keys-for-map-var 'minibuffer-local-map icicle-key-complete-keys-for-minibuffer)) ;; Restore prevention of `this-command' being `handle-switch-frame'. (define-key global-map [handle-switch-frame] nil) (define-key global-map [switch-frame] 'handle-switch-frame)) (defun icicle-unbind-isearch-keys () "Unbind Icicles Isearch commands." (dolist (key icicle-search-from-isearch-keys) (define-key isearch-mode-map key nil)) (dolist (key icicle-isearch-complete-keys) (define-key isearch-mode-map key nil)) (define-key isearch-mode-map (icicle-kbd "C-M-i") 'isearch-complete) (dolist (key icicle-isearch-history-insert-keys) (define-key isearch-mode-map key nil)) (when (fboundp 'isearch-moccur) ; Restore `moccur.el' binding. (define-key isearch-mode-map (icicle-kbd "M-o") 'isearch-moccur)) (define-key isearch-mode-map (icicle-kbd "C-o") nil)) (defun icicle-unbind-key-completion-keys-for-map-var (keymap-var &optional keys) "Unbind `S-TAB' in keymaps accessible from keymap KEYMAP-VAR. KEYMAP-VAR should be bound to a keymap that has at least one prefix keymap. If KEYMAP-VAR is not bound to a keymap, it is ignored. Actually, by default, it is the keys in `icicle-key-complete-keys' that are unbound, not `S-TAB'. And if optional arg KEYS is non-nil then it, not `icicle-key-complete-keys', is the list of keys that are unbound." (let ((temp keymap-var)) (when (boundp temp) (setq temp (symbol-value temp)) (when (keymapp temp) (icicle-unbind-key-completion-keys-in-keymaps-from temp keys))))) (defun icicle-unbind-key-completion-keys-in-keymaps-from (map &optional keys) "Unbind `icicle-key-complete-keys' in keymaps accessible from MAP. Each key in `icicle-complete-keys' (or optional arg KEYS, if non-nil) is unbound in all keymaps accessible from keymap MAP." (dolist (key+map (accessible-keymaps map)) (let ((map (cdr key+map))) (while (and (symbolp map) (fboundp map)) (setq map (symbol-function map))) ; Get a list. (when (and (keymapp map) (not (eq 'autoload (car-safe map))) ; Skip autoload keymaps. (not (stringp (car-safe (last map))))) ; Try to exclude menu maps. (dolist (key (or keys icicle-key-complete-keys)) (when (eq (lookup-key map key) 'icicle-complete-keys) (condition-case nil (define-key map key nil) (error nil)))))))) ;;(@* "Other Icicles functions that define Icicle mode") ;;; Other Icicles functions that define Icicle mode ------------------ (defun icicle-skip-this-command () "Prevent `handle-switch-frame' from being added to `this-command'." (interactive) (setq this-command last-command)) (defun icicle-handle-switch-frame (event) "Call `handle-switch-frame', but don't add it to `this-command'." (interactive "e") (handle-switch-frame event) (setq this-command last-command)) (defun icicle-define-minibuffer-maps (turn-on-p) "Define keymaps for the minibuffer and buffer `*Completions*'." (cond (turn-on-p ; TURN IT ON ******************************** ;; `minibuffer-local-map': default minibuffer map. (let ((map minibuffer-local-map)) ;; Menu-bar `Minibuf' menu. ;; First, remove some standard bindings that are on submenus here. (define-key map [menu-bar minibuf isearch-forward] nil) (define-key map [menu-bar minibuf isearch-backward] nil) (define-key map [menu-bar minibuf next] nil) (define-key map [menu-bar minibuf previous] nil) (define-key-after (lookup-key map [menu-bar minibuf]) [icicle-top-level] '(menu-item "Top Level" icicle-top-level :help "Cancel all minibuffers and return to the top level") 'quit) (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit' '(menu-item "Quit" icicle-abort-recursive-edit :help "Cancel this minibuffer and return to the next higher level")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] '("--")) (define-key map [menu-bar minibuf completion-help] '(menu-item "Icicles Help" icicle-minibuffer-help :help "Display help for minibuffer input and completion" :keys "M-?")) (define-key map [menu-bar minibuf separator-last] '("--")) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] '(menu-item "Toggle Searching Complement" icicle-toggle-search-complementing-domain :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~")) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] '(menu-item "Toggle All-Current Icicle-Search Highlighting" icicle-toggle-highlight-all-current :enable icicle-searching-p :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^")) (define-key map [menu-bar minibuf icicle-multi-inputs-save] '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save :help "Add inputs in minibuffer to saved candidates set for completion")) (define-key map [menu-bar minibuf icicle-multi-inputs-act] '(menu-item "Act on Multiple Inputs" icicle-multi-inputs-act :help "Parse minibuffer input into a list of candidates, then act on each")) (define-key map [menu-bar minibuf separator-misc] '("--")) (define-key map [menu-bar minibuf edit] (list 'menu-item "Edit" icicle-minibuf-edit-menu-map)) (define-key map [menu-bar minibuf history] (list 'menu-item "History" icicle-minibuf-history-menu-map)) ;; Keyboard keys (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g' (dolist (key icicle-completing-read+insert-keys) (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f' ) ; End `minibuffer-local-map'. ;; `minibuffer-local-ns-map': default minibuffer map when spaces are not allowed. ;; In Emacs 22+, local is parent of local-ns. (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-ns-map)) (let ((map minibuffer-local-ns-map)) (define-key-after (lookup-key map [menu-bar minibuf]) [icicle-top-level] '(menu-item "Top Level" icicle-top-level :help "Cancel all minibuffers and return to the top level") 'quit) (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit' '(menu-item "Quit" icicle-abort-recursive-edit :help "Cancel this minibuffer and return to the next higher level")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] '("--")) (define-key map [menu-bar minibuf completion-help] '(menu-item "Icicles Help" icicle-minibuffer-help :help "Display help for minibuffer input and completion" :keys "M-?")) (define-key map [menu-bar minibuf separator-last] '("--")) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] '(menu-item "Toggle Searching Complement" icicle-toggle-search-complementing-domain :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~")) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] '(menu-item "Toggle All-Current Icicle-Search Highlighting" icicle-toggle-highlight-all-current :enable icicle-searching-p :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^")) (define-key map [menu-bar minibuf icicle-multi-inputs-save] '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save :help "Add inputs in minibuffer to saved candidates set for completion")) (define-key map [menu-bar minibuf icicle-multi-inputs-act] '(menu-item "Act on Multiple Inputs" icicle-multi-inputs-act :help "Parse minibuffer input into a list of candidates, then act on each")) (define-key map [menu-bar minibuf separator-misc] '("--")) (define-key map [menu-bar minibuf edit] (list 'menu-item "Edit" icicle-minibuf-edit-menu-map)) (define-key map [menu-bar minibuf history] (list 'menu-item "History" icicle-minibuf-history-menu-map)) ;; Keyboard keys (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g' (dolist (key icicle-completing-read+insert-keys) (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f' )) ; End `minibuffer-local-ns-map'. ;; `minibuffer-local-isearch-map': minibuffer map for editing isearch strings. ;; In Emacs 21+, local is parent of local-isearch. (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-isearch-map)) (let ((map minibuffer-local-isearch-map)) (define-key-after (lookup-key map [menu-bar minibuf]) [icicle-top-level] '(menu-item "Top Level" icicle-top-level :help "Cancel all minibuffers and return to the top level") 'quit) (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit' '(menu-item "Quit" icicle-abort-recursive-edit :help "Cancel this minibuffer and return to the next higher level")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] '("--")) (define-key map [menu-bar minibuf completion-help] '(menu-item "Icicles Help" icicle-minibuffer-help :help "Display help for minibuffer input and completion" :keys "M-?")) (define-key map [menu-bar minibuf separator-last] '("--")) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] '(menu-item "Toggle Searching Complement" icicle-toggle-search-complementing-domain :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~")) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] '(menu-item "Toggle All-Current Icicle-Search Highlighting" icicle-toggle-highlight-all-current :enable icicle-searching-p :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^")) (define-key map [menu-bar minibuf icicle-multi-inputs-save] '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save :help "Add inputs in minibuffer to saved candidates set for completion")) (define-key map [menu-bar minibuf icicle-multi-inputs-act] '(menu-item "Act on Multiple Inputs" icicle-multi-inputs-act :help "Parse minibuffer input into a list of candidates, then act on each")) (define-key map [menu-bar minibuf separator-misc] '("--")) (define-key map [menu-bar minibuf edit] (list 'menu-item "Edit" icicle-minibuf-edit-menu-map)) (define-key map [menu-bar minibuf history] (list 'menu-item "History" icicle-minibuf-history-menu-map)) ;; Keyboard keys (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g' (dolist (key icicle-completing-read+insert-keys) (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f' )) ; End `minibuffer-local-isearch-map'. ;; `minibuffer-local-completion-map': completion map. (icicle-bind-completion-keys minibuffer-local-completion-map) ;; `minibuffer-local-must-match-map': must-match map. ;; In Emacs 22+, local-completion is parent of local-must-match. (let ((map minibuffer-local-must-match-map)) (if (not (eq minibuffer-local-completion-map (keymap-parent map))) (icicle-bind-completion-keys map) ;; Keyboard keys (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings) ;; Need `C-g' anyway, even if `minibuffer-local-must-match-map' inherits completion map. (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g' (dolist (key icicle-completing-read+insert-keys) (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f' )) ; End `minibuffer-local-must-match-map'. ;; `completion-list-mode-map': map for `*Completions*' buffer. ;; Abort on `C-g' or `q'. Switch to minibuffer on `C-insert'. Do not allow normal input. (let ((map completion-list-mode-map)) ;; Keyboard keys (icicle-bind-custom-minibuffer-keys map icicle-completion-list-key-bindings) (dolist (key icicle-candidate-help-keys) ; `C-M-return', `C-help', `C-M-help', `C-f1', (define-key map key 'icicle-help-on-candidate)) ; `C-M-f1' (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g' (define-key map (icicle-kbd "C-M-S-t") 'icicle-top-level) ; `C-M-S-t' (aka `C-M-T') )) ; End `completion-list-mode-map'. (t ; TURN IT OFF ******************************* ;; `minibuffer-local-map': default minibuffer map. (let ((map minibuffer-local-map)) ;; Menu-bar `Minibuf' menu. (define-key map [menu-bar minibuf quit] '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] nil) (define-key map [menu-bar minibuf completion-help] nil) (define-key map [menu-bar minibuf separator-last] nil) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil) (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil) (define-key map [menu-bar minibuf separator-set2] nil) (define-key map [menu-bar minibuf icicle-clear-current-history] nil) (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil) (define-key map [menu-bar minibuf icicle-delete-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil) (define-key map [menu-bar minibuf icicle-insert-key-description] nil) (define-key map [menu-bar minibuf icicle-insert-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil) (define-key map [menu-bar minibuf icicle-completing-read+insert] nil) (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil) ;; Keyboard keys (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f' ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'. (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit) delete-selection-mode) 'minibuffer-keyboard-quit 'abort-recursive-edit)) ; `C-g' (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r' (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s' (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j' ) ; End `minibuffer-local-map'. ;; `minibuffer-local-ns-map': default minibuffer map when spaces are not allowed. ;; In Emacs 22+, local is parent of local-ns. (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-ns-map)) (let ((map minibuffer-local-ns-map)) (define-key map [menu-bar minibuf quit] '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] nil) (define-key map [menu-bar minibuf completion-help] nil) (define-key map [menu-bar minibuf separator-last] nil) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil) (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil) (define-key map [menu-bar minibuf separator-set2] nil) (define-key map [menu-bar minibuf icicle-clear-current-history] nil) (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil) (define-key map [menu-bar minibuf icicle-delete-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil) (define-key map [menu-bar minibuf icicle-insert-key-description] nil) (define-key map [menu-bar minibuf icicle-insert-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil) (define-key map [menu-bar minibuf icicle-completing-read+insert] nil) (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil) ;; Keyboard keys (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f' ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'. (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit) delete-selection-mode) 'minibuffer-keyboard-quit 'abort-recursive-edit)) ; `C-g' (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r' (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s' (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j' )) ; End `minibuffer-local-ns-map'. ;; `minibuffer-local-isearch-map': minibuffer map for editing isearch strings. ;; In Emacs 21+, local is parent of local-isearch (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-isearch-map)) (let ((map minibuffer-local-isearch-map)) (define-key map [menu-bar minibuf quit] '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] nil) (define-key map [menu-bar minibuf completion-help] nil) (define-key map [menu-bar minibuf separator-last] nil) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil) (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil) (define-key map [menu-bar minibuf separator-set2] nil) (define-key map [menu-bar minibuf icicle-clear-current-history] nil) (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil) (define-key map [menu-bar minibuf icicle-delete-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil) (define-key map [menu-bar minibuf icicle-insert-key-description] nil) (define-key map [menu-bar minibuf icicle-insert-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil) (define-key map [menu-bar minibuf icicle-completing-read+insert] nil) (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil) ;; Keyboard keys (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c' (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f' ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'. (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit) delete-selection-mode) 'minibuffer-keyboard-quit 'abort-recursive-edit)) ; `C-g' (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r' (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s' (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j' )) ; End `minibuffer-local-isearch-map'. ;; `minibuffer-local-completion-map': completion map. (icicle-restore-completion-keys minibuffer-local-completion-map) ;; `minibuffer-local-must-match-map': must-match map. ;; In Emacs 22+, local-completion is parent of local-must-match (let ((map minibuffer-local-must-match-map)) (if (not (eq minibuffer-local-completion-map (keymap-parent map))) (icicle-restore-completion-keys map) ;; Keyboard keys (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings) (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'. ;; Need do `C-g' anyway, even if inherit completion map. (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit) delete-selection-mode) 'minibuffer-keyboard-quit 'abort-recursive-edit)) ; `C-g' (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r' (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s' (define-key map (icicle-kbd "C-j") 'minibuffer-complete-and-exit) ; `C-j' (newline) )) ; End `minibuffer-local-must-match-map'. ;; `completion-list-mode-map': map for `*Completions*' buffer. (let ((map completion-list-mode-map)) ;; Keyboard keys (icicle-restore-custom-minibuffer-keys map icicle-completion-list-key-bindings) (dolist (key icicle-candidate-help-keys) (define-key map key nil)) (define-key map (icicle-kbd "C-g") nil) (define-key map (icicle-kbd "C-M-S-t") nil) ;; Do these last: (define-key map (icicle-kbd "right") 'next-completion) (define-key map (icicle-kbd "left") 'previous-completion)))) (when (and (interactive-p) turn-on-p) (message (substitute-command-keys "Use `\\\ \\[icicle-minibuffer-help]' in minibuffer for help.")))) (defun icicle-unmap (command map current) "In MAP, unbind any keys that are bound to COMMAND. If command remapping is available, remap COMMAND to nil in MAP, unbinding it. Otherwise, bind COMMAND to whatever CURRENT is bound to in MAP." (if (fboundp 'command-remapping) (define-key map (vector 'remap command) nil) (substitute-key-definition current command map))) (defun icicle-rebind-global (old new map) "Bind command NEW in MAP to all keys currently bound globally to OLD." (substitute-key-definition old new map (current-global-map))) (defun icicle-bind-completion-keys (map) "Bind keys for minibuffer completion map MAP. MAP is `minibuffer-local-completion-map' or `minibuffer-local-must-match-map'." ;; Menu-bar `Minibuf' menu. (define-key map [menu-bar minibuf separator-complete2] '("--")) (define-key map [menu-bar minibuf word-complete] '(menu-item "Word-Complete" icicle-prefix-word-complete :help "Complete at most one word of prefix")) (define-key map [menu-bar minibuf prefix-complete] '(menu-item "Prefix-Complete" icicle-prefix-complete :help "Complete prefix as far as possible")) (define-key map [menu-bar minibuf apropos-complete] '(menu-item "Apropos-Complete" icicle-apropos-complete :keys "S-TAB" :help "Complete regular expression as far as possible and list completions")) (define-key map [menu-bar minibuf separator-complete1] '("--")) ;; In Emacs 22+, local is parent of local-completion (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)) (define-key-after (lookup-key map [menu-bar minibuf]) [icicle-top-level] '(menu-item "Top Level" icicle-top-level :help "Cancel all minibuffers and return to the top level") 'quit) (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit' '(menu-item "Quit" icicle-abort-recursive-edit :help "Cancel this minibuffer and return to the next higher level")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] '("--")) (define-key map [menu-bar minibuf completion-help] '(menu-item "Icicles Help" icicle-minibuffer-help :help "Display help for minibuffer input and completion" :keys "M-?")) (define-key map [menu-bar minibuf separator-last] '("--")) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] '(menu-item "Toggle Searching Complement" icicle-toggle-search-complementing-domain :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~")) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] '(menu-item "Toggle All-Current Icicle-Search Highlighting" icicle-toggle-highlight-all-current :enable icicle-searching-p :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^")) (define-key map [menu-bar minibuf icicle-multi-inputs-save] '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save :help "Add inputs in minibuffer to saved candidates set for completion")) (define-key map [menu-bar minibuf icicle-multi-inputs-act] '(menu-item "Act on Multiple Inputs" icicle-multi-inputs-act :help "Parse minibuffer input into a list of candidates, then act on each")) (define-key map [menu-bar minibuf separator-misc] '("--")) ;; Submenus. (define-key map [menu-bar minibuf edit] (list 'menu-item "Edit" icicle-minibuf-edit-menu-map)) (define-key map [menu-bar minibuf history] (list 'menu-item "History" icicle-minibuf-history-menu-map)) ) ;; Remove some standard menu items. (define-key map [menu-bar minibuf ?\?] nil) (define-key map [menu-bar minibuf space] nil) (define-key map [menu-bar minibuf tab] nil) ;; Submenus. (define-key map [menu-bar minibuf candidate-action] (list 'menu-item "Act on All Candidates" icicle-minibuf-act-on-all-menu-map)) (define-key map [menu-bar minibuf candidate-set] (list 'menu-item "Candidate Set" icicle-minibuf-candidate-set-menu-map)) (define-key map [menu-bar minibuf save/retrieve] (list 'menu-item "Save/Retrieve Candidates" icicle-minibuf-save-retrieve-menu-map)) ;; Remap some commands for completion. (icicle-remap 'self-insert-command 'icicle-self-insert map (current-global-map)) (icicle-remap 'universal-argument 'icicle-universal-argument ; `C-u' map (current-global-map)) (icicle-remap 'negative-argument 'icicle-negative-argument ; `M--' map (current-global-map)) (icicle-remap 'digit-argument 'icicle-digit-argument ; `C-9' map (current-global-map)) (icicle-remap 'backward-delete-char-untabify 'icicle-backward-delete-char-untabify ; `DEL' map (current-global-map)) (icicle-remap 'delete-backward-char 'icicle-delete-backward-char ; `DEL' map (current-global-map)) (icicle-remap 'delete-char 'icicle-delete-char ; `C-d', `deletechar' map (current-global-map)) (icicle-remap 'backward-kill-word 'icicle-backward-kill-word ; `M-DEL' map (current-global-map)) (icicle-remap 'kill-word 'icicle-kill-word ; `M-d' map (current-global-map)) (icicle-remap 'backward-kill-sexp 'icicle-backward-kill-sexp ; `C-M-backspace' map (current-global-map)) (icicle-remap 'kill-sexp 'icicle-kill-sexp ; `C-M-k', `C-M-delete' map (current-global-map)) (icicle-remap 'backward-kill-sentence 'icicle-backward-kill-sentence ; `C-x DEL' map (current-global-map)) (icicle-remap 'backward-kill-paragraph 'icicle-backward-kill-paragraph ; `C-backspace' map (current-global-map)) (icicle-remap 'kill-paragraph 'icicle-kill-paragraph ; `C-delete' map (current-global-map)) (icicle-remap 'kill-line 'icicle-kill-line ; `C-k', `deleteline' map (current-global-map)) (icicle-remap 'reposition-window 'icicle-goto/kill-failed-input ; `C-M-l' map (current-global-map)) (icicle-remap 'transpose-chars 'icicle-transpose-chars ; `C-t' map (current-global-map)) (icicle-remap 'transpose-words 'icicle-transpose-words ; `M-t' map (current-global-map)) (icicle-remap 'transpose-sexps 'icicle-transpose-sexps ; `C-M-t' map (current-global-map)) (icicle-remap 'yank-pop 'icicle-yank-pop ; `M-y', `M-insert' map (current-global-map)) (icicle-remap 'mouse-yank-secondary 'icicle-mouse-yank-secondary ; `M-mouse-2' map (current-global-map)) ;; Bind additional keys. (dolist (key icicle-candidate-action-keys) (define-key map key 'icicle-candidate-action)) ; `C-return', `C-RET' (dolist (key icicle-candidate-help-keys) ; `C-M-return', `C-M-RET', `C-help', `C-M-help', (define-key map key 'icicle-help-on-candidate)) ; `C-f1', `C-M-f1' (dolist (key icicle-word-completion-keys) (define-key map key 'icicle-prefix-word-complete)) ; `M-SPC' (dolist (key icicle-apropos-complete-keys) (define-key map key 'icicle-apropos-complete)) ; `S-TAB' (dolist (key icicle-prefix-complete-keys) (define-key map key 'icicle-prefix-complete)) ; `TAB' (dolist (key icicle-apropos-complete-no-display-keys) (define-key map key 'icicle-apropos-complete-no-display)) ; `C-M-S-TAB' (dolist (key icicle-prefix-complete-no-display-keys) (define-key map key 'icicle-prefix-complete-no-display)) ; `C-M-TAB' (icicle-define-cycling-keys map) ; `up', `down', `prior', `next', ; `C-up', `C-down', `C-prior', `C-next', ; `C-M-up', `C-M-down', `C-M-prior', `C-M-next', ; `C-S-up', `C-S-down', `C-S-prior', `C-S-next', (icicle-bind-custom-minibuffer-keys map icicle-completion-key-bindings)) (defun icicle-restore-completion-keys (map) "Restore standard keys for minibuffer completion map MAP. MAP is `minibuffer-local-completion-map', `minibuffer-local-filename-completion-map', or `minibuffer-local-must-match-map'." ;; Menu-bar `Minibuf' menu. ;; In Emacs 22+, local is parent of local-completion (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)) (define-key map [menu-bar minibuf quit] '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer")) (define-key map [menu-bar minibuf return] '(menu-item "Enter" exit-minibuffer :help "Terminate input and exit minibuffer" :keys "RET")) (define-key map [menu-bar minibuf separator-help] nil) (define-key map [menu-bar minibuf completion-help] nil) (define-key map [menu-bar minibuf separator-last] nil) (define-key map [menu-bar minibuf icicle-clear-current-history] nil) (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil) (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil) (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil) (define-key map [menu-bar minibuf separator-set2] nil) (define-key map [menu-bar minibuf icicle-clear-current-history] nil) (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil) (define-key map [menu-bar minibuf icicle-delete-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil) (define-key map [menu-bar minibuf icicle-insert-key-description] nil) (define-key map [menu-bar minibuf icicle-insert-history-element] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil) (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil) (define-key map [menu-bar minibuf icicle-completing-read+insert] nil) (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil) ) (define-key map [menu-bar minibuf icicle-goto/kill-failed-input] nil) (define-key map [menu-bar minibuf icicle-retrieve-next-input] nil) (define-key map [menu-bar minibuf icicle-retrieve-previous-input] nil) (define-key map [menu-bar minibuf separator-C-l] nil) (define-key map [menu-bar minibuf alt-action-list-all] nil) (define-key map [menu-bar minibuf alt-action-all] nil) (define-key map [menu-bar minibuf action-list-all] nil) (define-key map [menu-bar minibuf action-all] nil) (define-key map [menu-bar minibuf separator-actions] nil) (define-key map [menu-bar minibuf set-define] nil) (define-key map [menu-bar minibuf icicle-keep-only-past-inputs] nil) (define-key map [menu-bar minibuf set-union] nil) (define-key map [menu-bar minibuf set-difference] nil) (define-key map [menu-bar minibuf set-intersection] nil) (define-key map [menu-bar minibuf icicle-save-predicate-to-variable] nil) (define-key map [menu-bar minibuf icicle-narrow-candidates-with-predicate] nil) (define-key map [menu-bar minibuf icicle-narrow-candidates] nil) (define-key map [menu-bar minibuf icicle-widen-candidates] nil) (define-key map [menu-bar minibuf set-complement] nil) (define-key map [menu-bar minibuf separator-set1] nil) (define-key map [menu-bar minibuf set-swap] nil) (define-key map [menu-bar minibuf icicle-candidate-set-save-more-selected] nil) (define-key map [menu-bar minibuf icicle-candidate-set-save-selected] nil) (define-key map [menu-bar minibuf icicle-candidate-set-save-more] nil) (define-key map [menu-bar minibuf set-retrieve-from-cache-file] nil) (define-key map [menu-bar minibuf set-retrieve-from-variable] nil) (define-key map [menu-bar minibuf set-retrieve] nil) (define-key map [menu-bar minibuf set-save-to-cache-file] nil) (define-key map [menu-bar minibuf set-save-to-variable] nil) (define-key map [menu-bar minibuf set-save] nil) (define-key map [menu-bar minibuf separator-set2] nil) (define-key map [menu-bar minibuf word-complete] nil) (define-key map [menu-bar minibuf prefix-complete] nil) (define-key map [menu-bar minibuf apropos-complete] nil) (define-key map [menu-bar minibuf ?\?] '(menu-item "List Completions" minibuffer-completion-help :help "Display all possible completions")) (define-key map [menu-bar minibuf space] '(menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word")) (define-key map [menu-bar minibuf tab] '(menu-item "Complete" minibuffer-complete :help "Complete as far as possible")) ;; Unmap commands that were bound for completion. (icicle-unmap 'self-insert-command map 'icicle-self-insert) (icicle-unmap 'universal-argument map 'icicle-universal-argument) (icicle-unmap 'negative-argument map 'icicle-negative-argument) (icicle-unmap 'digit-argument map 'icicle-digit-argument) (icicle-unmap 'backward-delete-char-untabify map 'icicle-backward-delete-char-untabify) (icicle-unmap 'delete-backward-char map 'icicle-delete-backward-char) (icicle-unmap 'delete-char map 'icicle-delete-char) (icicle-unmap 'backward-kill-word map 'icicle-backward-kill-word) (icicle-unmap 'kill-word map 'icicle-kill-word) (icicle-unmap 'backward-kill-sexp map 'icicle-backward-kill-sexp) (icicle-unmap 'kill-sexp map 'icicle-kill-sexp) (icicle-unmap 'backward-kill-sentence map 'icicle-backward-kill-sentence) (icicle-unmap 'backward-kill-paragraph map 'icicle-backward-kill-paragraph) (icicle-unmap 'kill-paragraph map 'icicle-kill-paragraph) (icicle-unmap 'kill-line map 'icicle-kill-line) (icicle-unmap 'reposition-window map 'icicle-goto/kill-failed-input) (icicle-unmap 'transpose-chars map 'icicle-transpose-chars) (icicle-unmap 'transpose-words map 'icicle-transpose-words) (icicle-unmap 'transpose-sexps map 'icicle-transpose-sexps) (icicle-unmap 'yank-pop map 'icicle-yank-pop) (icicle-unmap 'mouse-yank-secondary map 'icicle-mouse-yank-secondary) ;; Restore additional bindings. ;; Do the option keys first, so they can be rebound as needed. (dolist (key icicle-candidate-action-keys) (define-key map key nil)) (dolist (key icicle-candidate-help-keys) (define-key map key nil)) (dolist (key icicle-word-completion-keys) (define-key map key nil)) (dolist (key icicle-apropos-complete-keys) (define-key map key nil)) (dolist (key icicle-prefix-complete-keys) (define-key map key nil)) (dolist (key icicle-apropos-complete-no-display-keys) (define-key map key nil)) (dolist (key icicle-prefix-complete-no-display-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-previous-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-next-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-previous-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-next-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-previous-action-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-previous-alt-action-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-next-action-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-next-alt-action-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-previous-action-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-previous-alt-action-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-next-action-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-next-alt-action-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-up-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-down-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-up-action-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-up-alt-action-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-down-action-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-down-alt-action-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-up-help-keys) (define-key map key nil)) (dolist (key icicle-modal-cycle-down-help-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-previous-help-keys) (define-key map key nil)) (dolist (key icicle-prefix-cycle-next-help-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-previous-help-keys) (define-key map key nil)) (dolist (key icicle-apropos-cycle-next-help-keys) (define-key map key nil)) (icicle-restore-custom-minibuffer-keys map icicle-completion-key-bindings) ;; Do these last. ----------------- (define-key map (icicle-kbd "C-i") 'minibuffer-complete) (define-key map (icicle-kbd "tab") 'minibuffer-complete) (define-key map (icicle-kbd "?") 'minibuffer-completion-help) (define-key map (icicle-kbd "SPC") 'minibuffer-complete-word) (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit) delete-selection-mode) 'minibuffer-keyboard-quit 'abort-recursive-edit)) ;; In Emacs 22+, local is parent of local-completion (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)) (define-key map (icicle-kbd "C-j") 'exit-minibuffer)) (define-key map (icicle-kbd "M-p") 'previous-history-element) (define-key map (icicle-kbd "M-n") 'next-history-element) (define-key map (icicle-kbd "up") 'previous-history-element) (define-key map (icicle-kbd "down") 'next-history-element) (define-key map (icicle-kbd "M-v") 'switch-to-completions) (define-key map (icicle-kbd "prior") 'switch-to-completions) (define-key map (icicle-kbd "next") 'next-history-element)) (defun icicle-bind-custom-minibuffer-keys (map option &optional defs) "Bind customizable keys for minibuffer completion map MAP. These are the keys defined by option OPTION." (let (key command condition) (unless defs (setq defs option)) (dolist (key-def defs) (setq key (car key-def) command (cadr key-def) condition (car (cddr key-def))) (when (eval condition) (if (symbolp key) (icicle-remap key command map) (define-key map key command)))))) (defun icicle-restore-custom-minibuffer-keys (map option) "Restore customizable keys for minibuffer map MAP. These are the keys defined by option OPTION." (let (key condition) (dolist (key-def option) (setq key (car key-def) condition (car (cddr key-def))) (when (eval condition) (if (symbolp key) (icicle-remap key nil map) (define-key map key nil)))))) (defun icicle-minibuffer-setup () "Run in minibuffer on activation, to enable completion cycling. Usually run by inclusion in `minibuffer-setup-hook'." (when (and icicle-mode (window-minibuffer-p (selected-window)) (not executing-kbd-macro)) ;; The pre- and post-command hooks are local to the ;; minibuffer, so they are added here, not in `icicle-mode'. ;; They are removed in `icicle-mode' when mode is exited. (unless (fboundp 'define-minor-mode) (make-local-hook 'pre-command-hook)) (add-hook 'pre-command-hook 'icicle-top-level-prep) ; This must not be LOCAL (nil LOCAL arg). (add-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook nil t) (unless (fboundp 'define-minor-mode) (make-local-hook 'post-command-hook)) (add-hook 'post-command-hook 'icicle-run-icicle-post-command-hook nil t) ;; Change the region background here dynamically. It would be better to ;; just use a buffer-local face, but those don't yet exist. (when (= 1 (recursion-depth)) (setq icicle-saved-region-background (face-background 'region)) (when icicle-change-region-background-flag (set-face-background 'region icicle-region-background))) ;; Reset prompt, because some commands (e.g. `find-file') don't use `read-file-name' ;; or `completing-read'. Reset other stuff too. (setq icicle-candidate-nb nil icicle-completion-candidates nil ;; This is so that cycling works right initially, without first hitting `TAB' or `S-TAB'. icicle-current-completion-mode (and (< (minibuffer-depth) 2) (case icicle-default-cycling-mode ((nil) nil) (apropos 'apropos) (prefix 'prefix) (otherwise nil))) icicle-mode-line-help nil icicle-next-apropos-complete-cycles-p nil icicle-next-prefix-complete-cycles-p nil icicle-incremental-completion-p icicle-incremental-completion icicle-initial-value nil icicle-cmd-reading-input this-command icicle-last-completion-command nil icicle-last-completion-candidate nil icicle-last-input nil icicle-input-fail-pos nil icicle-saved-proxy-candidates nil ;; `other-buffer' doesn't work, because it looks for a buffer only from the same frame. icicle-pre-minibuffer-buffer (cadr (buffer-list)) ; $$$$$$ (other-buffer nil t) ) (when (and (icicle-completing-p) (> emacs-major-version 20)) (let ((prompt-prefix (if icicle-candidate-action-fn "+ " ". "))) (put-text-property 0 1 'face (cond ((and icicle-candidate-action-fn (icicle-require-match-p)) '(icicle-multi-command-completion icicle-mustmatch-completion)) (icicle-candidate-action-fn 'icicle-multi-command-completion) ((icicle-require-match-p) '(icicle-completion icicle-mustmatch-completion)) (t 'icicle-completion)) prompt-prefix) (if (overlayp icicle-completion-prompt-overlay) (move-overlay icicle-completion-prompt-overlay (point-min) (point-min)) (setq icicle-completion-prompt-overlay (make-overlay (point-min) (point-min)))) (overlay-put icicle-completion-prompt-overlay 'before-string prompt-prefix))) (unless icicle-add-proxy-candidates-flag (setq icicle-saved-proxy-candidates (prog1 icicle-proxy-candidates (setq icicle-proxy-candidates icicle-saved-proxy-candidates)))) (while icicle-saved-candidate-overlays (delete-overlay (car icicle-saved-candidate-overlays)) (setq icicle-saved-candidate-overlays (cdr icicle-saved-candidate-overlays))) (icicle-update-ignored-extensions-regexp) (when (memq icicle-default-value '(preselect-start preselect-end)) (icicle-select-minibuffer-contents)) (when (and icicle-show-Completions-initially-flag (not icicle-progressive-completing-p) ; If narrowed, then we have already completed. (icicle-completing-p) ; Function initializes variable `icicle-completing-p'. (sit-for icicle-incremental-completion-delay)) ; Let user interrupt. (case icicle-default-cycling-mode (apropos (icicle-apropos-complete)) (otherwise (icicle-prefix-complete)))) ; Prefix completion, by default. (run-hooks 'icicle-minibuffer-setup-hook))) (defun icicle-define-cycling-keys (map) "Define keys for cycling candidates. The modal keys are defined first, then the non-modal keys. That means that in case of conflict mode-specific cyling wins. For example, if you define both `icicle-modal-cycle-up-keys' and `icicle-prefix-cycle-previous-keys' as ([up]), the latter gets the binding." (cond (icicle-use-C-for-actions-flag ; Use `C-' for actions, no `C-' for plain cycling. ;; Modal cycling keys. (dolist (key icicle-modal-cycle-up-keys) (define-key map key 'icicle-previous-candidate-per-mode)) ; `up' (dolist (key icicle-modal-cycle-down-keys) (define-key map key 'icicle-next-candidate-per-mode)) ; `down' (dolist (key icicle-modal-cycle-up-action-keys) (define-key map key 'icicle-previous-candidate-per-mode-action)) ; `C-up' (dolist (key icicle-modal-cycle-down-action-keys) (define-key map key 'icicle-next-candidate-per-mode-action)) ; `C-down' ;; Non-modal cycling keys. In case of conflict, these will prevail over modal keys. (dolist (key icicle-prefix-cycle-previous-keys) (define-key map key 'icicle-previous-prefix-candidate)) ; `home' (dolist (key icicle-prefix-cycle-next-keys) (define-key map key 'icicle-next-prefix-candidate)) ; `end' (dolist (key icicle-apropos-cycle-previous-keys) (define-key map key 'icicle-previous-apropos-candidate)) ; `prior' (dolist (key icicle-apropos-cycle-next-keys) (define-key map key 'icicle-next-apropos-candidate)) ; `next' (dolist (key icicle-prefix-cycle-previous-action-keys) (define-key map key 'icicle-previous-prefix-candidate-action)) ; `C-home' (dolist (key icicle-prefix-cycle-next-action-keys) (define-key map key 'icicle-next-prefix-candidate-action)) ; `C-end' (dolist (key icicle-apropos-cycle-previous-action-keys) (define-key map key 'icicle-previous-apropos-candidate-action)) ; `C-prior' (dolist (key icicle-apropos-cycle-next-action-keys) (define-key map key 'icicle-next-apropos-candidate-action))) ; `C-next' (t ; Use `C-' for plain cycling, NO `C-' for action. ;; Modal cycling keys. At least some of these will overwrite non-modal keys. (dolist (key icicle-modal-cycle-up-keys) (define-key map key 'icicle-previous-candidate-per-mode-action)) ; `up' (dolist (key icicle-modal-cycle-down-keys) (define-key map key 'icicle-next-candidate-per-mode-action)) ; `down' (dolist (key icicle-modal-cycle-up-action-keys) (define-key map key 'icicle-previous-candidate-per-mode)) ; `C-up' (dolist (key icicle-modal-cycle-down-action-keys) (define-key map key 'icicle-next-candidate-per-mode)) ; `C-down' ;; Non-modal cycling keys. In case of conflict, these will prevail over modal keys. (dolist (key icicle-prefix-cycle-previous-keys) (define-key map key 'icicle-previous-prefix-candidate-action)) ; `home' (dolist (key icicle-prefix-cycle-next-keys) (define-key map key 'icicle-next-prefix-candidate-action)) ; `end' (dolist (key icicle-apropos-cycle-previous-keys) (define-key map key 'icicle-previous-apropos-candidate-action)) ; `prior' (dolist (key icicle-apropos-cycle-next-keys) (define-key map key 'icicle-next-apropos-candidate-action)) ; `next' (dolist (key icicle-prefix-cycle-previous-action-keys) (define-key map key 'icicle-previous-prefix-candidate)) ; `C-home' (dolist (key icicle-prefix-cycle-next-action-keys) (define-key map key 'icicle-next-prefix-candidate)) ; `C-end' (dolist (key icicle-apropos-cycle-previous-action-keys) (define-key map key 'icicle-previous-apropos-candidate)) ; `C-prior' (dolist (key icicle-apropos-cycle-next-action-keys) (define-key map key 'icicle-next-apropos-candidate)))) ;; Help and alternative-action keys are NOT controlled by `icicle-use-C-for-actions-flag'. ;; ;; Define modal cycling help and alternative action keys. (dolist (key icicle-modal-cycle-up-help-keys) (define-key map key 'icicle-previous-candidate-per-mode-help)) ; `C-M-up' (dolist (key icicle-modal-cycle-down-help-keys) (define-key map key 'icicle-next-candidate-per-mode-help)) ; `C-M-down' (dolist (key icicle-modal-cycle-up-alt-action-keys) (define-key map key 'icicle-previous-candidate-per-mode-alt-action)) ; `C-S-up' (dolist (key icicle-modal-cycle-down-alt-action-keys) (define-key map key 'icicle-next-candidate-per-mode-alt-action)) ; `C-S-down' ;; Define non-modal cycling help and alternative action keys. (dolist (key icicle-prefix-cycle-previous-help-keys) (define-key map key 'icicle-help-on-previous-prefix-candidate)) ; `C-M-home' (dolist (key icicle-prefix-cycle-next-help-keys) (define-key map key 'icicle-help-on-next-prefix-candidate)) ; `C-M-end' (dolist (key icicle-apropos-cycle-previous-help-keys) (define-key map key 'icicle-help-on-previous-apropos-candidate)) ; `C-M-prior' (dolist (key icicle-apropos-cycle-next-help-keys) (define-key map key 'icicle-help-on-next-apropos-candidate)) ; `C-M-next' (dolist (key icicle-prefix-cycle-previous-alt-action-keys) (define-key map key 'icicle-previous-prefix-candidate-alt-action)) ; `C-S-home' (dolist (key icicle-prefix-cycle-next-alt-action-keys) (define-key map key 'icicle-next-prefix-candidate-alt-action)) ; `C-S-end' (dolist (key icicle-apropos-cycle-previous-alt-action-keys) (define-key map key 'icicle-previous-apropos-candidate-alt-action)) ; `C-S-prior' (dolist (key icicle-apropos-cycle-next-alt-action-keys) (define-key map key 'icicle-next-apropos-candidate-alt-action))) ; `C-S-next' (defun icicle-select-minibuffer-contents () "Select minibuffer contents and leave point at its beginning." (let ((min (icicle-minibuffer-prompt-end))) (set-mark (if (eq 'preselect-start icicle-default-value) (point-max) min)) (goto-char (if (eq 'preselect-start icicle-default-value) min (point-max))))) ;; $$$ (defadvice next-history-element (after icicle-select-minibuffer-contents activate) ;; "Select minibuffer contents and leave point at its beginning." ;; (when (and icicle-mode (memq icicle-default-value '(preselect-start preselect-end))) ;; (icicle-select-minibuffer-contents) ;; (setq deactivate-mark nil))) (defun icicle-cancel-Help-redirection () "Cancel redirection of focus from *Help* buffer to minibuffer. Focus was redirected during `icicle-help-on-candidate'." (let* ((help-window (get-buffer-window "*Help*" 0)) (help-frame (and help-window (window-frame help-window)))) (when help-frame (redirect-frame-focus help-frame)))) (defun icicle-run-icicle-pre-command-hook () "Run `icicle-pre-command-hook' functions. Used in `pre-command-hook'." (run-hooks 'icicle-pre-command-hook)) (defun icicle-run-icicle-post-command-hook () "Run `icicle-post-command-hook' functions. Used in `post-command-hook'." (run-hooks 'icicle-post-command-hook)) (defun icicle-set-calling-cmd () "Remember last command that called for completion. Used in `completion-setup-hook'." (setq icicle-cmd-calling-for-completion this-command)) (defun icicle-update-ignored-extensions-regexp () "Update ignored extensions if `completion-ignored-extensions' changed." (when (and (icicle-file-name-input-p) ; In `icicles-fn.el'. (not (equal icicle-ignored-extensions completion-ignored-extensions))) (setq icicle-ignored-extensions-regexp ; Make regexp for ignored file extensions. (concat "\\(" (mapconcat #'regexp-quote completion-ignored-extensions "\\|") "\\)\\'") ;; Flag to prevent updating `icicle-ignored-extensions-regexp' unless ;; `completion-ignored-extensions' changes. icicle-ignored-extensions completion-ignored-extensions))) ;; We change the region background here dynamically. ;; It would be better to just use a buffer-local face, but those don't yet exist. (defun icicle-restore-region-face () "Restore region face. It was changed during minibuffer activity if `icicle-change-region-background-flag' is non-nil." (when (and icicle-change-region-background-flag (= 1 (recursion-depth))) (set-face-background 'region icicle-saved-region-background))) (defun icicle-activate-mark () "Prevent region from being deactivated. Used in `icicle-post-command-hook'." (when (and (window-minibuffer-p (selected-window)) icicle-completing-p (not executing-kbd-macro)) (setq deactivate-mark nil))) (defun icicle-show-current-help-in-mode-line () "Show `icicle-mode-line-help'. Used in `icicle-post-command-hook'." (when icicle-mode-line-help (icicle-show-help-in-mode-line icicle-mode-line-help))) (defun icicle-redefine-standard-functions () "Alias the functions in `icicle-functions-to-redefine' to Icicles versions." (when (fboundp 'icicle-completing-read) (dolist (fn icicle-functions-to-redefine) (when (fboundp (intern (concat "icicle-ORIG-" (symbol-name fn)))) (fset fn (intern (concat "icicle-" (symbol-name fn)))))))) (defun icicle-restore-standard-functions () "Restore original versions of functions in `icicle-functions-to-redefine'." (when (fboundp 'icicle-ORIG-completing-read) (let (orig-fn) (dolist (fn icicle-functions-to-redefine) (when (fboundp (setq orig-fn (intern (concat "icicle-ORIG-" (symbol-name fn))))) (fset fn orig-fn)))))) (defun icicle-redefine-standard-widgets () "Alias the widgets in `icicle-widgets-to-redefine' to Icicles versions." (when (fboundp 'icicle-completing-read) (let (ici-wid) (dolist (wid icicle-widgets-to-redefine) (when (icicle-widgetp (intern (concat "icicle-ORIG-" (symbol-name wid)))) (setq ici-wid (intern (concat "icicle-" (symbol-name wid)))) (put wid 'widget-type (get ici-wid 'widget-type)) (put wid 'widget-documentation (get ici-wid 'widget-documentation))))))) (defun icicle-restore-standard-widgets () "Restore original versions of widgets in `icicle-widgets-to-redefine'." (when (fboundp 'icicle-ORIG-completing-read) (let (orig-wid) (dolist (wid icicle-widgets-to-redefine) (when (icicle-widgetp (setq orig-wid (intern (concat "icicle-ORIG-" (symbol-name wid))))) (put wid 'widget-type (get orig-wid 'widget-type)) (put wid 'widget-documentation (get orig-wid 'widget-documentation))))))) ;;; In Emacs versions before 22: ;;; Save original `read-file-name'. We redefine it as `icicle-read-file-name' (which calls it). ;;; Then we restore it when you quit Icicle mode. (In Emacs 22+, no redefinition is needed.) (unless (or (boundp 'read-file-name-function) (fboundp 'icicle-ORIG-read-file-name)) (defalias 'icicle-ORIG-read-file-name (symbol-function 'read-file-name))) (defun icicle-redefine-std-completion-fns () "Replace some standard functions with versions for Icicle mode." (when (fboundp 'icicle-completing-read) (fset 'choose-completion 'icicle-choose-completion) (fset 'choose-completion-string 'icicle-choose-completion-string) (fset 'completing-read 'icicle-completing-read) (when (fboundp 'icicle-completing-read-multiple) (fset 'completing-read-multiple 'icicle-completing-read-multiple) (setq crm-local-completion-map icicle-crm-local-completion-map crm-local-must-match-map icicle-crm-local-must-match-map)) (fset 'completion-setup-function 'icicle-completion-setup-function) (unless (> emacs-major-version 22) (fset 'dired-smart-shell-command 'icicle-dired-smart-shell-command)) (fset 'display-completion-list 'icicle-display-completion-list) (fset 'exit-minibuffer 'icicle-exit-minibuffer) (when (fboundp 'face-valid-attribute-values) (fset 'face-valid-attribute-values 'icicle-face-valid-attribute-values)) (fset 'minibuffer-complete-and-exit 'icicle-minibuffer-complete-and-exit) (unless (or (> emacs-major-version 23) (and (= emacs-major-version 23) (> emacs-minor-version 1))) (fset 'mouse-choose-completion 'icicle-mouse-choose-completion)) ; Emacs < 23.2 (fset 'next-history-element 'icicle-next-history-element) (fset 'read-buffer 'icicle-read-buffer) (fset 'read-face-name 'icicle-read-face-name) (if (boundp 'read-file-name-function) ; Emacs 22+ (setq icicle-orig-read-file-name-fn (prog1 (and (not (eq read-file-name-function 'icicle-read-file-name)) read-file-name-function) (setq read-file-name-function 'icicle-read-file-name))) (fset 'read-file-name 'icicle-read-file-name)) ; Emacs 20, 21 (when (fboundp 'read-file-name-default) ; Emacs 24+ (fset 'read-file-name-default 'icicle-read-file-name-default)) (when (fboundp 'icicle-read-number) (fset 'read-number 'icicle-read-number)) (unless (> emacs-major-version 22) (fset 'shell-command 'icicle-shell-command)) (unless (> emacs-major-version 22) (fset 'shell-command-on-region 'icicle-shell-command-on-region)) (when (> emacs-major-version 22) (fset 'sit-for 'icicle-sit-for)) (fset 'switch-to-completions 'icicle-switch-to-completions) )) (defun icicle-restore-std-completion-fns () "Restore some standard functions that were replaced in Icicle mode." (when (fboundp 'icicle-ORIG-completing-read) (fset 'choose-completion 'icicle-ORIG-choose-completion) (fset 'choose-completion-string 'icicle-ORIG-choose-completion-string) (fset 'completing-read 'icicle-ORIG-completing-read) (when (fboundp 'icicle-ORIG-completing-read-multiple) (fset 'completing-read-multiple 'icicle-ORIG-completing-read-multiple) (setq crm-local-completion-map icicle-ORIG-crm-local-completion-map crm-local-must-match-map icicle-ORIG-crm-local-must-match-map)) (fset 'completion-setup-function 'icicle-ORIG-completion-setup-function) (when (fboundp 'icicle-ORIG-dired-smart-shell-command) ; Emacs 23 (fset 'dired-smart-shell-command 'icicle-ORIG-dired-smart-shell-command)) (fset 'display-completion-list 'icicle-ORIG-display-completion-list) (fset 'exit-minibuffer 'icicle-ORIG-exit-minibuffer) (when (fboundp 'icicle-ORIG-face-valid-attribute-values) (fset 'face-valid-attribute-values 'icicle-ORIG-face-valid-attribute-values)) (fset 'minibuffer-complete-and-exit 'icicle-ORIG-minibuffer-complete-and-exit) (unless (or (> emacs-major-version 23) (and (= emacs-major-version 23) (> emacs-minor-version 1))) (fset 'mouse-choose-completion 'icicle-ORIG-mouse-choose-completion)) ; Emacs < 23.2 (fset 'next-history-element 'icicle-ORIG-next-history-element) (fset 'read-buffer 'icicle-ORIG-read-buffer) (fset 'read-face-name 'icicle-ORIG-read-face-name) (if (boundp 'read-file-name-function) ; Emacs 22+ (setq read-file-name-function (and (not (eq icicle-orig-read-file-name-fn 'icicle-read-file-name)) icicle-orig-read-file-name-fn)) (fset 'read-file-name 'icicle-ORIG-read-file-name)) ; Emacs 20, 21 (when (fboundp 'icicle-ORIG-read-file-name-default) ; Emacs 24+ (fset 'read-file-name-default 'icicle-ORIG-read-file-name-default)) (when (fboundp 'icicle-ORIG-read-number) (fset 'read-number 'icicle-ORIG-read-number)) (when (fboundp 'icicle-ORIG-shell-command) ; Emacs < 23 (fset 'shell-command 'icicle-ORIG-shell-command)) (when (fboundp 'icicle-ORIG-shell-command-on-region) ; Emacs < 23 (fset 'shell-command-on-region 'icicle-ORIG-shell-command-on-region)) (when (> emacs-major-version 22) (fset 'sit-for 'icicle-ORIG-sit-for)) (fset 'switch-to-completions 'icicle-ORIG-switch-to-completions) )) ;; Free vars here: `icicle-saved-kmacro-ring-max' is bound in `icicles-var.el'. (defun icicle-redefine-standard-options () "Replace certain standard Emacs options with Icicles versions." (when (boundp 'icicle-search-ring-max) (setq icicle-saved-search-ring-max search-ring-max ; Save it. search-ring-max icicle-search-ring-max icicle-saved-regexp-search-ring-max regexp-search-ring-max ; Save it. regexp-search-ring-max icicle-regexp-search-ring-max)) (when (boundp 'icicle-kmacro-ring-max) (setq icicle-saved-kmacro-ring-max kmacro-ring-max ; Save it. kmacro-ring-max icicle-kmacro-ring-max))) (defun icicle-restore-standard-options () "Restore standard Emacs options replaced in Icicle mode." (when (boundp 'icicle-saved-search-ring-max) (setq search-ring-max icicle-saved-search-ring-max regexp-search-ring-max icicle-saved-regexp-search-ring-max))) ;; This is used only in Emacs 22+, but we define it always anyway. (defun icicle-undo-std-completion-faces () "Get rid of standard completion-root highlighting in `*Completions*'." ;; Do this because the standard Emacs 22 highlighting can interfere with ;; apropos-completion highlighting. (when (fboundp 'face-spec-reset-face) (when (facep 'completions-common-part) (face-spec-reset-face 'completions-common-part) (set-face-attribute 'completions-common-part nil :inherit nil)) (when (facep 'completions-first-difference) (face-spec-reset-face 'completions-first-difference) (set-face-attribute 'completions-first-difference nil :inherit nil)))) ;;; Save original functions, so they can be restored when leave Icicle mode. ;;; Toggle Icicle mode after loading the library (and `icicles-mode.el'), ;;; to pick up the original definition. ;;; ;;; Note: The `boundp' test for `icicle-mode' is just in case the form gets evaluated while ;;; loading `icicles-mode.el' (e.g. the library gets loaded while loading `icicles-mode.el'). ;;; `comint.el' - `comint-dynamic-complete', `comint-dynamic-complete-filename', ;;; `comint-replace-by-expanded-filename', `comint-completion-at-point'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'comint-dynamic-complete) (not (fboundp 'icicle-ORIG-comint-dynamic-complete))) (fset 'icicle-ORIG-comint-dynamic-complete (symbol-function 'comint-dynamic-complete))) (when (and (fboundp 'comint-dynamic-complete-filename) (not (fboundp 'icicle-ORIG-comint-dynamic-complete-filename))) (fset 'icicle-ORIG-comint-dynamic-complete-filename (symbol-function 'comint-dynamic-complete-filename))) (when (and (fboundp 'comint-replace-by-expanded-filename) (not (fboundp 'icicle-ORIG-comint-replace-by-expanded-filename))) (fset 'icicle-ORIG-comint-replace-by-expanded-filename (symbol-function 'comint-replace-by-expanded-filename))) (when (and (fboundp 'comint-completion-at-point) ; Emacs 24+ (not (fboundp 'icicle-ORIG-comint-completion-at-point))) (fset 'icicle-ORIG-comint-completion-at-point (symbol-function 'comint-completion-at-point))) (when icyp (icicle-mode 1))))) (if (featurep 'comint) (eval-after-load "icicles-mode" form) (eval-after-load "comint" form))) ;;; `ess-site.el' - `ess-complete-object-name'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'ess-complete-object-name) (not (fboundp 'icicle-ORIG-ess-complete-object-name))) (fset 'icicle-ORIG-ess-complete-object-name (symbol-function 'ess-complete-object-name))) (when icyp (icicle-mode 1))))) (if (featurep 'ess-site) (eval-after-load "icicles-mode" form) (eval-after-load "ess-site" form))) ;;; `gud.el' - `gud-gdb-complete-command'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'gud-gdb-complete-command) (not (fboundp 'icicle-ORIG-gud-gdb-complete-command))) (fset 'icicle-ORIG-gud-gdb-complete-command (symbol-function 'gud-gdb-complete-command))) (when icyp (icicle-mode 1))))) (if (featurep 'gud) (eval-after-load "icicles-mode" form) (eval-after-load "gud" form))) ;;; `info.el' - `Info-goto-node', `Info-index', `Info-menu'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (featurep 'info) (not (fboundp 'icicle-ORIG-Info-goto-node))) (fset 'icicle-ORIG-Info-goto-node (symbol-function 'Info-goto-node)) (fset 'icicle-ORIG-Info-index (symbol-function 'Info-index)) (fset 'icicle-ORIG-Info-menu (symbol-function 'Info-menu))) (when icyp (icicle-mode 1))))) (if (featurep 'info) (eval-after-load "icicles-mode" form) (eval-after-load "info" form))) ;;; `bbdb-com.el' version 2.35 - `bbdb-complete-name'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'bbdb-complete-name) (not (fboundp 'icicle-ORIG-bbdb-complete-name))) (fset 'icicle-ORIG-bbdb-complete-name (symbol-function 'bbdb-complete-name))) (when icyp (icicle-mode 1))))) (if (and (featurep 'bbdb-com) (fboundp 'bbdb-complete-name)) (eval-after-load "icicles-mode" form) (eval-after-load "bbdb-com" form))) ;;; `bbdb-com.el' version 3.02 - `bbdb-complete-mail'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'bbdb-complete-mail) (not (fboundp 'icicle-ORIG-bbdb-complete-mail))) (fset 'icicle-ORIG-bbdb-complete-mail (symbol-function 'bbdb-complete-mail))) (when icyp (icicle-mode 1))))) (if (and (featurep 'bbdb-com) (fboundp 'bbdb-complete-mail)) (eval-after-load "icicles-mode" form) (eval-after-load "bbdb-com" form))) ;;; `dired-aux.el' - `dired-read-shell-command'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'dired-read-shell-command) (not (fboundp 'icicle-ORIG-dired-read-shell-command))) (fset 'icicle-ORIG-dired-read-shell-command (symbol-function 'dired-read-shell-command))) (when icyp (icicle-mode 1))))) (if (featurep 'dired-aux) (eval-after-load "icicles-mode" form) (eval-after-load "dired-aux" form))) ;;; `dired-x.el' - `dired-read-shell-command', `dired-smart-shell-command'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'dired-read-shell-command) (not (fboundp 'icicle-ORIG-dired-read-shell-command))) (fset 'icicle-ORIG-dired-read-shell-command (symbol-function 'dired-read-shell-command))) (unless (fboundp 'read-shell-command) ; `dired-smart-shell-command' in Emacs < 23. (when (and (fboundp 'dired-smart-shell-command) (not (fboundp 'icicle-ORIG-dired-smart-shell-command))) (fset 'icicle-ORIG-dired-smart-shell-command (symbol-function 'dired-smart-shell-command)))) (when icyp (icicle-mode 1))))) (if (featurep 'dired-x) (eval-after-load "icicles-mode" form) (eval-after-load "dired-x" form))) ;;; `simple.el' - `read-shell-command' - Emacs 23+. (when (> emacs-major-version 22) ;; `simple.el' is preloaded for Emacs 23+, so just do it now. (let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'read-shell-command) (not (fboundp 'icicle-ORIG-read-shell-command))) (defalias 'icicle-ORIG-read-shell-command (symbol-function 'read-shell-command))) (when icyp (icicle-mode 1)))) ;;; `recentf.el' - `recentf-make-menu-items'. (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode))) (when icyp (icicle-mode -1)) (when (and (fboundp 'recentf-make-menu-items) (not (fboundp 'icicle-ORIG-recentf-make-menu-items))) (fset 'icicle-ORIG-recentf-make-menu-items (symbol-function 'recentf-make-menu-items))) (when icyp (icicle-mode 1))))) (if (featurep 'recentf) (eval-after-load "icicles-mode" form) (eval-after-load "recentf" form))) ;; Do this last. ;; ;; When these libraries are first loaded, toggle Icicle mode to pick up the definitions (dolist (library '("bookmark+" "buff-menu" "comint" "dired" "ess-site" "gud" "ibuffer" "idlw-shell" ; (untested - I don't have an `idl' program) "ielm" "info" "net-utils" "rlogin" "shell" "sh-script" "tcl")) (unless (if (fboundp 'load-history-regexp) ; Emacs 22+ (load-history-filename-element (load-history-regexp library)) (assoc library load-history)) (eval-after-load library '(icicle-toggle-icicle-mode-twice)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-mode) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-mode.el ends here icicles-2013.04.23.23400/icicles-opt.el000066400000000000000000007656531214003072700167470ustar00rootroot00000000000000;;; icicles-opt.el --- User options (customizable variables) for Icicles ;; ;; Filename: icicles-opt.el ;; Description: User options (customizable variables) for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:22:14 2006 ;; Version: 22.0 ;; Last-Updated: Mon Apr 22 20:04:03 2013 (-0700) ;; By: dradams ;; Update #: 5622 ;; URL: http://www.emacswiki.org/icicles-opt.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `cl', `el-swank-fuzzy', `ffap', `ffap-', `fuzzy', `fuzzy-match', ;; `hexrgb', `kmacro', `levenshtein', `regexp-opt', `thingatpt', ;; `thingatpt+', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; user options (variables). For Icicles documentation, see ;; `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Widgets defined here: ;; ;; `icicle-key-definition'. ;; ;; Constants defined here: ;; ;; `icicle-anychar-regexp', `icicle-Completions-misc-submenu', ;; `icicle-Completions-save/retrieve-submenu', ;; `icicle-Completions-sets-submenu', ;; `icicle-Completions-sorting-submenu', ;; `icicle-Completions-this-candidate-submenu', ;; `icicle-Completions-toggle-submenu', `icicle-doremi-submenu'. ;; ;; Commands defined here: ;; ;; `icicle-read-kbd-macro'. ;; ;; User options defined here (in Custom group `Icicles'): ;; ;; `icicle-act-before-cycle-flag', ;; `icicle-add-proxy-candidates-flag', ;; `icicle-alternative-actions-alist', ;; `icicle-alternative-sort-comparer', ;; `icicle-apropos-complete-keys', ;; `icicle-apropos-complete-no-display-keys', ;; `icicle-apropos-cycle-next-keys', ;; `icicle-apropos-cycle-next-action-keys', ;; `icicle-apropos-cycle-next-alt-action-keys', ;; `icicle-apropos-cycle-next-help-keys', ;; `icicle-apropos-cycle-previous-keys', ;; `icicle-apropos-cycle-previous-action-keys', ;; `icicle-apropos-cycle-previous-alt-action-keys', ;; `icicle-apropos-cycle-previous-help-keys', ;; `icicle-anything-transform-candidates-flag', ;; `icicle-bookmark-name-length-max', ;; `icicle-bookmark-refresh-cache-flag', ;; `icicle-buffer-candidate-key-bindings', `icicle-buffer-configs', ;; `icicle-buffer-extras', ;; `icicle-buffer-ignore-space-prefix-flag', ;; `icicle-buffer-include-cached-files-nflag', ;; `icicle-buffer-include-recent-files-nflag', ;; `icicle-buffer-match-regexp', `icicle-buffer-no-match-regexp', ;; `icicle-buffer-predicate', `icicle-buffer-prefix-arg-filtering', ;; `icicle-buffer-require-match-flag', `icicle-buffer-skip-hook', ;; `icicle-buffer-sort', `icicle-buffers-ido-like-flag', ;; `icicle-candidate-action-keys', `icicle-candidate-help-keys', ;; `icicle-candidate-width-factor', ;; `icicle-change-region-background-flag', ;; `icicle-change-sort-order-completion-flag', ;; `icicle-C-l-uses-completion-flag', `icicle-color-themes', ;; `icicle-comint-dynamic-complete-replacements', ;; `icicle-command-abbrev-alist', ;; `icicle-command-abbrev-match-all-parts-flag', ;; `icicle-command-abbrev-priority-flag', ;; `icicle-complete-key-anyway-flag', ;; `icicle-complete-keys-self-insert-ranges', ;; `icicle-completing-read+insert-keys', ;; `icicle-completion-history-max-length', ;; `icicle-completion-key-bindings', ;; `icicle-completion-list-key-bindings', ;; `icicle-Completions-display-min-input-chars', ;; `icicle-completions-format', `icicle-Completions-max-columns', ;; `icicle-Completions-mouse-3-menu-entries', ;; `icicle-Completions-text-scale-decrease', ;; `icicle-Completions-window-max-height', ;; `icicle-customize-save-flag', ;; `icicle-customize-save-variable-function', ;; `icicle-default-in-prompt-format-function', ;; `icicle-default-cycling-mode', `icicle-default-thing-insertion', ;; `icicle-default-value', `icicle-define-alias-commands-flag', ;; `icicle-deletion-action-flag', `icicle-dot-show-regexp-flag', ;; `icicle-dot-string', `icicle-expand-input-to-common-match', ;; `icicle-expand-input-to-common-match-alt', `icicle-file-extras', ;; `icicle-file-match-regexp', `icicle-file-no-match-regexp', ;; `icicle-file-predicate', `icicle-file-require-match-flag', ;; `icicle-file-sort', `icicle-files-ido-like-flag', ;; `icicle-filesets-as-saved-completion-sets-flag', ;; `icicle-find-file-of-content-skip-hook', ;; `icicle-functions-to-redefine', `icicle-guess-commands-in-path', ;; `icicle-help-in-mode-line-delay', ;; `icicle-hide-common-match-in-Completions-flag', ;; `icicle-hide-non-matching-lines-flag', ;; `icicle-highlight-historical-candidates-flag', ;; `icicle-highlight-input-completion-failure', ;; `icicle-highlight-input-completion-failure-delay', ;; `icicle-highlight-input-completion-failure-threshold', ;; `icicle-highlight-input-initial-whitespace-flag', ;; `icicle-highlight-lighter-flag', ;; `icicle-highlight-saved-candidates-flag', ;; `icicle-ignore-comments-flag', `icicle-ignored-directories', ;; `icicle-image-files-in-Completions', ;; `icicle-incremental-completion', ;; `icicle-incremental-completion-delay', ;; `icicle-incremental-completion-threshold', ;; `icicle-Info-visited-max-candidates', ;; `icicle-inhibit-advice-functions', `icicle-inhibit-ding-flag', ;; `icicle-input-string', `icicle-inter-candidates-min-spaces', ;; `icicle-isearch-complete-keys', ;; `icicle-isearch-history-insert-keys', ;; `icicle-key-complete-keys', ;; `icicle-key-complete-keys-for-minibuffer', ;; `icicle-key-descriptions-use-<>-flag', ;; `icicle-key-descriptions-use-angle-brackets-flag', ;; `icicle-keymaps-for-key-completion', ;; `icicle-kill-visited-buffers-flag', `icicle-kmacro-ring-max', ;; `icicle-levenshtein-distance', `icicle-list-join-string', ;; `icicle-list-nth-parts-join-string', ;; `icicle-mark-position-in-candidate', `icicle-max-candidates', ;; `icicle-menu-items-to-history-flag', ;; `icicle-minibuffer-key-bindings', ;; `icicle-minibuffer-setup-hook', `icicle-modal-cycle-down-keys', ;; `icicle-modal-cycle-down-action-keys', ;; `icicle-modal-cycle-down-alt-action-keys', ;; `icicle-modal-cycle-down-help-keys', ;; `icicle-modal-cycle-up-keys', ;; `icicle-modal-cycle-up-action-keys', ;; `icicle-modal-cycle-up-alt-action-keys', ;; `icicle-modal-cycle-up-help-keys', ;; `icicle-move-Completions-frame', `icicle-no-match-hook', ;; `icicle-option-type-prefix-arg-list', ;; `icicle-network-drive-means-remote-flag', ;; `icicle-point-position-in-candidate', ;; `icicle-populate-interactive-history-flag', ;; `icicle-pp-eval-expression-print-length', ;; `icicle-pp-eval-expression-print-level', ;; `icicle-prefix-complete-keys', ;; `icicle-prefix-complete-no-display-keys', ;; `icicle-prefix-cycle-next-keys', ;; `icicle-prefix-cycle-next-action-keys', ;; `icicle-prefix-cycle-next-alt-action-keys', ;; `icicle-prefix-cycle-next-help-keys', ;; `icicle-prefix-cycle-previous-keys', ;; `icicle-prefix-cycle-previous-action-keys', ;; `icicle-prefix-cycle-previous-alt-action-keys', ;; `icicle-prefix-cycle-previous-help-keys', ;; `icicle-quote-shell-file-name-flag', ;; `icicle-read+insert-file-name-keys', `icicle-regexp-quote-flag', ;; `icicle-regexp-search-ring-max', `icicle-region-background', ;; `icicle-require-match-flag', `icicle-saved-completion-sets', ;; `icicle-search-cleanup-flag', `icicle-search-from-isearch-keys', ;; `icicle-search-highlight-all-current-flag', ;; `icicle-search-highlight-context-levels-flag', ;; `icicle-search-highlight-threshold', `icicle-search-hook', ;; `icicle-search-key-prefix', ;; `icicle-search-replace-common-match-flag', ;; `icicle-search-replace-literally-flag', ;; `icicle-search-replace-whole-candidate-flag', ;; `icicle-search-ring-max', `icicle-search-whole-word-flag', ;; `icicle-shell-command-candidates-cache', ;; `icicle-show-annotations-flag', ;; `icicle-show-Completions-help-flag', ;; `icicle-show-Completions-initially-flag', ;; `icicle-show-multi-completion-flag', `icicle-sort-comparer', ;; `icicle-sort-orders-alist', `icicle-special-candidate-regexp', ;; `icicle-S-TAB-completion-methods-alist', ;; `icicle-S-TAB-completion-methods-per-command', ;; `icicle-swank-prefix-length', `icicle-swank-timeout', ;; `icicle-TAB-completion-methods', ;; `icicle-TAB-completion-methods-per-command', ;; `icicle-TAB-shows-candidates-flag', ;; `icicle-TAB/S-TAB-only-completes-flag', `icicle-recenter', ;; `icicle-test-for-remote-files-flag', ;; `icicle-thing-at-point-functions', ;; `icicle-top-level-key-bindings', ;; `icicle-top-level-when-sole-completion-delay', ;; `icicle-top-level-when-sole-completion-flag', ;; `icicle-touche-pas-aux-menus-flag', `icicle-type-actions-alist', ;; `icicle-unpropertize-completion-result-flag', ;; `icicle-update-input-hook', `icicle-use-~-for-home-dir-flag', ;; `icicle-use-C-for-actions-flag', ;; `icicle-use-anything-candidates-flag', ;; `icicle-use-candidates-only-once-flag', ;; `icicle-widgets-to-redefine', `icicle-word-completion-keys', ;; `icicle-WYSIWYG-Completions-flag', `icicle-yank-function', ;; `icicle-zap-to-char-candidates'. ;; ;; Functions defined here: ;; ;; `icicle-bind-top-level-commands', ;; `icicle-buffer-sort-*...*-last', ;; `icicle-compute-shell-command-candidates', ;; `icicle-edmacro-parse-keys', `icicle-kbd', `icicle-remap', ;; `icicle-thing-at-point', `icicle-widgetp'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;; ;; Note: Occasionally I have renamed or removed an Icicles option. ;; If you have customized such an option, then your customization ;; will no longer have any effect. With the exception of options ;; `icicle-mode' and `icicle-mode-hook', library `icicles-opt.el' ;; always contains the complete set of Icicles options. If your ;; custom file or init file contains an Icicles option that is not ;; listed above, then you can remove it because it is obsolete. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Constants used to define user options") ;; (@> "User options, organized alphabetically, except for dependencies") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;; Emacs 20 does not DTRT wrt `:type' and `:set' sexps at compile time, ;; so there seems no way around this, short of coding without push and dolist. ;; This MUST be `eval-and-compile', even though in principle `eval-when-compile' should be enough. (eval-and-compile (when (< emacs-major-version 21) (require 'cl))) ;; dolist, push (require 'thingatpt) ;; symbol-at-point, thing-at-point, thing-at-point-url-at-point (when (and (require 'thingatpt+ nil t) ; (no error if not found) (fboundp 'tap-put-thing-at-point-props)) ; >= 2012-08-21 (tap-define-aliases-wo-prefix) (tap-put-thing-at-point-props)) ;; list-nearest-point-as-string, non-nil-symbol-name-nearest-point, word-nearest-point (require 'hexrgb nil t) ;; (no error if not found): ;; hexrgb-approx-equal, hexrgb-increment-hue, hexrgb-increment-value, hexrgb-saturation ;; Quiet the byte-compiler. (defvar shell-completion-execonly) ; In `shell.el'. (defvar icicle-dot-string-internal) (defvar icicle-mode-map) (defvar icicle-top-level-key-bindings) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Constants used to define user options") ;;; Constants used to define user options -- (defconst icicle-Completions-misc-submenu '(misc-menu menu-item "Miscellaneous" (keymap (complete-for-past-completion menu-item "Complete for Past Completion Input" icicle-retrieve-previous-input :visible (or (and icicle-C-l-uses-completion-flag (not current-prefix-arg)) (and (not icicle-C-l-uses-completion-flag) current-prefix-arg))) (previous-completion-input menu-item "Previous Completion Input" icicle-retrieve-previous-input :visible (not (or (and icicle-C-l-uses-completion-flag (not current-prefix-arg)) (and (not icicle-C-l-uses-completion-flag) current-prefix-arg)))) (next-completion-input menu-item "Next Completion Input" icicle-retrieve-next-input) (one-off-eval menu-item "One-Off Eval..." icicle-pp-eval-expression-in-minibuffer) (sep-misc "--") (icicles-help menu-item "Icicles Help" icicle-minibuffer-help))) "Submenu for miscellaneous operations on completions.") (defconst icicle-Completions-save/retrieve-submenu '(save-retrieve-menu menu-item "Save/Retrieve" (keymap (save-all menu-item "Save All" icicle-candidate-set-save) (save-all-var menu-item " to Variable..." icicle-candidate-set-save-to-variable) (save-all-cache menu-item " to Cache File..." icicle-candidate-set-save-persistently) (add-all-to-saved menu-item "Add All to Saved" icicle-candidate-set-save-more) (save-selected menu-item "Save Selected (Region) Candidates" icicle-candidate-set-save-selected :enable (and mark-active (> (region-end) (region-beginning)))) (clear-saved menu-item "Clear Saved Candidates" icicle-candidate-set-save-selected :enable (and (boundp 'icicle-saved-completion-candidates) icicle-saved-completion-candidates)) (add-selected-to-saved menu-item "Add Selected (Region) Candidates" icicle-candidate-set-save-more-selected :enable (and mark-active (> (region-end) (region-beginning)))) (sep-save/retrieve-2 "--") (retrieve-saved menu-item "Retrieve Saved" icicle-candidate-set-retrieve :enable (and (boundp 'icicle-saved-completion-candidates) icicle-saved-completion-candidates)) (retrieve-more-saved menu-item "Retrieve More Saved" icicle-candidate-set-retrieve-more :enable (and (boundp 'icicle-saved-completion-candidates) icicle-saved-completion-candidates)))) "Submenu for saving and retrieving completion candidates.") (defconst icicle-Completions-sets-submenu '(sets-menu menu-item "Sets" (keymap (complement menu-item "Complement" icicle-candidate-set-complement) (widen menu-item "Or Match Alternative..." icicle-widen-candidates) (narrow menu-item "Match Also Regexp..." icicle-narrow-candidates) (save-pred-read-var menu-item "Save Predicate to Variable... (`C-u')" icicle-save-predicate-to-variable :visible current-prefix-arg) (save-pred-std-var menu-item "Save Predicate to `icicle-input-string'" icicle-save-predicate-to-variable :visible (not current-prefix-arg)) (intersect menu-item "Intersect Saved" icicle-candidate-set-intersection :enable icicle-saved-completion-candidates) (difference menu-item "Subtract Saved" icicle-candidate-set-difference :enable icicle-saved-completion-candidates) (union menu-item "Add (Union) Saved" icicle-candidate-set-union :enable icicle-saved-completion-candidates) (keep-past-chrono menu-item "Only Previously Entered, By Time (`C-u')" icicle-keep-only-past-inputs :visible current-prefix-arg) (keep-past-alpha menu-item "Only Previously Entered" icicle-keep-only-past-inputs :visible (not current-prefix-arg)))) "Submenu for set operations on completion candidates.") (defconst icicle-Completions-sorting-submenu '(sorting-menu menu-item "Sorting" (keymap (change-sort-order menu-item "Change Sort Order (`C-,')" icicle-change-sort-order :visible (or (and icicle-change-sort-order-completion-flag (not current-prefix-arg)) (and (not icicle-change-sort-order-completion-flag) current-prefix-arg))) (next-sort-order menu-item "Next Sort Order" icicle-change-sort-order :visible (not (or (and icicle-change-sort-order-completion-flag (not current-prefix-arg)) (and (not icicle-change-sort-order-completion-flag) current-prefix-arg)))) (change-alt-sort menu-item "Change Alternative Sort Order (`M-,')" icicle-change-alternative-sort-order :visible (or (and icicle-change-sort-order-completion-flag (not current-prefix-arg)) (and (not icicle-change-sort-order-completion-flag) current-prefix-arg))) (next-alt-sort menu-item "Next Alternative Sort Order (`M-,')" icicle-change-alternative-sort-order :visible (not (or (and icicle-change-sort-order-completion-flag (not current-prefix-arg)) (and (not icicle-change-sort-order-completion-flag) current-prefix-arg)))) (swap-sort menu-item "Swap Alternative/Normal Sort" icicle-toggle-alternative-sorting))) "Submenu for sorting completion candidates.") (defconst icicle-Completions-this-candidate-submenu '(this-candidate-menu menu-item "This Candidate" (keymap (help-on-cand menu-item "Help About" icicle-help-on-candidate) (sep-this-1 "--") (action menu-item "Act On (`C-mouse-2')" icicle-candidate-action) (read-fn-invoke menu-item "Apply a Function To... (`M-mouse-2')" icicle-candidate-read-fn-invoke) (insert-in-minibuffer menu-item "Insert in Minibuffer (`C-insert')" (lambda () (interactive) (select-window (active-minibuffer-window)) (goto-char (icicle-minibuffer-prompt-end)) (icicle-clear-minibuffer) (insert icicle-last-completion-candidate)) :help "Insert candidate in minibuffer") (sep-this-2 "--") (all-cands menu-item "Act on Each Individually" icicle-all-candidates-action) (all-list menu-item "Act on All as a List" icicle-all-candidates-list-action))) "Submenu for acting on candidate under the mouse.") (defconst icicle-Completions-toggle-submenu '(toggle-menu menu-item "Toggle/Cycle/Change" (keymap ;; This one is not a toggle or cycle. (regexp-quote-input menu-item "Regexp-Quote Current Input" icicle-regexp-quote-input :visible (not (and mark-active (> (region-end) (region-beginning))))) ;; This one is not a toggle or cycle. (regexp-quote-region menu-item "Regexp-Quote Input Region" icicle-regexp-quote-input :visible (and mark-active (> (region-end) (region-beginning)))) (next-thumbnail-setting menu-item "Next Image-File Thumbnail Setting" icicle-cycle-image-file-thumbnail :visible (fboundp 'icicle-cycle-image-file-thumbnail)) (oneoff-next-S-TAB menu-item "ONE-OFF Next S-TAB Completion Method" icicle-next-S-TAB-completion-method :visible current-prefix-arg) (next-S-TAB menu-item "Next S-TAB Completion Method" icicle-next-S-TAB-completion-method :visible (not current-prefix-arg)) (oneoff-next-TAB menu-item "ONE-OFF Next TAB Completion Method" icicle-next-TAB-completion-method :visible current-prefix-arg) (next-TAB menu-item "Next TAB Completion Method" icicle-next-TAB-completion-method :visible (not current-prefix-arg)) (WYSIWYG menu-item "Toggle WYSIWYG for `*Completions*'" icicle-toggle-WYSIWYG-Completions) (using-~-for-home menu-item "Toggle Using `~' for $HOME" icicle-toggle-~-for-home-dir) (using-C-for-actions menu-item "Toggle Using `C-' for Actions" icicle-toggle-C-for-actions) (removing-dups menu-item "Toggle Duplicate Removal" icicle-toggle-transforming) (proxy-candidates menu-item "Toggle Including Proxy Candidates" icicle-toggle-proxy-candidates) (case-sensitivity menu-item "Toggle Case Sensitivity (`C-A')" icicle-toggle-case-sensitivity) (highlighting-past menu-item "Toggle Highlighting Past Inputs" icicle-toggle-highlight-historical-candidates) (highlighting-saved menu-item "Toggle Highlighting Saved Candidates" icicle-toggle-highlight-saved-candidates) (angle-brackets menu-item "Toggle Using Angle Brackets" icicle-toggle-angle-brackets) (remote-file-testing menu-item "Toggle Remote File Handling (`C-^')" icicle-toggle-remote-file-testing) (ignored-files menu-item "Toggle Ignored File Extensions (`C-.')" icicle-toggle-ignored-extensions) (ignoring-space-prefix menu-item "Toggle Ignoring Space Prefix" icicle-toggle-ignored-space-prefix) (ignoring-comments menu-item "Toggle Ignoring Comments" icicle-toggle-ignoring-comments) (expanding-to-common menu-item "Toggle Common Match Expansion" icicle-toggle-expand-to-common-match) (hiding-common-match menu-item "Toggle Hiding Common Match (`C-x .')" icicle-toggle-hiding-common-match) (hiding-non-matching-lines menu-item "Toggle Hiding Non-Matching Lines (`C-u C-x .')" icicle-toggle-hiding-non-matching-lines) (completions-format menu-item "Toggle Horizontal/Vertical Layout" icicle-toggle-completions-format) (multi-completions menu-item "Toggle Showing Multi-Completions" icicle-toggle-show-multi-completion) (incremental-completion menu-item "Cycle Incremental Completion" icicle-cycle-incremental-completion) (matching-of-newlines menu-item "Toggle `.' Matching of Newlines Too" icicle-toggle-dot) (literal-vs-regexp menu-item "Toggle Escaping Special Chars" icicle-toggle-regexp-quote) (sep-toggle-2 "--") (search-highlight-all menu-item "Toggle All-Current Search Highlighting (`C-^')" icicle-toggle-highlight-all-current) (search-complementing-domain menu-item "Toggle Searching Complement" icicle-toggle-search-complementing-domain) (search-whole-word menu-item "Toggle Whole-Word Searching (`M-q')" icicle-toggle-search-whole-word) (search-replace-whole menu-item "Toggle Replacing Whole Search Hit (`M-_')" icicle-toggle-search-replace-whole) (search-replace-common menu-item "Toggle Replacing Longest Common Match" icicle-toggle-search-replace-common-match) (search-cleanup menu-item "Toggle Removal of Search Highlighting (`C-.')" icicle-toggle-search-cleanup) (sep-toggle-1 "--") (option menu-item "+ Toggle Option..." icicle-toggle-option :visible (and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg)))) (any-var menu-item "+ Toggle Any Variable..." icicle-toggle-option :visible (and current-prefix-arg (not (wholenump (prefix-numeric-value current-prefix-arg))))) (boolean menu-item "+ Toggle Boolean Option..." :visible (not current-prefix-arg)) ;; This one is not a toggle or cycle. (reset-var menu-item "+ Set Any Variable to `nil'..." icicle-reset-option-to-nil :visible current-prefix-arg) ;; This one is not a toggle or cycle. (reset-option menu-item "+ Set Option to `nil'..."icicle-reset-option-to-nil :visible (not current-prefix-arg)) ;; This one is not a toggle or cycle. (set-option-to-t menu-item "+ Set Option to `t'..." icicle-set-option-to-t :visible (and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg)))) ;; This one is not a toggle or cycle. (set-var-to-t menu-item "+ Set Any Variable to `t'..." icicle-set-option-to-t :visible (and current-prefix-arg (not (wholenump (prefix-numeric-value current-prefix-arg))))) ;; This one is not a toggle or cycle. (set-boolean-to-t menu-item "+ Set Boolean Option to `t'..." icicle-set-option-to-t :visible (not current-prefix-arg)))) "Submenu for toggling, cycling or changing a variable or a behavior.") (defconst icicle-doremi-submenu '(doremi-menu menu-item "Do Re Mi" (keymap (zoom "*Completions* Zoom Factor (`C-x -')" icicle-doremi-zoom-Completions+ :visible (fboundp 'text-scale-increase) ) ; Emacs 23+. (spacing "*Completions* Candidate Spacing (`C-x |')" icicle-doremi-inter-candidates-min-spaces+) (column-width "*Completions* Column Width (`C-x w')" icicle-doremi-candidate-width-factor+) (swank-prefix "Swank Min Match Chars (`C-x 2')" icicle-doremi-increment-swank-prefix-length+ :visible (eq (icicle-current-TAB-method) 'swank)) (swank-timeout "Swank Timeout (`C-x 1')" icicle-doremi-increment-swank-timeout+ :visible (eq (icicle-current-TAB-method) 'swank)) (max-completions "Max # of Completions (`C-x #')" icicle-doremi-increment-max-candidates+))) "Submenu for Do Re Mi incrementation operations.") ;;(@* "User options, organized alphabetically, except for dependencies") ;;; User options, organized alphabetically, except for dependencies -- ;;; But first some functions and a widget that are used in option definitions. ;; Same as `naked-edmacro-parse-keys' in `naked.el'. ;; Based on `edmacro-parse-keys' in standard library `edmacro.el' ;; Differences are: ;; ;; 1. Addition of optional arg ANGLES. ;; 2. Ensure same behavior as `edmacro-parse-keys', if ANGLES is non-nil. ;; 2. Handle angle brackets, whether ANGLES is nil or non-nil. ;; 3. Handle `TAB' correctly, if ANGLES is nil. ;; 4. Handle names without angle brackets, if ANGLES is nil. ;; 5. Works for all Emacs versions. ;; (defun icicle-edmacro-parse-keys (string &optional need-vector angles) "Like `edmacro-parse-keys', but does not use angle brackets, by default. Non-nil optional arg ANGLES means to use angle brackets, exactly like `edmacro-parse-keys'. See `icicle-read-kbd-macro' for more about ANGLES." (let ((case-fold-search nil) (len (length string)) ; We won't alter string in the loop below. (pos 0) (res [])) (while (and (< pos len) (string-match "[^ \t\n\f]+" string pos)) (let* ((word-beg (match-beginning 0)) (word-end (match-end 0)) (word (substring string word-beg len)) (times 1) (key nil)) ;; Try to catch events of the form "". (if (string-match "\\`<[^ <>\t\n\f][^>\t\n\f]*>" word) (setq word (match-string 0 word) pos (+ word-beg (match-end 0))) (setq word (substring string word-beg word-end) pos word-end)) (when (string-match "\\([0-9]+\\)\\*." word) (setq times (string-to-number (substring word 0 (match-end 1))) word (substring word (1+ (match-end 1))))) (cond ((string-match "^<<.+>>$" word) (setq key (vconcat (if (eq (key-binding [?\M-x]) 'execute-extended-command) [?\M-x] (or (car (where-is-internal 'execute-extended-command)) [?\M-x])) (substring word 2 -2) "\r"))) ;; Must test this before [ACHMsS]- etc., to prevent match. ((or (equal word "REM") (string-match "^;;" word)) (setq pos (string-match "$" string pos))) ;; Straight `edmacro-parse-keys' case - ensure same behavior. ;; Includes same bugged handling of `TAB'. That is Emacs bug #12535. ;; The bug fix is to add `TAB' to the list in this clause. ((and angles (string-match "^\\(\\([ACHMsS]-\\)*\\)<\\(.+\\)>$" word) (progn (setq word (concat (substring word (match-beginning 1) (match-end 1)) (substring word (match-beginning 3) (match-end 3)))) (not (string-match "\\<\\(NUL\\|RET\\|LFD\\|ESC\\|SPC\\|DEL\\)$" word)))) (setq key (list (intern word)))) ;; NaKeD handling of <...>. Recognize it anyway, even without non-nil ANGLES. ;; But unlike `edmacro-parse-keys', include , to handle it correctly. ((and (string-match "^\\(\\([ACHMsS]-\\)*\\)<\\(..+\\)>$" word) (progn (setq word (concat (substring word (match-beginning 1) (match-end 1)) (substring word (match-beginning 3) (match-end 3)))) (not (string-match "\\<\\(NUL\\|RET\\|LFD\\|ESC\\|SPC\\|DEL\\|TAB\\)$" word)))) (setq key (list (intern word)))) ;; NaKeD handling of names without <...>. ((and (not angles) (string-match "^\\(\\([ACHMsS]-\\)*\\)\\([^ \t\f\n][^ \t\f\n]+\\)$" word) ;; Do not count `C-' etc. when at end of string. (save-match-data (not (string-match "\\([ACHMsS]-.\\)+$" word))) (progn (setq word (concat (substring word (match-beginning 1) (match-end 1)) (substring word (match-beginning 3) (match-end 3)))) (not (string-match "\\<\\(NUL\\|RET\\|LFD\\|ESC\\|SPC\\|DEL\\|TAB\\)$" word)))) (setq key (list (intern word)))) (t (let ((orig-word word) (prefix 0) (bits 0)) (while (string-match "^[ACHMsS]-." word) (incf bits (cdr (assq (aref word 0) '((?A . ?\A-\^@) (?C . ?\C-\^@) (?H . ?\H-\^@) (?M . ?\M-\^@) (?s . ?\s-\^@) (?S . ?\S-\^@))))) (incf prefix 2) (callf substring word 2)) (when (string-match "^\\^.$" word) (incf bits ?\C-\^@) (incf prefix) (callf substring word 1)) (let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r") ("LFD" . "\n") ("ESC" . "\e") ("SPC" . " ") ("DEL" . "\177") ("TAB" . "\t"))))) (when found (setq word (cdr found)))) (when (string-match "^\\\\[0-7]+$" word) (loop for ch across word for n = 0 then (+ (* n 8) ch -48) finally do (setq word (vector n)))) (cond ((= bits 0) (setq key word)) ((and (= bits ?\M-\^@) (stringp word) (string-match "^-?[0-9]+$" word)) (setq key (loop for x across word collect (+ x bits)))) ((/= (length word) 1) (error "%s must prefix a single character, not %s" (substring orig-word 0 prefix) word)) ((and (/= (logand bits ?\C-\^@) 0) (stringp word) ;; Used to accept `.' and `?' here, but `.' is simply wrong, ;; and `C-?' is not used (so use `DEL' instead). (string-match "[@-_a-z]" word)) (setq key (list (+ bits (- ?\C-\^@) (logand (aref word 0) 31))))) (t (setq key (list (+ bits (aref word 0))))))))) (when key (loop repeat times do (callf vconcat res key))))) (when (and (>= (length res) 4) (eq (aref res 0) ?\C-x) (eq (aref res 1) ?\( ) (eq (aref res (- (length res) 2)) ?\C-x) (eq (aref res (- (length res) 1)) ?\))) (setq res (edmacro-subseq res 2 -2))) (if (and (not need-vector) (loop for ch across res always (and (if (fboundp 'characterp) (characterp ch) (char-valid-p ch)) (let ((ch2 (logand ch (lognot ?\M-\^@)))) (and (>= ch2 0) (<= ch2 127)))))) (concat (loop for ch across res collect (if (= (logand ch ?\M-\^@) 0) ch (+ ch 128)))) res))) ;; Same as `naked-read-kbd-macro' in `naked.el'. (defun icicle-read-kbd-macro (start &optional end angles) "Read the region as a keyboard macro definition. Like `read-kbd-macro', but does not use angle brackets, by default. With a prefix arg use angle brackets, exactly like `read-kbd-macro'. That is, with non-nil arg ANGLES, expect key descriptions to use angle brackets (<...>). Otherwise, expect key descriptions not to use angle brackets. For example: (icicle-read-kbd-macro \"mode-line\" t) returns [mode-line] (icicle-read-kbd-macro \"\" t t) returns [mode-line]" (interactive "r\P") (if (stringp start) (icicle-edmacro-parse-keys start end angles) (setq last-kbd-macro (icicle-edmacro-parse-keys (buffer-substring start end) nil angles)))) (put 'icicle-kbd 'pure t) ;; Same as `naked' in `naked.el'. (defun icicle-kbd (keys &optional angles) "Like `kbd', but does not use angle brackets, by default. With non-nil optional arg ANGLES, expect key descriptions to use angle brackets (<...>), exactly like `kbd'. Otherwise, expect key descriptions not to use angle brackets. For example: (icicle-kbd \"mode-line\") returns [mode-line] (icicle-kbd \"\" t) returns [mode-line] The default behavior lets you use, e.g., \"C-x delete\" and \"C-delete\" instead of \"C-x \" and \"C-\"." (icicle-read-kbd-macro keys nil angles)) ;; Must be before first use, which is currently in `icicle-buffer-candidate-key-bindings'. (define-widget 'icicle-key-definition 'lazy "Key definition type for Icicle mode keys. A list of three components: KEY, COMMAND, CONDITION, that represents an `icicle-mode-map' binding of COMMAND according to KEY, if CONDITION evaluates to non-nil. KEY is either a key sequence (string or vector) or a command. COMMAND is a command. CONDITION is a sexp. If KEY is a command, then the binding represented is its remapping to COMMAND." :indent 1 :offset 0 :tag "" ; $$$$$ "Icicle Mode Key Definition" :type '(list (choice (key-sequence :tag "Key" :value [ignore]) ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. (restricted-sexp :tag "Command to remap" :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition"))) (defcustom icicle-act-before-cycle-flag nil "*Non-nil means act on current candidate, then cycle to next/previous. Otherwise (nil), cycle to the next or previous candidate, and then act on it. This affects keys such as the following: `C-down', `C-wheel-down', `C-next', `C-end', `C-M-down', `C-M-wheel-down', `C-M-next', `C-M-end', `C-S-down', `C-S-wheel-down', `C-S-next', `C-S-end'. Note: A few Icicles commands ignore this setting, in order to \"do the right thing\". Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Bindings :group 'Icicles-Miscellaneous) (defcustom icicle-add-proxy-candidates-flag nil ; Toggle with `C-M-_'. "*Non-nil means to include proxy candidates whenever possible. A proxy candidate is a special candidate (shown in `*Completions*' using face `icicle-special-candidate') whose name is a placeholder for the real candidate. The proxy candidate typically stands for some value obtained from the cursor position or by some action such as clicking the mouse. Example candidates include a color or file name, named by proxy candidates such as `*copied foreground*' or `*file at point*'. You can toggle this option at any time from the minibuffer using `\\\\[icicle-toggle-proxy-candidates]'. However, for \ commands that provide many proxy candidates, if the flag is off initially when input is read, then you must re-invoke the completing command for the new value to take effect. (This is for performance reasons.) Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-alternative-actions-alist () "*Alist of Emacs commands and alternative action functions. This always overrides any alternative action defined by `icicle-candidate-alt-action-fn'. Each alist element has the form (COMMAND . FUNCTION), where COMMAND is a command (a symbol) that reads input and FUNCTION is the alternative-action function it uses. To disable alternative action for a given command, use `ignore' as the FUNCTION. This option has no effect on `icicle-all-candidates-list-alt-action', that is, `M-|', but it does affect `C-|'." :type '(alist :key-type (symbol :tag "Command") :value-type (function :tag "Alternative action (function)")) :group 'Icicles-Miscellaneous) (defcustom icicle-alternative-sort-comparer ; Toggle with `C-M-,'. 'icicle-historical-alphabetic-p "*An alternative sort function, in place of `icicle-sort-comparer'. You can swap this with `icicle-sort-comparer' at any time by using `icicle-toggle-alternative-sorting' (\\\ `\\[icicle-toggle-alternative-sorting]' in the minibuffer)." :type '(choice (const :tag "None" nil) function) :group 'Icicles-Completions-Display) ;; Must be before `icicle-dot-string'. (defconst icicle-anychar-regexp (let ((strg (copy-sequence "\\(.\\|[\n]\\)"))) (set-text-properties 0 (length strg) '(display "." face highlight) strg) strg) "Regexp that matches any single character, including newline.") (defcustom icicle-anything-transform-candidates-flag nil "*Non-nil means `icicle-anything' transforms completion candidates. Function `anything-transform-candidates' is used for the transforming. The advantage of a nil value is that `icicle-anything' then acts as a multi-command: you can act on multiple candidates, or apply multiple actions for the same candidate, within a single invocation of `icicle-anything' (or related commands). The advantage of a non-nil value is that some of the displayed Anything candidates might be more readable. This option has no effect if library `anything.el' cannot be loaded. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display :group 'Icicles-Matching) (defcustom icicle-apropos-complete-keys (if (> emacs-major-version 23) ; `S-TAB' '([backtab]) '([S-tab] [S-iso-lefttab])) ;; In Emacs 22 and later, `backtab' is the canonical key that represents both `S-tab' and ;; `S-iso-lefttab', so in principle that could be used in the default value for Emacs 22+. ;; ;; In other words, the following should be sufficient: ;; (if (> emacs-major-version 21) ;; '([backtab]) ;; '([S-tab] [S-iso-lefttab])) ;; ;; However, some Emacs 22+ libraries, such as `info.el', are brain-dead and explicitly ;; bind both `backtab' and `S-tab'. I filed Emacs bug #1281. "*Key sequences to use for `icicle-apropos-complete'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards - for example, `S-tab' and `S-iso-lefttab'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-complete-no-display-keys '([C-M-S-tab] ; `C-M-S-TAB' [C-M-S-iso-lefttab]) "*Key sequences to use for `icicle-apropos-complete-no-display'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards - for example, `C-M-S-tab' and `C-M-S-iso-lefttab'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-next-keys '([next]) ; `next' "*Key sequences for apropos completion to cycle to the next candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-apropos-cycle-next-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-next-action-keys '([C-next]) ; `C-next' "*Keys for apropos completion to cycle next and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-apropos-cycle-next-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-next-alt-action-keys '([C-S-next]) ; `C-S-next' "*Keys for apropos completion to cycle next and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-next-help-keys '([C-M-next]) ; `C-M-next' "*Keys for apropos completion to cycle next and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-previous-keys '([prior]) ; `prior' "*Key sequences for apropos completion to cycle to the previous candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-apropos-cycle-previous-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-previous-action-keys '([C-prior]) ; `C-prior' "*Keys for apropos completion to cycle previous and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-apropos-cycle-previous-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-previous-alt-action-keys '([C-S-prior]) ; `C-S-prior' "*Keys for apropos completion to cycle previous and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-apropos-cycle-previous-help-keys '([C-M-prior]) ; `C-M-prior' "*Keys for apropos completion to cycle previous and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-bookmark-name-length-max 70 "*Maximum number of characters used to name a bookmark. When `icicle-bookmark-cmd' is used with a non-negative numeric prefix arg, the name of the bookmark that is set has at most this many chars. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Miscellaneous) (defcustom icicle-bookmark-refresh-cache-flag t "*t means `icicle-bookmark' refreshes the bookmark-list cache. Use nil to speed up `icicle-bookmark(-other-window)' if you have a lot of bookmarks, at the cost of having the bookmark list possibly not be up to date. Use t if you want to be sure the list is refreshed. If nil, the list of bookmarks is updated only if you use `C-u'. If t, the list is always updated unless you use `C-u'. This affects only commands such as `icicle-bookmark' that use the full bookmark list. It does not affect more specific Icicles bookmark commands such as `\\[icicle-bookmark-dired-other-window]' or the use of a negative prefix arg with `\\[icicle-bookmark-cmd]'. Regardless of the option value, the cache is refreshed whenever you use `S-delete' to delete a candidate bookmark. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display :group 'Icicles-Matching) (defcustom icicle-buffer-candidate-key-bindings `( (,(icicle-kbd "C-x m") icicle-bookmark-non-file-other-window ; `C-x m' (require 'bookmark+ nil t)) (,(icicle-kbd "C-x M -") icicle-remove-buffer-cands-for-mode t) ; `C-x M -' (,(icicle-kbd "C-x M +") icicle-keep-only-buffer-cands-for-mode t) ; `C-x M +' (,(icicle-kbd "C-x C-m -") icicle-remove-buffer-cands-for-derived-mode t) ; `C-x C-m -' (,(icicle-kbd "C-x C-m +") icicle-keep-only-buffer-cands-for-derived-mode t) ; `C-x C-m +' (,(icicle-kbd "C-x v -") icicle-remove-buffer-cands-for-visible t) ; `C-x v -' (,(icicle-kbd "C-x v +") icicle-keep-only-buffer-cands-for-visible t) ; `C-x v +' (,(icicle-kbd "C-x F" ) icicle-toggle-include-cached-files t) ; `C-x F' (,(icicle-kbd "C-x R" ) icicle-toggle-include-recent-files t) ; `C-x R' ) "*List of minibuffer key bindings for use with buffer-name completion. The option value has the same form as that of option `icicle-top-level-key-bindings' (which see). Each list element is of custom type `icicle-key-definition' and has the form (KEY COMMAND CONDITION)." :type (if (> emacs-major-version 21) '(repeat icicle-key-definition) '(repeat (list (choice (restricted-sexp :tag "Key" :match-alternatives ((lambda (x) (or (stringp x) (vectorp x)))) :value [ignore]) (restricted-sexp :tag "Command to remap" ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition")))) :group 'Icicles-Key-Bindings) (defcustom icicle-buffer-extras nil "*List of additional buffer-name candidates added to the normal list. List elements are strings." :type '(repeat string) :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-ignore-space-prefix-flag t "*Non-nil means ignore buffer-name completions that start with a space. However, apart from minibuffer names such as \" *Minibuf-0*\", such candidates are not ignored when your input also starts with a space or when there are no buffers whose names do not start with a space. Note: This option is provided mainly for use (binding) in `icicle-define-command' and `icicle-define-file-command'. You probably do not want to set this globally, but you can. You can toggle this option from the minibuffer using `\\\\[icicle-dispatch-M-_]' (except during Icicles searching). \ You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-include-cached-files-nflag (if (boundp 'most-positive-fixnum) (- most-positive-fixnum) -99999999) "*An integer > 0 means include cached files during buffer-name completion. This means names cached using the Emacs file-name cache - see (emacs) `File Name Cache'. An integer < 0 means do not include them. When they are included, the value is the maximum number of such candidates to include. You can toggle this option (between + and -) using `C-x F' in the minibuffer during buffer-name completion." :type '(restricted-sexp :tag "Max number of cached file candidates (+/-)" :match-alternatives ((lambda (x) (and (integerp x) (not (zerop x))))) :value ignore) :group 'Icicles-Files :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-include-recent-files-nflag (if (boundp 'most-positive-fixnum) (- most-positive-fixnum) -99999999) "*An integer > 0 means include recent files during buffer-name completion. This means file names managed by `recentf-mode' - see (emacs) `File Conveniences'. An integer < 0 means do not include them. When they are included, the value is the maximum number of such candidates to include. You can toggle this option (between + and -) using `C-x R' in the minibuffer during buffer-name completion. This option has no effect prior to Emacs 21 (no library `recentf.el')." :type '(restricted-sexp :tag "Max number of recent file candidates (+/-)" :match-alternatives ((lambda (x) (and (integerp x) (not (zerop x))))) :value ignore) :group 'Icicles-Files :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-match-regexp nil "*nil or a regexp that buffer-name completion candidates must match. If nil, then this does nothing. If a regexp, then show only candidates that match it (and match the user input). See also `icicle-buffer-no-match-regexp'." :type '(choice (const :tag "None" nil) regexp) :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-no-match-regexp nil "*nil or a regexp that buffer-name completion candidates must not match. If nil, then this does nothing. If a regexp, then show only candidates that do not match it. See also `icicle-buffer-match-regexp'." :type '(choice (const :tag "None" nil) regexp) :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-predicate nil "*nil or a predicate that buffer-name candidates must satisfy. If nil, then this does nothing. Otherwise, this is a function of one argument, a candidate, and only candidates that satisfy the predicate are displayed. For example, this value will show only buffers that are associated with files: (lambda (bufname) (buffer-file-name (get-buffer bufname))) This predicate is applied after matching against user input. It thus corresponds to `icicle-must-pass-after-match-predicate', not to `icicle-must-pass-predicate'." :type '(choice (const :tag "None" nil) function) :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-prefix-arg-filtering 'use-default "*Conditions that filter buffers for buffer-name candidates. This filtering is in addition to removing the names of minibuffers. If the value is `use-default' then use the default Icicles behavior \(see the doc). Otherwise, it is a list of conditions that are applied, in order until one matches, to filter out buffers. If none match then no filtering is done. Each condition is a list of two items: (PREF-ARG-TEST BUF-TEST). PREF-ARG-TEST is a predicate that accepts a raw prefix argument value, such as is returned by `current-prefix-arg', as its argument. If PREF-ARG-TEST returns non-nil then BUF-TEST is used to filter buffers (see next). If PREF-ARG-TEST returns nil then the next condition is checked, and so on. If none of the conditions match then no filtering is done. BUF-TEST is a predicate that accepts a buffer as argument. If it returns non-nil then name of that buffer is removed as a completion candidate. Alternatively, BUF-TEST can be the constant `nil', which has the same effect as applying (lambda (buf) nil) as the filter predicate: the buffer is not removed. As an example, this value of `icicle-buffer-prefix-arg-filtering' provides the same behavior as value `use-default' (but it is slower): ((not nil) ; (no prefix arg): no filtering. ((lambda (cpa) ; `C-u C-u C-u' (and (consp cpa) ; Visible (> (prefix-numeric-value cpa) 16))) (lambda (bf) (get-buffer-window bf 0))) ((lambda (cpa) ; `C-u C-u' (and (consp cpa) ; Invisible (> (prefix-numeric-value cpa) 4))) (lambda (bf) (not (get-buffer-window bf 0)))) ((lambda (cpa) ; `C-u' (and (consp current-prefix-arg) ; Derived mode (fboundp 'derived-mode-p))) (lambda (bf) (derived-mode-p (with-current-buffer bf major-mode)))) ((lambda (cpa) ; 0 (zerop (prefix-numeric-value cpa))) ; Same mode (let ((this-mode major-mode)) `(lambda (bf) (with-current-buffer bf (not (eq major-mode ',this-mode)))))) ((lambda (cpa) ; < 0 (< (prefix-numeric-value cpa) 0)) ; Other frame (lambda (bf) (not (member bf (cdr (assq 'buffer-list (frame-parameters))))))) ((lambda (cpa) cpa) ; > 0 (lambda (bf) ; Not file/dir (and (not (buffer-file-name bf)) (with-current-buffer bf (not (eq major-mode 'dired-mode)))))))" :type '(choice (const :tag "Use the default Icicles behavior" 'use-default) (repeat :tag "Conditions tested in order, to filter buffer-name candidates" (list (function :tag "Predicate to test raw prefix arg") (choice (const :tag "No filtering - include all buffer names" nil) (function :tag "Predicate to filter out a buffer name"))))) :group 'Icicles-Buffers) (defcustom icicle-buffer-require-match-flag nil "*Override `icicle-require-match-flag' for `icicle-buffer*' commands. Controls the REQUIRE-MATCH arg to `completing-read' and `read-file-name'. The possible values are as follows: - nil means this option imposes nothing on completion; the REQUIRE-MATCH argument provided to the function governs behavior - `no-match-required' means the same as a nil value for REQUIRE-MATCH - `partial-match-ok' means the same as a t value for REQUIRE-MATCH - `full-match-required' means the same as a non-nil, non-t value for REQUIRE-MATCH Note: This option is provided mainly for use (binding) in `icicle-define-command' and `icicle-define-file-command'. You probably do not want to set this globally, but you can." :type '(choice (const :tag "Do not impose any match behavior" nil) (const :tag "Do not require a match" no-match-required) (const :tag "Require a partial match, with RET" partial-match-ok) (const :tag "Require a full match" full-match-required)) :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-skip-hook nil "*Hook run by `icicle-buffer' on each matching buffer name. If a function returns non-nil then the buffer content is not searched. Use this to skip visiting and trying to search non-text buffers, such as PDFs and images, or buffers that might be time-consuming to access. See also the `icicle-buffer' doc for other ways to filter the set of candidate buffers." :type 'hook :group 'Icicles-Buffers :group 'Icicles-Matching) (defcustom icicle-buffer-sort 'icicle-buffer-sort-*...*-last "*A sort function for buffer names, or nil. Examples of sort functions are `icicle-buffer-sort-*...*-last' and `string<'. If nil, then buffer names are not sorted." :type '(choice (const :tag "None" nil) function) :group 'Icicles-Buffers :group 'Icicles-Completions-Display) (defcustom icicle-buffers-ido-like-flag nil "*t means `icicle-buffer' and similar commands act more Ido-like. Specifically, those commands then bind these options to t: `icicle-show-Completions-initially-flag' `icicle-top-level-when-sole-completion-flag' `icicle-default-value' Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Buffers :group 'Icicles-Completions-Display :group 'Icicles-Matching) (defcustom icicle-candidate-action-keys '([C-return]) ; `C-return' "*Keys for acting on the current completion candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-candidate-help-keys '([C-M-return] ; `C-M-return' [C-help] ; `C-help' [C-M-help] ; `C-M-help' [C-f1] ; `C-f1' [C-M-f1]) ; `C-M-f1' "*Keys for showing help about the current completion candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-candidate-width-factor 80 "*Percentage of widest candidate width to use for calculating columns. The number of columns of candidates displayed in `*Completions*' is no more than the window width divided by this percentage of the maximum candidate width. Increasing this toward 100 spreads columns out. Decreasing it compresses columns together. The higher the value, the more candidates will form well-defined columns, but the likelier that horizontal space will be wasted between them. The lower the value, the more candidates will not line up in columns, but the less horizontal space will be wasted between them. When most candidates are almost as wide as the widest candidate, a high value works well. When most candidates are much shorter than the widest candidate, a low value works well. If you use Do Re Mi (library `doremi.el') then you can modify this option incrementally during completion, seeing the effect as it changes. Use `C-x w' from the minibuffer, then use the `right' and `left' arrow keys or the mouse wheel to increment and decrement the value. WYSIWYG. If you use `doremi.el' then you can also use multi-command `icicle-increment-option' anytime to change the option value incrementally. See also option `icicle-inter-candidates-min-spaces' and (starting with Emacs 23) option `icicle-Completions-text-scale-decrease'." :type 'integer :group 'Icicles-Completions-Display) ;; Must be before `icicle-change-region-background-flag'. (defcustom icicle-mark-position-in-candidate 'input-end "*Position of mark when you cycle through completion candidates. This is the mark position in the minibuffer. Possible values are those for `icicle-point-position-in-candidate'." :type '(choice (const :tag "Leave mark at the beginning of the minibuffer input" input-start) (const :tag "Leave mark at the end of the minibuffer input" input-end) (const :tag "Leave mark at the beginning of the completion root" root-start) (const :tag "Leave mark at the end of the completion root" root-end)) :group 'Icicles-Minibuffer-Display) ;; Must be before `icicle-change-region-background-flag'. (defcustom icicle-point-position-in-candidate 'root-end "*Position of cursor when you cycle through completion candidates. This is the cursor position in the minibuffer. Possible values are: `input-start': beginning of the minibuffer input `input-end': end of the minibuffer input `root-start': beginning of the completion root `root-end': end of the completion root When input is expected to be a file name, `input-start' is just after the directory, which is added automatically during completion cycling. See also `icicle-mark-position-in-candidate'." :type '(choice (const :tag "Leave cursor at the beginning of the minibuffer input" input-start) (const :tag "Leave cursor at the end of the minibuffer input" input-end) (const :tag "Leave cursor at the beginning of the completion root" root-start) (const :tag "Leave cursor at the end of the completion root" root-end)) :group 'Icicles-Minibuffer-Display) (defcustom icicle-change-region-background-flag (not (eq icicle-point-position-in-candidate icicle-mark-position-in-candidate)) "*Non-nil means use color `icicle-region-background' during input. See `icicle-region-background'. If you load library `hexrgb.el' before Icicles, then `icicle-region-background' will be a slightly different hue from your normal background color. This makes minibuffer input easier to read than if your normal `region' face were used. This has an effect only during minibuffer input. A non-nil value for this option is particularly useful if you use delete-selection mode. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Minibuffer-Display) (defcustom icicle-change-sort-order-completion-flag nil "*Non-nil means `icicle-change-sort-order' uses completion, by default. Otherwise, it cycles among the possible sort orders. You can override the behavior by using `C-u' with `icicle-change-sort-order'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display :group 'Icicles-Matching) (defcustom icicle-C-l-uses-completion-flag nil "*Non-nil means \\\ `\\[icicle-retrieve-previous-input]' uses completion for choosing completion history entries, by default. Otherwise, it cycles among the possible previous inputs. You can override the behavior by using `C-u' with `\\[icicle-retrieve-previous-input]'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Minibuffer-Display :group 'Icicles-Matching) ;; Replace this list by your favorite color themes. Each must be the name of a defined function. ;; By default, this includes all color themes defined globally (variable `color-themes'). ;; ;; NOTE: We need the `condition-case' because of a BUG in `directory-files' for Emacs 20. ;; Bug reported to `color-theme.el' maintainer 2009-11-22. The problem is that the default value ;; of `color-theme-libraries' concats `file-name-directory', which ends in `/', with `/themes', ;; not with `themes'. So the result is `...//themes'. That is tolerated by Emacs 21+ ;; `directory-files', but not for Emacs 20. Until this `color-theme.el' bug is fixed, Emacs 20 ;; users will need to manually load `color-theme-libraries.el'. (defcustom icicle-color-themes () "*List of color themes to cycle through using `M-x icicle-color-theme'. Note: Starting with Color Theme version 6.6.0, you will need to put library `color-theme-library.el', as well as library `color-theme.el', in your `load-path'." :type 'hook :group 'Icicles-Miscellaneous) (defcustom icicle-comint-dynamic-complete-replacements '((shell-command-completion 'icicle-shell-dynamic-complete-command) ; Emacs 24+ (shell-dynamic-complete-command 'icicle-shell-dynamic-complete-command) ; Emacs 20-23 (shell-dynamic-complete-environment-variable 'icicle-shell-dynamic-complete-environment-variable) (shell-dynamic-complete-filename 'icicle-shell-dynamic-complete-filename) ((pcomplete-completions-at-point comint-filename-completion shell-filename-completion) (lambda () (and (comint-match-partial-filename) #'icicle-comint-dynamic-complete-filename))) ) "*List of function replacements for `comint-dynamic-complete-functions'. Instead of using `comint-dynamic-complete-functions' as is, command `icicle-comint-dynamic-complete' uses a modified version of that list according to the value of this option. You can use this option to provide Icicles completion for various modes that inherit from Comint mode or otherwise use `comint-dynamic-complete'. Each option list element is itself a list of two elements, (OLD NEW). OLD specifies a function in `comint-dynamic-complete-functions'. NEW is a sexp that evaluates to an Icicles completion function to use instead of OLD. If OLD is a symbol then the value of NEW, in effect, replaces OLD in `comint-dynamic-complete-functions'. If OLD is a list then the value of NEW is inserted in `comint-dynamic-complete-functions' before whichever element of OLD occurs first in `comint-dynamic-complete-functions'. That ensures that NEW is invoked before OLD when attempting completion. OLD is invoked only if NEW cannot find a completion. For example, this list element says to replace completion function `foo' by completion function `my-foo': (foo 'my-foo). And this one says to try completing with function `mine' before `foo' or `bar': \((foo bar) 'mine)." :type '(repeat (list (choice (symbol :tag "OLD to replace") (repeat :tag "OLD to insert before" sexp)) (sexp :tag "NEW (must eval to completion function)"))) :group 'Icicles-Miscellaneous) (defcustom icicle-command-abbrev-alist () "*Alist of command abbreviations and commands, with frequency of use. Each element has the form (COMMAND ABBREV N), where ABBREV is an abbreviation of COMMAND and N is the number of times COMMAND has been invoked via ABBREV. Both COMMAND and ABBREV are symbols." :type '(alist :key-type (symbol :tag "Command") :value-type (list (symbol :tag "Abbreviation") (integer :tag "Times Used"))) :group 'Icicles-Matching) (defcustom icicle-command-abbrev-match-all-parts-flag nil "*Non-nil means `icicle-command-abbrev' matches each command-name part. Otherwise, an abbrev need match only a prefix of the command name. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-command-abbrev-priority-flag nil "*nil means commands take precedence over abbreviations for `\\\ \\[icicle-command-abbrev]'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-complete-key-anyway-flag nil "*Non-nil means bind `S-TAB' for key completion even if already bound. If nil, then each of the keys in `icicle-key-complete-keys' is bound to `icicle-complete-keys' in each keymap of `icicle-keymaps-for-key-completion' only if `S-TAB' is not already bound in the keymap. Note: the keys in `icicle-key-complete-keys' are always bound to `icicle-complete-keys' in `icicle-mode-map'. This option affects only the binding of those keys in `icicle-keymaps-for-key-completion'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Completion :group 'Icicles-Key-Bindings) (when (fboundp 'map-keymap) ; Emacs 22+. (defcustom icicle-complete-keys-self-insert-ranges () "*Non-nil means `icicle-complete-keys' includes self-inserting keys. That means keys bound to `self-insert-command'. For Emacs 22, this is effectively Boolean: any non-nil value allows all self-inserting keys as candidates. In Emacs 23+, there are thousands of self-inserting keys, so it is not practical to allow all as candidates. Instead, a non-nil value is a list of character ranges of the form (MIN . MAX). Characters in the inclusive range MIN through MAX are possible key-completion candidates. For Emacs 23+, if you use a non-nil value then use only small ranges for better performance, e.g., `((0 . 687))' covers Latin characters. In general, leave the value as nil. Use `C-x 8 RET' in Emacs 23+ to insert characters by completing against their Unicode names. With Icicles, you can see the characters themselves in `*Completions*' whether you use key completion or `C-x 8 RET', but in both cases you complete against the character name. `C-x 8 RET' is bound by default in Emacs to command `insert-char' \(called `ucs-insert' prior to Emacs 24). If you use my library `ucs-cmds.el' then you might want to remap that command to command `ucsc-insert', which is an enhancement. For reference, below are the ranges supported by `C-x 8 RET' (Emacs 23+). But unless you have a very powerful computer, choose only only one or two small ranges of characters you actually might use. BMP ranges: (0 . 13311) = (#x0000 . #x33FF) (19904 . 19967) = (#x4DC0 . #x4DFF) (40960 . 55295) = (#xA000 . #x0D7FF) (64256 . 65533) = (#xFB00 . #xFFFD) Upper ranges: (65536 . 79103) = (#x10000 . #x134FF) (118784 . 131071) = (#x1D000 . #x1FFFF) (917504 . 918015) = (#xE0000 . #xE01FF)" :type '(alist :key-type integer :value-type integer) :group 'Icicles-Key-Completion)) (defcustom icicle-completing-read+insert-keys '([(control meta shift ?c)]) ; `C-M-S-c' "*Key sequences to invoke `icicle-completing-read+insert'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Such a key has no effect unless `icicle-completing-read+insert-candidates' is non-nil." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-completion-history-max-length (if icicle-C-l-uses-completion-flag 1000 100) "*Maximum number of inputs to save in the completion history. This is the history that you access using \\\ `\\[icicle-retrieve-previous-input]' and `\\[icicle-retrieve-next-input]'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Miscellaneous) (defcustom icicle-completion-key-bindings `((,(icicle-kbd "M-return") icicle-candidate-read-fn-invoke t) ;`M-RET' ; (`M-return') (,(icicle-kbd "C-M-m") icicle-candidate-read-fn-invoke t) ;`M-RET' ; (`ESC RET') (,(icicle-kbd "C-S-return") icicle-candidate-alt-action t) ; `C-S-RET' ; (`C-S-return') (,(icicle-kbd "delete") icicle-remove-candidate t) ; `delete' (,(icicle-kbd "S-delete") icicle-delete-candidate-object t) ; `S-delete' (,(icicle-kbd "C-w") icicle-kill-region t) ; `C-w' (,(icicle-kbd "C-!") icicle-all-candidates-action t) ; `C-!' (,(icicle-kbd "C-|") icicle-all-candidates-alt-action t) ; `C-|' (,(icicle-kbd "M-!") icicle-all-candidates-list-action t) ; `M-!' (,(icicle-kbd "M-|") icicle-all-candidates-list-alt-action t) ; `M-|' (,(icicle-kbd "C-M-/") icicle-prefix-complete t) ; (for `dabbrev.el') `C-M-/' (,(icicle-kbd "M-h") icicle-history t) ; `M-h' (,(icicle-kbd "M-pause") icicle-keep-only-past-inputs t) ; `M-pause' (,(icicle-kbd "C-pause") icicle-toggle-highlight-historical-candidates t) ;`C-pause' (,(icicle-kbd "S-pause") icicle-toggle-highlight-saved-candidates t) ; `S-pause' ;;$$$$$$ (,(icicle-kbd "C-M-pause") 'icicle-other-history) ; `C-M-pause' (,(icicle-kbd "C-insert") icicle-switch-to-Completions-buf t) ; `C-insert' (,(icicle-kbd "insert") icicle-save/unsave-candidate t) ; `insert' ;; In Emacs 22+, local is parent of local-completion ;; Note: `setup-keys.el' binds `C-o' to `1on1-fit-minibuffer-frame' if defined. (,(icicle-kbd "C-a") icicle-beginning-of-line+ (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-a' (,(icicle-kbd "C-e") icicle-end-of-line+ (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-e' (,(icicle-kbd "C-M-v") icicle-scroll-forward (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-M-v' (,(icicle-kbd "C-M-S-v") icicle-scroll-backward (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-M-V' ; (`C-M-S-v') (,(icicle-kbd "C-=") icicle-insert-string-from-variable (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-=' ;; Replaces `tab-to-tab-stop': (,(icicle-kbd "M-i") icicle-clear-current-history (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-i' ;; Replaces `kill-sentence': (,(icicle-kbd "M-k") icicle-erase-minibuffer-or-history-element (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-k' (,(icicle-kbd "M-o") icicle-insert-history-element (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-o' (,(icicle-kbd "M-.") icicle-insert-string-at-point (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-.' (,(icicle-kbd "C-x C-f") icicle-resolve-file-name (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-x C-f' (,(icicle-kbd "M-:") icicle-pp-eval-expression-in-minibuffer (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-:' (,(icicle-kbd "C-M-y") icicle-yank-secondary (and (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map))) (fboundp 'icicle-yank-secondary))) ; `C-M-y' (,(icicle-kbd "C-M-pause") icicle-other-history (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-M-pause' (,(icicle-kbd "M-S-backspace") icicle-erase-minibuffer (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-S-backspace' (,(icicle-kbd "M-S-delete") icicle-erase-minibuffer (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-S-delete' ;; Need `C-g', even if `minibuffer-local-completion-map' inherits from `minibuffer-local-map'. (,(icicle-kbd "C-g") icicle-abort-recursive-edit t) ; `C-g' (,(icicle-kbd "M-q") icicle-dispatch-M-q t) ; `M-q' (,(icicle-kbd "C-l") icicle-retrieve-previous-input t) ; `C-l' (,(icicle-kbd "C-S-l") icicle-retrieve-next-input t) ; `C-L' (`C-S-l') (,(icicle-kbd "M-$") icicle-candidate-set-truncate t) ; `M-$' (,(icicle-kbd "C-~") icicle-candidate-set-complement t) ; `C-~' (,(icicle-kbd "C--") icicle-candidate-set-difference t) ; `C--' (,(icicle-kbd "C-+") icicle-candidate-set-union t) ; `C-+' (,(icicle-kbd "C-*") icicle-candidate-set-intersection t) ; `C-*' (,(icicle-kbd "C->") icicle-candidate-set-save-more t) ; `C->' (,(icicle-kbd "C-M->") icicle-candidate-set-save t) ; `C-M->' (,(icicle-kbd "C-(") icicle-next-TAB-completion-method t) ; `C-(' (,(icicle-kbd "M-(") icicle-next-S-TAB-completion-method t) ; `M-(' (,(icicle-kbd "C-)") icicle-candidate-set-save-more-selected t) ; `C-)' (,(icicle-kbd "C-M-)") icicle-candidate-set-save-selected t) ; `C-M-)' (,(icicle-kbd "C-M-<") icicle-candidate-set-retrieve t) ; `C-M-<' (,(icicle-kbd "C-M-}") icicle-candidate-set-save-to-variable t) ; `C-M-}' (,(icicle-kbd "C-M-{") icicle-candidate-set-retrieve-from-variable t) ; `C-M-{' (,(icicle-kbd "C-}") icicle-candidate-set-save-persistently t) ; `C-}' (,(icicle-kbd "C-{") icicle-candidate-set-retrieve-persistent t) ; `C-{' (,(icicle-kbd "C-%") icicle-candidate-set-swap t) ; `C-%' (,(icicle-kbd "M-%") icicle-regexp-quote-input t) ; `M-%' (,(icicle-kbd "C-:") icicle-candidate-set-define t) ; `C-:' (,(icicle-kbd "C-M-j") icicle-insert-list-join-string t) ; `C-M-j' (,(icicle-kbd "C-,") icicle-change-sort-order t) ; `C-,' (,(icicle-kbd "C-M-\;") icicle-toggle-ignoring-comments t) ; `C-M-;' (,(icicle-kbd "C-`") icicle-toggle-regexp-quote t) ; `C-`' (,(icicle-kbd "C-M-.") icicle-toggle-dot t) ; `C-M-.' (,(icicle-kbd "C-M-`") icicle-toggle-literal-replacement t) ; `C-M-`' (,(icicle-kbd "C-<") icicle-candidate-set-retrieve-more t) ; `C-<' (,(icicle-kbd "C-M-_") icicle-toggle-proxy-candidates t) ; `C-M-_' (,(icicle-kbd "C-$") icicle-toggle-transforming t) ; `C-$' ;;; ;; In Emacs 22+, local is parent of local-completion ;;; ;; $$$$$$ Keep `C-?' also for a while, undocumented, for backward compatibility only. ;;; (,(icicle-kbd "C-?") icicle-minibuffer-help ;;; (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-?' (,(icicle-kbd "M-?") icicle-minibuffer-help (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `M-?' (,(icicle-kbd "C-.") icicle-dispatch-C-. t) ; `C-.' (,(icicle-kbd "C-#") icicle-cycle-incremental-completion t) ; `C-#' (,(icicle-kbd "C-\"") icicle-toggle-expand-to-common-match t) ; `C-"' (,(icicle-kbd "C-M-\"") icicle-cycle-expand-to-common-match t) ; `C-M-"' (,(icicle-kbd "M-\;") icicle-toggle-search-replace-common-match t) ; `M-;' (,(icicle-kbd "C-^") icicle-dispatch-C-^ t) ; `C-^' (,(icicle-kbd "C-M-^") icicle-toggle-completions-format t) ; `C-M-^' (,(icicle-kbd "C-S-a") icicle-toggle-case-sensitivity t) ; `C-A' (`C-S-a') (,(icicle-kbd "M-~") icicle-toggle-~-for-home-dir t) ; `M-~' (,(icicle-kbd "C-M-~") icicle-toggle-search-complementing-domain t) ; `C-M-~' (,(icicle-kbd "M-g") icicle-toggle-C-for-actions t) ; `M-g' (,(icicle-kbd "M-,") icicle-dispatch-M-comma t) ; `M-,' (,(icicle-kbd "C-M-,") icicle-toggle-alternative-sorting t) ; `C-M-,' (,(icicle-kbd "C-M-+") icicle-plus-saved-sort t) ; `C-M-+' (,(icicle-kbd "M-+") icicle-widen-candidates t) ; `M-+' (,(icicle-kbd "M-*") icicle-narrow-candidates t) ; `M-*' (,(icicle-kbd "M-&") icicle-narrow-candidates-with-predicate t) ; `M-&' (,(icicle-kbd "M-_") icicle-dispatch-M-_ t) ; `M-_' (,(icicle-kbd "C-M-&") icicle-save-predicate-to-variable t) ; `C-M-&' (,(icicle-kbd "S-SPC") icicle-apropos-complete-and-narrow t) ; `S-SPC' (,(icicle-kbd "S-return") icicle-apropos-complete-and-exit t) ; `S-return' (,(icicle-kbd "S-backspace") icicle-apropos-complete-and-widen t) ; `S-backspace' (,(icicle-kbd "C-v") icicle-scroll-Completions-forward t) ; `C-v' (,(icicle-kbd "M-v") icicle-scroll-Completions-backward t) ; `M-v' (,(icicle-kbd ".") icicle-insert-dot-command t) ; `.' (,(icicle-kbd "M-m") icicle-toggle-show-multi-completion t) ; `M-m' (,(icicle-kbd "M-r") icicle-roundup t) ; `M-r' (,(icicle-kbd "C-x .") icicle-dispatch-C-x. t) ; `C-x .' (,(icicle-kbd "C-x :") icicle-toggle-network-drives-as-remote t) ; `C-x :' (,(icicle-kbd "C-x C-a") icicle-toggle-annotation t) ; `C-x C-a' (,(icicle-kbd "C-x t") icicle-cycle-image-file-thumbnail (fboundp 'icicle-cycle-image-file-thumbnail)) ; `C-x t' (,(icicle-kbd "C-x w") icicle-doremi-candidate-width-factor+ (fboundp 'doremi)) ; `C-x w' (,(icicle-kbd "C-x |") icicle-doremi-inter-candidates-min-spaces+ (fboundp 'doremi)) ; `C-x |' (,(icicle-kbd "C-x #") icicle-doremi-increment-max-candidates+ (fboundp 'doremi)) ; `C-x #' (,(icicle-kbd "C-x -") icicle-doremi-zoom-Completions+ (and (fboundp 'doremi) (fboundp 'text-scale-increase))) ; `C-x -' (,(icicle-kbd "C-x 1") icicle-doremi-increment-swank-timeout+ (and (fboundp 'doremi) (eq (icicle-current-TAB-method) 'swank))) ;; NO - NEED TO DO THE SWANK PART AT RUNTIME, in icicles-mode.el (,(icicle-kbd "C-x 2") icicle-doremi-increment-swank-prefix-length+ (and (fboundp 'doremi) (eq (icicle-current-TAB-method) 'swank))) ;; `minibuffer-completion-help' got wiped out by remap for self-insert. (,(icicle-kbd "?") icicle-self-insert t) ; `? (,(icicle-kbd "SPC") icicle-self-insert t) ; " " ;; In Emacs 22+, local is parent of local-completion (,(icicle-kbd "C-j") icicle-insert-newline-in-minibuffer (not (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map)))) ; `C-j ) "*List of minibuffer key bindings during completion in Icicle mode. The option value has the same form as that of option `icicle-top-level-key-bindings' (which see). Each list element is of custom type `icicle-key-definition' and has the form (KEY COMMAND CONDITION). If you customize this option then you must exit and re-enter Icicle mode to ensure that the change takes effect. This is really necessary only if your changes would undefine a key. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode." :type (if (> emacs-major-version 21) '(repeat icicle-key-definition) '(repeat (list (choice (restricted-sexp :tag "Key" :match-alternatives ((lambda (x) (or (stringp x) (vectorp x)))) :value [ignore]) (restricted-sexp :tag "Command to remap" ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition")))) :group 'Icicles-Key-Bindings) (defcustom icicle-completion-list-key-bindings `( ;;; (,(icicle-kbd "C-?") icicle-minibuffer-help t) ; `C-?' (,(icicle-kbd "M-?") icicle-minibuffer-help t) ; `M-?' (,(icicle-kbd "q") icicle-abort-recursive-edit t) ; `q' (,(icicle-kbd "C-insert") icicle-insert-completion t) ; `C-insert' (,(icicle-kbd "down") icicle-next-line t) ; `down' (,(icicle-kbd "up") icicle-previous-line t) ; `up' (,(icicle-kbd "left") icicle-move-to-previous-completion t) ; `left' (,(icicle-kbd "backtab") icicle-move-to-previous-completion ; `S-TAB' (> emacs-major-version 23)) (,(icicle-kbd "S-tab") icicle-move-to-previous-completion ; `S-TAB' (< emacs-major-version 24)) (,(icicle-kbd "S-iso-lefttab") icicle-move-to-previous-completion ; `S-TAB' (< emacs-major-version 24)) (,(icicle-kbd "right") icicle-move-to-next-completion t) ; `right' (,(icicle-kbd "C-i") icicle-move-to-next-completion t) ; `TAB' (,(icicle-kbd "tab") icicle-move-to-next-completion t) ; `TAB' ,@(and (boundp 'mouse-wheel-down-event) ; Emacs 22+ `((,(vector mouse-wheel-down-event) icicle-scroll-Completions-backward t) ; `wheel-down' (,(vector mouse-wheel-up-event) icicle-scroll-Completions-forward t))) ; `wheel-up' (,(icicle-kbd "S-down-mouse-2") icicle-mouse-remove-candidate t) ; `S-mouse-2' (,(icicle-kbd "S-mouse-2") ignore t) (,(icicle-kbd "C-S-down-mouse-2") icicle-mouse-candidate-alt-action t) ; `C-S-mouse-2' (,(icicle-kbd "C-S-mouse-2") ignore t) (,(icicle-kbd "C-down-mouse-2") icicle-mouse-candidate-action t) ; `C-mouse-2' (,(icicle-kbd "C-mouse-2") ignore t) (,(icicle-kbd "C-M-down-mouse-2") icicle-mouse-help-on-candidate t) ; `C-M-mouse-2' (,(icicle-kbd "C-M-mouse-2") ignore t) (,(icicle-kbd "M-S-down-mouse-2") icicle-mouse-save/unsave-candidate t) ; `M-S-mouse-2' (,(icicle-kbd "M-S-mouse-2") ignore t) (,(icicle-kbd "M-down-mouse-2") icicle-mouse-candidate-read-fn-invoke t) ; `M-mouse-2' (,(icicle-kbd "M-mouse-2") ignore t) (,(icicle-kbd "C-down-mouse-3") icicle-Completions-mouse-3-menu t) ; `C-mouse-3' (,(icicle-kbd "C-mouse-3") ignore t) (,(icicle-kbd "M-down-mouse-3") icicle-mouse-candidate-set-save-more t) ; `M-mouse-3' (,(icicle-kbd "M-mouse-3") ignore t) (,(icicle-kbd "M-S-down-mouse-3") icicle-mouse-candidate-set-save t) ; `M-S-mouse-3' (,(icicle-kbd "M-S-mouse-3") ignore t) (,(icicle-kbd "mouse-3") icicle-mouse-save-then-kill t) ; `mouse-3' (,(icicle-kbd "C->") icicle-candidate-set-save-more t) ; `C->' (,(icicle-kbd "C-M->") icicle-candidate-set-save t) ; `C-M->' (,(icicle-kbd "C-)") icicle-candidate-set-save-more-selected t) ; `C-)' (,(icicle-kbd "C-M-)") icicle-candidate-set-save-selected t) ; `C-M-)' (,(icicle-kbd "C-M-<") icicle-candidate-set-retrieve t) ; `C-M-<' (,(icicle-kbd "C-l") icicle-retrieve-previous-input t) ; `C-l' (,(icicle-kbd "C-a") icicle-beginning-of-line+ t) ; `C-a' (,(icicle-kbd "C-e") icicle-end-of-line+ t) ; `C-e' ) "*List of key bindings in `*Completions*' for use in Icicle mode. The option value has the same form as that of option `icicle-top-level-key-bindings' (which see). Each list element is of custom type `icicle-key-definition' and has the form (KEY COMMAND CONDITION). If you customize this option then you must exit and re-enter Icicle mode to ensure that the change takes effect. This is really necessary only if your changes would undefine a key. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode." :type (if (> emacs-major-version 21) '(repeat icicle-key-definition) '(repeat (list (choice (restricted-sexp :tag "Key" :match-alternatives ((lambda (x) (or (stringp x) (vectorp x)))) :value [ignore]) (restricted-sexp :tag "Command to remap" ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition")))) :group 'Icicles-Key-Bindings) (defcustom icicle-Completions-display-min-input-chars 0 "*`*Completions*' window is removed if fewer chars than this are input. You might want to set this to, say 1 or 2, to avoid display of a large set of candidates during incremental completion. The default value of 0 causes this option to have no effect: `*Completions*' is never removed based only on the number of input characters. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Completions-Display) (defcustom icicle-completions-format (if (boundp 'completions-format) ; Defined in Emacs 23+. completions-format 'horizontal) "*Layout of completion candidates in buffer `*Completions*'. `vertical' means display down columns first, then to the right. `horizontal' or nil means display across rows first, then down. Note that multi-line candidates are always displayed in a single column, and in this case it makes no difference what the value of the option is - the effect is the same. You can toggle this option at any time from the minibuffer using `\\\\[icicle-toggle-completions-format]'." :type '(choice (const :tag "Display vertically" vertical) (other :tag "Display horizontally" horizontal)) :group 'Icicles-Completions-Display) (defcustom icicle-move-Completions-frame 'right "*Non-nil means move `*Completions*' frame to the edge of the display. This is done by `icicle-candidate-action'. It only happens if `*Completions*' is alone in its frame. This can be useful to make `*Completions*' more visible. Possible values are `right', `left', and nil (do not move)." :type '(choice (const :tag "Move to right edge" right) (const :tag "Move to right edge" left) (const :tag "Do not move" nil)) :group 'Icicles-Completions-Display) (defcustom icicle-Completions-max-columns nil "*Maximum number of columns to use in buffer `*Completions*'. If nil, the number is calculated automatically. I recommend that you leave this nil and use options `icicle-inter-candidates-min-spaces' and `icicle-candidate-width-factor' to control columns and candidate spacing. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "Calculate columns automatically" nil) (integer :tag "Maximum number of columns" :value 1)) :group 'Icicles-Completions-Display) (defcustom icicle-Completions-mouse-3-menu-entries (if (fboundp 'doremi) `(,icicle-Completions-this-candidate-submenu ,icicle-Completions-sorting-submenu ,icicle-doremi-submenu ,icicle-Completions-save/retrieve-submenu ,icicle-Completions-sets-submenu ,icicle-Completions-toggle-submenu ,icicle-Completions-misc-submenu) `(,icicle-Completions-this-candidate-submenu ,icicle-Completions-sorting-submenu ,icicle-Completions-save/retrieve-submenu ,icicle-Completions-sets-submenu ,icicle-Completions-toggle-submenu ,icicle-Completions-misc-submenu)) "*Entries for the `mouse-3' popup menu in `*Completions*'. The menu is created by `icicle-Completions-mouse-3-menu'. The option value is a list. Each element defines a submenu or a menu item. A null element (`nil') is ignored. Several alternative entry formats are available. When customizing, choose an alternative in the Customize `Value Menu'. In this description: SYMBOL is a symbol identifying the menu entry. `menu-item' is just that text, literally. NAME is a string naming the menu item or submenu. COMMAND is the command to be invoked by an item. MENU-KEYMAP is a menu keymap or a var whose value is a menu keymap. KEYWORDS is a property list of menu keywords (`:enable', `:visible', `:filter', `:keys', etc.). 1. Single menu item. For a selectable item, use (SYMBOL menu-item NAME COMMAND . KEYWORDS). For a non-selectable item such as a separator, use (SYMBOL NAME) or (SYMBOL menu-item NAME nil . KEYWORDS). 2. Items taken from a menu-keymap variable, such as `menu-bar-edit-menu'. Just use the name of the variable (a symbol). The items appear at the top level of the popup menu, not in a submenu. 3. Submenu. Use (SYMBOL menu-item NAME MENU-KEYMAP . KEYWORDS) or (SYMBOL NAME . MENU-KEYMAP). Remember that MENU-KEYMAP can also be a variable (symbol) whose value is a menu keymap. All of these are standard menu elements, with the exception of the use of a keymap variable to represent its value. See also: * (elisp) Format of Keymaps * (elisp) Classifying Events * (elisp) Extended Menu Items Example submenu element: (toto menu-item \"Toto\" menu-bar-toto-menu) Example selectable menu-item element: (foo menu-item \"Foo\" foo-command :visible (not buffer-read-only))" :type '(repeat (choice ;; These could be combined, but it's better for users to see separate choices. (restricted-sexp :tag "Submenu (SYMBOL menu-item NAME MENU-KEYMAP . KEYWORDS) or (SYMBOL NAME . MENU-KEYMAP)" :match-alternatives ((lambda (x) (and (consp x) (symbolp (car x)) (or (and (stringp (cadr x)) (cddr x)) ; (SYMBOL NAME . MENU-KEYMAP) ;; (SYMBOL menu-item NAME MENU-KEYMAP . KEYWORDS) (and (eq 'menu-item (cadr x)) (stringp (car (cddr x))) (or (keymapp (car (cdr (cddr x)))) ; Can be a keymap var. (and (symbolp (car (cdr (cddr x)))) (boundp (car (cdr (cddr x)))) (keymapp (symbol-value (car (cdr (cddr x))))))))))) 'nil)) (restricted-sexp :tag "Items from a keymap variable's value." :match-alternatives ((lambda (x) (and (symbolp x) (keymapp (symbol-value x)))) 'nil)) (restricted-sexp :tag "Selectable item (SYMBOL menu-item NAME COMMAND . KEYWORDS)" :match-alternatives ((lambda (x) (and (consp x) (symbolp (car x)) (eq 'menu-item (cadr x)) (stringp (car (cddr x))) (commandp (car (cdr (cddr x)))))) 'nil)) (restricted-sexp :tag "Non-selectable item (SYMBOL NAME) or (SYMBOL menu-item NAME nil . KEYWORDS)" :match-alternatives ((lambda (x) (and (consp x) (symbolp (car x)) (or (and (stringp (cadr x)) (null (caddr x))) (and (eq 'menu-item (cadr x)) (stringp (car (cddr x))) (null (car (cdr (cddr x)))))))) 'nil)))) :group 'Icicles-Completions-Display) (when (fboundp 'text-scale-decrease) ; Emacs 23+ (defcustom icicle-Completions-text-scale-decrease 0.75 "*Initial height decrease for text in buffer `*Completions*'. A value of 0.0 means the height is not decreased at all. This is used as the argument to function `text-scale-decrease'. If you use library Do Re Mi (library `doremi.el') then you can use `C-x -' to incrementally resize the text during completion. If you use `doremi.el' then you can also use multi-command `icicle-increment-option' anytime to change the option value incrementally. See also options `icicle-candidate-width-factor' and `icicle-inter-candidates-min-spaces'." :type 'number :group 'Icicles-Completions-Display)) (defcustom icicle-Completions-window-max-height 30 "*Maximum height of `*Completions*' window, in lines. The window is fit to the buffer size, with this as maximum height. Not used if `*Completions*' is a special buffer with its own frame. Not used in Emacs releases prior to 21. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Completions-Display) (defcustom icicle-customize-save-flag t "*Non-nil means save some updated Icicles options when you quit Emacs. That is, add some functions to `kill-emacs-hook' that call `customize-save-variable'. Currently, this includes only function `icicle-command-abbrev-save', which saves updated option `icicle-command-abbrev-alist'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Minibuffer-Display) (defcustom icicle-customize-save-variable-function 'customize-save-variable "*Function used to save user option changes. I RECOMMEND that you do NOT change this. The option value is a function that has the same signature as `customize-save-variable' (perhaps with additional arguments after VAR and VAL, the variable to save and its new value. If you do not want changes that Icicles commands make to certain user options to be saved automatically, you can set this to the function \(symbol) `ignore'. If you want to use your own function to somehow save the current value, you can set this to your function." :type 'function :group 'Icicles-Miscellaneous) (defcustom icicle-default-in-prompt-format-function (lambda (default) (format " (%s)" default)) "*Function that formats the default value to include in the prompt. The function must accept the default value (a string) as its (first) argument and return a string, which is prepended to the first occurrence of `: ' in the prompt. This option has no effect unless `icicle-default-value' is t." :group 'Icicles-Miscellaneous :type 'function) (defcustom icicle-default-cycling-mode 'prefix "*Default completion mode for per-mode cycling. When you hit a completion key (`TAB' or `S-TAB'), it sets the current completion mode (prefix or apropos, respectively). That determines the kind of completion to be used by the per-mode cycling keys. This option controls which completion mode to use if you cycle using a per-mode key (e.g. `down') *before* hitting a completion key. - `prefix' means cycle prefix completions - `apropos' means cycle apropos completions - Any other non-nil value means cycle inputs from the input history - nil means do not cycle - you must first hit a completion key The per-mode cycling keys are the values of `icicle-modal-cycle-up-keys' (backward) and `icicle-modal-cycle-down-keys' (forward). By default, these are keys `up' and `down' as well as the mouse wheel. For example, if the value is `prefix' (the default) then you can immediately cycle prefix completions using `up', `down', or the mouse wheel, without first hitting `TAB'. Once you have used `TAB' or `S-TAB', the only way to traverse the history is using `M-p' and `M-n' (they always traverse the history). This option affects only cycling with the per-mode keys. You can always use the mode-specific cycling keys instead to cycle according to a particular mode. The mode-specific keys are (by default): - `end' and `home' for prefix completion - `next' and `prior' for apropos completion \(By default there is no conflict between the cycling keys that are mode-specific and those that are per-mode. But if you customize them in such a way that you set a key to both, the mode-specific use takes priority.) After you change the value of this option, toggle Icicle mode off, then on again, for the change to take effect in the same session." :type '(choice (const :tag "Prefix cycling for per-mode keys, by default" prefix) (const :tag "Apropos cycling for per-mode keys, by default" apropos) (const :tag "No per-mode cycling - invoke completion first (`TAB', `S-TAB')" nil) (other :tag "History cycling for per-mode keys, by default" t)) :group 'Icicles-Key-Bindings) (defcustom icicle-default-thing-insertion 'alternatives "*Behavior of successive `\\\\[icicle-insert-string-at-point]'. If `alternatives', then the next function in the `car' of `icicle-thing-at-point-functions' is used to retrieve the text to be inserted. If `more-of-the-same', then the function that is the `cdr' of `icicle-thing-at-point-functions' is used to retrieve the text to be inserted." :type `(choice (const :tag ,(substitute-command-keys "Successive calls to `\\\ \\[icicle-insert-string-at-point]' use different text-grabbing functions.") alternatives) (const :tag ,(substitute-command-keys "Successive calls to `\\\ \\[icicle-insert-string-at-point]' grab more text at point.") more-of-the-same)) :group 'Icicles-Key-Bindings) ;; We don't use `define-obsolete-variable-alias' so that byte-compilation in older Emacs ;; works for newer Emacs too. (when (fboundp 'defvaralias) ; Emacs 22+ (defvaralias 'icicle-init-value-flag 'icicle-default-value) (make-obsolete-variable 'icicle-init-value-flag 'icicle-default-value "2008-04-18")) (defcustom icicle-default-value t "*How to treat the default value when reading minibuffer input. These are the possible option values: nil - Do not insert default value or add it to prompt. t - Add default value to `completing-read' prompt. Do not insert it. `insert-start' - Insert default value and leave cursor at start. `insert-end' - Insert default value and leave cursor at end. `preselect-start' - Insert and preselect default value; leave cursor at beginning. `preselect-end' - Insert and preselect default value; leave cursor at end. This option controls how a non-nil default-value argument to functions such as `completing-read', `read-file-name', `read-from-minibuffer', and `read-string' is handled. When it is non-nil and the initial-input argument is nil or \"\", the default value can be inserted into the minibuffer as the initial input. For `completing-read', if the option value is `t' then the default value is added the prompt as a hint. Adding the default value to the prompt corresponds to the more or less conventional behavior of vanilla Emacs. But vanilla Emacs does not do this systematically for `completing-read' (or for any of the input-reading functions). Instead, it hard-codes default values into prompts in the commands that call these functions. By design, Icicles commands never add the default value to the prompt themselves. This includes Icicles versions of standard commands that might do so. Icicles instead tries to give you the choice, using option `icicle-default-value'. Function `completing-read' is the only input-reading function for which Icicles adds the default value to the prompt (for option value `t'). Other such functions, like `(icicle-)read-from-minibuffer' and `(icicle-)read-file-name', treat empty input (just `RET') specially - see their doc for details. Inserting the default value in the minibuffer as the initial input has the advantage of not requiring you to use `M-n' to retrieve it. It has the disadvantage of making you use `M-p' (or do something else) to get rid of the default value in the minibuffer if you do not want to use or edit it. If you often want to use or edit the default value, then set `icicle-default-value' to non-nil and non-t. If you rarely do so, then set it to nil or t. If the default value is inserted in the minibuffer, the value of this option also determines whether or not the inserted text is preselected, and where the cursor is left: at the beginning or end of the text. Preselection can be useful in Delete Selection mode or PC Selection mode. It makes it easy to replace the value by typing characters, or delete it by hitting `C-d' or `DEL' (backspace). However, all of the initial input is lost if you type or hit `C-d' or `DEL'. That is inconvenient if you want to keep most of it and edit it only slightly. My own preference for the option value is `insert-end', but the default value is `t', which is closest to what vanilla Emacs does." :type '(choice (const :tag "Do not insert default value or add it to prompt" nil) (const :tag "Add default value to prompt (do not insert in minibuffer)" t) (const :tag "Insert default value. Leave cursor at beginning" insert-start) (const :tag "Insert default value. Leave cursor at end" insert-end) (const :tag "Insert default value, select it, leave cursor at beginning" preselect-start) (const :tag "Insert default value, select it, leave cursor at end" preselect-end)) :group 'Icicles-Miscellaneous) (defcustom icicle-define-alias-commands-flag t "*Non-nil means define some commands that do not begin with `icicle-'. For convenience, a few top-level commands are defined, typically as aliases for commands with longer names. For example, command `toggle' is defined as an alias for command `icicle-toggle-option'. In any case, no such command is ever defined by Icicles if a function with the same name is already defined. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-deletion-action-flag t "*Non-nil means `S-delete' during completion deletes the current object. More precisely, it deletes the object named by the current completion candidate, if a deletion action is defined for the current command. If no deletion action is defined, then the value of this option has no effect. If you are worried about inadvertently deleting an object by accidentally hitting `S-delete', you can customize this to nil to inhibit `S-delete' object deletion during completion. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-dot-show-regexp-flag nil "*Non-nil means show `icicle-anychar-regexp' explicitly for `.'. Otherwise, display it as a highlighted `.' only. This has no effect for Emacs versions prior to 21: acts as if non-nil. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching :group 'Icicles-Minibuffer-Display) (defcustom icicle-dot-string "." "*String inserted by `icicle-insert-dot-command'. It is either \".\" or the value of `icicle-anychar-regexp'. You can toggle this at any time using command `icicle-toggle-dot', bound to \\`\\[icicle-toggle-dot]' during completion." :set (lambda (sym defs) (custom-set-default sym defs) (setq icicle-dot-string-internal icicle-dot-string)) :type `(choice (const :tag "Match any char EXCEPT newline" ".") (const :tag "Match any char, including NEWLINE" ,icicle-anychar-regexp)) :group 'Icicles-Matching :group 'Icicles-Minibuffer-Display) (defcustom icicle-expand-input-to-common-match 4 ; Cycle with `C-M-"'. "*Expansion of your minibuffer input to the longest common match. The expansion replaces your input in the minibuffer. See the Icicles doc, section `Expanded-Common-Match Completion' for information about what is meant by the \"longest\" common match. This option controls when such expansion occurs. You can cycle among the possible values using \\\ `\\[icicle-cycle-expand-to-common-match]' in the minibuffer. 0 Do not expand your input, except when you use `C-M-TAB' or `C-M-S-TAB', which does not display `*Completions*'. 1 Do not expand your input automatically, during incremental completion. Expand it only when you use `TAB' or `S-TAB'. 2 Expand your input when you use `TAB' or `S-TAB'. Expand it also automatically whenever only one candidate matches it. 3 Expand your input when you use `TAB' or `S-TAB'. Expand it also whenever only one candidate matches it. Expand it also automatically, during incremental prefix completion. 4 Expand your input always, including for incremental completion. If you want to return to your original, unexpanded input, use \\\ `\\[icicle-retrieve-previous-input]'. For apropos completion, your input is, in general, a regexp. Setting the value to `never', `explicit', or `nil' lets you always work with a regexp in the minibuffer for apropos completion - your regexp is never replaced by the expanded common match. If you want to just toggle between the current value of this option and one of the other values, then see also option `icicle-expand-input-to-common-match-alt'. You can toggle between the values of these two options using \\\ `\\[icicle-toggle-expand-to-common-match]' in the minibuffer." :type '(choice (const :tag "Never expand (except for `C-M-TAB' and `C-M-S-TAB')" 0) (const :tag "No auto-expansion. Expand only for explicit completion" 1) (const :tag "Auto-expand when only one matching completion" 2) (const :tag "Auto-expand for prefix completion or when only one match" 3) (const :tag "Auto-expand always: both prefix and apropos completion" 4)) :group 'Icicles-Matching) (defcustom icicle-expand-input-to-common-match-alt 3 ; Toggle with `C-"'. "*Other value for toggling `icicle-expand-input-to-common-match'. The values of the two options should be different. The value choices are the same. You can use \\\ `\\[icicle-toggle-expand-to-common-match]' to toggle between the two values." :type '(choice (const :tag "Never expand (except for `C-M-TAB' and `C-M-S-TAB')" 0) (const :tag "No auto-expansion. Expand only for explicit completion" 1) (const :tag "Auto-expand when only one matching completion" 2) (const :tag "Auto-expand for prefix completion or when only one match" 3) (const :tag "Auto-expand always: both prefix and apropos completion" 4)) :group 'Icicles-Matching) (defcustom icicle-file-extras nil "*List of additional file-name candidates added to the normal list. List elements are strings." :type '(repeat string) :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-find-file-of-content-skip-hook nil "*Hook run by `icicle-find-file-of-content' on each matching file name. Also run by `icicle-buffer' on the names of files that are included from the set of recent files or from the Emacs file cache. If any function returns non-nil then the file content is not searched. Use this to skip visiting and trying to search non-text files, such as PDFs and images, or files that might be time-consuming to access, such as compressed files." :type 'hook :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-file-match-regexp nil "*nil or a regexp that file-name completion candidates must match. If nil, then this does nothing. If a regexp, then show only candidates that match it (and match the user input). See also `icicle-file-no-match-regexp'." :type '(choice (const :tag "None" nil) regexp) :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-file-no-match-regexp nil "*nil or a regexp that file-name completion candidates must not match. If nil, then this does nothing. If a regexp, then show only candidates that do not match it. See also `icicle-file-match-regexp'." :type '(choice (const :tag "None" nil) regexp) :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-file-predicate nil "*nil or a predicate that file-name candidates must satisfy. If nil, then this does nothing. Otherwise, this is a function of one argument, a candidate, and only candidates that satisfy the predicate are displayed. For example, this value will show only names of files with more than 5000 bytes: (lambda (file) (and (numberp (nth 7 (file-attributes file))) (> (nth 7 (file-attributes file)) 5000))) This predicate is applied after matching against user input. It thus corresponds to `icicle-must-pass-after-match-predicate', not to `icicle-must-pass-predicate'." :type '(choice (const :tag "None" nil) function) :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-file-require-match-flag nil "*Override `icicle-require-match-flag' for file-name completion. The possible values are as follows: - nil means this option imposes nothing on completion; the REQUIRE-MATCH argument provided to the function governs behavior - `no-match-required' means the same as a nil value for REQUIRE-MATCH - `partial-match-ok' means the same as a t value for REQUIRE-MATCH - `full-match-required' means the same as a non-nil, non-t value for REQUIRE-MATCH Note: This option is provided mainly for use (binding) in `icicle-define-command' and `icicle-define-file-command'. You probably do not want to set this globally, but you can." :type '(choice (const :tag "Do not impose any match behavior" nil) (const :tag "Do not require a match" no-match-required) (const :tag "Require a partial match, with RET" partial-match-ok) (const :tag "Require a full match" full-match-required)) :group 'Icicles-Files :group 'Icicles-Matching) (defcustom icicle-file-sort nil "*A sort function for file names, or nil. Examples of sort functions are `icicle-dirs-last-p', `icicle-last-accessed-first-p', and `icicle-last-modified-first-p'. If nil, then file names are not sorted." :type '(choice (const :tag "None" nil) function) :group 'Icicles-Files :group 'Icicles-Completions-Display) (defcustom icicle-files-ido-like-flag nil "*t means `icicle-file' and similar commands act more Ido-like. Specifically, those commands then bind these options to t: `icicle-show-Completions-initially-flag' `icicle-top-level-when-sole-completion-flag' `icicle-default-value' This option has no effect for Emacs 20. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Files :group 'Icicles-Completions-Display :group 'Icicles-Matching) (defcustom icicle-filesets-as-saved-completion-sets-flag t "*Non-nil means you can use filesets to save candidates persistently. This means that you can save file-name candidates in a persistent Icicles saved completion set (cache file) or in in an Emacs fileset. It also means that an Icicles persistent completion set can contain filesets, in addition to file names: any number of filesets, and filesets of different type. Available only for Emacs 22 and later, and you must load library `filesets.el'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-functions-to-redefine `(bbdb-complete-name ; For older BBDB versions such as 2.35 bbdb-complete-mail ; For BBDB versions such as 3.02 ,@(if (> emacs-major-version 23) '(comint-completion-at-point) '(comint-dynamic-complete)) comint-dynamic-complete-filename comint-replace-by-expanded-filename ;; Use these two if you want Icicles completion for shell commands. ;; See http://www.emacswiki.org/Icicles_-_Shell-Command_Enhancements. ;; dired-read-shell-command ;; read-shell-command ess-complete-object-name gud-gdb-complete-command Info-goto-node Info-index Info-menu lisp-complete-symbol lisp-completion-at-point minibuffer-default-add-completions read-char-by-name read-color read-from-minibuffer read-string recentf-make-menu-items) "*List of symbols representing functions to be redefined in Icicle mode. In Icicle mode, each such FUNCTION is aliased to Icicles function `icicle-FUNCTION'. The original functions are restored when you exit Icicle mode, by aliasing each FUNCTION to `icicle-ORIG-FUNCTION', that is, using the prefix `icicle-ORIG-' instead of `icicle-'. Aliasing takes place only if `icicle-ORIG-FUNCTION' is defined. Icicles predefines each `icicle-ORIG-FUNCTION' found in the default value, as well as each corresponding `icicle-FUNCTION' . If you add additional functions of your own choosing, then you will also need to define `icicle-ORIG-FUNCTION' and `icicle-FUNCTION' accordingly - see the Icicles code for examples. If you customize this option, then you must exit and re-enter Icicle mode to ensure that the change takes effect. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode. See also option `icicle-top-level-key-bindings'." :type '(repeat (restricted-sexp :tag "Command" ;; Use `symbolp' instead of `functionp' or `fboundp', in case the library ;; defining the function is not loaded. :match-alternatives (symbolp) :value ignore)) :set (lambda (sym defs) (custom-set-default sym defs) (when (boundp 'icicle-mode-map) ; Avoid error on initialization. (icicle-redefine-standard-functions))) :initialize #'custom-initialize-default :group 'Icicles-Miscellaneous) (defcustom icicle-guess-commands-in-path nil "*Non-nil means all shell commands are available for completion. This is used in Icicle mode whenever a shell-command is read. If non-nil, then all executable files (or all files, if option `shell-completion-execonly' is nil) in your search path are included among the completion candidates, in addition to any commands that are guessed as being appropriate for the target files (e.g. marked files in Dired). If non-nil and if option `icicle-shell-command-candidates-cache' is nil, then the list of commands is computed once and cached as the value of `icicle-shell-command-candidates-cache'. The particular non-nil value of `icicle-guess-commands-in-path' determines when the cache is filled, as follows: - If the value is `load', then the cache is filled when Icicles is first loaded, and it is saved persistently. - If the value is `first-use', then the cache is filled when you first complete a shell command, and the computed list is not saved persistently. If the value is not `load', then whenever you enter Icicle mode the cache is emptied. If your environment changes and you want to update the cached list, you can use command `icicle-recompute-shell-command-candidates'. With a prefix argument, that command also saves the cache persistently." :type '(choice (const :tag "Do not add shell commands from search path" nil) (const :tag "Compute shell commands from path when Icicles is loaded" load) (const :tag "Compute shell commands from path upon first use" first-use)) :group 'Icicles-Miscellaneous) (defcustom icicle-help-in-mode-line-delay 5 "*Seconds to show help in the mode-line for individual completions. If buffer `*Completions*' is displayed, then use its mode-line. Otherwise, use the mode-line of the current buffer. The help is shown when you cycle among completion candidates and when your input is completed (entirely) to a candidate. Face `icicle-mode-line-help' is used for the help. A value of zero means do not show such help at all. In any case, a user event (e.g. a key press) always interrupts this display. Note that `post-command-hook' actions do not take place until this display is finished. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'number :group 'Icicles-Completions-Display :group 'Icicles-Miscellaneous) (defcustom icicle-hide-common-match-in-Completions-flag nil "*Non-nil means hide the common match for your input, in `*Completions*'. The common match used here is governed by option `icicle-expand-input-to-common-match'. It is elided using ellipsis (`...'). You can toggle this option during completion using `C-x .' (no prefix arg). You can also use multi-command `icicle-toggle-option' anytime to toggle the option. See also option `icicle-hide-non-matching-lines-flag'." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-hide-non-matching-lines-flag nil "*Non-nil means hide search candidate lines that do not match input. This applies only to multi-line candidates in buffer `*Completions*'. Lines that do not contain text matched by your current minibuffer input are elided using ellipsis (`...'). You can toggle this option during completion using `C-u C-x .'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option. See also option `icicle-hide-common-match-in-Completions-flag'." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-highlight-historical-candidates-flag t ; Toggle with `C-pause'. "*Non-nil means highlight `*Completions*' candidates that have been used. This is done using face `icicle-historical-candidate'. Historical candidates are those that you have entered (using `RET' or `S-RET') previously. You can toggle this option from the minibuffer at any time using `C-pause'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-highlight-input-completion-failure 'implicit-strict "*Non-nil means highlight the part of your input that does not complete. This is done using face `icicle-input-completion-fail' or `icicle-input-completion-fail-lax'. You can use `\\\\[icicle-goto/kill-failed-input]' \ to go to the start of the highlighted part. Repeat to kill it. This highlighting can have a negative impact on performance, because it can mean recomputing completion candidates multiple times, in order to determine the longest part that completes. For this reason, you can fine tune when you want this highlighting to occur. The values of this option and options `icicle-highlight-input-completion-failure-delay' and `icicle-highlight-input-completion-failure-threshold' determine when the highlighting can take place. In particular, highlighting the non-matching part of remote file names can be slow. Two values of this option allow remote file name highlighting: `always' and `explicit-remote'. The other values do not highlight remote file names. You probably do not want to use a value of `always'. If the value is nil, then highlighting never occurs. If the value is `explicit-strict', `explicit', or `explicit-remote', then highlighting occurs only upon demand: when you hit `TAB' or `S-TAB' to request completion. If the value is `implicit-strict', `implicit', or `always', then highlighting occurs also when you update your input during incremental completion. If the value is `implicit-strict' or `implicit', then highlighting occurs not only upon demand but also during incremental completion if `icicle-incremental-completion' is non-nil. Remember that you can cycle incremental completion, using `C-#' in the minibuffer. I use a value of `implicit' myself, but the default value is `implicit-strict' because, depending on your setup and use cases, `implicit' can impact performance for file-name completion (which is lax, not strict). I suggest you try `implicit' to see - this feature is especially useful for file names. Summary of choices for when to highlight: nil Never `explicit-strict' When you hit `TAB'/`S-TAB' for strict completion `explicit' When you hit `TAB'/`S-TAB' `explicit-remote' When you hit `TAB'/`S-TAB', including remote files `implicit-strict' During strict completion `implicit' During lax or strict completion `always' Always, even for names of remote files After highlighting, you can use `C-M-l' to move the cursor to the start of the mismatch, for editing there. You can use a second `C-M-l' to kill (delete) the mismatch up to the next input line (if any). You can repeat `C-M-l' to kill additional input lines. See also: * `icicle-highlight-input-completion-failure-delay' * `icicle-highlight-input-completion-failure-threshold'" :type '(choice (const :tag "Never" nil) (const :tag "Explicit (`TAB'/`S-TAB') strict completion" explicit-strict) (const :tag "Explicit (`TAB'/`S-TAB') lax and strict completion" explicit) (const :tag "Explicit completion, even of remote file names" explicit-remote) (const :tag "Strict completion" implicit-strict) (const :tag "Lax and strict completion" implicit) (const :tag "Always (including for remote file names)" always)) :group 'Icicles-Minibuffer-Display) (defcustom icicle-highlight-input-completion-failure-delay 0.7 "*Seconds to wait before highlighting non-completing part of your input. Zero means there is no wait. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'number :group 'Icicles-Minibuffer-Display) (defcustom icicle-highlight-input-completion-failure-threshold 1000 "*More candidates means do not highlight non-completing part of input. See also `icicle-highlight-input-completion-failure'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Minibuffer-Display) (defcustom icicle-highlight-input-initial-whitespace-flag t "*Non-nil means highlight initial whitespace in your input. This is done using face `icicle-whitespace-highlight'. Purpose: Otherwise, you might not notice that you accidentally typed some whitespace at the beginning of your input, so you might not understand the set of matching candidates (or lack thereof). Note: Highlighting input completion failure (see option `icicle-highlight-input-completion-failure') subsumes initial-whitespace highlighting. This means that if no completion candidate starts with whitespace, and if Icicles is highlighting input completion failure, then only that highlighting is shown. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Minibuffer-Display) (defcustom icicle-highlight-lighter-flag t "*Non-nil means highlight the `Icy' mode-line lighter during completion. See the Icicles doc, section `Nutshell View of Icicles', subsection `Completion Status Indicators' for more information. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-highlight-saved-candidates-flag t ; Toggle with `S-pause'. "*Non-nil means highlight `*Completions*' candidates that have been saved. This is done using face `icicle-saved-candidate'. You save candidates using, for example, `C-M->'. You can toggle this option from the minibuffer at any time using `S-pause'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-ignore-comments-flag t "*Non-nil means `icicle-with-comments-hidden' hides comments. You can toggle this option using `C-M-;' in the minibuffer, but to see the effect you might need to invoke the current command again. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-ignored-directories (and (boundp 'vc-directory-exclusion-list) vc-directory-exclusion-list) "*Directories ignored by `icicle-locate-file'." :type '(repeat string) :group 'Icicles-Files) ;; Do not check here whether (if (fboundp 'display-graphic-p) (display-graphic-p) window-system). ;; Do that only at runtime, where we display the thumbnails. (defcustom icicle-image-files-in-Completions (and (fboundp 'image-file-name-regexp) t) "*Non-nil means show thumbnail images for image files in `*Completions*'. This has no effect if your Emacs version does not have image support. `nil' means show only file names. `image' means show only thumbnail images. `t' means show both file names and thumbnail images. You can cycle the value during completion using `C-x t'." :type '(choice (const :tag "Both name and thumbnail" t) (const :tag "Thumbnail image only" image-only) (const :tag "File name only" nil)) :group 'Icicles-Completions-Display) (defcustom icicle-incremental-completion-delay 0.7 "*Number of seconds to wait before updating `*Completions*' incrementally. There is no wait if the number of completion candidates is less than or equal to `icicle-incremental-completion-threshold'. See also `icicle-incremental-completion'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'number :group 'Icicles-Completions-Display) (defcustom icicle-incremental-completion t ; Cycle with `C-#'. "*Non-nil means update `*Completions*' buffer incrementally as you type. nil means do not update `*Completions*' incrementally, as you type. t means do nothing if `*Completions*' is not already displayed. Non-nil and non-t means display `*Completions*' and update it. You can cycle this among the possible values using `C-#' from the minibuffer at any time. Note: Incremental completion is effectively turned off when a remote file name is read, that is, whenever your file-name input matches a remote-file syntax. See also `icicle-incremental-completion-delay' and `icicle-incremental-completion-threshold'." :type '(choice (const :tag "Do not update `*Completions*' incrementally" nil) (const :tag "Update `*Completions*' incrementally if already displayed" t) (other :tag "Update `*Completions*' incrementally always" always)) :group 'Icicles-Completions-Display) (defcustom icicle-incremental-completion-threshold 1000 "*More candidates means apply `icicle-incremental-completion-delay'. See also `icicle-incremental-completion' and `icicle-incremental-completion-delay'. This threshold is also used to decide when to display the message \"Displaying completion candidates...\". If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Completions-Display) (when (> emacs-major-version 21) (defcustom icicle-Info-visited-max-candidates 10 "*Max number of Info index-entry candidates for visited highlighting. This is used for command `icicle-Info-index'. If there are more than this many candidates matching your current index-topic input, then no attempt is made to higlight specially those that refer to nodes you have visited. Otherwise, they are highlighted using face `icicle-historical-candidate-other'. Be aware that this highlighting can be costly, especially for large values of the option. If you use `doremi.el' then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally. To turn the highlighting off, set the value to 0 or set option `icicle-highlight-historical-candidates-flag' to nil. You can toggle that option from the minibuffer anytime using `C-pause'." :type 'integer :group 'Icicles-Completions-Display :group 'Icicles-Matching)) (defcustom icicle-inhibit-advice-functions `(choose-completion choose-completion-string completing-read completion-setup-function ,@(and (not (fboundp 'read-shell-command)) '(dired-smart-shell-command)) ; Emacs < 23 display-completion-list exit-minibuffer face-valid-attribute-values minibuffer-complete-and-exit mouse-choose-completion next-history-element read-face-name read-file-name ,@(and (fboundp 'read-number) '(read-number)) ; Emacs 22+ ,@(and (not (fboundp 'read-shell-command)) '(shell-command shell-command-on-region)) ; Emacs < 23 switch-to-completions completing-read-multiple) "*Functions that Icicles redefines, and for which advice is deactivated. Icicle mode deactivates all advice for such functions. The advice is reactivated when you leave Icicle mode." :type '(repeat (function :tag "Function for which Icicles deactivates advice")) :group 'Icicles-Miscellaneous) (defcustom icicle-inhibit-ding-flag nil "*Non-nil means Icicles never uses an audible bell (ding). If nil, Icicles sometimes signals you with a sound. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-input-string ".*" "*String to insert in minibuffer via `\\\ \\[icicle-insert-string-from-variable]'. Typically, this is a regexp or a portion of a regexp." :type 'string :group 'Icicles-Miscellaneous) (when (fboundp 'defvaralias) ; Emacs 22+ (defvaralias 'icicle-key-descriptions-use-angle-brackets-flag 'icicle-key-descriptions-use-<>-flag)) (defcustom icicle-inter-candidates-min-spaces 1 "*Min number of spaces between candidates displayed in `*Completions*'. If you use Do Re Mi (library `doremi.el'), then you can modify this option incrementally during completion, seeing the effect as it changes. Use `\\\ \\[icicle-doremi-inter-candidates-min-spaces+]' from the minibuffer, then use the `up' and `down' arrow keys or the mouse wheel to increment and decrement the value. WYSIWYG. If you use `doremi.el' then you can also use multi-command `icicle-increment-option' anytime to change the option value incrementally. See also option `icicle-candidate-width-factor' and (starting with Emacs 23) option `icicle-Completions-text-scale-decrease'." :type 'integer :group 'Icicles-Completions-Display) (defcustom icicle-isearch-complete-keys '([C-M-tab] ; `M-TAB', `C-M-TAB' [(control meta ?i)] [M-tab] ; Replace vanilla. [escape tab]) "*Key sequences to use for `icicle-isearch-complete'. A list of values that each has the same form as a key-sequence argument to `define-key'. The default value includes `M-TAB', which replaces the vanilla binding of `isearch-complete'. It also includes `ESC TAB' and `C-M-TAB', because some operating systems intercept `M-TAB' for their own use. (Note: For MS Windows, you can use (w32-register-hot-key [M-tab]) to allow Emacs to use `M-TAB'.)" :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-isearch-history-insert-keys '([(meta ?o)]) ; `M-o', like Icicles minibuffer "*Key sequences to use for `icicle-isearch-history-insert'. A list of values that each has the same form as a key-sequence argument to `define-key'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-key-complete-keys (if (> emacs-major-version 23) ; `S-TAB' '([backtab]) '([S-tab] [S-iso-lefttab])) ;; In Emacs 22 and later, `backtab' is the canonical key that represents both `S-tab' and ;; `S-iso-lefttab', so that is used in the default value. If, for some reason, `backtab' is not being ;; translated to `S-tab' and `S-iso-lefttab' on your platform, you might want to customize the value ;; to ([S-tab] [S-iso-lefttab]). And if your Emacs version is 22 or later, please file an Emacs bug ;; about the lack of translation. ;; The reason that the default value here is not just ([backtab]) for Emacs < 24 is that some Emacs ;; libraries, such as `info.el', explicitly bind both `backtab' and `S-tab'. I filed Emacs bug #1281, ;; which took care of this for Emacs 24+. "*Key sequences to use for `icicle-complete-keys'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards - for example, `S-tab' and `S-iso-lefttab'." :type '(repeat sexp) :group 'Icicles-Key-Completion :group 'Icicles-Key-Bindings) (defcustom icicle-key-complete-keys-for-minibuffer '([M-backtab]) ; `M-S-TAB' "*Key sequences to use for `icicle-complete-keys' in the minibuffer. A list of values that each has the same form as a key-sequence argument to `define-key'. Note: Some operating systems intercept `M-S-TAB' for their own use. For MS Windows, you can use (w32-register-hot-key [M-S-tab]) to allow Emacs to use `M-S-TAB'." :type '(repeat sexp) :group 'Icicles-Key-Completion :group 'Icicles-Key-Bindings) (defcustom icicle-key-descriptions-use-<>-flag nil "*Non-nil means Icicles key descriptions use angle brackets (<>). For example, non-nil gives `'; nil gives `mode-line'. This does not affect Emacs key descriptions outside of Icicles. This has no effect for versions of Emacs prior to 21, because they never use angle brackets. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Completion :group 'Icicles-Minibuffer-Display) (defcustom icicle-keymaps-for-key-completion '(bookmark-bmenu-mode-map bmkp-jump-map bmkp-jump-other-window-map calendar-mode-map dired-mode-map facemenu-keymap jde-mode-map jde-jdb-mode-map senator-mode-map srecode-mode-map synonyms-mode-map vc-dired-mode-map) "*List of keymaps in which to bind `S-TAB' to `icicle-complete-keys'. List elements are symbols that are bound to keymaps. Each keymap should have at least one prefix key. `S-TAB' is bound in each keymap, so that you can use it to complete the prefix keys. If one of the keymaps is not defined when Icicle mode is entered, then it is ignored. If you later define it, then just exit and reenter Icicle mode, to bind `S-TAB' in the newly defined map. For example, use `M-x icy-mode' twice after entering Calendar mode, to be able to complete `calendar-mode' prefix keys such as `A'. Do not add `global-map' or any keymaps, such as `ctl-x-map', that are accessible from the global keymap to the list - they are already treated, by default. Do not add any of the translation keymaps, `function-key-map', `key-translation-map', or `iso-transl-ctl-x-8-map' to the list - that will not work." :type '(repeat symbol) :group 'Icicles-Key-Completion :group 'Icicles-Key-Bindings) (defcustom icicle-kill-visited-buffers-flag t "*Non-nil means kill buffers visited temporarily to search files. This applies to commands such as `icicle-find-file-of-content', which search files that match your completion input. If non-nil then any such buffers for files that you do not actually choose are killed when the command is finished. If nil then they are not killed." :type 'boolean :group 'Icicles-Buffers :group 'Icicles-Files :group 'Icicles-Matching) (when (boundp 'kmacro-ring) ; Emacs 22+ (defcustom icicle-kmacro-ring-max (if (boundp 'most-positive-fixnum) most-positive-fixnum 67108863) ; 1/2 of `most-positive-fixnum' on Windows. "*Icicles version of `kmacro-ring-max'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Miscellaneous)) (defcustom icicle-levenshtein-distance 1 "*Levenshtein distance allowed for strings to be considered as matching. Icicles matching function `icicle-levenshtein-match' considers a string to match another if the first string is within this distance of some substring of the second. This option is used only if you have library `levenshtein.el'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Matching) ;;; $$$$$$ ;;; (defcustom icicle-list-end-string " ;;; " ;;; "*String appended to a completion candidate that is a list of strings. ;;; When a completion candidate is a list of strings, they are joined ;;; pairwise using `icicle-list-join-string', and `icicle-list-end-string' ;;; is appended to the joined strings. The result is what is displayed as ;;; a completion candidate in buffer `*Completions*', and that is what is ;;; matched by your minibuffer input. ;;; The purpose of `icicle-list-end-string' is to allow some separation ;;; between the displayed completion candidates. Candidates that are ;;; provided to input-reading functions such as `completing-read' as lists ;;; of strings are often displayed using multiple lines of text. If ;;; `icicle-list-end-string' is \"\", then the candidates appear run ;;; together, with no visual separation. ;;; It is important to remember that `icicle-list-end-string' is part of ;;; each completion candidate in such circumstances. This matters if you ;;; use a regexp that ends in `$', matching the end of the candidate." ;;; :type 'string :group 'Icicles-Completions-Display) ;; Note: If your copy of this file does not have the two-character string "^G^J" ;; (Control-G, Control-J) or, equivalently, \007\012, as the default value, you will want ;; to change the file to have that. To insert these control characters in the file, use ;; `C-q'. Emacs Wiki loses the ^G from the file, so I use \007, which works OK. ;; (defcustom icicle-list-join-string (let ((strg (copy-sequence "\007\012"))) ;; Emacs 20 ignores `display', so don't bother. ;; Emacs 21 has a big bug, which interprets `display' badly. (when (> emacs-major-version 21) ; Avoid Emacs 21 bug. (set-text-properties 0 (length strg) '(display "\n") strg)) strg) "*String joining items in a completion that is a list of strings. When a completion candidate is a list of strings, this string is used to join the strings in the list, for display and matching purposes. When completing input, you type regexps that match the strings, separating them pairwise by the value of `icicle-list-join-string'. Actually, what you enter is interpreted as a single regexp to be matched against the joined strings. Typically, the candidate list contains two strings: a name and its doc string. A good value for this option is a string that: 1) does not normally occur in doc strings, 2) visually separates the two strings it joins, and 3) is not too difficult or too long to type. The default value is \"^G\^J\", that is, control-g followed by control-j (newline): 1) ^G does not normally occur in doc strings 2) a newline visually separates the multiple component strings, which helps readability in buffer `*Completions*' 3) you can type the value using `C-q C-g C-q C-j'. For readability (in Emacs 22 and later), the default value has a `display' property that makes it appear as simply a newline in `*Completions*' - the `^G' is hidden. you can also make the default value appear this way in your minibuffer input also, by using \ `\\\\[icicle-insert-list-join-string].' If you like the default value of `^G^J', but you prefer that the `^G' not be hidden, then just customize this option. In Customize, use `Show initial Lisp expression' after clicking the `State' button, to be able to edit the default value. Remove the `set-text-properties' expression, which sets text property `display' to \"\"." :type 'string :group 'Icicles-Completions-Display) (defcustom icicle-list-nth-parts-join-string " " "*String joining candidate parts split by `icicle-list-use-nth-parts'. This has an effect on multi-completion candidates only, and only if the current command uses `icicle-list-use-nth-parts'." :type 'string :group 'Icicles-Completions-Display) (defcustom icicle-max-candidates nil "*Non-nil means truncate completion candidates to at most this many. If you use library `doremi.el' then you can use `C-x #' during completion to increment or decrement the option value using the vertical arrow keys or the mouse wheel. A numeric prefix argument for `C-x #' sets the increment size. A plain prefix argument (`C-u') resets `icicle-max-candidates' to nil, meaning no truncation. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "None" nil) integer) :group 'Icicles-Completions-Display :group 'Icicles-Matching :group 'Icicles-Buffers :group 'Icicles-Files) (defcustom icicle-menu-items-to-history-flag t "*Non-nil means to add menu-item commands to the command history. This history is `extended-command-history'. After you change the value of this option, toggle Icicle mode off, then on again, for the change to take effect in the same session. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) ;; Inspired from `icomplete-minibuffer-setup-hook'. (defcustom icicle-minibuffer-setup-hook nil "*Functions run at the end of minibuffer setup for Icicle mode." :type 'hook :group 'Icicles-Miscellaneous) (defcustom icicle-minibuffer-key-bindings `( ;;; (,(icicle-kbd "C-?") icicle-minibuffer-help t) ; `C-?' (,(icicle-kbd "M-?") icicle-minibuffer-help t) ; `M-?' (,(icicle-kbd "M-S-backspace") icicle-erase-minibuffer t) ; `M-S-backspace' (,(icicle-kbd "M-S-delete") icicle-erase-minibuffer t) ; `M-S-delete' (,(icicle-kbd "M-.") icicle-insert-string-at-point t) ; `M-.' (,(icicle-kbd "C-x C-f") icicle-resolve-file-name t) ; `C-x C-f' (,(icicle-kbd "C-=") icicle-insert-string-from-variable t) ; `C-=' (,(icicle-kbd "M-i") icicle-clear-current-history t) ; `M-i' (,(icicle-kbd "M-k") icicle-erase-minibuffer-or-history-element t) ; `M-k' (,(icicle-kbd "M-o") icicle-insert-history-element t) ; `M-o' (,(icicle-kbd "M-R") icicle-multi-inputs-act t) ; `M-R' (,(icicle-kbd "M-S") icicle-multi-inputs-save t) ; `M-S' (,(icicle-kbd "M-:") icicle-pp-eval-expression-in-minibuffer t) ; `M-:' (,(icicle-kbd "C-a") icicle-beginning-of-line+ t) ; `C-a' (,(icicle-kbd "C-e") icicle-end-of-line+ t) ; `C-e' (,(icicle-kbd "C-g") icicle-abort-recursive-edit t) ; `C-g' (,(icicle-kbd "C-M-S-t") icicle-top-level t) ; `C-M-S-t' ; ( `C-M-T') (,(icicle-kbd "C-M-v") icicle-scroll-forward t) ; `C-M-v' (,(icicle-kbd "C-M-S-v") icicle-scroll-backward t) ; `C-M-S-v' ; ( `C-M-V') (,(icicle-kbd "C-M-pause") icicle-other-history t) ; `C-M-pause' (,(icicle-kbd "C-j") icicle-insert-newline-in-minibuffer t) ; `C-j' (,(icicle-kbd "C-M-y") icicle-yank-secondary (fboundp 'icicle-yank-secondary)) ; `C-M-y' ) "*List of minibuffer commands to bind for use in Icicle mode. These bindings are available in the minibuffer regardless of whether completion is available. See `icicle-completion-key-bindings' for bindings available only during completion. The option value has the same form as that of option `icicle-top-level-key-bindings' (which see). Each list element is of custom type `icicle-key-definition' and has the form (KEY COMMAND CONDITION). If you customize this option then you must exit and re-enter Icicle mode to ensure that the change takes effect. This is really necessary only if your changes would undefine a key. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode." :type (if (> emacs-major-version 21) '(repeat icicle-key-definition) '(repeat (list (choice (restricted-sexp :tag "Key" :match-alternatives ((lambda (x) (or (stringp x) (vectorp x)))) :value [ignore]) (restricted-sexp :tag "Command to remap" ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition")))) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-down-keys ; `down', `wheel-down' (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ (list [down] (vector nil mouse-wheel-up-event) (vector mouse-wheel-up-event)) '([down])) "*Key sequences to use for modal cycling to the next candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-modal-cycle-down-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-down-action-keys ; `C-down', `C-wheel-down' (if (boundp 'mouse-wheel-up-event) ; Emacs 22+ (list [C-down] (vector nil (list 'control mouse-wheel-up-event)) (vector (list 'control mouse-wheel-up-event))) '([C-down])) "*Keys for modal completion to cycle next and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-modal-cycle-down-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-down-alt-action-keys ; `C-S-down', `C-S-wheel-down' (if (boundp 'mouse-wheel-up-event) ;Emacs22+ (list [C-S-down] (vector nil (list 'control 'shift mouse-wheel-up-event)) (vector (list 'control 'shift mouse-wheel-up-event))) '([C-S-down])) "*Keys for modal completion to cycle next and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-down-help-keys ; `C-M-down', `C-M-wheel-down' (if (boundp 'mouse-wheel-up-event) ; Emacs 22+ (list [C-M-down] (vector nil (list 'control 'meta mouse-wheel-up-event)) (vector (list 'control 'meta mouse-wheel-up-event))) '([C-M-down])) "*Keys for modal completion to cycle next and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-up-keys ; `up', `wheel-up' (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ (list [up] (vector nil mouse-wheel-down-event) (vector mouse-wheel-down-event)) '([up])) "*Key sequences to use for modal cycling to the previous candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-modal-cycle-up-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-up-action-keys ; `C-up', `C-wheel-up' (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ (list [C-up] (vector nil (list 'control mouse-wheel-down-event)) (vector (list 'control mouse-wheel-down-event))) '([C-up])) "*Keys for modal completion to cycle previous and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-modal-cycle-up-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-up-alt-action-keys ; `C-S-up', `C-S-wheel-up' (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ (list [C-S-up] (vector nil (list 'control 'shift mouse-wheel-down-event)) (vector (list 'control 'shift mouse-wheel-down-event))) '([C-S-up])) "*Keys for modal completion to cycle previous and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-modal-cycle-up-help-keys ; `C-M-up', `C-M-wheel-up' (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ (list [C-M-up] (vector nil (list 'control 'meta mouse-wheel-down-event)) (vector (list 'control 'meta mouse-wheel-down-event))) '([C-M-up])) "*Keys for modal completion to cycle previous and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-no-match-hook nil "*List of hook functions run during completion when there are no matches." :type 'hook :group 'Icicles-Miscellaneous) (defcustom icicle-option-type-prefix-arg-list '(direct inherit inherit-or-value direct-or-value inherit-or-regexp direct-or-regexp) "*Symbols controlling prefix args for `icicle-describe-option-of-type'. A list of six symbols taken from this list: direct inherit inherit-or-value direct-or-value inherit-or-regexp direct-or-regexp Choose the order you like. The list members map, in order left to right, to these prefix argument keys: `C-u C-u' `C-0' `C-u' `C-9' (positive) no prefix arg `C--' (negative) For the meanings of the symbols, see the doc string of `icicle-describe-option-of-type', which describes the default prefix-argument bindings for the command." :type '(list symbol symbol symbol symbol symbol symbol) :group 'Icicles-Key-Bindings) (defcustom icicle-network-drive-means-remote-flag t "*Non-nil means that a file on a network drive is considered remote. This pertains to an MS Windows mapped netword drive, such as `f:'. You can use `C-x :' during completion to toggle this option." :type 'boolean :group 'Icicles-Files) (when (> emacs-major-version 22) (defcustom icicle-populate-interactive-history-flag nil "*Non-nil means populate `icicle-interactive-history'. That means add commands invoked interactively to that history, for use during completion by `C-M-pause'. After you change the value of this option, toggle Icicle mode off, then on again, for the change to take effect in the same session. Be aware that this history can become quite long. Furthermore, there is an Emacs bug (#3984) that causes interactiveness tests (`interactive-p' and `called-interactively-p') to fail, whenever `call-interactively' is advised (which is how Icicles implements this feature). Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous)) (defcustom icicle-pp-eval-expression-print-length nil "*Value for `print-length' while printing value in `pp-eval-expression'. A value of nil means no limit. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "No Limit" nil) integer) :group 'Icicles-Miscellaneous) (defcustom icicle-pp-eval-expression-print-level nil "*Value for `print-level' while printing value in `pp-eval-expression'. A value of nil means no limit. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "No Limit" nil) integer) :group 'Icicles-Miscellaneous) (defcustom icicle-prefix-complete-keys '([?\t] [tab] [(control ?i)]) ; `C-i' is `TAB'. "*Key sequences to use for `icicle-prefix-complete'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-complete-no-display-keys '([C-M-tab]) ; `C-M-TAB' "*Key sequences to use for `icicle-prefix-complete-no-display'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-next-keys '([end]) ; `end' "*Key sequences for prefix completion to cycle to the next candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-prefix-cycle-next-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-next-action-keys '([C-end]) ; `C-end' "*Keys for prefix completion to cycle next and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-prefix-cycle-next-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-next-alt-action-keys '([C-S-end]) ; `C-S-end' "*Keys for prefix completion to cycle next and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-next-help-keys '([C-M-end]) ; `C-M-end' "*Keys for prefix completion to cycle next and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-previous-keys '([home]) ; `home' "*Key sequences for prefix completion to cycle to the previous candidate. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-prefix-cycle-previous-action-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-previous-action-keys '([C-home]) ; `C-home' "*Keys for prefix completion to cycle previous and perform action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Option `icicle-use-C-for-actions-flag' swaps these keys with `icicle-prefix-cycle-previous-keys'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-previous-alt-action-keys '([C-S-home]) ; `C-S-home' "*Keys for prefix completion to cycle previous and perform alt action. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-prefix-cycle-previous-help-keys '([C-M-home]) ; `C-M-home' "*Keys for prefix completion to cycle previous and show candidate help. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-quote-shell-file-name-flag t "*Non-nil means to double-quote the file name that starts a shell command. This is used by `icicle-read-shell-command-completing'. If this is nil, then Emacs commands such as `M-!' will not quote a shell-command file name such as `c:/Program Files/My Dir/mycmd.exe'. In that case, a shell such as `bash' fails for a shell command such as `c:/Program Files/My Dir/mycmd.exe arg1 arg2 &', because it interprets only `c:/Program' as the shell command. That is, it interprets the space characters in the file name as separators. If this is non-nil, then input such as `c:/Program Files/My Dir/mycmd.exe arg1 arg2 &' is passed to the shell as `\"c:/Program Files/My Dir/mycmd.exe\" arg1 arg2 &'. See the doc string of `icicle-quote-file-name-part-of-cmd' for information about the characters that, like SPC, lead to quoting. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-read+insert-file-name-keys '([(control meta shift ?f)]) ; `C-M-S-f' "*Key sequences to invoke `icicle-read+insert-file-name'. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-regexp-quote-flag nil ; Toggle with `C-`'. "*Non-nil means special characters in regexps are escaped. This means that no characters are recognized as special: they match themselves. This turns apropos completion into simple substring completion. It also turns Icicles searching into literal searching. You can toggle this option from the minibuffer at any time using `C-`'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-regexp-search-ring-max (if (boundp 'most-positive-fixnum) (/ most-positive-fixnum 10) 13421772) ; 1/10 of `most-positive-fixnum' on Windows. "*Icicles version of `regexp-search-ring-max'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Searching) ;; You can use `hexrgb-increment-value' in place of `hexrgb-increment-hue', if you prefer highlighting ;; background to be slightly darker instead of a slightly different hue. ;; (defcustom icicle-region-background (if (featurep 'hexrgb) (let* ((bg (or (and (boundp '1on1-active-minibuffer-frame-background) 1on1-active-minibuffer-frame-background) ; In `oneonone.el'. (let ((frame-bg (cdr (assq 'background-color (frame-parameters))))) (when (member frame-bg '(nil unspecified "unspecified-bg")) (setq frame-bg (if (eq (frame-parameter nil 'background-mode) 'dark) "Black" "White"))) (and frame-bg (x-color-defined-p frame-bg) frame-bg)) (face-background 'region))) (sat (condition-case nil (hexrgb-saturation bg) (error nil)))) (if sat (if (hexrgb-approx-equal sat 0.0) ;; Grayscale - change bg value slightly. (hexrgb-increment-value bg (if (eq (frame-parameter nil 'background-mode) 'dark) 0.20 -0.10)) (hexrgb-increment-hue bg 0.24)) ; Color - change bg hue slightly. (face-background 'region))) (face-background 'region)) ; Use normal region background. "*Background color to use for the region during minibuffer cycling. This has no effect if `icicle-change-region-background-flag' is nil. If you do not define this explicitly, and if you have loaded library `hexrgb.el' (recommended), then this color will be slightly different from your frame background. This still lets you notice the region, but it makes the region less conspicuous, so you can more easily read your minibuffer input." :type (if (and (require 'wid-edit nil t) (get 'color 'widget-type)) 'color 'string) :group 'Icicles-Minibuffer-Display) (defcustom icicle-require-match-flag nil "*Control REQUIRE-MATCH arg to `completing-read' and `read-file-name'. The possible values are as follows: - nil means this option imposes nothing on completion; the REQUIRE-MATCH argument provided to the function governs behavior - `no-match-required' means the same as a nil value for REQUIRE-MATCH - `partial-match-ok' means the same as a t value for REQUIRE-MATCH - `full-match-required' means the same as a non-nil, non-t value for REQUIRE-MATCH Note: This option is provided mainly for use (binding) in `icicle-define-command' and `icicle-define-file-command'. You probably do not want to set this globally, but you can." :type '(choice (const :tag "Do not impose any match behavior" nil) (const :tag "Do not require a match" no-match-required) (const :tag "Require a partial match, with RET" partial-match-ok) (const :tag "Require a full match" full-match-required)) :group 'Icicles-Matching) (defcustom icicle-saved-completion-sets nil "*Completion sets available for `icicle-candidate-set-retrieve'. The form is ((SET-NAME . CACHE-FILE-NAME)...), where SET-NAME is the name of a set of completion candidates and CACHE-FILE-NAME is the absolute name of the cache file that contains those candidates. You normally do not customize this directly, statically. Instead, you add or remove sets using commands `icicle-add/update-saved-completion-set' and `icicle-remove-saved-completion-set'." :type '(repeat (cons string file)) :group 'Icicles-Matching) (defcustom icicle-search-cleanup-flag t "*Controls whether to remove highlighting after a search. If this is nil, highlighting can be removed manually with `\\[icicle-search-highlight-cleanup]'. You can toggle this option from the minibuffer during Icicles search \(e.g., `C-c`') using `C-.'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-from-isearch-keys (if (> emacs-major-version 23) ; `S-TAB' '([backtab]) '([S-tab] [S-iso-lefttab])) ;; $$$$$ The following should be sufficient, but some Emacs 22+ libraries, such as `info.el', ;; are brain-dead and explicitly bind both `backtab' and `S-tab'. I filed Emacs bug #1281. ;; (if (> emacs-major-version 21) ;; '([backtab]) ;; '([S-tab] [S-iso-lefttab])) "*Key sequences to use to start `icicle-search' from Isearch. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards - for example, `S-tab' and `S-iso-lefttab'." ;; In Emacs 22 and later, `backtab' is the canonical key that represents ;; both `S-tab' and `S-iso-lefttab', so that is used in the default ;; value. If, for some reason, `backtab' is not being translated to ;; `S-tab' and `S-iso-lefttab' on your platform, you might want to ;; customize the value to ([S-tab] [S-iso-lefttab]). And if your Emacs ;; version is 22 or later, please file an Emacs bug about the lack of ;; translation. :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-search-highlight-all-current-flag nil ; Toggle with `C-^'. "*Non-nil means highlight input match in each context search hit. Setting this to non-nil can impact performance negatively, because the highlighting is updated with each input change. You can toggle this option from the minibuffer during Icicles search \(e.g., `C-c`') using `C-^'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-highlight-context-levels-flag t "*Non-nil means highlight 1-8 context levels, within the search context. Level highlighting is done only when this is non-nil and a subgroup is not used as the search context, that is, the context corresponds to the entire search regexp. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-highlight-threshold 100000 "*Max number of context search hits to highlight at once. If the value is `t' then there is no limit. This highlighting uses face `icicle-search-main-regexp-others'. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "Highlight all search hits (no limit)" t) (integer :tag "Max number of search hits to highlight")) :group 'Icicles-Searching) (defcustom icicle-search-hook nil "*List of functions run by `icicle-search' after you visit a search hit. See `run-hooks'." :type 'hook :group 'Icicles-Searching) (defcustom icicle-search-key-prefix "\M-s\M-s" "*Key sequence prefix for keys bound to Icicles search commands. Has the same form as a key-sequence argument to `define-key'. This same prefix key sequence, followed by `m', is used in some major modes for a mode-specific Icicles search command. E.g., if the prefix key is `M-s M-s' then `M-s M-s m' is bound in Dired mode to `icicle-search-dired-marked-recursive', which searches the marked files." :type 'sexp :group 'Icicles-Key-Bindings) (defcustom icicle-search-replace-common-match-flag t ; Toggle with `M-;'. "*Non-nil means to replace the expanded common match of your input. This has no effect if `icicle-search-highlight-all-current-flag' is nil or `icicle-expand-input-to-common-match' does not cause expansion. You can cycle those options from the minibuffer using `C-^' and `C-M-\"', respectively. You can toggle `icicle-search-replace-common-match-flag' using `M-;'. Remember that you can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-replace-literally-flag nil ; Toggle with `M-`'. "*Non-nil means to treat replacement text literally. Otherwise (nil), interpret `\\' specially in replacement text, as in the LITERAL argument to `replace-match'. You can use `M-`' to toggle this at any time during Icicles search. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-replace-whole-candidate-flag t ; Toggle with `M-_'. "*Non-nil means replacement during search replaces the entire search hit. Otherwise (nil), replace only what matches your current input. You can use `\\\\[icicle-dispatch-M-_]' to \ toggle this at any time during Icicles search. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) (defcustom icicle-search-ring-max (if (boundp 'most-positive-fixnum) (/ most-positive-fixnum 10) 13421772) ; 1/10 of `most-positive-fixnum' on Windows. "*Icicles version of `search-ring-max'. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Searching) (defcustom icicle-search-whole-word-flag nil ; Toggle with `M-q'. "*Non-nil means that `icicle-search' looks for a whole word. Whole-word searching here means that matches can contain embedded strings of non word-constituent chars (they are skipped over, when matching, included in the match), and any leading or trailing word-constituent chars in the search string are dropped (ignored for matching, not included in the match). This means, for instance, that you can match `foo-bar' as a word, even in contexts (such as Emacs Lisp) where `-' is not a word-constituent character. Similarly, you can include embedded whitespace in a \"word\", e.g., `foo bar'. You can use `M-q' to toggle this at any time during Icicles search; the new value takes effect for the next complete search. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Searching) ;; Based more or less on `shell-dynamic-complete-as-command'. ;; Must be before `icicle-shell-command-candidates-cache'. (defun icicle-compute-shell-command-candidates () "*Compute shell command candidates from search path, and return them. The candidates are the executable files in your search path or, if `shell-completion-execonly' is nil, all files in your search path." (require 'shell) ; `shell-completion-execonly' (message "Finding commands in search path...") (let* ((filenondir "") (path-dirs (cdr (reverse exec-path))) (cwd (file-name-as-directory (expand-file-name default-directory))) (ignored-extensions (and comint-completion-fignore (mapconcat (lambda (x) (concat (regexp-quote x) "$")) comint-completion-fignore "\\|"))) (dir "") (comps-in-dir ()) (file "") (abs-file-name "") (completions ())) ;; Go through each dir in the search path, finding completions. (while path-dirs (setq dir (file-name-as-directory (comint-directory (or (car path-dirs) "."))) comps-in-dir (and (file-accessible-directory-p dir) (file-name-all-completions filenondir dir))) ;; Go see whether it should be used. (while comps-in-dir (setq file (car comps-in-dir) abs-file-name (concat dir file)) (when (and (not (member file completions)) (not (and ignored-extensions (string-match ignored-extensions file))) (or (string-equal dir cwd) (not (file-directory-p abs-file-name))) (or (null shell-completion-execonly) (file-executable-p abs-file-name))) (setq completions (cons file completions))) (setq comps-in-dir (cdr comps-in-dir))) (setq path-dirs (cdr path-dirs))) completions)) (defcustom icicle-shell-command-candidates-cache (and (eq icicle-guess-commands-in-path 'load) (icicle-compute-shell-command-candidates)) "*Cache for shell command candidates. You typically do not need to customize this option. It is an option mainly to persist its value. See `icicle-guess-commands-in-path'." :type '(repeat sexp) :group 'Icicles-Miscellaneous) (defcustom icicle-show-annotations-flag t "*Non-nil means display candidate annotations in `*Completions*'. Annotations are available only in some contexts, and only for some candidates. They are highlighted using face `icicle-annotation'. You can toggle this option from the minibuffer using `\\\ \\[icicle-toggle-annotation]'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-show-Completions-help-flag t "*Non-nil means display help lines at the top of buffer `*Completions*'. A nil value means show only the completion candidates themselves. But if there are no candidates then say so in `*Completions*'. Note that vanilla Emacs option `completion-show-help' has no effect in Icicle mode. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-show-Completions-initially-flag nil "*Non-nil means to show buffer `*Completions*' even without user input. nil means that `*Completions*' is shown upon demand, via `TAB' or `S-TAB'. For an alternative but similar behavior to using non-nil for `icicle-show-Completions-initially-flag', you can set option `icicle-incremental-completion' to a value that is neither nil nor t. That displays buffer `*Completions*' as soon as you type or delete input, but not initially. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) (defcustom icicle-show-multi-completion-flag t "*Non-nil means to show completion candidates as multi-completions. This has an effect only where multi-completion is available. Also, some commands, such as `icicle-locate-file', use a prefix arg to determine whether to show multi-completions. Such commands generally ignore this option. A typical example of showing multi-completions is adding buffer names to candidates to show which buffer they are associated with. Some commands, such as `icicle-search', append the name of the associated buffer, highlighted, to the normal completion candidate. This lets you easily see which buffer the candidate applies to. Also, the buffer name is part of the candidate, so you can match against it. Note: Even when the option value is nil, you can use `C-M-mouse-2' and so on to see information about a candidate. This information typically includes whatever a non-nil value of the option would have shown. You can toggle this option from the minibuffer using `M-m'. The new value takes effect after you exit the minibuffer (i.e., for the next command). You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Completions-Display) ;; This is similar to `bmkp-sort-comparer'. (defcustom icicle-sort-comparer 'icicle-case-string-less-p ; Cycle with `C-,'. "*Predicate or predicates for sorting (comparing) two items. Used in particular to sort completion candidates. In that case, this determines the order of candidates when cycling and their order in buffer `*Completions*'. You can cycle completion sort orders at any time using `C-,' in the minibuffer. Although this is a user option, it may be changed by program locally, for use in particular contexts. In particular, you can bind this to nil in an Emacs-Lisp function, to inhibit sorting in that context. Various sorting commands change the value of this option dynamically \(but they do not save the changed value). The value must be one of the following: * nil, meaning do not sort * a predicate that takes two items as args * a list of the form ((PRED...) FINAL-PRED), where each PRED and FINAL-PRED are binary predicates If the value is a non-empty list, then each PRED is tried in turn until one returns a non-nil value. In that case, the result is the car of that value. If no non-nil value is returned by any PRED, then FINAL-PRED is used and its value is the result. Each PRED should return `(t)' for true, `(nil)' for false, or nil for undecided. A nil value means that the next PRED decides (or FINAL-PRED, if there is no next PRED). Thus, a PRED is a special kind of predicate that indicates either a boolean value (as a singleton list) or \"I cannot decide - let the next guy else decide\". (Essentially, each PRED is a hook function that is run using `run-hook-with-args-until-success'.) Examples: nil - No sorting. string-lessp - Single predicate that returns nil or non-nil. ((p1 p2)) - Two predicates `p1' and `p2', which each return (t) for true, (nil) for false, or nil for undecided. ((p1 p2) string-lessp) - Same as previous, except if both `p1' and `p2' return nil, then the return value of `string-lessp' is used. Note that these two values are generally equivalent, in terms of their effect (*): ((p1 p2)) ((p1) p2-plain) where p2-plain is (icicle-make-plain-predicate p2) Likewise, these three values generally act equivalently: ((p1)) (() p1-plain) p1-plain where p1-plain is (icicle-make-plain-predicate p1) The PRED form lets you easily combine predicates: use `p1' unless it cannot decide, in which case try `p2', and so on. The value ((p2 p1)) tries the predicates in the opposite order: first `p2', then `p1' if `p2' returns nil. Using a single predicate or FINAL-PRED makes it easy to reuse an existing predicate that returns nil or non-nil. You can also convert a PRED-type predicate (which returns (t), (nil), or nil) into an ordinary predicate, by using function `icicle-make-plain-predicate'. That lets you reuse elsewhere, as ordinary predicates, any PRED-type predicates you define. Note: As a convention, predefined Icicles PRED-type predicate names have the suffix `-cp' (for \"component predicate\") instead of `-p'." ;; We don't bother to define a `icicle-reverse-multi-sort-order' ;; analogous to `bmkp-reverse-multi-sort-order'. If we did, the doc ;; string would need to be updated to say what the doc string of ;; `bmkp-sort-comparer' says about `bmkp-reverse-multi-sort-order'. :type '(choice (const :tag "None (do not sort)" nil) (function :tag "Sorting Predicate") (list :tag "Sorting Multi-Predicate" (repeat (function :tag "Component Predicate")) (choice (const :tag "None" nil) (function :tag "Final Predicate")))) :group 'Icicles-Matching :group 'Icicles-Completions-Display) (defcustom icicle-buffer-configs `(("All" nil nil nil nil ,icicle-sort-comparer) ("Files" nil nil (lambda (bufname) (buffer-file-name (get-buffer bufname))) nil ,icicle-sort-comparer) ("Files and Scratch" nil nil (lambda (bufname) (buffer-file-name (get-buffer bufname))) ("*scratch*") ,icicle-sort-comparer) ("All, *...* Buffers Last" nil nil nil nil icicle-buffer-sort-*...*-last)) "*List of option configurations available for `icicle-buffer-config'. The form is (CONFIG...), where CONFIG is a list of these items: - Configuration name (string) - `icicle-buffer-match-regexp' value (regexp string) - `icicle-buffer-no-match-regexp' value (regexp string) - `icicle-buffer-predicate' value (function) - `icicle-buffer-extras' value (list of strings) - `icicle-buffer-sort' value (function) A configuration describes which buffer names are displayed during completion and their order." :type '(repeat (list string ; Configuration name (choice (const :tag "None" nil) (string :tag "Match regexp")) (choice (const :tag "None" nil) (string :tag "No-match regexp")) (choice (const :tag "None" nil) (function :tag "Predicate")) ; Predicate (choice (const :tag "None" nil) (repeat (string :tag "Extra buffer"))) (choice (const :tag "None" nil) (function :tag "Sort function")))) :group 'Icicles-Buffers) (defun icicle-buffer-sort-*...*-last (buf1 buf2) "Return non-nil if BUF1 is `string<' BUF2 or only BUF2 starts with \"*\"." (let ((b1 (if completion-ignore-case (downcase buf1) buf1)) (b2 (if completion-ignore-case (downcase buf2) buf2))) (if (string-match "^\\*" b1) (and (string-match "^\\*" b2) (string< b1 b2)) (or (string-match "^\\*" b2) (string< b1 b2))))) (when (> emacs-major-version 20) (defcustom icicle-sort-orders-alist () "*Alist of available sort functions. This is a pseudo option - you probably do NOT want to customize this. Instead, use macro `icicle-define-sort-command' to define a new sort function and automatically add it to this list. Each alist element has the form (SORT-ORDER . COMPARER): SORT-ORDER is a short string or symbol describing the sort order. Examples: \"by date\", \"alphabetically\", \"directories first\". COMPARER compares two items. It must be acceptable as a value of `icicle-sort-comparer'." :type '(alist :key-type (choice :tag "Sort order" string symbol) :value-type (choice (const :tag "None (do not sort)" nil) (function :tag "Sorting Predicate") (list :tag "Sorting Multi-Predicate" (repeat (function :tag "Component Predicate")) (choice (const :tag "None" nil) (function :tag "Final Predicate"))))) :group 'Icicles-Completions-Display :group 'Icicles-Matching)) (unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist. (defcustom icicle-sort-orders-alist () "*Alist of available sort functions. This is a pseudo option - you probably do NOT want to customize this. Instead, use macro `icicle-define-sort-command' to define a new sort function and automatically add it to this list. Each alist element has the form (SORT-ORDER . COMPARER): SORT-ORDER is a short string or symbol describing the sort order. Examples: \"by date\", \"alphabetically\", \"directories first\". COMPARER compares two items. It must be acceptable as a value of `icicle-sort-comparer'." :type '(repeat (cons (choice :tag "Sort order" string symbol) (choice (const :tag "None (do not sort)" nil) (function :tag "Sorting Predicate") (list :tag "Sorting Multi-Predicate" (repeat (function :tag "Component Predicate")) (choice (const :tag "None" nil) (function :tag "Final Predicate")))))) :group 'Icicles-Completions-Display :group 'Icicles-Matching)) (defcustom icicle-special-candidate-regexp nil "*Regexp to match special completion candidates, or nil to do nothing. The candidates are highlighted in buffer `*Completions*' using face `icicle-special-candidate'." :type '(choice (const :tag "None" nil) regexp) :group 'Icicles-Completions-Display) (defcustom icicle-S-TAB-completion-methods-alist ; Cycle with `M-('. `(("apropos" . string-match) ("scatter" . icicle-scatter-match) ,@(and (require 'fuzzy nil t) ; `fuzzy.el', part of library Autocomplete. '(("Jaro-Winkler" . fuzzy-match))) ,@(and (require 'levenshtein nil t) '(("Levenshtein" . icicle-levenshtein-match) ("Levenshtein strict" . icicle-levenshtein-strict-match)))) "*Alist of completion methods used by `S-TAB'. Each element has the form (NAME . FUNCTION), where NAME is a string name and FUNCTION is the completion match function. NAME is used in messages to indicate the type of completion matching. By default, `S-TAB' is the key for this completion. The actual keys used are the value of option `icicle-apropos-complete-keys'. See also options `icicle-TAB-completion-methods' and `icicle-S-TAB-completion-methods-per-command'." :type '(alist :key-type (string :tag "Name used in messages") :value-type (symbol :tag "Completion matching function")) :group 'Icicles-Matching) (defcustom icicle-S-TAB-completion-methods-per-command () "*Alist of commands and their available S-TAB completion methods. Each command is advised so that when invoked only the specified S-TAB completion methods are available for it when you use `M-('. (This makes sense only for commands that read input from the minibuffer.) This option gives you greater control over which completion methods are available. See also option `icicle-TAB-completion-methods-per-command', which does the same thing for `TAB' completion. The default behavior is provided by option `icicle-S-TAB-completion-methods-alist' (and `icicle-TAB-completion-methods' for `TAB'). NOTE: If you remove an entry from this list, that does NOT remove the advice for that command. To do that you will need to explicitly invoke command `icicle-set-S-TAB-methods-for-command' using a negative prefix argument (or else start a new Emacs session)." :type (let ((methods ())) (when (require 'levenshtein nil t) (push '(const :tag "Levenshtein strict" ("Levenshtein strict" . icicle-levenshtein-strict-match)) methods) (push '(const :tag "Levenshtein" ("Levenshtein" . icicle-levenshtein-match)) methods)) (when (require 'fuzzy nil t) ; `fuzzy.el', part of library Autocomplete. (push '(const :tag "Jaro-Winkler" ("Jaro-Winkler" . fuzzy-match)) methods)) (push '(const :tag "scatter" ("scatter" . icicle-scatter-match)) methods) (push '(const :tag "apropos" ("apropos" . string-match)) methods) `(alist :key-type (restricted-sexp :tag "Command" ;; Use `symbolp' instead of `commandp', in case the library ;; defining the command is not yet loaded. :match-alternatives (symbolp) :value ignore) :value-type (repeat :tag "S-TAB completion methods" (choice ,@methods)))) :set (lambda (sym val) (custom-set-default sym val) (when (fboundp 'icicle-set-S-TAB-methods-for-command) (dolist (entry val) (icicle-set-S-TAB-methods-for-command (car entry) (cdr entry))))) :initialize #'custom-initialize-default :group 'Icicles-matching) (defcustom icicle-swank-prefix-length 1 "*Length (chars) of symbol prefix that much match, for swank completion. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Matching) (defcustom icicle-swank-timeout 3000 "*Number of msec before swank (fuzzy symbol) completion gives up. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'integer :group 'Icicles-Matching) (defcustom icicle-TAB-completion-methods ; Cycle with `C-('. (let ((methods ())) ;; Unfortunately, `el-swankfuzzy.el' requires `cl.el' at runtime. ;; Comment this first line out if you do not want that. (when (require 'el-swank-fuzzy nil t) (push 'swank methods)) (when (require 'fuzzy-match nil t) (push 'fuzzy methods)) (when (boundp 'completion-styles) (push 'vanilla methods)) (push 'basic methods) methods) "*List of completion methods to use for \ `\\\\[icicle-prefix-complete]'. The first method in the list is the default method. The available methods can include these: 1. `basic' 2. `vanilla' (provided you have Emacs 23 or later) 3. `fuzzy' (provided you have library `fuzzy-match.el') 4. `swank' (provided you have library `el-swank-fuzzy.el') 1. Basic completion means ordinary prefix completion. It is the `basic' completion style of Emacs 23 or later, and it is essentially the completion style prior to Emacs 23 (Emacs 22 completion was slightly different - see Emacs 23 option `custom-styles' for more info). 2. Vanilla completion respects option `completion-styles' (new in Emacs 23), so that `TAB' behaves similarly in Icicles to what it does in vanilla Emacs. The vanilla method also completes environment variables during file-name completion and in shell commands. The non-vanilla methods do not complete environment variables, but the variables are expanded to their values when you hit `RET'. 3. Fuzzy completion is a form of prefix completion in which matching finds the candidates that have the most characters in common with your input, in the same order, and with a minimum of non-matching characters. It can skip over non-matching characters, as long as the number of characters skipped in the candidate is less that those following them that match. After the matching candidates are found, they are sorted by skip length and then candidate length. Fuzzy completion is described in detail in the commentary of library `fuzzy-match.el'. There is no fuzzy completion of file names - fuzzy completion is the same as basic for file names. Fuzzy completion is always case-sensitive. 4. Swank completion in Icicles is the same as fuzzy completion, except regarding symbols. That is, swank completion per se applies only to symbols. Symbols are completed using the algorithm of library `el-swank-fuzzy.el'. Icicles options `icicle-swank-timeout' and `icicle-swank-prefix-length' give you some control over the behavior. When the `TAB' completion method is `swank', you can use `C-x 1' \(`icicle-doremi-increment-swank-timeout+') and `C-x 2' \(`icicle-doremi-increment-swank-prefix-length+') in the minibuffer to increment these options on the fly using the arrow keys `up' and `down'. Swank symbol completion uses heuristics that relate to supposedly typical patterns found in symbol names. It also uses a timeout that can limit the number of matches. It is generally quite a bit slower than fuzzy completion, and it sometimes does not provide all candidates that you might think should match, even when all of your input is a prefix (or even when it is already complete!). If swank completion produces no match when you think it should, remember that you can use `\\[icicle-next-TAB-completion-method]' on the fly to \ change the completion method. If you do not customize `icicle-TAB-completion-methods', then the default value (that is, the available `TAB' completion methods) will reflect your current Emacs version and whether you have loaded libraries `fuzzy-match.el' and `el-swank-fuzzy.el'. By default, `TAB' is the key for this completion. The actual keys used are the value of option `icicle-prefix-complete-keys'. See also options `icicle-TAB-completion-methods-per-command' `icicle-S-TAB-completion-methods-alist'." :type (let ((methods ())) ;; Unfortunately, `el-swankfuzzy.el' requires `cl.el' at runtime. ;; Comment this first sexp out if you do not want that. (when (require 'el-swank-fuzzy nil t) (push '(const :tag "Swank (Fuzzy Symbol)" swank) methods)) (when (require 'fuzzy-match nil t) (push '(const :tag "Fuzzy" fuzzy) methods)) (when (boundp 'completion-styles) (push '(const :tag "Vanilla `completion-styles'" vanilla) methods)) (push '(const :tag "Basic" basic) methods) `(repeat (choice ,@methods))) :group 'Icicles-Matching) (defcustom icicle-TAB-completion-methods-per-command () "*Alist of commands and their available TAB completion methods. Each command is advised so that when invoked only the specified TAB completion methods are available for it when you use `C-('. (This makes sense only for commands that read input from the minibuffer.) This option gives you greater control over which completion methods are available. See also option `icicle-S-TAB-completion-methods-per-command', which does the same thing for `S-TAB' completion. The default behavior is provided by option `icicle-TAB-completion-methods' (and `icicle-S-TAB-completion-methods-alist' for `S-TAB'). NOTE: If you remove an entry from this list, that does NOT remove the advice for that command. To do that you will need to explicitly invoke command `icicle-set-TAB-methods-for-command' using a negative prefix argument (or else start a new Emacs session)." :type (let ((methods ())) ;; Unfortunately, `el-swankfuzzy.el' requires `cl.el' at runtime. ;; Comment this first sexp out if you do not want that. (when (require 'el-swank-fuzzy nil t) (push '(const :tag "Swank (Fuzzy Symbol)" swank) methods)) (when (require 'fuzzy-match nil t) (push '(const :tag "Fuzzy" fuzzy) methods)) (when (boundp 'completion-styles) (push '(const :tag "Vanilla `completion-styles'" vanilla) methods)) (push '(const :tag "Basic" basic) methods) `(alist :key-type (restricted-sexp :tag "Command" ;; Use `symbolp' instead of `commandp', in case the library ;; defining the command is not yet loaded. :match-alternatives (symbolp) :value ignore) :value-type (repeat :tag "TAB completion methods" (choice ,@methods)))) :set (lambda (sym val) (when (fboundp 'icicle-set-TAB-methods-for-command) (let ((old-val (symbol-value sym))) (dolist (entry old-val) (icicle-set-TAB-methods-for-command (car entry) nil)) (custom-set-default sym val) (dolist (entry val) (icicle-set-TAB-methods-for-command (car entry) (cdr entry)))))) :initialize #'custom-initialize-default :group 'Icicles-Matching) (defcustom icicle-TAB-shows-candidates-flag t "*Non-nil means that `TAB' always shows completion candidates. Otherwise (nil), follow the standard Emacs behavior of completing to the longest common prefix, and only displaying the candidates after a second `TAB'. Actually, the concerned keys are those defined by option `icicle-prefix-complete-keys', not necessarily `TAB'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Bindings) (defcustom icicle-TAB/S-TAB-only-completes-flag nil "Non-nil means keys bound to completion commands do not also cycle. That is, `TAB' and `S-TAB' perform only completion, not cycling." :type 'boolean :group 'Icicles-Key-Bindings) (defcustom icicle-recenter -4 "*Argument passed to `recenter' to recenter point in the target window. Used during functions such as `icicle-search' when the destination to visit would otherwise be off-screen. If the value is an integer and you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type '(choice (const :tag "To mid-window" nil) (integer :tag "On this line number (negative: from bottom)" -4)) :group 'Icicles-Miscellaneous) (defcustom icicle-test-for-remote-files-flag t ; Toggle with `C-^'. "*Non-nil means Icicles tests for remote file names. A value of nil turns off all handling of remote file names by Tramp, including file-name completion. The testing due to a non-nil value takes a little time, but the test result saves time with Tramp handling, and it is used to avoid some other costly operations when a file is determined to be remote. These operations are (a) incremental completion and (b) highlighting of the part of your current input that does not complete. Use a nil value only when you are sure that the file names you are completing are local. The effect will be a slight speed increase for operations (a) and (b) for local files. In addition, a nil value has the effect of ignoring the restriction of input mismatch highlighting to strict completion. That is, it treats an `icicle-highlight-input-completion-failure' value of `explicit-strict' or `implicit-strict' as if it were `implicit'. The assumption here is that you use these highlighting values only to avoid the cost of remote file name completion. You can toggle this option from the minibuffer using `C-^' (except during Icicles search). You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :initialize (lambda (opt-name val) (set opt-name t)) :set (lambda (opt-name val) (or (not (require 'tramp nil t)) (prog1 (set opt-name (not val)) (icicle-toggle-remote-file-testing)))) :type 'boolean :group 'Icicles-Matching) (defun icicle-thing-at-point (thing &optional syntax-table) "`thingatpt+.el' version of `thing-at-point', if possible. `tap-thing-at-point' if defined, else `thing-at-point'. If SYNTAX-TABLE is a syntax table, use it for the duration." (if (fboundp 'tap-thing-at-point) (tap-thing-at-point thing syntax-table) (if (and (syntax-table-p syntax-table) (fboundp 'with-syntax-table)) ; Emacs 21+. (with-syntax-table syntax-table (thing-at-point thing)) (thing-at-point thing)))) ; Ignore any SYNTAX-TABLE arg for Emacs 20, for vanilla. (defcustom icicle-thing-at-point-functions (progn (or (require 'ffap- nil t) (require 'ffap nil t)) ; Try `ffap-.el' first. (cons `(,(if (fboundp 'non-nil-symbol-name-nearest-point) 'non-nil-symbol-name-nearest-point (lambda () (symbol-name (symbol-at-point)))) ,(if (fboundp 'word-nearest-point) 'word-nearest-point (lambda () (icicle-thing-at-point 'word))) ,@(and (fboundp 'list-nearest-point-as-string) '(list-nearest-point-as-string)) ,@(and (fboundp 'list-nearest-point-as-string) '((lambda () (list-nearest-point-as-string 2)))) ,@(and (fboundp 'list-nearest-point-as-string) '((lambda () (list-nearest-point-as-string 3)))) ,@(and (fboundp 'ffap-guesser) '(ffap-guesser)) thing-at-point-url-at-point) 'forward-word)) "*Functions that return a string at or near point, or else nil. One of the functions is called when you hit `M-.' in the minibuffer. A cons cell whose car and cdr may each be empty. The car of the cons cell is a list of functions that grab different kinds of strings at or near point. They are used in sequence by command `icicle-insert-string-at-point' (bound to `M-.'). I recommend that you also use library `thingatpt+.el', so that `M-.' can take advantage of the string-grabbing functions it defines. The cdr of the cons cell is nil or a function that advances point one text thing. Each time command `icicle-insert-string-at-point' is called successively, this is called to grab more things of text (of the same kind). By default, successive words are grabbed. If either the car or cdr is empty, then the other alone determines the behavior of `icicle-insert-string-at-point'. Otherwise, option `icicle-default-thing-insertion' determines whether the car or cdr is used by `icicle-insert-string-at-point'. `C-u' with no number reverses the meaning of `icicle-default-thing-insertion'." :type '(cons (choice (repeat (function :tag "Function to grab some text at point and insert it in minibuffer")) (const :tag "No alternative text-grabbing functions" nil)) (choice (const :tag "No function to successively grab more text" nil) (function :tag "Function to advance point one text thing"))) :group 'Icicles-Miscellaneous) ;; Must be before `icicle-top-level-key-bindings'. (defun icicle-remap (old new map &optional oldmap) "Bind command NEW in MAP to all keys currently bound to OLD. If command remapping is available, use that. Otherwise, bind NEW to whatever OLD is bound to in MAP, or in OLDMAP, if provided." (if (fboundp 'command-remapping) (define-key map (vector 'remap old) new) ; Ignore OLDMAP for Emacs 22. (substitute-key-definition old new map oldmap))) ;; Must be before `icicle-top-level-key-bindings'. (defun icicle-bind-top-level-commands (&optional defs) "Bind top-level commands for Icicle mode." (let ((icicle-mode (and (boundp 'icicle-mode) icicle-mode)) key command condition) (unless icicle-mode (icy-mode 1)) ; Need `icicle-mode-map', which is unbound unless in Icicle mode. (unless defs (setq defs icicle-top-level-key-bindings)) (dolist (key-def defs) (setq key (car key-def) command (cadr key-def) condition (car (cddr key-def))) (when (eval condition) (if (symbolp key) (icicle-remap key command icicle-mode-map (current-global-map)) (define-key icicle-mode-map key command)))))) ;; Must be before `icicle-top-level-key-bindings'. (defcustom icicle-yank-function 'yank "*Yank function. A function that takes a prefix argument. This should be a command that is bound to whatever key you use to yank text, whether in Icicle mode or not. In Icicle mode, command `icicle-yank-maybe-completing' calls this function, except when `icicle-yank-maybe-completing' is called from the minibuffer or called with a negative prefix argument. `icicle-yank-maybe-completing' passes the raw prefix argument to `icicle-yank-function'. By default (see option `icicle-top-level-key-bindings'), the command that is the value of this option is remapped to `icicle-yank-maybe-completing' the first time you enter Icicle mode. If you customize `icicle-yank-function', then, to take advantage of this default remapping behavior, you will need to save your customization and then restart Emacs. Alternatively, you can customize both `icicle-yank-function' and the corresponding entry in `icicle-top-level-key-bindings', and then toggle Icicle mode off and then back on." :type 'function :group 'Icicles-Miscellaneous) (defcustom icicle-top-level-key-bindings `(([pause] icicle-switch-to/from-minibuffer t) ; `pause' ("\C-c`" icicle-search-generic t) ; `C-c `' ("\C-c$" icicle-search-word t) ; `C-c $' ("\C-c^" icicle-search-keywords t) ; `C-c ^' ("\C-c'" icicle-occur t) ; `C-c '' ("\C-c=" icicle-imenu t) ; `C-c =' ("\C-c\"" icicle-search-text-property t) ; `C-c "' ("\C-c/" icicle-complete-thesaurus-entry ; `C-c /' (fboundp 'icicle-complete-thesaurus-entry)) ("\C-x\M-e" icicle-execute-named-keyboard-macro t) ; `C-x M-e' ("\C-x " icicle-command-abbrev t) ; `C-x SPC' ("\C-x5o" icicle-select-frame t) ; `C-x 5 o' ("\C-h\C-o" icicle-describe-option-of-type t) ; `C-h C-o' ,@(and (require 'kmacro nil t) ; (Emacs 22+) '(([S-f4] icicle-kmacro t))) ; `S-f4' (abort-recursive-edit icicle-abort-recursive-edit t) ; `C-]' (apropos icicle-apropos t) (apropos-command icicle-apropos-command t) ; `C-h a' (apropos-value icicle-apropos-value t) (apropos-variable icicle-apropos-option (fboundp 'icicle-apropos-option)) (apropos-variable icicle-apropos-variable (not (fboundp 'icicle-apropos-option))) (apropos-zippy icicle-apropos-zippy t) (bookmark-jump icicle-bookmark t) ; `C-x j j', `C-x p b', `C-x r b' (bookmark-jump-other-window icicle-bookmark-other-window t) ; `C-x 4 j j', `C-x p j', `C-x p o', `C-x p q' (bookmark-set icicle-bookmark-cmd t) ; `C-x r m' (customize-apropos icicle-customize-apropos t) (customize-apropos-faces icicle-customize-apropos-faces t) (customize-apropos-groups icicle-customize-apropos-groups t) (customize-apropos-options icicle-customize-apropos-options t) (customize-face icicle-customize-face t) (customize-face-other-window icicle-customize-face-other-window t) (dabbrev-completion icicle-dabbrev-completion (< emacs-major-version 24)) (delete-window icicle-delete-window t) ; `C-x 0' (delete-windows-for icicle-delete-window t) ; `C-x 0' (`frame-cmds.el') (dired icicle-dired t) ; `C-x d' (dired-other-window icicle-dired-other-window t) ; `C-x 4 d' (exchange-point-and-mark icicle-exchange-point-and-mark t) ; `C-x C-x' (execute-extended-command icicle-execute-extended-command t) ; `M-x' (find-file icicle-file t) ; `C-x C-f' (find-file-other-window icicle-file-other-window t) ; `C-x 4 f' (find-file-read-only icicle-find-file-read-only t) ; `C-x C-r' (find-file-read-only-other-window icicle-find-file-read-only-other-window t) ; `C-x 4 r' ;; There are no key bindings in vanilla Emacs for `insert-buffer'. ;; If you use `setup-keys.el', then these are its bindings: `C-S-insert', `M-S-f1'. (insert-buffer icicle-insert-buffer t) ; `C-S-insert' (kill-buffer icicle-kill-buffer t) ; `C-x k' (kill-buffer-and-its-windows icicle-kill-buffer t) ; `C-x k' (`misc-cmds.el') (minibuffer-keyboard-quit icicle-abort-recursive-edit ; `C-g' (minibuffer - `delsel.el') (fboundp 'minibuffer-keyboard-quit)) (other-window icicle-other-window-or-frame t) ; `C-x o' (other-window-or-frame icicle-other-window-or-frame t) ; `C-x o' (`frame-cmds.el') (pop-global-mark icicle-goto-global-marker-or-pop-global-mark t) ; `C-x C-@', `C-x C-SPC' (repeat-complex-command icicle-repeat-complex-command t) ; `C-x M-:', `C-x M-ESC' (set-mark-command icicle-goto-marker-or-set-mark-command t) ; `C-@', `C-SPC' (switch-to-buffer icicle-buffer t) ; `C-x b' (switch-to-buffer-other-window icicle-buffer-other-window t) ; `C-x 4 b' ;; You might want to use these two instead of the previous two. ;; (switch-to-buffer icicle-buffer-no-search t) ;; (switch-to-buffer-other-window icicle-buffer-no-search-other-window t) (where-is icicle-where-is t) ; `C-h w' (,icicle-yank-function icicle-yank-maybe-completing t) ; `C-y' (yank-pop icicle-yank-pop-commands (featurep 'second-sel)) ; `M-y' (yank-pop-commands icicle-yank-pop-commands (featurep 'second-sel)) ; `M-y' (zap-to-char icicle-zap-to-char (fboundp 'read-char-by-name)) ; `M-z' (Emacs 23+) ;; The following are available only if you use library `bookmark+.el'. ;; Bookmark `read-file-name' autofile commands ("\C-xjt\C-f\C-f" icicle-find-file-tagged ; `C-x j t C-f C-f' (featurep 'bookmark+)) ("\C-x4jt\C-f\C-f" icicle-find-file-tagged-other-window ; `C-x 4 j t C-f C-f' (featurep 'bookmark+)) (bmkp-autofile-set icicle-bookmark-a-file (fboundp 'bmkp-bookmark-a-file)) ; `C-x p c a' (bmkp-tag-a-file icicle-tag-a-file (fboundp 'bmkp-tag-a-file)) ; `C-x p t + a' (bmkp-untag-a-file icicle-untag-a-file (fboundp 'bmkp-untag-a-file)) ; `C-x p t - a' ;; Bookmark jump commands (bmkp-find-file icicle-find-file-handle-bookmark (fboundp 'bmkp-find-file)) ; `C-x j C-f' (bmkp-find-file-other-window icicle-find-file-handle-bookmark-other-window (fboundp 'bmkp-find-file-other-window)) ; `C-x 4 j C-f' (bmkp-autofile-jump icicle-bookmark-autofile (fboundp 'bmkp-autofile-jump)) ; `C-x j a' (bmkp-autofile-jump-other-window icicle-bookmark-autofile-other-window (fboundp 'bmkp-autofile-jump)) ; `C-x 4 j a' (bmkp-autonamed-jump icicle-bookmark-autonamed (fboundp 'bmkp-autonamed-jump)) ; `C-x j #' (bmkp-autonamed-jump-other-window icicle-bookmark-autonamed-other-window (fboundp 'bmkp-autonamed-jump)) ; `C-x 4 j #' (bmkp-autonamed-this-buffer-jump icicle-bookmark-autonamed-this-buffer (fboundp 'bmkp-autonamed-this-buffer-jump)) ; `C-x j , #' ;; (bmkp-autonamed-this-buffer-jump-other-window ;; icicle-bookmark-autonamed-this-buffer-other-window ;; (fboundp 'bmkp-autonamed-jump-this-buffer-other-window)) ; `C-x 4 j , #' (bmkp-bookmark-file-jump ; (Other-window means nothing for a bookmark file.) icicle-bookmark-bookmark-file (fboundp 'bmkp-bookmark-file-jump)) ; `C-x j y' ;; (Other-window means nothing for a bookmark list.) (bmkp-bookmark-list-jump icicle-bookmark-bookmark-list (fboundp 'bmkp-bookmark-list-jump)) ; `C-x j B' ;; (Other-window means nothing for a desktop.) (bmkp-desktop-jump icicle-bookmark-desktop (fboundp 'bmkp-desktop-jump)) ; `C-x j K' (bmkp-dired-jump icicle-bookmark-dired (fboundp 'bmkp-dired-jump)) ; `C-x j d' (bmkp-dired-jump-other-window icicle-bookmark-dired-other-window (fboundp 'bmkp-dired-jump)) ; `C-x 4 j d' (bmkp-file-jump icicle-bookmark-file (fboundp 'bmkp-file-jump)) ; `C-x j f' (bmkp-file-jump-other-window icicle-bookmark-file-other-window (fboundp 'bmkp-file-jump)) ; `C-x 4 j f' (bmkp-file-this-dir-jump icicle-bookmark-file-this-dir (fboundp 'bmkp-file-this-dir-jump)) ; `C-x j . f' (bmkp-file-this-dir-jump-other-window icicle-bookmark-file-this-dir-other-window (fboundp 'bmkp-file-this-dir-jump)) ; `C-x 4 j . f' (bmkp-gnus-jump icicle-bookmark-gnus (fboundp 'bmkp-gnus-jump)) ; `C-x j g' (bmkp-gnus-jump-other-window icicle-bookmark-gnus-other-window (fboundp 'bmkp-gnus-jump)) ; `C-x 4 j g' (bmkp-image-jump icicle-bookmark-image (fboundp 'bmkp-image-jump)) ; `C-x j M-i' (bmkp-image-jump-other-window icicle-bookmark-image-other-window (fboundp 'bmkp-image-jump)) ; `C-x 4 j M-i' (bmkp-info-jump icicle-bookmark-info (fboundp 'bmkp-info-jump)) ; `C-x j i' (bmkp-info-jump-other-window icicle-bookmark-info-other-window (fboundp 'bmkp-info-jump)) ; `C-x 4 j i' (bmkp-local-file-jump icicle-bookmark-local-file (fboundp 'bmkp-local-file-jump)) ; `C-x j l' (bmkp-local-file-jump-other-window icicle-bookmark-local-file-other-window (fboundp 'bmkp-local-file-jump)) ; `C-x 4 j l' (bmkp-man-jump icicle-bookmark-man (fboundp 'bmkp-man-jump)) ; `C-x j m' (bmkp-man-jump-other-window icicle-bookmark-man-other-window (fboundp 'bmkp-man-jump)) ; `C-x 4 j m' (bmkp-non-file-jump icicle-bookmark-non-file (fboundp 'bmkp-non-file-jump)) ; `C-x j b' (bmkp-non-file-jump-other-window icicle-bookmark-non-file-other-window (fboundp 'bmkp-non-file-jump)) ; `C-x 4 j b' (bmkp-region-jump icicle-bookmark-region (fboundp 'bmkp-region-jump)) ; `C-x j r' (bmkp-region-jump-other-window icicle-bookmark-region-other-window (fboundp 'bmkp-region-jump)) ; `C-x 4 j r' (bmkp-remote-file-jump icicle-bookmark-remote-file (fboundp 'bmkp-remote-file-jump)) ; `C-x j n' (bmkp-remote-file-jump-other-window icicle-bookmark-remote-file-other-window (fboundp 'bmkp-remote-file-jump)) ; `C-x 4 j n' (bmkp-specific-buffers-jump icicle-bookmark-specific-buffers (fboundp 'bmkp-specific-buffers-jump)) ; `C-x j = b' (bmkp-specific-buffers-jump-other-window icicle-bookmark-specific-buffers-other-window (fboundp 'bmkp-specific-buffers-jump)) ; `C-x 4 j = b' (bmkp-specific-files-jump icicle-bookmark-specific-files (fboundp 'bmkp-specific-files-jump)) ; `C-x j = f' (bmkp-specific-files-jump-other-window icicle-bookmark-specific-files-other-window (fboundp 'bmkp-specific-files-jump)) ; `C-x 4 j = f' (bmkp-temporary-jump icicle-bookmark-temporary (fboundp 'bmkp-temporary-jump)) ; `C-x j x' (bmkp-temporary-jump-other-window icicle-bookmark-temporary-other-window (fboundp 'bmkp-temporary-jump)) ; `C-x 4 j x' (bmkp-this-buffer-jump icicle-bookmark-this-buffer (fboundp 'bmkp-this-buffer-jump)) ; `C-x j , ,' (bmkp-this-buffer-jump-other-window icicle-bookmark-this-buffer-other-window (fboundp 'bmkp-this-buffer-jump)) ; `C-x 4 j , ,' (bmkp-url-jump icicle-bookmark-url (fboundp 'bmkp-url-jump)) ; `C-x j u' (bmkp-url-jump-other-window icicle-bookmark-url-other-window (fboundp 'bmkp-url-jump)) ; `C-x 4 j u' (bmkp-w3m-jump icicle-bookmark-w3m (fboundp 'bmkp-w3m-jump)) ; `C-x j w' (bmkp-w3m-jump-other-window icicle-bookmark-w3m-other-window (fboundp 'bmkp-w3m-jump)) ; `C-x 4 j w' ;; Bookmark tags jump commands (bmkp-find-file-all-tags icicle-find-file-all-tags (fboundp 'bmkp-find-file-all-tags)) ; `C-x j t C-f *' (bmkp-find-file-all-tags-other-window icicle-find-file-all-tags-other-window (fboundp 'bmkp-find-file-all-tags)) ; `C-x 4 j t C-f *' (bmkp-find-file-all-tags-regexp icicle-find-file-all-tags-regexp (fboundp 'bmkp-find-file-all-tags-regexp)) ; `C-x j t C-f % *' (bmkp-find-file-all-tags-regexp-other-window icicle-find-file-all-tags-regexp-other-window (fboundp 'bmkp-find-file-all-tags-regexp-other-window)) ; `C-x 4 j t C-f % *' (bmkp-find-file-some-tags icicle-find-file-some-tags (fboundp 'bmkp-find-file-some-tags)) ; `C-x j t C-f +' (bmkp-find-file-some-tags-other-window icicle-find-file-some-tags-other-window (fboundp 'bmkp-find-file-some-tags-other-window)) ; `C-x 4 j t C-f +' (bmkp-find-file-some-tags-regexp icicle-find-file-some-tags-regexp (fboundp 'bmkp-find-file-some-tags-regexp)) ; `C-x j t C-f % +' (bmkp-find-file-some-tags-regexp-other-window icicle-find-file-some-tags-regexp-other-window (fboundp 'bmkp-find-file-some-tags-regexp-other-window)) ; `C-x 4 j t C-f % +' (bmkp-autofile-all-tags-jump icicle-bookmark-autofile-all-tags (fboundp 'bmkp-autofile-all-tags-jump)) ; `C-x j t a *' (bmkp-autofile-all-tags-jump-other-window icicle-bookmark-autofile-all-tags-other-window (fboundp 'bmkp-autofile-all-tags-jump)) ; `C-x 4 j t a *' (bmkp-autofile-all-tags-regexp-jump icicle-bookmark-autofile-all-tags-regexp (fboundp 'bmkp-autofile-all-tags-regexp-jump)) ; `C-x j t a % *' (bmkp-autofile-all-tags-regexp-jump-other-window icicle-bookmark-autofile-all-tags-regexp-other-window (fboundp 'bmkp-autofile-all-tags-regexp-jump)) ; `C-x 4 j t a % *' (bmkp-autofile-some-tags-jump icicle-bookmark-autofile-some-tags (fboundp 'bmkp-autofile-some-tags-jump)) ; `C-x j t a +' (bmkp-autofile-some-tags-jump-other-window icicle-bookmark-autofile-some-tags-other-window (fboundp 'bmkp-autofile-some-tags-jump)) ; `C-x 4 j t a +' (bmkp-autofile-some-tags-regexp-jump icicle-bookmark-autofile-some-tags-regexp (fboundp 'bmkp-autofile-some-tags-regexp-jump)) ; `C-x j t a % +' (bmkp-autofile-some-tags-regexp-jump-other-window icicle-bookmark-autofile-some-tags-regexp-other-window (fboundp 'bmkp-autofile-some-tags-regexp-jump)) ; `C-x 4 j t a % +' (bmkp-all-tags-jump icicle-bookmark-all-tags (fboundp 'bmkp-all-tags-jump)) ; `C-x j t *' (bmkp-all-tags-jump-other-window icicle-bookmark-all-tags-other-window (fboundp 'bmkp-all-tags-jump)) ; `C-x 4 j t *' (bmkp-all-tags-regexp-jump icicle-bookmark-all-tags-regexp (fboundp 'bmkp-all-tags-regexp-jump)) ; `C-x j t % *' (bmkp-all-tags-regexp-jump-other-window icicle-bookmark-all-tags-regexp-other-window (fboundp 'bmkp-all-tags-regexp-jump)) ; `C-x 4 j t % *' (bmkp-some-tags-jump icicle-bookmark-some-tags (fboundp 'bmkp-some-tags-jump)) ; `C-x j t +' (bmkp-some-tags-jump-other-window icicle-bookmark-some-tags-other-window (fboundp 'bmkp-some-tags-jump)) ; `C-x 4 j t +' (bmkp-some-tags-regexp-jump icicle-bookmark-some-tags-regexp (fboundp 'bmkp-some-tags-regexp-jump)) ; `C-x j t % +' (bmkp-some-tags-regexp-jump-other-window icicle-bookmark-some-tags-regexp-other-window (fboundp 'bmkp-some-tags-regexp-jump)) ; `C-x 4 j t % +' (bmkp-file-all-tags-jump icicle-bookmark-file-all-tags (fboundp 'bmkp-file-all-tags-jump)) ; `C-x j t f *' (bmkp-file-all-tags-jump-other-window icicle-bookmark-file-all-tags-other-window (fboundp 'bmkp-file-all-tags-jump)) ; `C-x 4 j t f *' (bmkp-file-all-tags-regexp-jump icicle-bookmark-file-all-tags-regexp (fboundp 'bmkp-file-all-tags-regexp-jump)) ; `C-x j t f % *' (bmkp-file-all-tags-regexp-jump-other-window icicle-bookmark-file-all-tags-regexp-other-window (fboundp 'bmkp-file-all-tags-regexp-jump)) ; `C-x 4 j t f % *' (bmkp-file-some-tags-jump icicle-bookmark-file-some-tags (fboundp 'bmkp-file-some-tags-jump)) ; `C-x j t f +' (bmkp-file-some-tags-jump-other-window icicle-bookmark-file-some-tags-other-window (fboundp 'bmkp-file-some-tags-jump)) ; `C-x 4 j t f +' (bmkp-file-some-tags-regexp-jump icicle-bookmark-file-some-tags-regexp (fboundp 'bmkp-file-some-tags-regexp-jump)) ; `C-x j t f % +' (bmkp-file-some-tags-regexp-jump-other-window icicle-bookmark-file-some-tags-regexp-other-window (fboundp 'bmkp-file-some-tags-regexp-jump)) ; `C-x 4 j t f % +' (bmkp-file-this-dir-all-tags-jump icicle-bookmark-file-this-dir-all-tags (fboundp 'bmkp-file-this-dir-all-tags-jump)) ; `C-x j t . *' (bmkp-file-this-dir-all-tags-jump-other-window icicle-bookmark-file-this-dir-all-tags-other-window (fboundp 'bmkp-file-this-dir-all-tags-jump)) ; `C-x 4 j t . *' (bmkp-file-this-dir-all-tags-regexp-jump icicle-bookmark-file-this-dir-all-tags-regexp ; `C-x j t . % *' (fboundp 'bmkp-file-this-dir-all-tags-regexp-jump)) (bmkp-file-this-dir-all-tags-regexp-jump-other-window icicle-bookmark-file-this-dir-all-tags-regexp-other-window (fboundp 'bmkp-file-this-dir-all-tags-regexp-jump)) ; `C-x 4 j t . % *' (bmkp-file-this-dir-some-tags-jump icicle-bookmark-file-this-dir-some-tags (fboundp 'bmkp-file-this-dir-some-tags-jump)) ; `C-x j t . +' (bmkp-file-this-dir-some-tags-jump-other-window icicle-bookmark-file-this-dir-some-tags-other-window (fboundp 'bmkp-file-this-dir-some-tags-jump)) ; `C-x 4 j t . +' (bmkp-file-this-dir-some-tags-regexp-jump icicle-bookmark-file-this-dir-some-tags-regexp (fboundp 'bmkp-file-this-dir-some-tags-regexp-jump)) ; `C-x j t . % +' (bmkp-file-this-dir-some-tags-regexp-jump-other-window icicle-bookmark-file-this-dir-some-tags-regexp-other-window (fboundp 'bmkp-file-this-dir-some-tags-regexp-jump)) ; `C-x 4 j t . % +' ;; Don't let Emacs 20 or 21 use `substitute-key-definition' on `M-.' or `M-*', since we need ;; these keys for the minibuffer. Leave them unbound in `icicle-mode-map' until Emacs 22+. (find-tag icicle-find-tag (fboundp 'command-remapping)) ; `M-.' (find-tag-other-window icicle-find-first-tag-other-window t) ; `C-x 4 .' (pop-tag-mark icicle-pop-tag-mark (fboundp 'command-remapping)) ; `M-*' (eval-expression icicle-pp-eval-expression (fboundp 'command-remapping)) ; `M-:' (pp-eval-expression icicle-pp-eval-expression (fboundp 'command-remapping)) ;`M-:' (`pp+.el') ;; For La Carte (`lacarte.el'), not Icicles, but it's convenient to do this here. ("\e\M-x" lacarte-execute-command ; `ESC M-x' (fboundp 'lacarte-execute-command)) ("\M-`" lacarte-execute-menu-command ; `M-`' - replaces `tmm-menubar'. (fboundp 'lacarte-execute-menu-command)) ([f10] lacarte-execute-menu-command ; `f10' - replaces `menu-bar-open'. (fboundp 'lacarte-execute-menu-command)) ) "*List of top-level key bindings in Icicle mode. Each list element is of custom type `icicle-key-definition' and has the form (KEY COMMAND CONDITION). KEY is either a key sequence (string or vector) to bind COMMAND to or a command to remap to COMMAND. COMMAND is bound according to the value of KEY, unless the result of evaluating CONDITION is nil. In Customize, to specify a key sequence, choose `Key' in the `Value Menu', then enter a key description such as that returned by `C-h k'. For convenience, you can use insert each key in the key description by hitting `C-q' then the key. For example, to enter the key description `C-c M-k' you can use `C-q C-c C-q M-k'. If you customize this option then you must exit and re-enter Icicle mode to ensure that the change takes effect. This is really necessary only if your changes would undefine a key. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode. See also option `icicle-functions-to-redefine'." :type (if (> emacs-major-version 21) '(repeat icicle-key-definition) '(repeat (list (choice (restricted-sexp :tag "Key" :match-alternatives ((lambda (x) (or (stringp x) (vectorp x)))) :value [ignore]) (restricted-sexp :tag "Command to remap" ;; Use `symbolp' instead of `commandp', in case the library defining the ;; command is not loaded. :match-alternatives (symbolp) :value ignore)) ;; Use `symbolp' instead of `commandp'... (restricted-sexp :tag "Command" :match-alternatives (symbolp) :value ignore) (sexp :tag "Condition")))) :set (lambda (sym defs) (custom-set-default sym defs) (when (boundp 'icicle-mode-map) ; Avoid error on initialization. (icicle-bind-top-level-commands defs))) :initialize #'custom-initialize-default :group 'Icicles-Key-Bindings) (defcustom icicle-top-level-when-sole-completion-delay 1.0 "*Number of secs to wait to return to top level if only one completion. This has no effect if `icicle-top-level-when-sole-completion-flag' is nil. Editing the completion (typing or deleting a character) before the delay expires prevents its automatic acceptance. Do not set this to 0.0. Set it to slightly more than zero if you want instant action. If you use Do Re Mi (library `doremi.el') then you can use multi-command `icicle-increment-option' anytime to change the option value incrementally." :type 'number :group 'Icicles-Matching) (defcustom icicle-top-level-when-sole-completion-flag nil "*Non-nil means to return to top level if only one matching completion. The sole completion is accepted. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-touche-pas-aux-menus-flag nil "*Non-nil means do not add items to menus except `Minibuf' and `Icicles'. Put differently, non-nil means that Icicles menu items are consolidated in a single menu: `Icicles'. Otherwise (if nil), they are instead placed in relevant existing menus: `File', `Search', etc. So if you want all Icicles menu items in the same place, set this to non-nil. The option value is used only when Icicles mode is initially established, so changing this has no effect after Icicles has been loaded. However, you can change it and save the new value so it will be used next time. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Bindings) (defcustom icicle-type-actions-alist '(("buffer" (lambda (b) (with-current-buffer b (ps-print-buffer))) ; E.g. showing you can use lambda. 1-window-frames-on another-buffer browse-url-of-buffer buffer-disable-undo buffer-enable-undo buffer-file-name buffer-local-variables buffer-modified-p buffer-name buffer-size bury-buffer choose-grep-buffer current-line-string delete-1-window-frames-on delete-windows-for delete-windows-on delete/iconify-windows-on describe-buffer-bindings diff-buffer-with-file display-buffer display-buffer-other-frame echo-in-buffer eval-buffer fontify-buffer generate-new-buffer get-buffer get-buffer-process get-buffer-window get-buffer-window-list grepp-choose-grep-buffer ibuffer-jump-to-buffer icicle-char-properties-in-buffer icicle-delete-window icicle-delete-windows-on icicle-help-line-buffer icicle-kill-a-buffer insert-buffer insert-buffer-substring insert-buffer-substring-as-yank insert-buffer-substring-no-properties kill-buffer kill-buffer-and-its-windows kill-buffer-if-not-modified last-buffer multi-window-frames-on other-buffer pop-to-buffer pr-interface remove-windows-on replace-buffer-in-windows smiley-buffer switch-to-buffer switch-to-buffer-other-frame switch-to-buffer-other-window view-buffer view-buffer-other-frame view-buffer-other-window) ("color" color-defined-p color-gray-p color-supported-p color-values colors doremi-set-background-color doremi-set-foreground-color eyedrop-color-message facemenu-set-background facemenu-set-foreground hexrgb-blue hexrgb-color-name-to-hex hexrgb-complement hexrgb-green hexrgb-hex-to-color-values hexrgb-hue hexrgb-red hexrgb-saturation hexrgb-value icicle-color-help icicle-color-name-w-bg palette-brightness-scale palette-color-message palette-complement-or-alternative palette-hex-info palette-hsv-info palette-rgb-info palette-swatch ps-e-color-values ps-e-x-color-values set-background-color set-border-color set-cursor-color set-foreground-color set-mouse-color tty-color-canonicalize tty-color-desc tty-color-standard-values tty-color-translate tty-color-values x-color-defined-p x-color-values) ("command" command-remapping define-prefix-command describe-command disable-command doremi-push-frame-config-for-command enable-command Info-find-emacs-command-nodes Info-goto-emacs-command-node) ("face" color-theme-spec custom-facep customize-face customize-face-other-window custom-theme-recalc-face describe-face face-all-attributes face-attr-construct face-background face-background-20+ face-background-pixmap face-bold-p face-default-spec face-differs-from-default-p face-doc-string face-documentation face-font face-foreground face-foreground-20+ face-id face-inverse-video-p face-italic-p face-nontrivial-p face-spec-reset-face face-stipple face-underline-p face-user-default-spec facemenu-add-face facemenu-add-new-face facemenu-set-face find-face-definition hlt-choose-default-face hlt-show-default-face hlt-unhighlight-region-for-face icicle-customize-face icicle-customize-face-other-window invert-face make-face make-face-bold make-face-bold-italic make-face-italic make-face-unbold make-face-unitalic moccur-face-check modify-face ps-face-attributes read-all-face-attributes read-face-font) ("file" abbreviate-file-name ange-ftp-chase-symlinks ange-ftp-file-modtime apropos-library auto-coding-alist-lookup bookmark-file-or-variation-thereof bookmark-load browse-url-of-file byte-compile-file check-declare-file comint-append-output-to-file comint-quote-filename comint-substitute-in-file-name comint-unquote-filename comint-write-output compilation-get-file-structure cookie-insert create-file-buffer delete-file describe-file dired-delete-file diredp-mouse-diff dired-show-file-type dir-locals-find-file dir-locals-read-from-file do-after-load-evaluation ebnf-eps-file ebnf-print-file ebnf-spool-file ebnf-syntax-file ediff-backup epa-decrypt-file epa-import-keys epa-verify-file eval-next-after-load ffap-file-remote-p ffap-locate-file file-attributes file-cache-add-file file-chase-links file-dependents file-directory-p file-executable-p file-exists-p file-loadhist-lookup file-local-copy file-modes file-name-nondirectory file-newest-backup file-nlinks file-ownership-preserved-p file-provides file-readable-p file-regular-p file-relative-name file-remote-p file-requires file-symlink-p file-system-info file-truename file-writable-p find-alternate-file find-alternate-file-other-window find-buffer-visiting finder-commentary find-file find-file-at-point find-file-binary find-file-literally find-file-noselect find-file-other-frame find-file-other-window find-file-read-only find-file-read-only-other-frame find-file-read-only-other-window find-file-text get-file-buffer gnus-audio-play gnus-convert-png-to-face hexl-find-file highlight-compare-with-file icicle-add-file-to-fileset icicle-delete-file-or-directory icicle-describe-file icicle-file-remote-p icicle-help-line-file icicle-search-file icicle-shell-command-on-file image-type-from-file-header image-type-from-file-name Info-find-file Info-index-nodes info-lookup-file Info-toc-nodes info-xref-check insert-file insert-file-literally insert-image-file list-tags lm-commentary lm-creation-date lm-keywords lm-keywords-list lm-last-modified-date lm-summary lm-synopsis lm-verify lm-version load load-file load-history-regexp make-backup-file-name move-file-to-trash open-dribble-file open-termscript play-sound-file pr-ps-file-preview pr-ps-file-print pr-ps-file-ps-print pr-ps-file-using-ghostscript recentf-add-file recentf-push recentf-remove-if-non-kept recover-file rmail-input rmail-output set-file-times set-visited-file-name substitute-in-file-name system-move-file-to-trash untranslated-canonical-name untranslated-file-p url-basepath vc-backend vc-delete-automatic-version-backups vc-file-clearprops vc-insert-file vc-make-version-backup vc-name vc-state vc-working-revision view-file view-file-other-frame view-file-other-window visit-tags-table w32-browser w32-long-file-name w32-short-file-name w32explore woman-find-file write-file xml-parse-file) ("frame" current-window-configuration delete-frame delete-other-frames thumfr-dethumbify-frame doremi-undo-last-frame-color-change thumfr-fisheye fit-frame fit-frame-maximize-frame fit-frame-minimize-frame fit-frame-restore-frame frame-char-height frame-char-width frame-current-scroll-bars frame-extra-pixels-height frame-extra-pixels-width frame-face-alist frame-first-window frame-focus frame-height frame-iconified-p frame-parameters frame-pixel-height frame-pixel-width frame-root-window frame-selected-window frame-set-background-mode frame-terminal frame-visible-p frame-width get-a-frame get-frame-name hide-frame icicle-select-frame-by-name iconify-frame lower-frame make-frame-invisible make-frame-visible maximize-frame maximize-frame-horizontally maximize-frame-vertically menu-bar-open minimize-frame next-frame thumfr-only-raise-frame previous-frame raise-frame really-iconify-frame redirect-frame-focus redraw-frame restore-frame restore-frame-horizontally restore-frame-vertically select-frame select-frame-set-input-focus set-frame-name show-frame thumfr-thumbify-frame thumfr-thumbify-other-frames thumfr-thumbnail-frame-p thumfr-toggle-thumbnail-frame toggle-max-frame toggle-max-frame-horizontally toggle-max-frame-vertically toggle-zoom-frame tty-color-alist tty-color-clear w32-focus-frame window-list window-system window-tree x-focus-frame zoom-frm-in zoom-frm-out zoom-frm-unzoom) ("function" cancel-function-timers describe-function elp-instrument-function find-function find-function-other-frame find-function-other-window symbol-function trace-function trace-function-background) ("option" custom-note-var-changed customize-option customize-option-other-window describe-option icicle-binary-option-p tell-customize-var-has-changed) ("process" accept-process-output anything-kill-async-process clone-process continue-process delete-process get-process interrupt-process kill-process process-buffer process-coding-system process-command process-contact process-exit-status process-filter process-filter-multibyte-p process-id process-inherit-coding-system-flag process-kill-without-query process-mark process-name process-plist process-query-on-exit-flag process-running-child-p process-send-eof process-sentinel process-status process-tty-name process-type quit-process set-process-coding-system stop-process tooltip-process-prompt-regexp tq-create) ("symbol" apropos-describe-plist apropos-macrop apropos-score-symbol byte-compile-const-symbol-p custom-guess-type custom-unlispify-tag-name custom-variable-type default-boundp default-value describe-minor-mode-from-symbol fmakunbound icicle-help-on-candidate-symbol info-lookup-symbol makunbound symbol-file symbol-function symbol-plist symbol-value) ("variable" custom-type custom-variable-documentation custom-variable-p custom-variable-type describe-variable find-variable find-variable-noselect find-variable-other-frame find-variable-other-window help-custom-type icicle-custom-type kill-local-variable local-variable-if-set-p local-variable-p make-local-variable make-variable-buffer-local make-variable-frame-local symbol-value user-variable-p variable-binding-locus) ("window" balance-windows browse-kill-ring-fit-window compilation-set-window-height delete-other-windows delete-other-windows-vertically delete-window delete/iconify-window fit-frame-max-window-size fit-window-to-buffer mouse-drag-vertical-line-rightward-window mouse-drag-window-above next-window previous-window remove-window select-window shrink-window-if-larger-than-buffer split-window truncated-partial-width-window-p window--display-buffer-1 window--even-window-heights window--try-to-split-window window-body-height window-buffer window-buffer-height window-current-scroll-bars window-dedicated-p window-display-table window-edges window-end window-fixed-size-p window-frame window-fringes window-full-width-p window-height window-hscroll window-inside-edges window-inside-pixel-edges window-margins window-minibuffer-p window-parameters window-pixel-edges window-point window-safely-shrinkable-p window-scroll-bars window-start window-text-height window-vscroll window-width)) "*Alist of Emacs object types and associated actions. Each element has the form (TYPE FUNCTION...), where TYPE names an object type, and each FUNCTION accepts an object of type TYPE as its only required argument A FUNCTION here can be a symbol or a lambda form. You can use a symbol that is not yet `fboundp', that is, one that does not yet have a function definition. Any symbols that do not have function definitions when this option is used are simply filtered out. However, just because a function is defined at runtime does not mean that it will work. For example, function `buffer-size' is included in the default value for type `buffer', but in Emacs 20 `buffer-size' accepts no arguments, so applying it to a buffer name raises an error. \[Note: If you have suggestions or corrections for the default value, send them in, using `\\[icicle-send-bug-report]'. The initial list was drawn up quickly by looking at functions with the type in their name and that accept a value of that type as only required argument. There is no doubt that the default value could be improved.]" :type '(alist :key-type (string :tag "Object type") ;; We cannot use type `function' because some symbols might not yet be `fboundp'. :value-type (repeat (restricted-sexp :tag "Action (function)" :match-alternatives (functionp symbolp)))) :group 'Icicles-Miscellaneous) (defcustom icicle-unpropertize-completion-result-flag nil "*Non-nil means strip text properties from the completion result. Set or bind this option to non-nil only if you need to ensure, for some other library, that the string returned by `completing-read' and \(starting with Emacs 23) `read-file-name' has no text properties. Typically, you will not use a non-nil value. Internal text properties added by Icicles are always removed anyway. A non-nil value lets you also remove properties such as `face'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Miscellaneous) (defcustom icicle-update-input-hook nil "*Functions run when minibuffer input is updated (typing or deleting)." :type 'hook :group 'Icicles-Miscellaneous) (defcustom icicle-use-~-for-home-dir-flag t ; Toggle with `M-~'. "*Non-nil means abbreviate your home directory using `~'. You can toggle this option from the minibuffer at any time using `M-~'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Bindings) (defcustom icicle-use-C-for-actions-flag t ; Toggle with `M-g'. "*Non-nil means use modifier `C-' (Control) for multi-command actions. If nil, then you need no `C-' modifier for actions, and, instead, you need a `C-' modifier for ordinary candidate cycling. It is not strictly correct to speak in terms of the `C-' modifier - that is only the default behavior. The actual keys concerned are those defined by these options: `icicle-modal-cycle-down-action-keys' `icicle-modal-cycle-up-action-keys' `icicle-apropos-cycle-next-action-keys' `icicle-apropos-cycle-previous-action-keys' `icicle-prefix-cycle-next-action-keys' `icicle-prefix-cycle-previous-action-keys' You can toggle this option from the minibuffer at any time using `M-g'. You can also use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Key-Bindings) (defcustom icicle-use-anything-candidates-flag t "*Non-nil means Icicles can include Anything candidates for completion. When non-nil, Anything actions are used for candidate alternate actions in some Icicles commands, and Anything types and actions are used by command `icicle-object-action' (aka `a' and `what-which-how'). This option has no effect if library `anything.el' cannot be loaded. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defcustom icicle-use-candidates-only-once-flag nil "*Non-nil means remove each candidate from the set after using it. When you use a multi-command and act on a candidate (for example, with `C-RET'), the candidate is removed from those available if this is non-nil. If this is nil, then the candidate is not removed, so you can act on it again. You can customize this option if you prefer the non-nil behavior all of the time. However, most users will not want to do that. If you write Emacs-Lisp code, you can bind this to non-nil during completion in contexts where it makes little sense for users to act on the same candidate more than once. That way, users cannot choose it again, and they are not distracted seeing it as a candidate. See also non-option variable `icicle-use-candidates-only-once-alt-p'. Remember that you can use multi-command `icicle-toggle-option' anytime to toggle the option." :type 'boolean :group 'Icicles-Matching) (defun icicle-widgetp (widget) "Return non-nil if WIDGET is a widget. Same as `widgetp' in Emacs 22+. Defined for Emacs 20 and 21." (if (symbolp widget) (get widget 'widget-type) (and (consp widget) (symbolp (car widget)) (get (car widget) 'widget-type)))) ;; To redefine widget `color' to `icicle-color', you need library `wid-edit+.el'. (defcustom icicle-widgets-to-redefine `(file ,@(and (require 'wid-edit+ nil t) '(color))) "*List of widgets to be redefined to provide Icicles completion. Each widget must be a symbol with property `widget-type'. When in Icicle mode, Icicles completion is available. Otherwise, vanilla completion is available. In other words, with Icicle mode turned off, you should get the ordinary behavior. For this option to have an effect upon startup, it must be set before you enter Icicle mode. This means that you must ensure that the code that sets it is invoked before you enter Icicle mode. If you use Customize to change this option, then ensure that the code inserted by Customize into your `user-init-file' or your `custom-file' is invoked before you enter Icicle mode. (Alternatively, you can toggle Icicle mode twice.)" :type '(repeat (restricted-sexp :tag "Widget (a symbol)" :match-alternatives (lambda (obj) (and (symbolp obj) (icicle-widgetp obj))) :value ignore)) :set (lambda (sym defs) (custom-set-default sym defs) (when (boundp 'icicle-mode-map) ; Avoid error on initialization. (icicle-redefine-standard-widgets))) :initialize #'custom-initialize-default :group 'Icicles-Miscellaneous) (defcustom icicle-word-completion-keys '([(meta ?\ )]) ; `M-SPC' "*Key sequences to use for minibuffer prefix word completion. A list of values that each has the same form as a key-sequence argument to `define-key'. It is a list mainly in order to accommodate different keyboards. Because file names, in particular, can contain spaces, some people prefer such a key sequence to be non-printable, such as `M-SPC'. This is the default value in Icicles. But because the spacebar is such a convenient key to hit, other people prefer to use `SPC' for word completion, and to insert a space some other way. The usual way to do that is via `C-q SPC', but command `icicle-insert-a-space' is provided for convenience. You can bind this to `M-SPC', for instance, in `minibuffer-local-completion-map', `minibuffer-local-completion-map', and `minibuffer-local-must-match-map'." :type '(repeat sexp) :group 'Icicles-Key-Bindings) (defcustom icicle-WYSIWYG-Completions-flag "MMMM" "*Non-nil means show candidates in `*Completions*' using WYSIWYG. This has an effect only for completion of faces and colors. The particular non-nil value determines the appearance: * If t, the candidate is shown with its text properties. * If a string, the string is propertized and then appended to the candidate, to serve as a color swatch. Some commands might override a string value with different text. This is the case for `icicle-read-color-wysiwyg', for instance: the color swatch text is always the color's RGB code. Note that, starting with Emacs 22, if this option is non-nil, then command `describe-face' does not use `completing-read-multiple', since that (non-Icicles) function does not support WYSIWYG candidates." :type '(choice (string :tag "Show candidate plus a WYSIWYG swatch with text..." :value "MMMM") (const :tag "Show candidate itself using WYSIWYG" t) (const :tag "Show candidate as is, with no text properties" nil)) :group 'Icicles-Completions-Display) (when (fboundp 'read-char-by-name) (defcustom icicle-zap-to-char-candidates nil "*Names to use for `icicle-zap-to-char' when completing. Either a function that returns a list of the same form as `ucs-names', or nil, which means the Unicode chars that have been read previously." :type '(choice (const :tag "All Unicode chars" icicle-ucs-names) (const :tag "Previously used chars" nil) (function :tag "Invoke function" icicle-ucs-names)) :group 'Icicles-Matching)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-opt) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-opt.el ends here icicles-2013.04.23.23400/icicles-var.el000066400000000000000000002125031214003072700167120ustar00rootroot00000000000000;;; icicles-var.el --- Internal variables for Icicles ;; ;; Filename: icicles-var.el ;; Description: Internal variables for Icicles ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Mon Feb 27 09:23:26 2006 ;; Version: 22.0 ;; Last-Updated: Thu Apr 4 09:11:50 2013 (-0700) ;; By: dradams ;; Update #: 1710 ;; URL: http://www.emacswiki.org/icicles-var.el ;; Doc URL: http://www.emacswiki.org/Icicles ;; Keywords: internal, extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `apropos', `apropos-fn+var', `cl', `el-swank-fuzzy', `ffap', ;; `ffap-', `fuzzy', `fuzzy-match', `hexrgb', `icicles-opt', ;; `kmacro', `levenshtein', `naked', `regexp-opt', `thingatpt', ;; `thingatpt+', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This is a helper library for library `icicles.el'. It defines ;; internal variables (not to be modified by users. For Icicles ;; documentation, see `icicles-doc1.el' and `icicles-doc2.el'. ;; ;; Internal variables defined here: ;; ;; `icicle-abs-file-candidates', `icicle-acting-on-next/prev', ;; `icicle-advice-info-list', `icicle-all-candidates-action', ;; `icicle-all-candidates-list-action-fn', ;; `icicle-all-candidates-list-alt-action-fn', ;; `icicle-allowed-sort-predicate', `icicle-apply-nomsg', ;; `icicle-apropos-complete-match-fn', ;; `icicle-apropos-value-last-initial-cand-set', ;; `icicle-bookmark-history', `icicle-bookmark-list-names-only-p', ;; `icicle-bookmark-types', `icicle-buffer-complete-fn', ;; `icicle-buffer-config-history', `icicle-buffer-name-input-p', ;; `icicle-buffer-sort-first-time-p', `icicle-bufflist', ;; `icicle-candidate-action-fn', `icicle-candidate-alt-action-fn', ;; `icicle-candidate-entry-fn', `icicle-candidate-help-fn', ;; `icicle-candidate-nb', `icicle-candidate-properties-alist', ;; `icicle-candidates-alist', `icicle-cands-to-narrow', ;; `icicle-char-property-value-history', ;; `icicle-cmd-calling-for-completion', `icicle-cmd-reading-input', ;; `icicle-color-history', `icicle-color-theme-history', ;; `icicle-command-abbrev-history', `icicle-commands-for-abbrev', ;; `icicle-common-match-string', ;; `icicle-comp-base-is-default-dir-p', ;; `icicle-complete-input-overlay', `icicle-complete-keys-alist', ;; `icicle-completing-keys-p', `icicle-completing-p', ;; `icicle-completing-read+insert-candidates', ;; `icicle-completion-candidates', ;; `icicle-completion-prompt-overlay', ;; `icicle-completion-set-history', ;; `icicle-compute-narrowing-regexp-p', ;; `icicle-confirm-exit-commands', ;; `icicle-current-completion-candidate-overlay', ;; `icicle-current-completion-mode', `icicle-current-input', ;; `icicle-current-raw-input', `icicle-current-TAB-method', ;; `icicle-cycling-p', `icicle-default-thing-insertion-flipped-p', ;; `icicle-delete-candidate-object', `icicle-dictionary-history', ;; `icicle-dir-candidate-can-exit-p', ;; `icicle-doc-last-initial-cand-set', ;; `icicle-dot-string-internal', `icicle-edit-update-p', ;; `icicle-ess-use-ido', `icicle-exclude-default-proxies', ;; `icicle-explore-final-choice', ;; `icicle-explore-final-choice-full', `icicle-extra-candidates', ;; `icicle-extra-candidates-dir-insert-p', ;; `icicle-face-name-history', `icicle-fancy-candidates-p', ;; `icicle-fancy-cands-internal-p', ;; `icicle-file-name-completion-table', ;; `icicle-file-sort-first-time-p', ;; `icicle-filtered-default-value', `icicle-font-name-history', ;; `icicle-frame-alist', `icicle-frame-name-history', ;; `icicle-full-cand-fn', `icicle-function-name-history', ;; `icicle-fundoc-last-initial-cand-set', ;; `icicle-general-help-string', ;; `icicle-get-alist-candidate-function', ;; `icicle-hist-cands-no-highlight', `icicle-hist-var', ;; `icicle-ignored-extensions', `icicle-ignored-extensions-regexp', ;; `icicle-incremental-completion-p', `icicle-Info-index-cache', ;; `icicle-Info-only-rest-of-book-p', `icicle-Info-tag-table-posn', ;; `icicle-inhibit-sort-p', `icicle-inhibit-try-switch-buffer', ;; `icicle-initial-value', `icicle-input-completion-fail-overlay', ;; `icicle-input-fail-pos', `icicle-insert-string-at-pt-end', ;; `icicle-insert-string-at-pt-start', ;; `icicle-interactive-history', `icicle-key-prefix-description', ;; `icicle-kill-history', `icicle-kmacro-alist', ;; `icicle-kmacro-history', ;; `icicle-last-apropos-complete-match-fn', ;; `icicle-last-completion-candidate', ;; `icicle-last-completion-command', `icicle-last-input', ;; `icicle-last-sort-comparer', `icicle-last-top-level-command', ;; `icicle-last-transform-function', `icicle-lighter-truncation', ;; `icicle-list-use-nth-parts', `icicle-menu-map', ;; `icicle-minibuffer-message-ok-p', `icicle-minor-mode-map-entry', ;; `icicle-mode-line-help', `icicle-ms-windows-drive-hash', ;; `icicle-multi-completing-p', `icicle-multi-inputs-action-fn', ;; `icicle-must-match-regexp', `icicle-must-not-match-regexp', ;; `icicle-must-pass-after-match-predicate', ;; `icicle-must-pass-predicate', `icicle-narrow-regexp', ;; `icicle-nb-candidates-before-truncation', ;; `icicle-nb-of-other-cycle-candidates', `icicle-new-last-cmd', ;; `icicle-next-apropos-complete-cycles-p', ;; `icicle-next-prefix-complete-cycles-p', `icicle-orig-buff', ;; `icicle-orig-must-pass-after-match-pred', ;; `icicle-orig-pt-explore', `icicle-orig-read-file-name-fn', ;; `icicle-orig-window', `icicle-orig-win-explore', ;; `icicle-other-window', `icicle-path-variables', ;; `icicle-plist-last-initial-cand-set', ;; `icicle-predicate-types-alist', `icicle-pref-arg', ;; `icicle-pre-minibuffer-buffer', `icicle-post-command-hook', ;; `icicle-pre-command-hook', ;; `icicle-previous-raw-file-name-inputs', ;; `icicle-previous-raw-non-file-name-inputs', ;; `icicle-progressive-completing-p', `icicle-prompt', ;; `icicle-proxy-candidate-regexp', `icicle-proxy-candidates', ;; `icicle-read-char-history', `icicle-read-expression-map', ;; `icicle-read-file-name-internal-fn' (Emacs 24+), ;; `icicle-remove-icicles-props-p', `icicle-re-no-dot', ;; `icicle-require-match-p', `icicle-reverse-multi-sort-p', ;; `icicle-reverse-sort-p', `icicle-saved-candidate-overlays', ;; `icicle-saved-candidates-variables-obarray', ;; `icicle-saved-completion-candidate', ;; `icicle-saved-completion-candidates', ;; `icicle-saved-completion-candidates-internal', ;; `icicle-saved-ignored-extensions', ;; `icicle-saved-kmacro-ring-max', `icicle-saved-proxy-candidates', ;; `icicle-saved-regexp-search-ring-max', ;; `icicle-saved-region-background', ;; `icicle-saved-search-ring-max', `icicle-scan-fn-or-regexp', ;; `icicle-scroll-Completions-reverse-p', `icicle-search-command', ;; `icicle-search-complement-domain-p', ;; `icicle-search-context-level', `icicle-search-context-regexp', ;; `icicle-search-current-overlay', `icicle-search-final-choice', ;; `icicle-search-history', `icicle-search-in-context-fn', ;; `icicle-searching-p', `icicle-search-level-overlays', ;; `icicle-search-map', `icicle-search-modes', ;; `icicle-search-overlays', `icicle-search-refined-overlays', ;; `icicle-search-replacement', ;; `icicle-search-replacement-history', ;; `icicle-successive-grab-count', ;; `icicle-text-property-value-history', ;; `icicle-thing-at-pt-fns-pointer', ;; `icicle-transform-before-sort-p', `icicle-transform-function', ;; `icicle-toggle-transforming-message', ;; `icicle-universal-argument-map', ;; `icicle-use-candidates-only-once-alt-p', ;; `icicle-vardoc-last-initial-cand-set', ;; `icicle-variable-name-history', ;; `icicle-whole-candidate-as-text-prop-p', ;; `lacarte-menu-items-alist'. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;;(@> "Index") ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Internal variables (alphabetical)") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (require 'apropos-fn+var nil t) ;; (no error if not found): apropos-command, ;; apropos-function, apropos-option, apropos-variable (require 'icicles-opt) ;; icicle-kbd, icicle-sort-comparer ;;; Defvars to quiet byte-compiler: (defvar kmacro-ring-max) ; Defined in `kmacro.el' in Emacs 22+. (defvar minibuffer-confirm-exit-commands) ; Defined in `minibuffer.el' in Emacs 23+. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(@* "Internal variables (alphabetical)") ;;; Internal variables (alphabetical) -------------------------------- (defvar lacarte-menu-items-alist nil) ; Defined in `lacarte.el'. ;; These two are defined here so they won't raise an error in `font-lock-add-keywords'. (defvar font-lock-function-name-face 'font-lock-function-name-face ; In `font-lock.el'. "Face name to use for function names.") (defvar font-lock-keyword-face 'font-lock-keyword-face ; Defined in `font-lock.el'. "Face name to use for keywords.") (defvar icicle-abs-file-candidates () "Current alist of absolute file-name candidates. An alist appropriate as the COLLECTION argument for `completing-read'. Each item is a cons whose car is an absolute file name (a string).") (defvar icicle-acting-on-next/prev nil "Non-nil means this command acts on the previous or next candidate. The particular non-nil value indicates the navigation direction: `forward' or `backward'.") (defvar icicle-advice-info-list () "List of advice information for functions that Icicles redefines. If such redefined functions are advised, then Icicles deactivates the advice when you turn on Icicle mode. It restores the recorded advice activation state when you turn off Icicle mode.") (defvar icicle-all-candidates-action nil "Non-nil means that we are acting on all candidates. That is, `icicle-all-candidates-action-1' is in progress. If neither nil nor t, then the value is the action function to use.") (defvar icicle-all-candidates-list-action-fn nil "Action function to apply to a list of all matching completions.") (defvar icicle-all-candidates-list-alt-action-fn nil "Alternative action function to apply to a list of matching completions.") (defvar icicle-allowed-sort-predicate nil "Predicate that `icicle-current-sort-functions' allows in a sort order. That is, if this predicate is used in an entry of `icicle-sort-orders-alist' then that entry is retained by `icicle-current-sort-functions'.") (defvar icicle-apply-nomsg nil "Non-nil means `icicle-apply' does not show status of applying function.") (defvar icicle-apropos-complete-match-fn 'string-match "Function to filter apropos completion candidates. Takes as arguments an input string and a completion candidate, and returns non-nil if the string is considered to match the candidate. A value of nil instead of a function means completion candidates are not filtered by the input, except possibly by a function-valued `minibuffer-completion-table'.") (defvar icicle-apropos-value-last-initial-cand-set () "Cache for initial set of completion cands for `icicle-apropos-value'.") (defvar icicle-bookmark-history nil "History for bookmark names.") (defvar icicle-bookmark-list-names-only-p nil "Non-nil means `icicle-bookmark-list' returns names, not bookmarks.") (defvar icicle-bookmark-types () "List of strings naming bookmark types. The list represents the set of all bookmarks of the given types. An empty list and the singleton list `(all)', where `all' is a symbol, are equivalent and stand for the set of all bookmarks (of any type).") (defvar icicle-buffer-complete-fn nil "If the value is non-nil then it is a buffer-name completion function. The function is used as the COLLECTION argument to `completing-read'. However, if the value is `internal-complete-buffer' then it is used only if `icicle-buffer-ignore-space-prefix-flag' is non-nil. Otherwise, all buffer names are used as candidates.") (defvar icicle-buffer-config-history nil "History for buffer configuration names.") (defvar icicle-buffer-name-input-p nil "Non-nil means we are reading a buffer name.") (defvar icicle-buffer-sort-first-time-p t "Non-nil means buffer-name completion has not yet been used.") (defvar icicle-bufflist nil "List of buffers defined by macro `icicle-buffer-bindings'.") (defvar icicle-candidate-action-fn nil "Action function to apply to current completion candidate. For `icicle-all-candidates-action' to be able to report successes, this should return nil for \"success\" and non-nil for \"failure\".") (defvar icicle-candidate-alt-action-fn nil "Alternative action function to apply to current completion candidate. For `icicle-all-candidates-alt-action' to be able to report successes, this should return nil for \"success\" and non-nil for \"failure\".") (defvar icicle-candidate-entry-fn nil "Function to apply to selected entries in `icicle-candidates-alist'.") (defvar icicle-candidate-help-fn nil "Help function to be applied to current completion candidate. If nil then default help function `icicle-help-on-candidate' is used. If non-nil, it must be a function that accepts a completion candidate in its display form. If the candidate is a multi-completion then the help function can invoke `icicle-transform-multi-completion' on it, binding `icicle-list-use-nth-parts' as appropriate.") (defvar icicle-candidate-nb nil "Current completion candidate number, or nil if not cycling candidates. Numbering starts at zero.") (defvar icicle-candidate-properties-alist nil "Alist of multi-completion indexes and associated text properties. The text properties apply to candidates in `*Completions*'. Each alist entry has the form (NTH PROPERTIES) or (NTH PROPERTIES JOIN-TOO). NTH is a whole-number index identifying the multi-completion part. PROPERTIES is a list of text properties to apply to the part. JOIN-TOO non-nil means to also apply PROPERTIES to the join string that follows the part. Example alist: ((3 (face 'underline)) (2 (invisible t) t)) The first entry underlines the third multi-completion part. The second entry makes both the second part and the join string that follows it invisible.") (defvar icicle-candidates-alist nil "Alist of candidate entries. The car (key) of each entry is treated as a completion candidate. The cdr is some other data to be used when the candidate is chosen. This is reset to nil at the beginning of each top-level command. This is used typically by commands that allow different cdrs for the same car. Icicles search is one such example.") (defvar icicle-cands-to-narrow () "Saved `icicle-completion-candidates' for reference during narrowing.") (defvar icicle-char-property-value-history nil "History for character property values.") (defvar icicle-cmd-calling-for-completion 'ignore "Last command causing display of list of possible completions.") (defvar icicle-cmd-reading-input 'ignore "Last command reading input in the minibuffer.") (defvar icicle-color-history nil "History for color names.") (defvar icicle-color-theme-history nil "History for color-theme names.") (defvar icicle-command-abbrev-history nil "History of command and abbrev entries.") (defvar icicle-commands-for-abbrev nil "List of commands that match the current abbreviation.") (defvar icicle-common-match-string nil "Expanded common match among all completion candidates. nil means no such common match is available.") (defvar icicle-comp-base-is-default-dir-p nil "Non-nil means to use `default-directory' as the completion base. This means use its length as `completion-base-size'.") (defvar icicle-complete-input-overlay nil "Overlay used to highlight minibuffer input when it is complete.") (defvar icicle-complete-keys-alist () "Alist of keys and their bindings. Each alist element is of the form (NAME KEY . BINDING), where: NAME is a symbol naming the key and its binding, whose name has form: KEYNAME = BINDING-NAME KEY is the actual key sequence BINDING is the actual binding of KEY. Used only for Emacs 22 and later.") (defvar icicle-completing-keys-p nil "Non-nil means completion is currently for a key sequence. Used only for Emacs 22 and later.") (defvar icicle-completing-p nil "Cached value of function `icicle-completing-p'.") (defvar icicle-completion-candidates nil "Current list of completion candidates.") (defvar icicle-completion-prompt-overlay nil "Overlay used to highlight saved completion candidates.") (defvar icicle-completing-read+insert-candidates () "`completing-read' COLLECTION arg to use for `icicle-completing-read+insert'.") (defvar icicle-completion-set-history nil "History for completion-set names.") (defvar icicle-compute-narrowing-regexp-p nil "Non-nil means that narrowing computes `icicle-narrow-regexp'.") (defvar icicle-confirm-exit-commands (and (boundp 'minibuffer-confirm-exit-commands) (append '(icicle-prefix-complete icicle-prefix-complete-no-display icicle-prefix-word-complete icicle-apropos-complete icicle-apropos-complete-no-display icicle-apropos-complete-and-narrow ; ???? ;; icicle-apropos-complete-and-exit ; ???? ) minibuffer-confirm-exit-commands)) "Version of `minibuffer-confirm-exit-commands' for Icicle mode. Effective starting with Emacs 23.") (defvar icicle-current-completion-candidate-overlay nil "Overlay used to highlight current completion candidate.") (defvar icicle-current-completion-mode nil "Symbol `prefix' or `apropos', specifying the current completion mode.") (defvar icicle-current-input "" "Current minibuffer input.") (defvar icicle-current-TAB-method nil "*Current completion method for \ `\\\\[icicle-prefix-complete]'.") (defvar icicle-current-raw-input "" "Current minibuffer raw (unexpanded) input. This can be different from `icicle-current-input' only when `icicle-expand-input-to-common-match' causes your input to expand.") (defvar icicle-cycling-p nil "Non-nil means the user is currently cycling completion candidates.") (defvar icicle-default-thing-insertion-flipped-p nil "Non-nil means a previous `M-.' in this succession was used with `C-u'. This means that the meaning of `icicle-default-thing-insertion' has been reversed.") (defvar icicle-delete-candidate-object nil "Defines deletion action for command `icicle-delete-candidate-object'. The value can be a function or a symbol bound to an alist. If the value is a function, then the function is called on the current completion candidate (a string) to delete some corresponding object. If the value is a symbol (variable) bound to an alist, then `icicle-delete-current-candidate-object' is called to delete the corresponding object from that alist. If the variable is also a user option, then the option is saved after the candidate is deleted. Note that if the value is a variable and you use multi-completion candidates during completion, then the alist value of the variable must itself contain multi-completions. Otherwise, no candidate will be deleted, because `icicle-delete-current-candidate-object' deletes the full candidate object.") (defvar icicle-dictionary-history nil "History for dictionary entries.") (defvar icicle-dir-candidate-can-exit-p nil "Non-nil means you can exit the minibuffer when you choose a directory.") (defvar icicle-doc-history () "History for documentation entries.") (defvar icicle-doc-last-initial-cand-set () "Cache for initial set of completion candidates for `icicle-doc'.") (defvar icicle-dot-string-internal icicle-dot-string "Internal version of `icicle-dot-string' (same values). This is changed automatically by Icicles when you switch completion mode, whereas `icicle-dot-string' is changed only via user commands.") (defvar icicle-edit-update-p nil "Internal flag: non-nil when editing text in minibuffer. More precisely, non-nil when updating the completions list inside simple character-editing commands such as `icicle-self-insert' and `icicle-delete-backward-char'.") (defvar icicle-ess-use-ido nil "Non-nil means that `ess-completing-read' respects `ess-use-ido'. Otherwise, in Icicle mode `ess-completing-read' always uses Icicles completion, never Ido completion.") (defvar icicle-exclude-default-proxies nil "Non-nil means exclude default proxy candidates.") (defvar icicle-explore-final-choice "" "Final `icicle-explore' completion choice (a string).") (defvar icicle-explore-final-choice-full nil "Full alist element that corresponds to `icicle-explore-final-choice'. This is an element of `icicle-candidates-alist'. The element's car is a completion-candidate string.") (defvar icicle-extra-candidates nil "A list of extra completion candidates (strings).") (defvar icicle-extra-candidates-dir-insert-p t "Non-nil means, for an extra candidate, insert a directory component. Can be bound to nil to prevent adding a directory to non file-name extra candidates during file-name completion. An extra candidate is one that is a member of `icicle-extra-candidates'.") (defvar icicle-face-name-history nil "History for face names.") (defvar icicle-fancy-candidates-p nil "Non-nil means we are completing using possibly fancy candidates. That is, some candidates might have attached properties. You can bind this in your code if you need to treat fancy candidates and your code has no direct access to the `completing-read' PROMPT string. See section `Candidates with Text Properties' of the Icicles doc. If you set this to non-nil, instead of binding it, then Icicles will always check whether each completion candidate might be fancy. That can be costly.") (defvar icicle-fancy-cands-internal-p nil "Same as `icicle-fancy-candidates-p', but for internal use only. Do not set or bind this. This is bound only by `completing-read'.") (when (> emacs-major-version 23) (defvar icicle-file-name-completion-table (completion-table-in-turn #'icicle-completion--embedded-envvar-table #'completion-file-name-table) "Completion table used for file-name completion.")) (defvar icicle-file-sort-first-time-p t "Non-nil means file-name completion has not yet been used.") (defvar icicle-filtered-default-value nil "Minibuffer default value, after filtering with `icicle-filter-wo-input'.") (defvar icicle-font-name-history nil "History for font names.") (defvar icicle-frame-alist nil "Alist of frames, returned by `icicle-make-frame-alist'.") (defvar icicle-frame-name-history nil "History for frame names.") (defvar icicle-full-cand-fn nil "nil or a function to create a full candidate from a display candidate. If candidates are currently multi-completions then the display candidate is assumed to have been transformed first (using `icicle-transform-multi-completion').") (defvar icicle-function-name-history nil "History for function names. Each name is a symbol name or a lambda form, as a string.") (defvar icicle-fundoc-last-initial-cand-set () "Cache for initial set of completion candidates for `icicle-fundoc'.") (defvar icicle-general-help-string " Customize Icicles: `M-x icicle-customize-icicles-group'. Summary of customizable options and faces (alphabetical order). Some of the options can be toggled or cycled - the keys for this are noted in parentheses. * `case-fold-search', `completion-ignore-case', (`C-u') `read-file-name-completion-ignore-case' - Case sensitivity? (`C-A') * `completion-ignored-extensions' - Ignored filenames (`C-.') * `icicle-act-before-cycle-flag' - Act then cycle or reverse? * `icicle-add-proxy-candidates-flag' - Include proxies? (`C-M-_') * `icicle-alternative-actions-alist' - Overriding alt actions * `icicle-alternative-sort-comparer' - Other sort (`M-,', `C-M-,') * `icicle-apropos-complete-keys*' - Keys to apropos-complete * `icicle-apropos-cycle-*-keys' - Keys to apropos-cycle * `icicle-bookmark-name-length-max' - Max length of bookmark name * `icicle-bookmark-refresh-cache-flag' - Refresh bookmarks cache? * `icicle-top-level-key-bindings' - Bind top-level commands * `icicle-buffer-*' - `icicle-buffer' options * `icicle-candidate-width-factor' - Width %%, candidate columns * `icicle-change-region-background-flag' - Change region color? * `icicle-change-sort-order-completion-flag' - Control `C-,' behavior * `icicle-C-l-uses-completion-flag' - `C-l' uses completion? * `icicle-color-themes' - For `icicle-color-theme' * `icicle-comint-dynamic-complete-replacements' - Comint complete fns * `icicle-command-abbrev*' - Command abbrev behavior * `icicle-complete-key-anyway-flag' - `S-TAB' must complete keys * `icicle-complete-keys-self-insert-ranges'- `S-TAB' for self-insert? * `icicle-completing-read+insert-keys' - Keys for complete-on-demand * `icicle-completion-history-max-length' - Completion history length * `icicle-completion-key-bindings' - minibuffer completion keys * `icicle-completion-list-key-bindings' - `*Completions*' bindings * `icicle-Completions-display-min-input-chars'- Remove `*Completions*' if fewer chars input * `icicle-completions-format' - `*Completions*' layout * `icicle-move-Completions-frame' - `*Completions*' at edge? * `icicle-Completions-text-scale-decrease'- `*Completions*' shrink * `icicle-Completions-window-max-height' - Max lines, `*Completions*' * `icicle-customize-save-flag' - Save some options on quit? * `icicle-default-cycling-mode' - Default completion mode for per-mode cycling * `icicle-default-thing-insertion' - Control behavior of \ \\\\[icicle-insert-string-at-point] * `icicle-default-value' - How to treat default value * `icicle-define-alias-commands-flag' - Define top-level aliases? * `icicle-deletion-action-flag' - `S-delete' deletes? * `icicle-dot-show-regexp-flag' - Show regexp for `.'? * `icicle-dot-string' - String that `.' inserts * `icicle-expand-input-to-common-match' - Expand your input? (`C-\"') * `icicle-file-*' - `icicle-file' options * `icicle-filesets-as-saved-completion-sets-flag'- Use filesets? * `icicle-guess-commands-in-path' - Shell commands to complete * `icicle-help-in-mode-line-delay' - Secs to show candidate help * `icicle-hide-common-match-in-Completions-flag'- Show common match? * `icicle-hide-non-matching-lines-flag' - Hide non-match lines? * `icicle-highlight-historical-candidates-flag' - Highlight past input? * `icicle-highlight-input-completion-failure*'- Input non-match sign * `icicle-highlight-input-initial-whitespace-flag' - Highlight input whitespace? * `icicle-highlight-lighter-flag' - Highlight mode-line `Icy' * `icicle-incremental-completion' - Icompletion? (`C-#') * `icicle-incremental-completion-delay' - Delay before update cands * `icicle-incremental-completion-threshold'- # of candidates for delay * `icicle-inhibit-advice-functions' - Advice-inhibited functions * `icicle-inhibit-ding-flag' - Suppress audible bell * `icicle-input-string' - String inserted by `C-=' * `icicle-inter-candidates-min-spaces' - Min spaces among candidates * `icicle-isearch-complete-keys' - Keys to complete search * `icicle-key-complete-keys' - Keys to complete keys * `icicle-key-descriptions-use-<>-flag' - Show key names with \"<>\"? * `icicle-keymaps-for-key-completion' - `S-TAB' = key-complete maps * `icicle-kmacro-ring-max' - Icicles `kmacro-ring-max' * `icicle-levenshtein-distance' - Levenshtein match distance * `icicle-list-join-string' - Multi-completion join * `icicle-list-nth-parts-join-string' - Join split-candidate parts * `icicle-mark-position-in-candidate' - Mark position in cycling * `icicle-menu-items-to-history-flag' - Add menus to history? * `icicle-minibuffer-key-bindings' - general minibuffer keys * `icicle-minibuffer-setup-hook' - Functions run after setup * `icicle-modal-cycle-*-keys' - Keys for modal cycling * `icicle-option-type-prefix-arg-list' - Prefix-args for `C-h C-o' * `icicle-point-position-in-candidate' - Cursor position in cycling * `icicle-populate-interactive-history-flag'- Track interactive use? * `icicle-pp-eval-expression-print-*' - Print control for `pp-*' * `icicle-prefix-complete-keys*' - Keys to prefix-complete * `icicle-prefix-cycle-*-keys' - Keys to prefix-cycle * `icicle-quote-shell-file-name-flag' - Quote file name in shell? * `icicle-read+insert-file-name-keys' - Keys for on-demand file * `icicle-regexp-quote-flag' - Escape chars? (`C-`') * `icicle-regexp-search-ring-max' - `regexp-search-ring-max' * `icicle-region-background' - Background for region * `icicle-require-match-flag' - Override REQUIRE-MATCH? * `icicle-saved-completion-sets' - Completion sets for \ `\\[icicle-candidate-set-retrieve]' * `icicle-search-cleanup-flag' - Remove search highlighting? (`C-.') * `icicle-search-from-isearch-keys' - Isearch-to-Icicles keys * `icicle-search-highlight-all-current-flag'- In each hit (`C-^') * `icicle-search-highlight-context-levels-flag' - Highlight match subgroups? * `icicle-search-highlight-threshold' - # hits to highlight at once * `icicle-search-hook' - Functions run by `C-c `' * `icicle-search-replace-common-match-flag' - Replace ECM? (`M-;') * `icicle-search-replace-literally-flag' - Replace text literally? * `icicle-search-replace-whole-candidate-flag' - Replace input match or whole search hit?(`M-_') * `icicle-search-ring-max' - Icicles `search-ring-max' * `icicle-search-whole-word-flag' - Find whole words? (`M-q') * `icicle-show-Completions-help-flag' - Show `*Completions*' help? * `icicle-show-Completions-initially-flag'- Show `*Completions*' 1st? * `icicle-show-multi-completion-flag' - Show extra candidate info? * `icicle-sort-comparer' - Sort candidates (`C-,') * `icicle-sort-orders-alist' - Predicates for sorting * `icicle-special-candidate-regexp' - To highlight special cands * `icicle-S-TAB-completion-methods-alist'- `S-TAB' methods (`M-(') * `icicle-swank-*' - Swank completion control * `icicle-TAB-completion-methods' - `TAB' methods (`C-(') * `icicle-TAB-shows-candidates-flag' - 1st `TAB' shows candidates? * `icicle-test-for-remote-files-flag' - Check remote files? (`C-^') * `icicle-thing-at-point-functions' - Functions to yank things * `icicle-top-level-key-bindings' - Top-level key bindings * `icicle-top-level-when-sole-completion-*'- Exiting if one completion * `icicle-touche-pas-aux-menus-flag' - Add to standard menus? * `icicle-transform-function' - Remove duplicates (`C-$') * `icicle-type-actions-alist' - Objects and their types * `icicle-unpropertize-completion-result-flag'- Properties in result? * `icicle-update-input-hook' - Fns run when input changes * `icicle-use-~-for-home-dir-flag' - Use `~' for $HOME? (`M-~') * `icicle-use-C-for-actions-flag' - `C-' for actions? (`M-g') * `icicle-use-candidates-only-once-flag' - Remove used candidate? * `icicle-word-completion-keys' - Keys for word completion * `icicle-WYSIWYG-Completions-flag' - WYSIWYG `*Completions*'? * `icicle-yank-function' - Yank function to use Faces that highlight input in minibuffer. * `icicle-complete-input' - Input when it is complete * `icicle-completion' - Completing? * `icicle-input-completion-fail*' - Non-match part of input * `icicle-match-highlight-minibuffer' - Matched part of input * `icicle-multi-command-completion' - Multi-command completion? * `icicle-mustmatch-completion' - Strict completion? * `icicle-whitespace-highlight' - Initial whitespace in input Faces that highlight candidates in buffer `*Completions*'. * `icicle-candidate-part' - Part of candidate * `icicle-common-match-highlight-Completions' - Max common substring * `icicle-current-candidate-highlight' - Current candidate (cycling) * `icicle-extra-candidate' - Extra candidate * `icicle-historical-candidate' - Highlight candidates used * `icicle-match-highlight-Completions' - Matched part of input * `icicle-proxy-candidate' - Proxy candidate * `icicle-saved-candidate' - Saved candidate * `icicle-special-candidate' - Special candidate Faces that highlight information in the mode line. * `icicle-completion' - Completing? * `icicle-mode-line-help' - Candidate help * `icicle-multi-command-completion' - Multi-command completion? * `icicle-mustmatch-completion' - Strict completion? Faces that highlight for command `icicle-search'. * `icicle-search-context-level-*' - Regexp subgroup highlighting * `icicle-search-current-input' - What input matches * `icicle-search-main-regexp-current' - Current match of 1st regexp * `icicle-search-main-regexp-others' - Other matches of 1st regexp Icicle mode defines many top-level commands. For a list, see the Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'. These are all of the top-level bindings in Icicle mode: \\{icicle-mode-map}" "General help string included in `icicle-minibuffer-help'.") (defvar icicle-get-alist-candidate-function 'icicle-get-alist-candidate "Function used to retrieve a full completion candidate. The signature must match that of the default value, `icicle-get-alist-candidate'.") (defvar icicle-hist-cands-no-highlight () "List of candidates not highlighted using `icicle-historical-candidate'. Bind, don't assign this, since the same string can have different meanings in different contexts.") (defvar icicle-hist-var nil "A history variable. `let'-bind this to a history variable. Leave the global value as `nil', to use it conditionally: (or ...).") (defvar icicle-ignored-extensions completion-ignored-extensions "Copy of `completion-ignored-extensions', serving as a control flag. When `completion-ignored-extensions' changes, we remake `icicle-ignored-extensions-regexp'.") (defvar icicle-ignored-extensions-regexp (concat "\\(" (mapconcat #'regexp-quote completion-ignored-extensions "$\\|") "$\\)\\'") "Regular expression matching ignored file extensions. If this is nil, then no file extensions are ignored. The ignored file extensions come from `completion-ignored-extensions'.") (defvar icicle-incremental-completion-p nil "Takes the place of `icicle-incremental-completion' during input. The program updates this to `always' from `t' after `*Completions*' has been displayed.") (defvar icicle-Info-index-cache () "Cache list of index entries and their nodes and files. Each cache entry has the form (TOPIC NODE INFO-FILE).") (defvar icicle-Info-only-rest-of-book-p nil "Non-nil means complete only Info nodes from the rest of the book.") (defvar icicle-Info-tag-table-posn nil "Tag table position in last Info file used by `icicle-Info-goto-node'.") (defvar icicle-inhibit-sort-p nil "Non-nil means that users cannot sort completion candidates. They also cannot remove duplicates.") (defvar icicle-inhibit-try-switch-buffer nil "Non-nil means do not switch back to `icicle-orig-buff'. \(The potential switching is in `icicle-try-switch-buffer'.)") (defvar icicle-initial-value "" "Initial value used in minibuffer completion. Any function that reads from the minibuffer and accepts a default value or initial value should, before reading, put that value in `icicle-initial-value'. For example, `completing-read' does that. In addition, `completing-read' and `read-file-name' will respect this value, using it as the initial value if none is provided explicitly. This means that you can bind `icicle-initial-value' around an expression that calls `completing-read' or `read-file-name', and the bound value will be used as the initial value.") (defvar icicle-input-completion-fail-overlay nil "Overlay used to highlight the input portion that does not complete.") (defvar icicle-input-fail-pos nil "Position in minibuffer of start of completion match failure. Nil means no match failure is known.") (defvar icicle-insert-string-at-pt-end nil "Position of end of text `icicle-insert-string-at-point' inserted.") (defvar icicle-insert-string-at-pt-start nil "Position of start of text `icicle-insert-string-at-point' inserted.") (defvar icicle-interactive-history () "History of commands called using `call-interactively'.") (defvar icicle-key-prefix-description "" "Description of a prefix key at some point during key completion.") (defvar icicle-kill-history nil "History of kill-ring entries.") (when (boundp 'kmacro-ring) ; Emacs 22+ (defvar icicle-kmacro-alist nil "Alist with elements (CANDIDATE-NAME . RING-ITEM). CANDIDATE-NAME is 1, 2, 3.... RING-ITEM is an item in `kmacro-ring' or `(kmacro-ring-head)'.") (defvar icicle-kmacro-history nil "History for keyboard-macro names.")) (defvar icicle-last-apropos-complete-match-fn 'string-match "Last value of `icicle-apropos-complete-match-fn'.") (defvar icicle-last-completion-candidate "" "Last completion candidate used in minibuffer completion.") (defvar icicle-last-completion-command nil "Last completion command used.") (defvar icicle-last-input "" "Last minibuffer input typed (not from cycling).") (defvar icicle-last-sort-comparer (or icicle-sort-comparer 'icicle-case-string-less-p) "Local copy of `icicle-sort-comparer', so we can restore it.") (defvar icicle-last-top-level-command nil "Last top-level command used.") (defvar icicle-lighter-truncation "..." "String appended to Icy lighter to show candidates-list truncation.") (defvar icicle-list-use-nth-parts nil "List of indexes of multi-completion pieces to use. This is not an internal variable. You can bind this in your own Lisp code to affect completion behavior. An empty list means use the entire multi-completion. Otherwise, concatenate, in order, the Nth parts of the multi-completion, where N is each of the (one-based) indexes, in turn. Any index larger than the actual number of parts in the multi-completion means use the last part. For example: If the value is (1), then use only the first part of the multi-completion as the completion candidate. If the value is (2 1), then use as candidate the second part followed by the first part, the two parts being joined by option `icicle-list-nth-parts-join-string'. If the value is (1 99) and the multi-completion has fewer than 99 parts, then use the first and last parts, joined by `icicle-list-nth-parts-join-string'. If the value is (2 1 2), then use the second part, first part, and second part again - you can use a given part any number of times.") (defvar icicle-menu-map nil "Icicles menu-bar menu keymap.") (defvar icicle-minibuffer-message-ok-p t "Non-nil means we can show messages in minibuffer. This affects only `icicle-msg-maybe-in-minibuffer'.") (defvar icicle-minor-mode-map-entry nil "Icicles mode entry in `minor-mode-map-alist'.") (defvar icicle-mode-line-help nil "Current mode line help (a string), or nil if none.") (defvar icicle-ms-windows-drive-hash (and (fboundp 'make-hash-table) (make-hash-table :test 'equal)) "Hash table for caching result of MS Windows `NET USE' system calls. For Emacs 20 and 21, this is not used unless you load library `cl.el' at runtime.") (defvar icicle-multi-completing-p nil "Non-nil means we are currently completing with multi-completions.") (defvar icicle-multi-inputs-action-fn nil "Function to apply to candidates that result from splitting input. The current minibuffer input is interpreted as a list of candidates. This function is applied to each candidate in turn, in list order. If nil then act using function `icicle-candidate-action-fn'.") (defvar icicle-must-match-regexp nil "A regexp that completion candidates must match, or nil. If nil, then this does nothing. If a regexp (string), then show only candidates whose display form matches it (and matches the user input). The display form is the string shown in `*Completions*'. Note: This is similar to the standard variable `completion-regexp-list', except: * `completion-regexp-list' is a list of regexps, not just one. * `icicle-must-match-regexp' is used after filtering using option `icicle-transform-function'. See also `icicle-must-not-match-regexp'.") (defvar icicle-must-not-match-regexp nil "A regexp that completion candidates must not match, or nil. If nil, then this does nothing. If a regexp (string), then show only candidates whose display form does not match it. The display form is the string shown in `*Completions*'. See also `icicle-must-match-regexp'.") (defvar icicle-must-pass-after-match-predicate nil "Predicate that completions must satisfy after matching input, or nil. This is just like `icicle-must-pass-predicate', except that it is applied only to display candidates that match your current input.") (defvar icicle-must-pass-predicate nil "Predicate that completion display candidates must satisfy, or nil. If nil, then this does nothing. Otherwise, this is a function of one argument, a display candidate (a string), and only the display candidates that satisfy the predicate are displayed. A display candidate is a string of text such as you see in buffer `*Completions*'. Note that this predicate is different from the PREDICATE argument for function `completing-read' or `read-file-name'. The latter applies to the elements of the COLLECTION argument, which are typically alist entries or obarray symbols. `icicle-must-pass-predicate' applies instead to a string, the display form of a completion candidate. See also `icicle-must-pass-after-match-predicate'.") (defvar icicle-narrow-regexp nil "Regexp matching each member of `icicle-completion-candidates'. This is nil except during narrowing, and then only if `icicle-compute-narrowing-regexp-p' is non-nil.") (defvar icicle-nb-candidates-before-truncation 0 "Number of candidates, before truncation per `icicle-max-candidates'.") (defvar icicle-nb-of-other-cycle-candidates 0 "Number of other candidates available for cycling. This is for use by other libraries, in particular, `icomplete+.el'.") (defvar icicle-new-last-cmd nil "Copy of current command being executed. Used by, e.g., `icicle-execute-extended-command'.") (defvar icicle-next-apropos-complete-cycles-p nil "Whether the next apropos-completion command should cycle.") (defvar icicle-next-prefix-complete-cycles-p nil "Whether the next prefix-completion command should cycle.") (defvar icicle-orig-buff nil "Current buffer when you invoked an Icicles multi-command.") (defvar icicle-orig-must-pass-after-match-pred nil "Saved value of `icicle-must-pass-after-match-predicate'.") (defvar icicle-orig-pt-explore nil "Point when you invoked `icicle-explore'.") (defvar icicle-orig-read-file-name-fn (and (not (boundp 'read-file-name-function)) ; Em 22+ 'icicle-ORIG-read-file-name) ; Emacs 20, 21 "Value of `read-file-name-function' outside of Icicle mode. For versions of Emacs < 22, this is the original `read-file-name'.") (defvar icicle-orig-window nil "Selected window when you invoked an Icicles multi-command.") (defvar icicle-orig-win-explore nil "Selected window when you invoked `icicle-explore'.") (defvar icicle-other-window nil "Window scrolled by `icicle-scroll-forward'/`icicle-scroll-backward'") (defvar icicle-path-variables '(cd-path charset-map-path compilation-search-path custom-theme-load-path exec-path ffap-bib-path ffap-c-path ffap-fortran-path ffap-tex-path find-function-source-path image-load-path load-path x-bitmap-file-path) "List of variables whose value can be a list containing directories. The variables are not checked until they are used. At that time: * Any of them that are not bound are ignored. * If the value of any of them is not a list it is ignored. * If it is a list, any non-string elements in the list are ignored.") (defvar icicle-plist-last-initial-cand-set () "Cache for initial set of completion candidates for `icicle-plist'.") (defvar icicle-post-command-hook nil "Functions added to `post-command-hook' when in Icicle mode. Use command `icy-mode' (aka `icicle-mode') to set this up properly.") (defvar icicle-pre-command-hook nil "Functions added to `pre-command-hook' when in Icicle mode. Use command `icy-mode' (aka `icicle-mode') to set this up properly.") (defvar icicle-predicate-types-alist '(("arrayp") ("atom") ("auto-save-file-name-p" . "file") ("backup-file-name-p" . "file") ("booleanp") ("bool-vector-p") ("bufferp" . "buffer") ("byte-code-function-p" . "function") ("byte-compile-const-symbol-p" . "symbol") ("case-table-p") ("char-or-string-p") ("char-table-p") ("color-defined-p" . "color") ("commandp" . "command") ("consp") ("custom-variable-p" . "option") ("display-table-p") ("facep" . "face") ("fboundp" . "function") ("ffap-file-remote-p" . "file") ("file-accessible-directory-p" . "file") ("file-directory-p" . "file") ("file-executable-p" . "file") ("file-exists-p" . "file") ("file-name-absolute-p" . "file") ("file-readable-p" . "file") ("file-regular-p" . "file") ("file-remote-p" . "file") ("file-symlink-p" . "file") ("file-writable-p" . "file") ("floatp") ("frame-configuration-p") ("frame-iconified-p" . "frame") ("frame-live-p" . "frame") ("frame-visible-p" . "frame") ("framep" . "frame") ("functionp" . "function") ("hash-table-p") ("icicle-binary-option-p" . "option") ("info-file-exists-p" . "file") ("integer-or-marker-p") ("integerp") ("keymapp") ("keywordp") ("listp") ("local-variable-p" . "variable") ("markerp") ("wholenump") ("nlistp") ("numberp") ("number-or-marker-p") ("overlayp") ("processp" . "process") ("process-running-child-p" . "process") ("risky-local-variable-p" . "variable") ("safe-local-variable-p" . "variable") ("sequencep") ("string-or-null-p") ("stringp") ("subrp") ("symbolp" . "symbol") ("syntax-table-p") ("thumfr-thumbnail-frame-p" . "frame") ("truncated-partial-width-window-p" . "window") ("user-variable-p" . "option") ("vectorp") ("window-configuration-p") ("window-fixed-size-p" . "window") ("window-full-width-p" . "window") ("window-live-p" . "window") ("window-minibuffer-p" . "window") ("windowp" . "window") ("window-safely-shrinkable-p" . "window") ("x-color-defined-p" . "color")) "Alist of type names that are predicate names. Each element is cons of a predicate name and the associated type from `icicle-type-actions-alist' (or nil if there is no associated type).") (defvar icicle-pref-arg nil "Prefix arg value when you invoked an Icicles multi-command.") (defvar icicle-pre-minibuffer-buffer nil "Buffer that was current before the minibuffer became active.") (defvar icicle-previous-raw-file-name-inputs nil "Previous inputs user has typed during file-name completion. These are inputs typed but not necessarily entered with `RET'.") (defvar icicle-previous-raw-non-file-name-inputs nil "Previous inputs user has typed during non-file-name completion. These are inputs typed but not necessarily entered with `RET'.") (defvar icicle-progressive-completing-p nil "Non-nil means this completion is a narrowing completion.") (defvar icicle-prompt nil "A minibuffer prompt. `let'-bind this to a string. Leave the global value as `nil', to use it conditionally: (or ...).") (defvar icicle-proxy-candidate-regexp nil "Regexp to match proxy candidates, or nil to do nothing. The candidates are highlighted in buffer `*Completions*' using face `icicle-proxy-candidate'.") (defvar icicle-proxy-candidates nil "List of proxy completion candidates (strings).") (when (fboundp 'read-char-by-name) ; Emacs 23+ (defvar icicle-read-char-history () "History list for reading characters by name. Augmented by `icicle-read-char-maybe-completing' and `icicle-read-char-by-name'.")) (defvar icicle-read-expression-map nil "Icicle mode version of `read-expression-map'. Several Emacs-Lisp mode key bindings are used.") (unless icicle-read-expression-map (let ((map (make-sparse-keymap))) (define-key map (icicle-kbd "C-M-i") 'lisp-complete-symbol) ; `ESC TAB', `C-M-i' (define-key map (icicle-kbd "C-i") 'lisp-indent-line) ; `C-i', `TAB' (define-key map (icicle-kbd "ESC tab") 'lisp-complete-symbol) ; `ESC tab' (define-key map (icicle-kbd "C-M-x") 'eval-defun) ; `ESC C-x', `C-M-x' (define-key map (icicle-kbd "C-M-q") 'indent-pp-sexp) ; `ESC C-q', `C-M-q' ;;(define-key map (icicle-kbd "DEL") 'backward-delete-char-untabify) (set-keymap-parent map minibuffer-local-map) (setq icicle-read-expression-map map))) (when (fboundp 'read-file-name-default) ; Emacs 24+ (defvar icicle-read-file-name-internal-fn 'read-file-name-internal "Function replacing `read-file-name-internal' in `read-file-name-default'. Function `icicle-read-file-name-default' is the same as `read-file-name-default', except that instead of hard-coding the use of `read-file-name-internal' it uses the value of this variable. Lisp code can thus bind this var to replace `read-file-name-internal'.")) (defvar icicle-remove-icicles-props-p t "Non-nil means to remove Icicles text properties from completion result. Icicles binds this internal variable to nil in contexts where it needs the completion result string to retain its Icicles text properties. Otherwise, function `icicle-unpropertize-completion' removes at least the Icicles internal text properties from the final completion result. Depending on the value of option `icicle-unpropertize-completion-result-flag', it may also remove all text properties.") ;; Same as `directory-files-no-dot-files-regexp' in `files.el', available for Emacs 23+. (defconst icicle-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" "Regexp that matches anything except `.' and `..'.") (defvar icicle-require-match-p nil "Current REQUIRE-MATCH arg to `completing-read' or `read-file-name'. Starting with Emacs 23, this is no longer enough to tell whether a match is required - use function `icicle-require-match-p' instead.") (defvar icicle-reverse-multi-sort-p nil "Non-nil means the truth values returned by predicates are complemented. This changes the order of the sorting groups, but it does not in general reverse that order. The order within each group is unchanged \(not reversed).") (defvar icicle-reverse-sort-p nil "Non-nil means that candidates are being sorted in the reverse order.") (defvar icicle-saved-candidate-overlays nil "Overlays used to highlight saved completion candidates.") (defvar icicle-saved-candidates-variables-obarray (make-vector 100 0) "Obarray of variables you have saved sets of completion candidates in. Used for completion in `icicle-candidate-set-retrieve-from-variable'.") (defvar icicle-saved-completion-candidate nil "Completion candidate to be restored after recursive `completing-read'.") (defvar icicle-saved-completion-candidates nil "Completion candidates saved using `icicle-candidate-set-save'.") (defvar icicle-saved-completion-candidates-internal nil "Completion candidates saved temporarily by program.") (defvar icicle-saved-ignored-extensions nil "Local copy of `icicle-ignored-extensions', so we can restore it.") (when (boundp 'kmacro-ring) ; Emacs 22+ (defvar icicle-saved-kmacro-ring-max kmacro-ring-max "Saved value of `kmacro-ring-max', so it can be restored.")) (defvar icicle-saved-regexp-search-ring-max regexp-search-ring-max "Saved value of `search-ring-max', so it can be restored.") (defvar icicle-saved-proxy-candidates nil "Saved value of `icicle-proxy-candidates'.") (defvar icicle-saved-region-background nil "Background of `region' face. Saved so it can be restored.") (defvar icicle-saved-search-ring-max search-ring-max "Saved value of `search-ring-max', so it can be restored.") (defvar icicle-scan-fn-or-regexp nil "`icicle-search' parameter SCAN-FN-OR-REGEXP. Used by `M-,'.") (defvar icicle-scroll-Completions-reverse-p nil "Non-nil means `icicle-scroll-Completions-*' scrolls in opposite direction.") (defvar icicle-search-command 'icicle-search "Command to use for Icicles searches. You can set a buffer-local value of this variable, to use a specific search command in a particular mode.") (defvar icicle-search-complement-domain-p nil "Non-nil means complement the initial search candidates wrt the buffer. This has an effect only on (some) Icicles search commands. The scan function or regexp for the search command defines a set of matches in the buffer. If this option is non-nil then the actual candidates used are the sections of buffer text that are separated by the initial candidates, that is, the non-candidates as defined by the scan or regexp.") (defvar icicle-search-context-level 0 "Match level for `icicle-search' context regexp. 0 means use whatever matches the whole context regexp as the search context. 1 means use whatever matches the first subgroup of the regexp as the search context, and so on.") (defvar icicle-search-context-regexp "" "Current search-context regexp used in `icicle-search'.") (defvar icicle-search-current-overlay nil "Overlay used to highlight current match of `icicle-search' regexp arg.") (defvar icicle-search-final-choice nil "Final user input from `icicle-search'. This might or might not be one of the possible search candidates.") (defvar icicle-search-history nil "History for `icicle-search' final choices.") (defvar icicle-search-in-context-fn 'icicle-search-in-context-default-fn "Function used by `icicle-search-action' to act on search context. The default value is `icicle-search-in-context-default-fn'. The function must take two arguments: - A full search candidate object, which is a cons of the candidate name and its source-file marker. - A replacement string, or nil, if no replacement is to be made. When the function is called, the region has been narrowed to the current search context.") (defvar icicle-searching-p nil "Non-nil means an Icicles search command is in progress.") (defvar icicle-search-level-overlays nil "Overlays used to highlight context levels other than the top level.") (defvar icicle-search-map (let ((map (make-sparse-keymap))) (define-key map (icicle-kbd "b") 'icicle-search-buffer) ; `b'uffer (define-key map (icicle-kbd "c") 'icicle-search-char-property) ; `c'har property (define-key map (icicle-kbd "d") 'icicle-search-defs) ; `d'efinitions (define-key map (icicle-kbd "D") 'icicle-search-defs-full) ; `D'efinitions (define-key map (icicle-kbd ",") 'icicle-tags-search) ; Like `M-,' for `tags-loop-continue' (define-key map (icicle-kbd "f") 'icicle-search-file) ; `f'ile (define-key map (icicle-kbd "g") 'icicle-grep-saved-file-candidates) ; `g'rep (define-key map (icicle-kbd "i") 'icicle-imenu) ; `i'menu (define-key map (icicle-kbd "I") 'icicle-imenu-full) ; `I'menu (define-key map (icicle-kbd "j") 'icicle-search-bookmark) ; `j'ump to bookmark first (define-key map (icicle-kbd "J") 'icicle-search-bookmarks-together); `J'ump to bookmark 1st (define-key map (icicle-kbd "k") 'icicle-search-keywords) ; `k'eywords (define-key map (icicle-kbd "l") 'icicle-search-lines) ; `l'ines (define-key map (icicle-kbd "C-l") 'icicle-search-pages) ; `C-l' is the page separator ;; Save `m' for `marked'/`mode-specific'. (define-key map (icicle-kbd "o") 'icicle-occur) ; `o'ccur (define-key map (icicle-kbd "p") 'icicle-search-paragraphs) ; `p'aragraphs (define-key map (icicle-kbd "O") 'icicle-search-overlay-property) ; `O'verlay (define-key map (icicle-kbd "s") 'icicle-search-sentences) ; `s'entence (define-key map (icicle-kbd "M-s") 'icicle-search-generic) (define-key map (icicle-kbd "t") 'icicle-search-thing) ; `t'hing (define-key map (icicle-kbd "T") 'icicle-search-text-property) ; `T'ext (define-key map (icicle-kbd "w") 'icicle-search-word) ; `w'ord (define-key map (icicle-kbd "x") 'icicle-search-xml-element) ; `x'ml (define-key map (icicle-kbd "X") 'icicle-search-xml-element-text-node) ; `X'ml map) "Keymap for Icicles search commands. It is bound to the key prefix `icicle-search-key-prefix'.") (defvar icicle-search-modes '((dired-mode (progn (unless (fboundp 'diredp-get-files) (icicle-user-error "You need library `Dired+' for this")) (diredp-get-files))) (ibuffer-mode (nreverse (ibuffer-get-marked-buffers))) (Buffer-menu-mode (Buffer-menu-marked-buffers)) (bookmark-bmenu-mode (progn (unless (fboundp 'bmkp-bmenu-get-marked-files) (icicle-user-error "You need library `Bookmark+' for this")) (bmkp-bmenu-get-marked-files)))) "Alist that maps `major-mode' values to sexps that return WHERE. Each entry is a two-element list (MODE SEXP). SEXP returns the WHERE argument for `icicle-search', for MODE.") (defvar icicle-search-overlays nil "Overlays used to highlight match of `icicle-search' regexp argument.") (defvar icicle-search-refined-overlays nil "Overlay(s) used to highlight match of current input for `icicle-search'. If `icicle-search-highlight-threshold' is less than one, then this is a single overlay (or nil). Otherwise, this is a list of overlays.") (defvar icicle-search-replacement nil "Replacement string for use during `icicle-search'.") (defvar icicle-search-replacement-history nil "History variable for reading replacement string for `icicle-search'.") (defvar icicle-successive-grab-count 0 "Number of text things to be grabbed by next `\\\ \\[icicle-insert-string-at-point]'.") (defvar icicle-text-property-value-history nil "History variable for reading text properties.") ;; (defvar icicle-text-properties-alist ;; '(;; Properties listed in Elisp manual node `Special Properties': ;; ("category") ("face") ("font-lock-face") ("mouse-face") ("fontified") ("display") ;; ("help-echo") ("keymap") ("local-map") ("syntax-table") ("read-only") ("invisible") ;; ("intangible") ("field") ("cursor") ("pointer") ("line-spacing") ("line-height") ;; ("modification-hooks") ("insert-in-front-hooks") ("insert-behind-hooks") ;; ("point-entered") ("point-left") ;; ;; Properties listed in Elisp manual node `Format Properties': ;; ("hard") ("right-margin") ("left-margin") ("justification") ;; ;; Properties listed in Elisp manual node `Links and Mouse-1': ;; ("follow-link") ;; ;; Others in Emacs-Lisp libraries in directory `lisp': ;; ("allout-was-hidden") ("ansi-color") ("buffer") ("buffer-name") ("column") ;; ("button") ("skip") ("literal") ("front-sticky") ("rear-nonsticky") ("composition") ;; ("untranslated-utf-8") ("yank-handler") ("dired-filename") ("read-face-name") ;; ("directory") ("message") ("debug") ("font-lock-multiline") ("unknown") ;; ("insert-in-front-hooks") ("kbd-help") ("hilit-chg") ("ibuffer-filter-group-name") ;; ("ibuffer-properties") ("ibuffer-title") ("ibuffer-summary") ;; ("ibuffer-title-header") ("inhibit-line-move-field-capture") ("image-counter") ;; ("header-line") ("cvs-goal-column") ("occur-target") ("occur-match") ;; ("foreign-selection") ("before-string") ("after-string") ("ses") ;; ("smerge-force-highlighting") ("speedbar-function") ("speedbar-token") ;; ("speedbar-text") ("type") ("stroke-glyph") ("data") ("thumb-image-file") ;; ("original-file-name") ("associated-dired-buffer") ("tags") ("comment") ;; ("tumme-thumbnail") ("tutorial-remark") ("vc-cvs-annotate-time") ("end-name") ;; ("old-name") ("end-link") ("old-link") ("end-perm") ("old-perm") ("perm-changed") ;; ("widget-doc") ("secret") ("real-field") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/emacs-lisp': ;; ("elp-symname") ("printed-value") ("duplicable") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/emulation': ;; ("cursor") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/erc': ;; ("erc-callback") ("erc-data") ("erc-identified") ("erc-parsed") ("erc-parsed") ;; ("timestamp") ("erc-prompt") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/eshell': ;; ("comment") ("arg-begin") ("arg-end") ("escaped") ("history") ("number") ;; ("test-func") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/gnus': ;; ("earcon-data") ("earcon-callback") ("gnus-category") ("gnus-part") ;; ("article-type") ("gnus-decoration") ("dummy-invisible") ("original-date") ;; ("gnus-data") ("gnus-callback") ("gnus-prev") ("gnus-next") ("gnus-mime-details") ;; ("gnus-line-format") ("gnus-backlog") ("gnus-image-category") ;; ("gnus-image-text-deletable") ("gnus-group") ("gnus-level") ("gnus-indentation") ;; ("gnus-unread") ("gnus-number") ("articles") ("gnus-server") ("gnus-named-server") ;; ("gnus-intangible") ("gnus-topic") ("gnus-topic-level") ("gnus-topic-unread") ;; ("gnus-topic-visible") ("gnus-active") ("gnus-position") ("gnus-time") ;; ("gnus-face") ("gnus-undeletable") ("message-rank") ("egg-end") ("egg-lang") ;; ("egg-start") ("message-hidden") ("message-deletable") ("buffer") ("from") ("mm") ;; ("script-name") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/international': ;; ("kkc-conversion-index") ("advice") ("untranslated-utf-8") ("composition") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/mail': ;; ("footnote-number") ("rmail-fontified") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/mh-e': ;; ("mh-data") ("mh-mime-inserted") ("mh-part") ("mh-region") ("mh-callback") ;; ("mh-button-pressed") ("mh-line-format") ("mh-folder") ("mh-children-p") ;; ("mh-expanded") ("mh-level") ("mh-count") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/net': ;; ("feed") ("w3m-image") ("nt-age") ("nt-title") ("nt-guid") ("nt-desc") ;; ("org-invisible") ("nt-link") ("nt-type") ("nt-face") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/progmodes': ;; ("c-type") ("c-awk-NL-prop") ("c-is-sws") ("c-decl-arg-start") ("c-decl-end") ;; ("c-decl-id-start") ("c-decl-type-start") ("message") ("REx-interpolated") ;; ("in-pod") ("here-doc-group") ("syntax-type") ("indentable") ("REx-part2") ;; ("first-format-line") ("attrib-group") ("cperl-postpone") ("cpp-data") ;; ("cpp-callback") ("token") ("ebrowse-tree") ("ebrowse-member") ("ebrowse-what") ;; ("gdb-enabled") ("gdb-bptno") ("gdb-max-frames") ("link") ("fetch") ("begin-glyph") ;; ("begin-glyph-layout") ("idlwave-class") ("data") ("source") ("keyword") ;; ("find-args") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/term': ;; ("mac-ts-active-input-string") ;; ;; Others in Emacs-Lisp libraries in directory `lisp/textmodes': ;; ("fill-space") ("priority") ("test") ("end-glyph") ("begin-glyph") ("org-cwidth") ;; ("org-dwidth") ("org-dwidth-n") ("org-linked-text") (":org-clock-minutes") ;; ("org-protected") ("org-date-line") ("org-today") ("day") ("org-agenda-type") ;; ("time-of-day") ("org-not-done-regexp") ("prefix-length") ("tags") ("org-marker") ;; ("org-agenda-diary-link") ("org-hd-marker") ("dotime") ("org-category") ;; ("undone-face") ("done-face") ("xr-alist") ("table-cell") ("text-clones") ;; ;; Others in my own libraries: ;; ("font-lock-ignore") ("highlight") ("back-link") ("forward-link")) ;; "Alist of text properties known to Emacs. ;; Each element is of form (PROP), where PROP is the name of a text ;; property (a string).") (defvar icicle-thing-at-pt-fns-pointer 0 "Current index into the car of `icicle-thing-at-point-functions'. This points to the current function in the list.") (defvar icicle-toggle-transforming-message "Completion-candidate transformation is now %s" "Message used by `icicle-toggle-transforming'. A format string that includes one `%s', to be replaced by `ON'/`OFF'.") (defvar icicle-transform-before-sort-p nil "Non-nil means transform each multi-completion candidate before sorting. Bind this to non-nil if you do not want sorting to use the whole multi-completion.") (defvar icicle-transform-function nil ; Toggle with `C-$,'. "Function used to transform the list of completion candidates. This is applied to the list of initial candidates. If this is nil, then no transformation takes place. You can toggle this at any time from the minibuffer using `C-$,'. The value is changed by program locally, for use in particular contexts. E.g., when you use `C-c C-`' (`icicle-search-generic') in a `*shell*' buffer, Icicles uses this variable with a value of `icicle-remove-duplicates', to remove duplicate shell commands from your input history list. You can use this variable in your Lisp code to transform the list of candidates any way you like. A typical use is to remove duplicates, by binding it to `icicle-remove-duplicates' or `icicle-remove-dups-if-extras'.") (defvar icicle-last-transform-function (or icicle-transform-function 'icicle-remove-duplicates) "Local copy of `icicle-transform-function', so we can restore it.") (defvar icicle-universal-argument-map (let ((map (make-sparse-keymap))) (define-key map [t] 'icicle-universal-argument-other-key) (define-key map (vector meta-prefix-char t) 'icicle-universal-argument-other-key) (define-key map [switch-frame] nil) (define-key map (icicle-kbd "C-u") 'icicle-universal-argument-more) (define-key map (icicle-kbd "-") 'icicle-universal-argument-minus) (define-key map (icicle-kbd "0") 'icicle-digit-argument) (define-key map (icicle-kbd "1") 'icicle-digit-argument) (define-key map (icicle-kbd "2") 'icicle-digit-argument) (define-key map (icicle-kbd "3") 'icicle-digit-argument) (define-key map (icicle-kbd "4") 'icicle-digit-argument) (define-key map (icicle-kbd "5") 'icicle-digit-argument) (define-key map (icicle-kbd "6") 'icicle-digit-argument) (define-key map (icicle-kbd "7") 'icicle-digit-argument) (define-key map (icicle-kbd "8") 'icicle-digit-argument) (define-key map (icicle-kbd "9") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-0") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-1") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-2") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-3") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-4") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-5") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-6") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-7") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-8") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-9") 'icicle-digit-argument) (define-key map (icicle-kbd "kp-subtract") 'icicle-universal-argument-minus) map) "Keymap used while processing `C-u' during Icicles completion.") (defvar icicle-use-candidates-only-once-alt-p nil "*Non-nil means remove each candidate from the set after using it. This is similar to `icicle-use-candidates-only-once-flag', but it is used only for alternative actions (e.g. `C-S-RET').") (defvar icicle-vardoc-last-initial-cand-set () "Cache for initial set of completion candidates for `icicle-vardoc'.") (defvar icicle-whole-candidate-as-text-prop-p nil "Non-nil means string candidate has candidate data as text property. If non-nil, then the value of text property `icicle-whole-candidate' for a string completion candidate (e.g. what is displayed) is the cdr of the full completion-candidate alist element. The car of that element is the string.") (defvar icicle-variable-name-history nil "History for variable names.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles-var) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles-var.el ends here icicles-2013.04.23.23400/icicles.el000066400000000000000000002312571214003072700161330ustar00rootroot00000000000000;;; icicles.el --- Minibuffer input completion and cycling. ;; ;; Filename: icicles.el ;; Description: Minibuffer completion and cycling. ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved. ;; Created: Tue Aug 1 14:21:16 1995 ;; Version: 2013.04.23 ;; Last-Updated: Tue Apr 30 13:51:20 2013 (-0700) ;; By: dradams ;; Update #: 23400 ;; URL: http://www.emacswiki.org/icicles.el ;; Doc URL: http://emacswiki.org/Icicles ;; Keywords: extensions, help, abbrev, local, minibuffer, ;; keys, apropos, completion, matching, regexp, command ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x ;; ;; Features that might be required by this library: ;; ;; `advice', `advice-preload', `apropos', `apropos+', ;; `apropos-fn+var', `avoid', `bookmark', `bookmark+', ;; `bookmark+-1', `bookmark+-bmu', `bookmark+-key', ;; `bookmark+-lit', `cl', `cus-edit', `cus-face', `cus-load', ;; `cus-start', `dired', `dired+', `dired-aux', `dired-x', ;; `doremi', `easymenu', `el-swank-fuzzy', `ffap', `ffap-', ;; `fit-frame', `frame-cmds', `frame-fns', `fuzzy', `fuzzy-match', ;; `help+20', `hexrgb', `icicles-cmd1', `icicles-cmd2', ;; `icicles-face', `icicles-fn', `icicles-mcmd', `icicles-mode', ;; `icicles-opt', `icicles-var', `image-dired', `info', `info+', ;; `kmacro', `levenshtein', `menu-bar', `menu-bar+', `misc-cmds', ;; `misc-fns', `mouse3', `mwheel', `naked', `pp', `pp+', ;; `regexp-opt', `ring', `ring+', `second-sel', `strings', ;; `subr-21', `thingatpt', `thingatpt+', `unaccent', `w32-browser', ;; `w32browser-dlgopen', `wid-edit', `wid-edit+', `widget'. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; Minibuffer input completion and cycling of completion candidates. ;; ;; Input completion takes as input a string and returns a name that ;; contains the input string. This library enables minibuffer ;; cycling of completion candidates, and provides additional support ;; for input completion. ;; ;; Two kinds of completion are offered here, which are distinguished ;; by how the input string is matched against the completed name: ;; ;; - Prefix completion - The input string is a prefix of the ;; completed name. This is the usual Emacs ;; completion. ;; ;; - Apropos completion - The input string is a regular expression ;; that matches somewhere (anywhere) within ;; the completed name. You can think of the ;; name as having been returned by `apropos' ;; (except it also works for file and buffer ;; names). ;; ;; Files `icicles-doc1.el' and `icicles-doc2.el' contain the doc for ;; Icicles, including how to install and use Icicles. You can also ;; read the Icicles doc, in formatted form, on the Emacs-Wiki Web ;; site: http://www.emacswiki.org/Icicles. Emacs Wiki also has a few ;; addtional pages about Icicles. In particular, if you are new to ;; Emacs, as well as Icicles, see this page: ;; http://www.emacswiki.org/EmacsNewbieWithIcicles. ;; ;; See also: Library `lacarte.el', which lets you execute menu ;; commands, cycling and completing them. It is not part of Icicles, ;; but it is greatly enhanced by Icicles. ;;(@> "Index") ;; ;; Index ;; ----- ;; ;; If you have library `linkd.el' and Emacs 22 or later, load ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily ;; navigate around the sections of this doc. Linkd mode will ;; highlight this Index, as well as the cross-references and section ;; headings throughout this file. You can get `linkd.el' here: ;; http://dto.freeshell.org/notebook/Linkd.html. ;; ;; (@> "Things Defined in Icicles") ;; (@> "Miscellaneous") ;;(@* "Things Defined in Icicles") ;; ;; Things Defined in Icicles ;; ------------------------- ;; ;; Key bindings defined in Icicles: see (@> "Key Bindings"), below. ;; ;; Macros defined in Icicles: ;; ;; `icicle-buffer-bindings', `icicle-condition-case-no-debug', ;; `icicle-define-add-to-alist-command', ;; `icicle-define-bookmark-command', ;; `icicle-define-bookmark-command-1', ;; `icicle-define-bookmark-other-window-command', ;; `icicle-define-command', `icicle-define-file-command', ;; `icicle-define-search-bookmark-command', ;; `icicle-define-sort-command', `icicle-file-bindings', ;; `icicle-maybe-cached-action', `icicle-search-modes', ;; `icicle-with-comments-hidden', `icicle-with-selected-window'. ;; ;; Commands defined in Icicles - ;; ;; Commands to be used mainly at top level: ;; ;; `a', `any', `buffer', `clear-option', ;; `cycle-icicle-expand-to-common-match', ;; `cycle-icicle-image-file-thumbnail', ;; `cycle-icicle-incremental-completion', ;; `cycle-icicle-sort-order', ;; `cycle-icicle-S-TAB-completion-method', ;; `cycle-icicle-TAB-completion-method', `file', ;; `icicle-add-buffer-candidate', `icicle-add-buffer-config', ;; `icicle-add-entry-to-saved-completion-set', ;; `icicle-add-file-to-fileset', ;; `icicle-add/update-saved-completion-set', `icicle-anything', ;; `icicle-apply' `icicle-apropos', `icicle-apropos-command', ;; `icicle-apropos-function', `icicle-apropos-option', ;; `icicle-apropos-options-of-type', `icicle-apropos-value', ;; `icicle-apropos-variable', ;; `icicle-apropos-vars-w-val-satisfying', `icicle-apropos-zippy', ;; `icicle-bbdb-complete-mail', `icicle-bbdb-complete-name', ;; `icicle-bookmark', `icicle-bookmark-a-file', ;; `icicle-bookmark-all-tags', ;; `icicle-bookmark-all-tags-other-window', ;; `icicle-bookmark-all-tags-regexp', ;; `icicle-bookmark-all-tags-regexp-other-window', ;; `icicle-bookmark-autofile', `icicle-bookmark-autofile-all-tags', ;; `icicle-bookmark-autofile-all-tags-other-window', ;; `icicle-bookmark-autofile-all-tags-regexp', ;; `icicle-bookmark-autofile-all-tags-regexp-other-window', ;; `icicle-bookmark-autofile-other-window', ;; `icicle-bookmark-autofile-some-tags', ;; `icicle-bookmark-autofile-some-tags-other-window', ;; `icicle-bookmark-autofile-some-tags-regexp', ;; `icicle-bookmark-autofile-some-tags-regexp-other-window', ;; `icicle-bookmark-autonamed', ;; `icicle-bookmark-autonamed-other-window', ;; `icicle-bookmark-autonamed-this-buffer', ;; `icicle-bookmark-autonamed-this-buffer-other-window', ;; `icicle-bookmark-bookmark-file', ;; `icicle-bookmark-bookmark-list', `icicle-bookmark-cmd', ;; `icicle-bookmark-desktop', `icicle-bookmark-dired', ;; `icicle-bookmark-dired-other-window', ;; `icicle-bookmarked-buffer-list', `icicle-bookmarked-file-list', ;; `icicle-bookmark-file', `icicle-bookmark-file-all-tags', ;; `icicle-bookmark-file-all-tags-other-window', ;; `icicle-bookmark-file-all-tags-regexp', ;; `icicle-bookmark-file-all-tags-regexp-other-window', ;; `icicle-bookmark-file-other-window', ;; `icicle-bookmark-file-some-tags', ;; `icicle-bookmark-file-some-tags-other-window', ;; `icicle-bookmark-file-some-tags-regexp', ;; `icicle-bookmark-file-some-tags-regexp-other-window', ;; `icicle-bookmark-file-this-dir', ;; `icicle-bookmark-file-this-dir-other-window', ;; `icicle-bookmark-file-this-dir-all-tags', ;; `icicle-bookmark-file-this-dir-all-tags-other-window', ;; `icicle-bookmark-file-this-dir-all-tags-regexp', ;; `icicle-bookmark-file-this-dir-all-tags-regexp-other-window', ;; `icicle-bookmark-file-this-dir-some-tags', ;; `icicle-bookmark-file-this-dir-some-tags-other-window', ;; `icicle-bookmark-file-this-dir-some-tags-regexp', ;; `icicle-bookmark-file-this-dir-some-tags-regexp-other-window', ;; `icicle-bookmark-gnus', `icicle-bookmark-gnus-other-window', ;; `icicle-bookmark-image', `icicle-bookmark-image-other-window', ;; `icicle-bookmark-info', `icicle-bookmark-info-other-window', ;; `icicle-bookmark-jump', `icicle-bookmark-jump-other-window', ;; `icicle-bookmark-list', `icicle-bookmark-local-file', ;; `icicle-bookmark-local-file-other-window', ;; `icicle-bookmark-man', `icicle-bookmark-man-other-window', ;; `icicle-bookmark-non-file', ;; `icicle-bookmark-non-file-other-window', ;; `icicle-bookmark-other-window', `icicle-bookmark-region', ;; `icicle-bookmark-region-other-window', ;; `icicle-bookmark-remote-file', ;; `icicle-bookmark-remote-file-other-window', ;; `icicle-bookmark-save-marked-files', ;; `icicle-bookmark-save-marked-files-as-project', ;; `icicle-bookmark-save-marked-files-more', ;; `icicle-bookmark-save-marked-files-persistently', ;; `icicle-bookmark-save-marked-files-to-variable', ;; `icicle-bookmark-set', `icicle-bookmark-some-tags', ;; `icicle-bookmark-some-tags-other-window', ;; `icicle-bookmark-some-tags-regexp', ;; `icicle-bookmark-some-tags-regexp-other-window', ;; `icicle-bookmark-specific-buffers', ;; `icicle-bookmark-specific-buffers-other-window', ;; `icicle-bookmark-specific-files', ;; `icicle-bookmark-specific-files-other-window', ;; `icicle-bookmark-temporary', ;; `icicle-bookmark-temporary-other-window', ;; `icicle-bookmark-this-buffer', ;; `icicle-bookmark-this-buffer-other-window', ;; `icicle-bookmark-url', `icicle-bookmark-url-other-window' ;; `icicle-bookmark-w3m-other-window', `icicle-buffer', ;; `icicle-buffer-config', `icicle-buffer-list', ;; `icicle-buffer-no-search', ;; `icicle-buffer-no-search-other-window', ;; `icicle-buffer-other-window', ;; `icicle-change-alternative-sort-order', `icicle-choose-faces', ;; `icicle-choose-invisible-faces', `icicle-choose-visible-faces', ;; `icicle-clear-history', `icicle-clear-current-history', ;; `icicle-color-theme', `icicle-comint-command', ;; `icicle-comint-dynamic-complete', ;; `icicle-comint-dynamic-complete-filename', ;; `icicle-comint-replace-by-expanded-filename', ;; `icicle-comint-search', `icicle-command-abbrev', ;; `icicle-compilation-search', `icicle-complete-keys', ;; `icicle-complete-thesaurus-entry', `icicle-completing-yank', ;; `icicle-customize-apropos', `icicle-customize-apropos-faces', ;; `icicle-customize-apropos-groups', ;; `icicle-customize-apropos-options', ;; `icicle-customize-apropos-options-of-type', ;; `icicle-customize-apropos-opts-w-val-satisfying', ;; `icicle-customize-face', `icicle-customize-icicles-group', ;; `icicle-cycle-expand-to-common-match', ;; `icicle-cycle-image-file-thumbnail', ;; `icicle-cycle-incremental-completion', ;; `icicle-dabbrev-completion', `icicle-delete-file', ;; `icicle-delete-window', `icicle-delete-windows', ;; `icicle-delete-windows-on', `icicle-describe-file', ;; `icicle-describe-option-of-type', `icicle-describe-process', ;; `icicle-describe-var-w-val-satisfying', `icicle-directory-list', ;; `icicle-dired', `icicle-dired-chosen-files', ;; `icicle-dired-chosen-files-other-window', ;; `icicle-dired-insert-as-subdir', `icicle-dired-other-window', ;; `icicle-dired-project', `icicle-dired-project-other-window', ;; `icicle-dired-saved-file-candidates', ;; `icicle-dired-saved-file-candidates-other-window', ;; `icicle-dired-save-marked', ;; `icicle-dired-save-marked-as-project', ;; `icicle-dired-save-marked-more', ;; `icicle-dired-save-marked-more-recursive', ;; `icicle-dired-save-marked-persistently', ;; `icicle-dired-save-marked-recursive', ;; `icicle-dired-save-marked-to-cache-file-recursive', ;; `icicle-dired-save-marked-to-fileset-recursive', ;; `icicle-dired-save-marked-to-variable', ;; `icicle-dired-save-marked-to-variable-recursive', ;; `icicle-dired-smart-shell-command', `icicle-doc', ;; `icicle-doremi-increment-variable+', ;; `icicle-exchange-point-and-mark', ;; `icicle-execute-extended-command', ;; `icicle-execute-named-keyboard-macro', `icicle-face-list', ;; `icicle-file', `icicle-file-list', `icicle-file-other-window', ;; `icicle-find-file', `icicle-find-file-absolute', ;; `icicle-find-file-absolute-other-window', ;; `icicle-find-file-all-tags', ;; `icicle-find-file-all-tags-other-window', ;; `icicle-find-file-all-tags-regexp', ;; `icicle-find-file-all-tags-regexp-other-window', ;; `icicle-find-file-handle-bookmark', ;; `icicle-find-file-handle-bookmark-other-window', ;; `icicle-find-file-in-tags-table', ;; `icicle-find-file-in-tags-table-other-window', ;; `icicle-find-file-of-content', ;; `icicle-find-file-of-content-other-window', ;; `icicle-find-file-other-window', `icicle-find-file-read-only', ;; `icicle-find-file-read-only-other-window', ;; `icicle-find-file-some-tags', ;; `icicle-find-file-some-tags-other-window', ;; `icicle-find-file-some-tags-regexp', ;; `icicle-find-file-some-tags-regexp-other-window', ;; `icicle-find-file-tagged', ;; `icicle-find-file-tagged-other-window', `icicle-find-first-tag', ;; `icicle-find-first-tag-other-window', `icicle-find-tag', ;; `icicle-font', `icicle-frame-bg', `icicle-frame-fg', ;; `icicle-fundoc', `icicle-goto-global-marker', ;; `icicle-goto-global-marker-or-pop-global-mark', ;; `icicle-goto-marker', `icicle-goto-marker-or-set-mark-command', ;; `icicle-grep-saved-file-candidates', ;; `icicle-gud-gdb-complete-command', `icicle-handle-switch-frame', ;; `icicle-hide-faces', `icicle-hide-only-faces', ;; `icicle-hide/show-comments', `icicle-ido-like-mode', ;; `icicle-imenu', `icicle-imenu-command', ;; `icicle-imenu-command-full', `icicle-imenu-face', ;; `icicle-imenu-face-full', `icicle-imenu-full', ;; `icicle-imenu-key-explicit-map', ;; `icicle-imenu-key-explicit-map-full', ;; `icicle-imenu-key-implicit-map', ;; `icicle-imenu-key-implicit-map-full', `icicle-imenu-macro', ;; `icicle-imenu-macro-full', ;; `icicle-imenu-non-interactive-function', ;; `icicle-imenu-non-interactive-function-full', ;; `icicle-imenu-user-option', `icicle-imenu-user-option-full', ;; `icicle-imenu-variable', `icicle-imenu-variable-full', ;; `icicle-increment-option', `icicle-increment-variable', ;; `icicle-Info-goto-node', `icicle-Info-goto-node-no-search', ;; `icicle-Info-goto-node-of-content', `icicle-Info-index', ;; `icicle-Info-index-20', `icicle-Info-menu', ;; `icicle-Info-menu-cmd', `icicle-Info-virtual-book', ;; `icicle-insert-buffer', `icicle-insert-thesaurus-entry', ;; `icicle-keyword-list', `icicle-kill-buffer', `icicle-kmacro', ;; `icicle-lisp-complete-symbol', `icicle-locate', ;; `icicle-locate-file', `icicle-locate-file-no-symlinks', ;; `icicle-locate-file-no-symlinks-other-window', ;; `icicle-locate-file-other-window', `icicle-locate-other-window', ;; `icicle-minibuffer-default-add-dired-shell-commands', ;; `icicle-minibuffer-help', `icicle-mode', `icy-mode', ;; `icicle-next-visible-thing', `icicle-object-action', ;; `icicle-occur', `icicle-ORIG-bbdb-complete-mail', ;; `icicle-ORIG-bbdb-complete-name', ;; `icicle-ORIG-comint-dynamic-complete', ;; `icicle-ORIG-comint-dynamic-complete-filename', ;; `icicle-ORIG-comint-replace-by-expanded-filename', ;; `icicle-ORIG-dired-read-shell-command', ;; `icicle-ORIG-ess-complete-object-name', ;; `icicle-ORIG-gud-gdb-complete-command', ;; `icicle-ORIG-read-buffer', `icicle-ORIG-read-file-name', ;; `icicle-ORIG-read-shell-command', ;; `icicle-other-window-or-frame', `icicle-pick-color-by-name', ;; `icicle-plist', `icicle-pop-tag-mark', ;; `icicle-pp-eval-expression', `icicle-previous-visible-thing', ;; `icicle-read-buffer', `icicle-read-color', ;; `icicle-read-color-wysiwyg', `icicle-read-kbd-macro', ;; `icicle-recent-file', `icicle-recent-file-other-window', ;; `icicle-recompute-shell-command-candidates', ;; `icicle-regexp-list', `icicle-remove-buffer-candidate', ;; `icicle-remove-buffer-config', ;; `icicle-remove-entry-from-saved-completion-set', ;; `icicle-remove-file-from-recentf-list', ;; `icicle-remove-saved-completion-set', ;; `icicle-repeat-complex-command', `icicle-reset-option-to-nil', ;; `icicle-resolve-file-name', `icicle-save-string-to-variable', ;; `icicle-search', `icicle-search-all-tags-bookmark', ;; `icicle-search-all-tags-regexp-bookmark', ;; `icicle-search-autofile-bookmark', ;; `icicle-search-autonamed-bookmark', `icicle-search-bookmark', ;; `icicle-search-bookmark-list-bookmark', ;; `icicle-search-bookmark-list-marked', ;; `icicle-search-bookmarks-together', `icicle-search-buffer', ;; `icicle-search-buff-menu-marked', `icicle-search-char-property', ;; `icicle-search-defs', `icicle-search-defs-full', ;; `icicle-search-dired-bookmark', ;; `icicle-search-dired-marked-recursive', `icicle-search-file', ;; `icicle-search-file-bookmark', `icicle-search-generic', ;; `icicle-search-gnus-bookmark', ;; `icicle-search-highlight-cleanup', ;; `icicle-search-ibuffer-marked', `icicle-search-info-bookmark', ;; `icicle-search-keywords', `icicle-search-lines', ;; `icicle-search-local-file-bookmark', ;; `icicle-search-man-bookmark', `icicle-search-non-file-bookmark', ;; `icicle-search-overlay-property', `icicle-search-pages', ;; `icicle-search-paragraphs', `icicle-search-region-bookmark', ;; `icicle-search-remote-file-bookmark', `icicle-search-sentences', ;; `icicle-search-some-tags-bookmark', ;; `icicle-search-some-tags-regexp-bookmark', ;; `icicle-search-specific-buffers-bookmark', ;; `icicle-search-specific-files-bookmark', ;; `icicle-search-temporary-bookmark', ;; `icicle-search-text-property', `icicle-search-thing', ;; `icicle-search-this-buffer-bookmark', ;; `icicle-search-url-bookmark', `icicle-search-w3m-bookmark', ;; `icicle-search-w-isearch-string', `icicle-search-word', ;; `icicle-search-xml-element', ;; `icicle-search-xml-element-text-node', ;; `icicle-select-bookmarked-region', `icicle-select-frame', ;; `icicle-select-frame-by-name', `icicle-select-text-at-point', ;; `icicle-select-window', `icicle-select-window-by-name', ;; `icicle-send-bug-report', `icicle-send-signal-to-process', ;; `icicle-set-option-to-t', ;; `icicle-set-S-TAB-methods-for-command', ;; `icicle-set-TAB-methods-for-command', `icicle-sexp-list', ;; `icicle-shell-command', `icicle-shell-command-on-region', ;; `icicle-shell-dynamic-complete-command', ;; `icicle-shell-dynamic-complete-environment-variable', ;; `icicle-shell-dynamic-complete-filename', `icicle-show-faces', ;; `icicle-show-only-faces', `icicle-skip-this-command', ;; `icicle-string-list', `icicle-synonyms', `icicle-tag-a-file', ;; `icicle-tags-search', `icicle-toggle-~-for-home-dir', ;; `icicle-toggle-alternative-sorting', ;; `icicle-toggle-angle-brackets', `icicle-toggle-annotation', ;; `icicle-toggle-case-sensitivity', `icicle-toggle-C-for-actions', ;; `icicle-toggle-completions-format', `icicle-toggle-dot', ;; `icicle-toggle-expand-to-common-match' ;; `icicle-toggle-hiding-common-match', ;; `icicle-toggle-hiding-non-matching-lines', ;; `icicle-toggle-highlight-all-current', ;; `icicle-toggle-highlight-historical-candidates', ;; `icicle-toggle-highlight-saved-candidates', ;; `icicle-toggle-ignored-extensions', ;; `icicle-toggle-ignored-space-prefix', ;; `icicle-toggle-ignoring-comments', ;; `icicle-toggle-include-cached-files', ;; `icicle-toggle-include-recent-files', ;; `icicle-toggle-literal-replacement', ;; `icicle-toggle-network-drives-as-remote', ;; `icicle-toggle-option', `icicle-toggle-proxy-candidates', ;; `icicle-toggle-regexp-quote', ;; `icicle-toggle-remote-file-testing', ;; `icicle-toggle-search-cleanup', ;; `icicle-toggle-search-complementing-domain', ;; `icicle-toggle-search-replace-common-match', ;; `icicle-toggle-search-replace-whole', ;; `icicle-toggle-search-whole-word', ;; `icicle-toggle-show-multi-completion', `icicle-toggle-sorting', ;; `icicle-toggle-transforming', ;; `icicle-toggle-WYSIWYG-Completions', `icicle-untag-a-file', ;; `icicle-vardoc', `icicle-visit-marked-file-of-content', ;; `icicle-visit-marked-file-of-content-other-window', ;; `icicle-where-is', `icicle-widget-file-complete', ;; `icicle-yank-maybe-completing', `icicle-yank-pop-commands', ;; `icicle-zap-to-char', `toggle', `synonyms', ;; `toggle-icicle-~-for-home-dir', ;; `toggle-icicle-alternative-sorting', ;; `toggle-icicle-angle-brackets', `toggle-icicle-annotation', ;; `toggle-icicle-case-sensitivity', `toggle-icicle-C-for-actions', ;; `toggle-icicle-fuzzy-completion', ;; `toggle-icicle-hiding-common-match', ;; `toggle-icicle-hiding-non-matching-lines', ;; `toggle-icicle-highlight-all-current', ;; `toggle-icicle-highlight-historical-candidates', ;; `toggle-icicle-highlight-saved-candidates', ;; `toggle-icicle-ignored-extensions', ;; `toggle-icicle-ignored-space-prefix', ;; `toggle-icicle-include-cached-files', ;; `toggle-icicle-include-recent-files', ;; `toggle-icicle-incremental-completion', ;; `toggle-icicle-literal-replacement', ;; `toggle-icicle-proxy-candidates', `toggle-icicle-regexp-quote', ;; `toggle-icicle-remote-file-testing', ;; `toggle-icicle-search-cleanup', ;; `toggle-icicle-search-complementing-domain', ;; `toggle-icicle-search-replace-whole', ;; `toggle-icicle-search-whole-word', ;; `toggle-icicle-show-multi-completion', `toggle-icicle-sorting', ;; `toggle-icicle-transforming', ;; `toggle-icicle-WYSIWYG-Completions', `what-which-how'. ;; ;; Commands to be used mainly in the minibuffer or `*Completions*': ;; ;; `cycle-icicle-expand-to-common-match', ;; `cycle-icicle-image-file-thumbnail', ;; `icicle-abort-recursive-edit', `icicle-all-candidates-action', ;; `icicle-all-candidates-alt-action', ;; `icicle-all-candidates-list-action', ;; `icicle-all-candidates-list-alt-action', ;; `icicle-apropos-complete', `icicle-apropos-complete-and-exit', ;; `icicle-apropos-complete-and-narrow', ;; `icicle-apropos-complete-and-widen', ;; `icicle-apropos-complete-no-display', ;; `icicle-bookmark-autofile-narrow', ;; `icicle-bookmark-autonamed-narrow', ;; `icicle-bookmark-autonamed-this-buffer-narrow', ;; `icicle-backward-char-magic', ;; `icicle-backward-delete-char-untabify', ;; `icicle-backward-kill-paragraph', ;; `icicle-backward-kill-sentence', `icicle-backward-kill-sexp', ;; `icicle-backward-kill-word', `icicle-beginning-of-line+', ;; `icicle-bookmark-bookmark-file-narrow', ;; `icicle-bookmark-bookmark-list-narrow', ;; `icicle-bookmark-desktop-narrow', ;; `icicle-bookmark-dired-narrow',`icicle-bookmark-file-narrow', ;; `icicle-bookmark-file-this-dir-narrow', ;; `icicle-bookmark-gnus-narrow', `icicle-bookmark-info-narrow', ;; `icicle-bookmark-local-file-narrow', ;; `icicle-bookmark-man-narrow', `icicle-bookmark-non-file-narrow', ;; `icicle-bookmark-region-narrow', ;; `icicle-bookmark-remote-file-narrow', ;; `icicle-bookmark-specific-buffers-narrow', ;; `icicle-bookmark-specific-files-narrow', ;; `icicle-bookmark-temporary-narrow', ;; `icicle-bookmark-this-buffer-narrow', ;; `icicle-bookmark-url-narrow', `icicle-bookmark-w3m-narrow', ;; `icicle-candidate-action', `icicle-candidate-alt-action', ;; `icicle-candidate-read-fn-invoke', ;; `icicle-candidate-set-complement', ;; `icicle-candidate-set-define', ;; `icicle-candidate-set-difference', ;; `icicle-candidate-set-intersection', ;; `icicle-candidate-set-retrieve', ;; `icicle-candidate-set-retrieve-from-variable', ;; `icicle-candidate-set-retrieve-more', ;; `icicle-candidate-set-retrieve-persistent', ;; `icicle-candidate-set-save', `icicle-candidate-set-save-more', ;; `icicle-candidate-set-save-more-selected', ;; `icicle-candidate-set-save-persistently', ;; `icicle-candidate-set-save-selected', ;; `icicle-candidate-set-save-to-variable', ;; `icicle-candidate-set-swap', `icicle-candidate-set-truncate', ;; `icicle-candidate-set-union', `icicle-cd-for-abs-files', ;; `icicle-cd-for-loc-files', ;; `icicle-change-alternative-sort-order', ;; `icicle-change-history-variable', `icicle-change-sort-order', ;; `icicle-change-sort-order', `icicle-choose-completion', ;; `icicle-clear-current-history', `icicle-completing-read+insert', ;; `icicle-Completions-mouse-3-menu', ;; `icicle-cycle-expand-to-common-match', ;; `icicle-cycle-image-file-thumbnail', ;; `icicle-cycle-incremental-completion', ;; `icicle-search-define-replacement', ;; `icicle-delete-backward-char', `icicle-delete-candidate-object', ;; `icicle-delete-char', `icicle-digit-argument', ;; `icicle-dispatch-C-^', `icicle-dispatch-C-.', ;; `icicle-dispatch-C-x.', `icicle-dispatch-M-_', ;; `icicle-dispatch-M-comma', `icicle-dispatch-M-q', ;; `icicle-doremi-candidate-width-factor+', ;; `icicle-doremi-increment-max-candidates+', ;; `icicle-doremi-increment-swank-prefix-length+', ;; `icicle-doremi-increment-swank-timeout+', ;; `icicle-doremi-inter-candidates-min-spaces', ;; `icicle-doremi-zoom-Completions+', `icicle-end-of-line+', ;; `icicle-erase-minibuffer', ;; `icicle-erase-minibuffer-or-history-element', ;; `icicle-exit-minibuffer', `icicle-file-all-tags-narrow', ;; `icicle-file-all-tags-regexp-narrow', ;; `icicle-file-some-tags-narrow', ;; `icicle-file-some-tags-regexp-narrow', ;; `icicle-forward-char-magic', `icicle-goto/kill-failed-input', ;; `icicle-help-on-candidate', ;; `icicle-help-on-next-apropos-candidate', ;; `icicle-help-on-next-prefix-candidate', ;; `icicle-help-on-previous-apropos-candidate', ;; `icicle-help-on-previous-prefix-candidate', ;; `icicle-help-string-non-completion', `icicle-history', ;; `icicle-bookmark-image-narrow', `icicle-insert-completion', ;; `icicle-insert-dot-command', `icicle-insert-history-element', ;; `icicle-insert-key-description', ;; `icicle-insert-list-join-string', ;; `icicle-insert-newline-in-minibuffer', ;; `icicle-insert-string-at-point', ;; `icicle-insert-string-from-variable', `icicle-isearch-complete', ;; `icicle-isearch-history-complete', ;; `icicle-isearch-history-insert', ;; `icicle-keep-only-buffer-cands-for-derived-mode', ;; `icicle-keep-only-buffer-cands-for-mode', ;; `icicle-keep-only-buffer-cands-for-visible', ;; `icicle-keep-only-past-inputs', `icicle-kill-line', ;; `icicle-kill-paragraph', `icicle-kill-region', ;; `icicle-kill-region-wimpy', `icicle-kill-sentence', ;; `icicle-kill-sexp', `icicle-kill-word', `icicle-make-directory', ;; `icicle-minibuffer-complete-and-exit', `icicle-minibuffer-help', ;; `icicle-mouse-candidate-action', ;; `icicle-mouse-candidate-alt-action', ;; `icicle-mouse-candidate-read-fn-invoke', ;; `icicle-mouse-candidate-set-save', ;; `icicle-mouse-candidate-set-save-more', ;; `icicle-mouse-choose-completion', ;; `icicle-mouse-help-on-candidate', ;; `icicle-mouse-remove-candidate', ;; `icicle-mouse-save/unsave-candidate', ;; `icicle-mouse-save-then-kill', `icicle-mouse-yank-secondary', ;; `icicle-move-to-next-completion', ;; `icicle-move-to-previous-completion', `icicle-multi-inputs-act', ;; `icicle-multi-inputs-save', `icicle-narrow-candidates', ;; `icicle-narrow-candidates-with-predicate', ;; `icicle-negative-argument', `icicle-next-apropos-candidate', ;; `icicle-next-apropos-candidate-action', ;; `icicle-next-apropos-candidate-alt-action', ;; `icicle-next-candidate-per-mode', ;; `icicle-next-candidate-per-mode-action', ;; `icicle-next-candidate-per-mode-alt-action', ;; `icicle-next-candidate-per-mode-help', `icicle-next-line', ;; `icicle-next-prefix-candidate', ;; `icicle-next-prefix-candidate-action', ;; `icicle-next-prefix-candidate-alt-action', ;; `icicle-next-S-TAB-completion-method', ;; `icicle-ORIG-choose-completion', `icicle-ORIG-exit-minibuffer', ;; `icicle-ORIG-minibuffer-complete-and-exit', ;; `icicle-ORIG-mouse-choose-completion', ;; `icicle-ORIG-next-history-element', `icicle-ORIG-sit-for', ;; `icicle-ORIG-switch-to-completions', `icicle-other-history', ;; `icicle-plus-saved-sort', ;; `icicle-pp-eval-expression-in-minibuffer', ;; `icicle-prefix-complete', `icicle-prefix-complete-no-display', ;; `icicle-prefix-word-complete', ;; `icicle-previous-apropos-candidate', ;; `icicle-previous-apropos-candidate-action', ;; `icicle-previous-apropos-candidate-alt-action', ;; `icicle-previous-candidate-per-mode', ;; `icicle-previous-candidate-per-mode-action', ;; `icicle-previous-candidate-per-mode-alt-action', ;; `icicle-previous-candidate-per-mode-help', ;; `icicle-previous-line', `icicle-previous-prefix-candidate', ;; `icicle-previous-prefix-candidate-action', ;; `icicle-previous-prefix-candidate-alt-action', ;; `icicle-read+insert-file-name', `icicle-regexp-quote-input', ;; `icicle-remove-buffer-cands-for-derived-mode', ;; `icicle-remove-buffer-cands-for-mode', ;; `icicle-remove-buffer-cands-for-visible', ;; `icicle-remove-candidate', `icicle-remove-Completions-window', ;; `icicle-resolve-file-name', `icicle-retrieve-last-input', ;; `icicle-retrieve-next-input', `icicle-retrieve-previous-input', ;; `icicle-reverse-sort-order', `icicle-roundup', ;; `icicle-save-predicate-to-variable', ;; `icicle-save/unsave-candidate', ;; `icicle-scroll-Completions-backward', ;; `icicle-scroll-Completions-forward', `icicle-scroll-backward', ;; `icicle-scroll-forward', `icicle-search-define-replacement', ;; `icicle-self-insert', `icicle-sort-alphabetical', ;; `icicle-sort-by-abbrev-frequency', ;; `icicle-sort-by-directories-first', ;; `icicle-sort-by-directories-last', `icicle-sort-by-file-type.', ;; `icicle-sort-by-last-file-access-time', ;; `icicle-sort-by-last-file-modification-time', ;; `icicle-sort-by-last-use-as-input', ;; `icicle-sort-by-previous-use-alphabetically', ;; `icicle-sort-by-2nd-parts-alphabetically', ;; `icicle-sort-case-insensitive', ;; `icicle-sort-extra-candidates-first', ;; `icicle-sort-proxy-candidates-first', ;; `icicle-sort-special-candidates-first', ;; `icicle-sort-special-candidates-first', ;; `icicle-sort-turned-OFF', `icicle-switch-to-Completions-buf', ;; `icicle-switch-to-completions', ;; `icicle-switch-to/from-minibuffer', `icicle-toggle-.', ;; `icicle-toggle-~-for-home-dir', ;; `icicle-toggle-alternative-sorting', ;; `icicle-toggle-angle-brackets', ;; `icicle-toggle-case-sensitivity', `icicle-toggle-C-for-actions', ;; `icicle-toggle-completions-format', `icicle-toggle-dot', ;; `icicle-toggle-expand-to-common-match', ;; `icicle-toggle-hiding-common-match', ;; `icicle-toggle-hiding-non-matching-lines', ;; `icicle-toggle-highlight-all-current', ;; `icicle-toggle-highlight-historical-candidates', ;; `icicle-toggle-highlight-saved-candidates', ;; `icicle-toggle-ignored-extensions', ;; `icicle-toggle-ignored-space-prefix', ;; `icicle-toggle-ignoring-comments', ;; `icicle-toggle-literal-replacement', ;; `icicle-toggle-proxy-candidates', `icicle-toggle-regexp-quote', ;; `icicle-toggle-search-cleanup', ;; `icicle-toggle-search-complementing-domain', ;; `icicle-toggle-search-replace-common-match', ;; `icicle-toggle-search-replace-whole', ;; `icicle-toggle-search-whole-word', ;; `icicle-toggle-show-multi-completion', `icicle-toggle-sorting', ;; `icicle-toggle-transforming', `icicle-top-level', ;; `icicle-transpose-chars', `icicle-transpose-sexps', ;; `icicle-transpose-words', `icicle-universal-argument', ;; `icicle-universal-argument-minus', ;; `icicle-universal-argument-more', ;; `icicle-universal-argument-other-key', `icicle-up-directory', ;; `icicle-use-interactive-command-history', ;; `icicle-widen-candidates', `icicle-yank', `icicle-yank-pop', ;; `icicle-yank-secondary', `toggle-icicle-.', ;; `toggle-icicle-~-for-home-dir', ;; `toggle-icicle-alternative-sorting', ;; `toggle-icicle-angle-brackets', ;; `toggle-icicle-case-sensitivity', `toggle-icicle-C-for-actions', ;; `toggle-icicle-completions-format', `toggle-icicle-dot', ;; `toggle-icicle-expand-to-common-match', ;; `toggle-icicle-fuzzy-completion', ;; `toggle-icicle-hiding-common-match', ;; `toggle-icicle-hiding-non-matching-lines', ;; `toggle-icicle-highlight-all-current', ;; `toggle-icicle-highlight-historical-candidates', ;; `toggle-icicle-ignored-extensions', ;; `toggle-icicle-ignored-space-prefix', ;; `toggle-icicle-incremental-completion', ;; `toggle-icicle-literal-replacement', ;; `toggle-icicle-network-drives-as-remote', ;; `toggle-icicle-proxy-candidates', `toggle-icicle-regexp-quote', ;; `toggle-icicle-search-cleanup', ;; `toggle-icicle-search-complementing-domain', ;; `toggle-icicle-search-replace-common-match', ;; `toggle-icicle-search-replace-whole', ;; `toggle-icicle-search-whole-word', `toggle-icicle-sorting', ;; `toggle-icicle-transforming'. ;; ;; Faces defined in Icicles (in Custom group `icicles'): ;; ;; `icicle-annotation', `icicle-candidate-part', ;; `icicle-common-match-highlight-Completions', ;; `icicle-complete-input', `icicle-completion', ;; `icicle-Completions-instruction-1', ;; `icicle-Completions-instruction-2', ;; `icicle-current-candidate-highlight', `icicle-extra-candidate', ;; `icicle-historical-candidate', ;; `icicle-historical-candidate-other', ;; `icicle-input-completion-fail', ;; `icicle-input-completion-fail-lax', ;; `icicle-match-highlight-Completions', ;; `icicle-match-highlight-minibuffer', `icicle-mode-line-help', ;; `icicle-msg-emphasis', `icicle-multi-command-completion', ;; `icicle-mustmatch-completion', `icicle-proxy-candidate', ;; `icicle-saved-candidate', `icicle-search-context-level-1', ;; `icicle-search-context-level-2', ;; `icicle-search-context-level-3', ;; `icicle-search-context-level-4', ;; `icicle-search-context-level-5', ;; `icicle-search-context-level-6', ;; `icicle-search-context-level-7', ;; `icicle-search-context-level-8', `icicle-search-current-input', ;; `icicle-search-main-regexp-current', ;; `icicle-search-main-regexp-others', `icicle-special-candidate', ;; `icicle-whitespace-highlight', `minibuffer-prompt'. ;; ;; Widgets defined in Icicles: ;; ;; `icicle-color', `icicle-file', `icicle-ORIG-color', ;; `icicle-ORIG-file'. ;; ;; User options defined in Icicles: ;; ;; `icicle-act-before-cycle-flag', ;; `icicle-add-proxy-candidates-flag', ;; `icicle-alternative-actions-alist', ;; `icicle-alternative-sort-comparer', ;; `icicle-anything-transform-candidates-flag', ;; `icicle-apropos-complete-keys', ;; `icicle-apropos-complete-no-display-keys', ;; `icicle-apropos-cycle-next-keys', ;; `icicle-apropos-cycle-next-action-keys', ;; `icicle-apropos-cycle-next-alt-action-keys', ;; `icicle-apropos-cycle-next-help-keys', ;; `icicle-apropos-cycle-previous-keys', ;; `icicle-apropos-cycle-previous-action-keys', ;; `icicle-apropos-cycle-previous-alt-action-keys', ;; `icicle-apropos-cycle-previous-help-keys', ;; `icicle-bookmark-name-length-max', ;; `icicle-bookmark-refresh-cache-flag', ;; `icicle-buffer-candidate-key-bindings', `icicle-buffer-configs', ;; `icicle-buffer-extras', ;; `icicle-buffer-ignore-space-prefix-flag', ;; `icicle-buffer-include-cached-files-nflag', ;; `icicle-buffer-include-recent-files-nflag', ;; `icicle-buffer-match-regexp', `icicle-buffer-no-match-regexp', ;; `icicle-buffer-predicate', `icicle-buffer-prefix-arg-filtering', ;; `icicle-buffer-require-match-flag' `icicle-buffer-skip-hook', ;; `icicle-buffer-sort', `icicle-buffers-ido-like-flag', ;; `icicle-candidate-action-keys', `icicle-candidate-help-keys', ;; `icicle-candidate-width-factor', ;; `icicle-change-region-background-flag', ;; `icicle-change-sort-order-completion-flag', ;; `icicle-C-l-uses-completion-flag', `icicle-color-themes', ;; `icicle-comint-dynamic-complete-replacements', ;; `icicle-command-abbrev-alist', ;; `icicle-command-abbrev-match-all-parts-flag', ;; `icicle-command-abbrev-priority-flag', ;; `icicle-complete-key-anyway-flag', ;; `icicle-complete-keys-self-insert-ranges', ;; `icicle-completing-read+insert-keys', ;; `icicle-completion-history-max-length', ;; `icicle-completion-key-bindings', ;; `icicle-completion-list-key-bindings', ;; `icicle-Completions-display-min-input-chars', ;; `icicle-completions-format', ;; `icicle-Completions-mouse-3-menu-entries', ;; `icicle-Completions-max-columns', ;; `icicle-Completions-text-scale-decrease', ;; `icicle-Completions-window-max-height', ;; `icicle-customize-save-flag', ;; `icicle-customize-save-variable-function', ;; `icicle-default-cycling-mode', ;; `icicle-default-in-prompt-format-function', ;; `icicle-default-thing-insertion', `icicle-default-value', ;; `icicle-define-alias-commands-flag', ;; `icicle-deletion-action-flag', `icicle-dot-show-regexp-flag', ;; `icicle-dot-string', `icicle-expand-input-to-common-match', ;; `icicle-expand-input-to-common-match-alt', `icicle-file-extras', ;; `icicle-find-file-of-content-skip-hook', ;; `icicle-file-match-regexp', `icicle-file-no-match-regexp', ;; `icicle-file-predicate', `icicle-file-require-match-flag', ;; `icicle-file-sort', `icicle-files-ido-like-flag', ;; `icicle-filesets-as-saved-completion-sets-flag', ;; `icicle-functions-to-redefine', `icicle-guess-commands-in-path', ;; `icicle-help-in-mode-line-delay', ;; `icicle-hide-common-match-in-Completions-flag', ;; `icicle-hide-non-matching-lines-flag', ;; `icicle-highlight-historical-candidates-flag', ;; `icicle-highlight-input-completion-failure', ;; `icicle-highlight-input-completion-failure-delay', ;; `icicle-highlight-input-completion-failure-threshold', ;; `icicle-highlight-input-initial-whitespace-flag', ;; `icicle-highlight-lighter-flag', ;; `icicle-highlight-saved-candidates-flag', ;; `icicle-ignore-comments-flag', `icicle-ignored-directories', ;; `icicle-image-files-in-Completions', ;; `icicle-incremental-completion', ;; `icicle-incremental-completion-delay', ;; `icicle-incremental-completion-threshold', ;; `icicle-Info-visited-max-candidates', ;; `icicle-inhibit-advice-functions', `icicle-inhibit-ding-flag', ;; `icicle-input-string', `icicle-inter-candidates-min-spaces', ;; `icicle-isearch-complete-keys', ;; `icicle-isearch-history-insert-keys', ;; `icicle-key-complete-keys', ;; `icicle-key-complete-keys-for-minibuffer', ;; `icicle-key-descriptions-use-<>-flag', ;; `icicle-key-descriptions-use-angle-brackets-flag', ;; `icicle-keymaps-for-key-completion', ;; `icicle-kill-visited-buffers-flag', `icicle-kmacro-ring-max', ;; `icicle-levenshtein-distance', `icicle-list-join-string', ;; `icicle-list-nth-parts-join-string', ;; `icicle-mark-position-in-candidate', `icicle-max-candidates', ;; `icicle-menu-items-to-history-flag', ;; `icicle-minibuffer-key-bindings', ;; `icicle-minibuffer-setup-hook', `icicle-modal-cycle-down-keys', ;; `icicle-modal-cycle-down-action-keys', ;; `icicle-modal-cycle-down-alt-action-keys', ;; `icicle-modal-cycle-down-help-keys', ;; `icicle-modal-cycle-up-keys', ;; `icicle-modal-cycle-up-action-keys', ;; `icicle-modal-cycle-up-alt-action-keys', ;; `icicle-modal-cycle-up-help-keys', `icicle-mode', ;; `icicle-mode-hook', `icicle-move-Completions-frame', ;; `icicle-network-drive-means-remote-flag', ;; `icicle-no-match-hook', `icicle-option-type-prefix-arg-list', ;; `icicle-point-position-in-candidate', ;; `icicle-populate-interactive-history-flag', ;; `icicle-pp-eval-expression-print-length', ;; `icicle-pp-eval-expression-print-level', ;; `icicle-prefix-complete-keys', ;; `icicle-prefix-complete-no-display-keys', ;; `icicle-prefix-cycle-next-keys', ;; `icicle-prefix-cycle-next-action-keys', ;; `icicle-prefix-cycle-next-alt-action-keys', ;; `icicle-prefix-cycle-next-help-keys', ;; `icicle-prefix-cycle-previous-keys', ;; `icicle-prefix-cycle-previous-action-keys', ;; `icicle-prefix-cycle-previous-alt-action-keys', ;; `icicle-prefix-cycle-previous-help-keys', ;; `icicle-quote-shell-file-name-flag', ;; `icicle-read+insert-file-name-keys', `icicle-recenter', ;; `icicle-regexp-quote-flag', `icicle-regexp-search-ring-max', ;; `icicle-region-background', `icicle-require-match-flag', ;; `icicle-saved-completion-sets', `icicle-search-cleanup-flag', ;; `icicle-search-from-isearch-keys', ;; `icicle-search-highlight-all-current-flag', ;; `icicle-search-highlight-context-levels-flag', ;; `icicle-search-highlight-threshold', `icicle-search-hook', ;; `icicle-search-key-prefix', ;; `icicle-search-replace-common-match-flag', ;; `icicle-search-replace-literally-flag', ;; `icicle-search-replace-whole-candidate-flag', ;; `icicle-search-ring-max', `icicle-search-whole-word-flag', ;; `icicle-shell-command-candidates-cache', ;; `icicle-show-annotations-flag', ;; `icicle-show-Completions-help-flag', ;; `icicle-show-Completions-initially-flag', ;; `icicle-show-multi-completion-flag', `icicle-sort-comparer', ;; `icicle-sort-orders-alist', `icicle-special-candidate-regexp', ;; `icicle-S-TAB-completion-methods-alist', ;; `icicle-S-TAB-completion-methods-per-command', ;; `icicle-swank-prefix-length', `icicle-swank-timeout', ;; `icicle-TAB-completion-methods', ;; `icicle-TAB-completion-methods-per-command', ;; `icicle-TAB-shows-candidates-flag', ;; `icicle-TAB/S-TAB-only-completes-flag', ;; `icicle-test-for-remote-files-flag', ;; `icicle-thing-at-point-functions', ;; `icicle-top-level-key-bindings', ;; `icicle-top-level-when-sole-completion-delay', ;; `icicle-top-level-when-sole-completion-flag', ;; `icicle-touche-pas-aux-menus-flag', `icicle-type-actions-alist', ;; `icicle-unpropertize-completion-result-flag', ;; `icicle-update-input-hook', `icicle-use-~-for-home-dir-flag', ;; `icicle-use-C-for-actions-flag', ;; `icicle-use-anything-candidates-flag', ;; `icicle-use-candidates-only-once-flag', ;; `icicle-widgets-to-redefine', `icicle-word-completion-keys', ;; `icicle-WYSIWYG-Completions-flag', `icicle-yank-function', ;; `icicle-zap-to-char-candidates'. ;; ;; Non-interactive functions in Icicles: ;; ;; `custom-variable-p', `icicle-2nd-part-string-less-p', ;; `icicle-abbreviate-or-expand-file-name', `icicle-activate-mark', ;; `icicle-add-key+cmd', `icicle-add-menu-item-to-cmd-history', ;; `icicle-all-candidates-action-1', `icicle-all-completions', ;; `icicle-all-exif-data', `icicle-alpha-p', ;; `icicle-alt-act-fn-for-type', `icicle-any-candidates-p', ;; `icicle-anychar-regexp', `icicle-anything-candidate-value', ;; `icicle-apply-action', `icicle-apply-list-action', ;; `icicle-apply-to-saved-candidate', ;; `icicle-apropos-any-candidates-p', ;; `icicle-apropos-any-file-name-candidates-p', ;; `icicle-apropos-candidates', `icicle-apropos-complete-1', ;; `icicle-apropos-complete-2', `icicle-apropos-opt-action', ;; `icicle-autofile-action', ;; `icicle-backward-delete-char-untabify-magic', ;; `icicle-barf-if-outside-Completions', ;; `icicle-barf-if-outside-Completions-and-minibuffer', ;; `icicle-barf-if-outside-minibuffer', `icicle-binary-option-p', ;; `icicle-bind-completion-keys', ;; `icicle-bind-buffer-candidate-keys', ;; `icicle-bind-custom-minibuffer-keys', ;; `icicle-bind-file-candidate-keys', `icicle-bind-isearch-keys', ;; `icicle-bind-key-completion-keys-for-map-var', ;; `icicle-bind-key-completion-keys-in-keymaps-from', ;; `icicle-bind-other-keymap-keys', ;; `icicle-bind-top-level-commands', ;; `icicle-bookmark-bind-narrow-commands', ;; `icicle-bookmark-cleanup', `icicle-bookmark-cleanup-on-quit', ;; `icicle-bookmark-delete-action', `icicle-bookmark-help-string', ;; `icicle-bookmark-jump-1', `icicle-bounds-of-thing-at-point', ;; `icicle-buffer-file/process-name-less-p', ;; `icicle-buffer-apropos-complete-match', ;; `icicle-buffer-cand-help', `icicle-buffer-multi-complete', ;; `icicle-buffer-name-prompt', `icicle-buffer-smaller-p', ;; `icicle-buffer-sort-*...*-last', ;; `icicle-cached-files-without-buffers', ;; `icicle-call-then-update-Completions', ;; `icicle-cancel-Help-redirection', `icicle-candidate-action-1', ;; `icicle-candidate-set-1', `icicle-candidate-set-retrieve-1', ;; `icicle-candidate-set-save-1', ;; `icicle-candidate-set-save-selected-1', ;; `icicle-candidate-short-help', ;; `icicle-case-insensitive-string-less-p', ;; `icicle-case-string-less-p', `icicle-cdr-lessp', ;; `icicle-char-cands-from-charlist', ;; `icicle-char-properties-in-buffer', ;; `icicle-char-properties-in-buffers', ;; `icicle-choose-anything-candidate', ;; `icicle-choose-candidate-of-type', ;; `icicle-choose-completion-string', `icicle-clear-history-1', ;; `icicle-clear-history-entry', `icicle-clear-lighter', ;; `icicle-clear-minibuffer', `icicle-cmd2-after-load-bookmark+', ;; `icicle-cmd2-after-load-hexrgb', ;; `icicle-cmd2-after-load-highlight', ;; `icicle-cmd2-after-load-palette', ;; `icicle-cmd2-after-load-synonyms', ;; `icicle-cmd2-after-load-wid-edit+', `icicle-color-blue-lessp', ;; `icicle-color-completion-setup', ;; `icicle-color-distance-hsv-lessp', ;; `icicle-color-distance-rgb-lessp', `icicle-color-green-lessp', ;; `icicle-color-help', `icicle-color-hsv-lessp', ;; `icicle-color-hue-lessp', `icicle-color-name-w-bg', ;; `icicle-color-red-lessp', `icicle-color-saturation-lessp', ;; `icicle-color-value-lessp', `icicle-column-wise-cand-nb', ;; `icicle-completion--embedded-envvar-table', ;; `icicle-Completions-popup-choice', ;; `icicle-Completions-popup-choice-1', ;; `icicle-comint-completion-at-point', ;; `icicle-comint-dynamic-complete-as-filename', ;; `icicle-comint-dynamic-simple-complete', ;; `icicle-comint-hook-fn', ;; `icicle-comint-replace-orig-completion-fns', ;; `icicle-comint-search-get-final-choice', ;; `icicle-comint-search-get-minibuffer-input', ;; `icicle-comint-search-send-input', ;; `icicle-command-abbrev-action', `icicle-command-abbrev-command', ;; `icicle-command-abbrev-matching-commands', ;; `icicle-command-abbrev-record', `icicle-command-abbrev-regexp', ;; `icicle-command-abbrev-save', ;; `icicle-command-abbrev-used-more-p', ;; `icicle-command-names-alphabetic-p', ;; `icicle-compilation-hook-fn', ;; `icicle-compilation-search-in-context-fn', ;; `icicle-complete-again-update', `icicle-complete-keys-1', ;; `icicle-complete-keys-action', `icicle-completing-p', ;; `icicle-completing-read', , `icicle-completing-read-multiple', ;; `icicle-completing-read-history', ;; `icicle-completion-all-completions', ;; `icicle-completion-setup-function', ;; `icicle-completion-try-completion', ;; `icicle-compute-shell-command-candidates', ;; `icicle-convert-dots', ;; `icicle-current-completion-in-Completions', ;; `icicle-current-sort-functions', `icicle-current-sort-order', ;; `icicle-current-TAB-method', ;; `icicle-customize-apropos-opt-action', `icicle-customize-faces', ;; `icicle-custom-type', `icicle-dabbrev--abbrev-at-point', ;; `icicle-default-buffer-names', `icicle-defaults-at-point', ;; `icicle-define-crm-completion-map', , ;; `icicle-define-cycling-keys', `icicle-defined-thing-p', ;; `icicle-define-icicle-maps', `icicle-define-minibuffer-maps', ;; `icicle-delete-alist-dups', `icicle-delete-backward-char-magic', ;; `icicle-delete-candidate-object-1', `icicle-delete-char-magic', ;; `icicle-delete-count', `icicle-delete-current-candidate-object', ;; `icicle-delete-dups', `icicle-delete-file-or-directory', ;; `icicle-delete-whitespace-from-string', ;; `icicle-describe-opt-action', ;; `icicle-describe-opt-of-type-complete', `icicle-ding', ;; `icicle-dired-read-shell-command', ;; `icicle-dir-prefix-wo-wildcards', `icicle-dirs-first-p', ;; `icicle-dirs-last-p', `icicle-displayable-cand-from-saved-set', ;; `icicle-display-cand-from-full-cand', ;; `icicle-display-completion-list', `icicle-display-Completions', ;; `icicle-display-candidates-in-Completions', `icicle-doc-action', ;; `icicle-edmacro-parse-keys', ;; `icicle-ensure-overriding-map-is-bound', ;; `icicle-execute-extended-command-1', ;; `icicle-expanded-common-match', ;; `icicle-expanded-common-match-1', `icicle-expand-file-name-20', ;; `icicle-expand-file-or-dir-name', ;; `icicle-explicit-saved-completion-candidates', `icicle-explore', ;; `icicle-extra-candidates-first-p', ;; `icicle-face-valid-attribute-values', `icicle-file-directory-p', ;; `icicle-file-name-apropos-candidates', ;; `icicle-file-name-directory', ;; `icicle-file-name-directory-w-default', ;; `icicle-file-name-input-p', `icicle-file-name-nondirectory', ;; `icicle-file-name-prefix-candidates', ;; `icicle-file-of-content-apropos-complete-match', ;; `icicle-file-readable-p', `icicle-file-remote-p', ;; `icicle-file-type-less-p', `icicle-file-writable-p', ;; `icicle-filesets-files-under', `icicle-files-within', ;; `icicle-files-within-1', `icicle-filter-alist', ;; `icicle-filter-wo-input', `icicle-find-first-tag-action', ;; `icicle-find-first-tag-other-window-action', ;; `icicle-find-tag-action', `icicle-find-tag-define-candidates', ;; `icicle-find-tag-define-candidates-1', ;; `icicle-find-tag-final-act', `icicle-find-tag-help', ;; `icicle-find-tag-quit-or-error', ;; `icicle-first-matching-candidate', `icicle-first-N', ;; `icicle-fit-completions-window', `icicle-fix-default-directory', ;; `icicle-flat-list', `icicle-fn-doc-minus-sig', ;; `icicle-font-w-orig-size', `icicle-frame-name-history', ;; `icicle-frames-on', `icicle-function-name-history', ;; `icicle-fuzzy-candidates', `icicle-get-alist-candidate', ;; `icicle-get-anything-actions-for-type', ;; `icicle-get-anything-cached-candidates', ;; `icicle-get-anything-candidates', ;; `icicle-get-anything-candidates-of-type', ;; `icicle-get-anything-default-actions-for-type', ;; `icicle-get-anything-input-delay', ;; `icicle-get-anything-req-pat-chars', ;; `icicle-get-anything-types', ;; `icicle-get-candidates-from-saved-set', `icicle-get-safe', ;; `icicle-goto-marker-1', `icicle-goto-marker-1-action', ;; `icicle-group-regexp', `icicle-dired-guess-shell-command', ;; `icicle-handle-default-for-prompt', ;; `icicle-help-on-candidate-symbol', `icicle-help-line-buffer', ;; `icicle-help-line-file', `icicle-help-string-completion', ;; `icicle-highlight-candidate-in-Completions', ;; `icicle-highlight-complete-input', ;; `icicle-highlight-initial-whitespace', ;; `icicle-highlight-input-noncompletion', ;; `icicle-highlight-input-noncompletion-rest', ;; `icicle-highlight-lighter', `icicle-historical-alphabetic-p', ;; `icicle-imenu-command-p', `icicle-imenu-in-buffer-p', ;; `icicle-imenu-non-interactive-function-p', ;; `icicle-increment-cand-nb+signal-end', ;; `icicle-Info-apropos-complete-match', ;; `icicle-Info-build-node-completions', ;; `icicle-Info-build-node-completions-1', ;; `icicle-Info-content-match', `icicle-Info-goto-node-1', ;; `icicle-Info-goto-node-action', `icicle-Info-index-action', ;; `icicle-Info-multi-read-node-name', ;; `icicle-Info-node-is-indexed-by-topic', ;; `icicle-Info-read-node-name', ;; `icicle-Info-read-node-of-content', ;; `icicle-input-from-minibuffer', ;; `icicle-input-is-a-completion-p', `icicle-insert-candidates', ;; `icicle-insert-candidate-action', ;; `icicle-insert-cand-in-minibuffer', ;; `icicle-insert-Completions-help-string', `icicle-insert-dot', ;; `icicle-insert-for-yank', `icicle-insert-input', ;; `icicle-insert-thesaurus-entry-cand-fn', `icicle-insert-thing', ;; `icicle-invisible-face-p', `icicle-invisible-p', ;; `icicle-isearch-complete-past-string', `icicle-join-nth-parts', ;; `icicle-kbd', `icicle-keep/remove-buffer-cands-for-visible', ;; `icicle-key-description', `icicle-keys+cmds-w-prefix', ;; `icicle-kill-a-buffer', ;; `icicle-kill-a-buffer-and-update-completions', ;; `icicle-kmacro-action', `icicle-last-accessed-first-p', ;; `icicle-last-modified-first-p', `icicle-levenshtein-match', ;; `icicle-levenshtein-one-match', `icicle-levenshtein-one-regexp', ;; `icicle-levenshtein-strict-match', ;; `icicle-lisp-completion-at-point', ;; `icicle-lisp-vanilla-completing-read', ;; `icicle-local-keys-first-p', `icicle-locate-file-1', ;; `icicle-locate-file-action', ;; `icicle-locate-file-other-window-action', ;; `icicle-locate-file-use-locate-p', `icicle-looking-at-p', ;; `icicle-looking-back-at-p', `icicle-major-mode-name-less-p', ;; `icicle-make-bookmark-candidate', `icicle-make-color-candidate', ;; `icicle-make-face-candidate', `icicle-make-frame-alist', ;; `icicle-make-plain-predicate', `icicle-make-window-alist', ;; `icicle-markers', `icicle-markers-to-readable', ;; `icicle-marker+text', ;; `icicle-maybe-multi-completion-completing-p', ;; `icicle-maybe-sort-and-strip-candidates', ;; `icicle-maybe-sort-maybe-truncate', `icicle-mctize-all', ;; `icicle-mctized-display-candidate', ;; `icicle-mctized-full-candidate', ;; `icicle-merge-saved-order-less-p', ;; `icicle-minibuffer-default-add-completions', ;; `icicle-minibuf-input', `icicle-minibuf-input-sans-dir', ;; `icicle-minibuffer-prompt-end', `icicle-minibuffer-setup', ;; `icicle-mode-line-name-less-p', `icicle-most-recent-first-p', ;; `icicle-mouse-candidate-action-1', ;; `icicle-msg-maybe-in-minibuffer', `icicle-ms-windows-NET-USE', ;; `icicle-multi-comp-apropos-complete-match', `icicle-multi-sort', ;; `icicle-nb-Completions-cols', ;; `icicle-nb-of-cand-at-Completions-pos', ;; `icicle-nb-of-cand-in-Completions-horiz', ;; `icicle-next-candidate', ;; `icicle-next-single-char-property-change', ;; `icicle-next-visible-thing-1', `icicle-next-visible-thing-2', ;; `icicle-next-visible-thing-and-bounds', ;; `icicle-non-whitespace-string-p', ;; `icicle-not-basic-prefix-completion-p', ;; `icicle-ORIG-choose-completion-string', ;; `icicle-ORIG-completing-read', ;; `icicle-ORIG-completing-read-multiple', ;; `icicle-ORIG-completion-setup-function', ;; `icicle-ORIG-dired-smart-shell-command', ;; `icicle-ORIG-display-completion-list', ;; `icicle-ORIG-face-valid-attribute-values', ;; `icicle-ORIG-minibuffer-default-add-completions', ;; `icicle-ORIG-read-char-by-name', `icicle-ORIG-read-color', ;; `icicle-ORIG-read-face-name', ;; `icicle-ORIG-read-file-name-default', ;; `icicle-ORIG-read-from-minibuffer', `icicle-ORIG-read-number', ;; `icicle-ORIG-read-string', `icicle-ORIG-shell-command', ;; `icicle-ORIG-shell-command-on-region', ;; `icicle-ORIG-widget-color-complete', `icicle-part-1-cdr-lessp', ;; `icicle-part-1-lessp', `icicle-part-2-lessp', ;; `icicle-part-3-lessp', `icicle-part-4-lessp', ;; `icicle-part-N-lessp', `icicle-pick-color-by-name-action', ;; `icicle-place-cursor', `icicle-place-overlay', ;; `icicle-position', `icicle-prefix-any-candidates-p', ;; `icicle-prefix-any-file-name-candidates-p', ;; `icicle-prefix-candidates', `icicle-prefix-complete-1', ;; `icicle-prefix-complete-2', `icicle-prefix-keys-first-p', ;; `icicle-previous-single-char-property-change', ;; `icicle-propertize', `icicle-proxy-candidate-first-p', ;; `icicle-put-at-head', `icicle-put-whole-cand-prop', ;; `icicle-quote-file-name-part-of-cmd', ;; `icicle-raise-Completions-frame', `icicle-readable-to-markers', ;; `icicle-read-args-w-val-satisfying', `icicle-read-char-by-name', ;; `icicle-read-args-for-set-completion-methods', ;; `icicle-read-char-exclusive', ;; `icicle-read-char-maybe-completing', `icicle-read-face-name', ;; `icicle-read-file-name', `icicle-read-file-name-default', ;; `icicle-read-from-minibuffer', ;; `icicle-read-from-minibuf-nil-default', `icicle-read-number', ;; `icicle-read-shell-command', ;; `icicle-read-shell-command-completing', `icicle-read-string', ;; `icicle-read-string-completing', ;; `icicle-read-var-value-satisfying', `icicle-rebind-global', ;; `icicle-recent-files-without-buffers.', ;; `icicle-recentf-make-menu-items', `icicle-recompute-candidates', ;; `icicle-redefine-standard-functions', ;; `icicle-redefine-standard-options', ;; `icicle-redefine-std-completion-fns', ;; `icicle-region-or-buffer-limits', `icicle-remap', ;; `icicle-remove-buffer-candidate-action', ;; `icicle-remove-buffer-config-action', ;; `icicle-remove-cand-from-lists', ;; `icicle-remove-candidate-display-others', ;; `icicle-remove-color-duplicates', `icicle-remove-dots', ;; `icicle-remove-duplicates', `icicle-remove-dups-if-extras', ;; `icicle-remove-from-recentf-candidate-action', ;; `icicle-remove-if', `icicle-remove-if-not', ;; `icicle-remove-property', `icicle-replace-mct-cand-in-mct', ;; `icicle-remove-saved-set-action', ;; `icicle-replace-input-w-parent-dir', `icicle-require-match-p', ;; `icicle-restore-completion-keys', ;; `icicle-restore-custom-minibuffer-keys', ;; `icicle-restore-other-keymap-keys', ;; `icicle-restore-region-face', ;; `icicle-restore-standard-commands', ;; `icicle-restore-standard-options', ;; `icicle-restore-std-completion-fns', ;; `icicle-retrieve-candidates-from-set', `icicle-reversible-sort', ;; `icicle-row-wise-cand-nb', ;; `icicle-run-icicle-post-command-hook', ;; `icicle-run-icicle-pre-command-hook', `icicle-saved-fileset-p', ;; `icicle-save-or-restore-input', `icicle-save-raw-input', ;; `icicle-scatter', `icicle-scatter-match', ;; `icicle-scroll-or-update-Completions', `icicle-search-action', ;; `icicle-search-action-1', `icicle-search-bookmark-action', ;; `icicle-search-char-property-scan', ;; `icicle-search-char-prop-matches-p', ;; `icicle-search-choose-buffers', `icicle-search-cleanup', ;; `icicle-search-define-candidates', ;; `icicle-search-define-candidates-1', ;; `icicle-search-file-found-p', `icicle-search-final-act', ;; `icicle-search-help', ;; `icicle-search-highlight-all-input-matches', ;; `icicle-search-highlight-and-maybe-replace', ;; `icicle-search-highlight-input-matches-here', ;; `icicle-search-in-context-default-fn', ;; `icicle-search-property-args', ;; `icicle-search-property-default-match-fn', ;; `icicle-search-quit-or-error', ;; `icicle-search-read-context-regexp', `icicle-search-read-word', ;; `icicle-search-regexp-scan', ;; `icicle-search-replace-all-search-hits', ;; `icicle-search-replace-cand-in-alist', ;; `icicle-search-replace-cand-in-mct', ;; `icicle-search-replace-fixed-case-p', ;; `icicle-search-replace-match', `icicle-search-thing-args', ;; `icicle-search-thing-scan', `icicle-search-where-arg', ;; `icicle-select-minibuffer-contents' `icicle-set-calling-cmd', ;; `icicle-set-completion-methods-for-command', ;; `icicle-set-difference', `icicle-set-intersection', ;; `icicle-set-union', `icicle-shell-command-on-file', ;; `icicle-shell-dynamic-complete-as-command', ;; `icicle-shell-dynamic-complete-as-environment-variable', ;; `icicle-show-current-help-in-mode-line', ;; `icicle-show-help-in-mode-line', `icicle-show-in-mode-line', ;; `icicle-signum', `icicle-S-iso-lefttab-to-S-TAB', ;; `icicle-sit-for', `icicle-some', ;; `icicle-special-candidates-first-p', `icicle-split-input', ;; `icicle-start-of-candidates-in-Completions', ;; `icicle-string-match-p', `icicle-strip-ignored-files-and-sort', ;; `icicle-subst-envvar-in-file-name', ;; `icicle-substring-no-properties', `icicle-substrings-of-length', ;; `icicle-substitute-keymap-vars', `icicle-successive-action', ;; `icicle-take', `icicle-thing-at-point', `icicle-things-alist', ;; `icicle-this-command-keys-prefix', ;; `icicle-toggle-icicle-mode-twice', `icicle-top-level-prep', ;; `icicle-transform-candidates', ;; `icicle-transform-multi-completion', ;; `icicle-transform-sole-candidate', ;; `icicle-transpose-chars-magic', `icicle-try-switch-buffer', ;; `icicle-ucs-names', `icicle-unbind-buffer-candidate-keys', ;; `icicle-unbind-file-candidate-keys', ;; `icicle-unbind-isearch-keys', ;; `icicle-unbind-key-completion-keys-for-map-var', ;; `icicle-unbind-key-completion-keys-in-keymaps-from', ;; `icicle-undo-std-completion-faces', ;; `icicle-unhighlight-lighter', `icicle-unmap', ;; `icicle-unpropertize-completion', ;; `icicle-unsorted-apropos-candidates', ;; `icicle-unsorted-file-name-apropos-candidates', ;; `icicle-unsorted-file-name-prefix-candidates', ;; `icicle-unsorted-prefix-candidates', `icicle-upcase', ;; `icicle-upcase-if-ignore-case', `icicle-update-and-next', ;; `icicle-update-ignored-extensions-regexp', ;; `icicle-value-satisfies-type-p', `icicle-var-inherits-type-p', ;; `icicle-var-is-of-type-p', `icicle-var-matches-type-p', ;; `icicle-var-val-satisfies-type-p', ;; `icicle-widget-color-complete', `icicle-widgetp'. ;; ;; Internal variables and constants defined in Icicles: ;; ;; `icicle-abs-file-candidates', `icicle-acting-on-next/prev', ;; `icicle-active-map', `icicle-advice-info-list', ;; `icicle-all-candidates-action', ;; `icicle-all-candidates-list-action-fn', ;; `icicle-all-candidates-list-alt-action-fn', ;; `icicle-allowed-sort-predicate', `icicle-anychar-regexp', ;; `icicle-apply-nomsg', `icicle-apropos-complete-match-fn', ;; `icicle-apropos-value-last-initial-cand-set', ;; `icicle-bookmark-history', `icicle-bookmark-list-names-only-p', ;; `icicle-bookmark-menu-map', `icicle-bookmark-types', ;; `icicle-buffer-config-history', `icicle-buffer-name-input-p', ;; `icicle-buffer-sort-first-time-p', `icicle-bufflist', ;; `icicle-candidate-action-fn', `icicle-candidate-alt-action-fn', ;; `icicle-candidate-entry-fn', `icicle-candidate-help-fn', ;; `icicle-candidate-nb', `icicle-candidate-properties-alist', ;; `icicle-candidates-alist', `icicle-cands-to-narrow', ;; `icicle-char-property-value-history', ;; `icicle-cmd-calling-for-completion', `icicle-cmd-reading-input', ;; `icicle-color-history', `icicle-color-theme-history', ;; `icicle-command-abbrev-history', `icicle-commands-for-abbrev', ;; `icicle-common-match-string', ;; `icicle-comp-base-is-default-dir-p', ;; `icicle-complete-input-overlay', `icicle-complete-keys-alist', ;; `icicle-completing-p', ;; `icicle-completing-read+insert-candidates', ;; `icicle-completion-candidates', ;; `icicle-completion-prompt-overlay', ;; `icicle-completion-set-history', ;; `icicle-Completions-misc-submenu', ;; `icicle-Completions-save/retrieve-submenu', ;; `icicle-Completions-sets-submenu', ;; `icicle-Completions-sorting-submenu', ;; `icicle-Completions-this-candidate-submenu', ;; `icicle-Completions-toggle-submenu', ;; `icicle-compute-narrowing-regexp-p', ;; `icicle-confirm-exit-commands', ;; `icicle-crm-local-completion-map', ;; `icicle-crm-local-must-match-map', ;; `icicle-current-completion-candidate-overlay', ;; `icicle-current-completion-mode', `icicle-current-input', ;; `icicle-current-raw-input', `icicle-current-TAB-method', ;; `icicle-custom-menu-map', `icicle-cycling-p', ;; `icicle-default-thing-insertion-flipped-p', ;; `icicle-delete-candidate-object', `icicle-describe-menu-map', ;; `icicle-dictionary-history', `icicle-dir-candidate-can-exit-p', ;; `icicle-dirs-done', `icicle-doc-last-initial-cand-set', ;; `icicle-dot-string-internal', `icicle-edit-menu-map', ;; `icicle-edit-update-p', `icicle-ess-use-ido', ;; `icicle-exclude-default-proxies', `icicle-explore-final-choice', ;; `icicle-explore-final-choice-full', `icicle-extra-candidates', ;; `icicle-extra-candidates-dir-insert-p', ;; `icicle-face-name-history', `icicle-fancy-candidates-p', ;; `icicle-fancy-cands-internal-p', `icicle-file-menu-map', ;; `icicle-file-name-completion-table', `icicle-files', ;; `icicle-file-sort-first-time-p', ;; `icicle-filtered-default-value', `icicle-font-name-history', ;; `icicle-frame-alist', `icicle-frame-name-history', ;; `icicle-frames-menu-map', `icicle-full-cand-fn', ;; `icicle-function-name-history', ;; `icicle-fundoc-last-initial-cand-set', ;; `icicle-general-help-string', ;; `icicle-get-alist-candidate-function', ;; `icicle-hist-cands-no-highlight', `icicle-hist-var', ;; `icicle-ignored-extensions', `icicle-ignored-extensions-regexp', ;; `icicle-incremental-completion-p', `icicle-info-buff', ;; `icicle-Info-index-cache', `icicle-info-menu-map', ;; `icicle-Info-only-rest-of-book-p', `icicle-Info-tag-table-posn', ;; `icicle-info-window', `icicle-inhibit-sort-p', ;; `icicle-inhibit-try-switch-buffer', `icicle-initial-value', ;; `icicle-input-completion-fail-overlay', `icicle-input-fail-pos', ;; `icicle-insert-string-at-pt-end', ;; `icicle-insert-string-at-pt-start', ;; `icicle-interactive-history', `icicle-key-prefix', ;; `icicle-key-prefix-2', `icicle-key-prefix-description', ;; `icicle-kill-history', `icicle-kmacro-alist', ;; `icicle-kmacro-history', ;; `icicle-last-apropos-complete-match-fn', ;; `icicle-last-completion-candidate', ;; `icicle-last-completion-command', `icicle-last-input', ;; `icicle-last-sort-comparer', `icicle-last-top-level-command', ;; `icicle-last-transform-function', `icicle-last-thing-type', ;; `icicle-locate-file-action-fn', ;; `icicle-locate-file-no-symlinks-p', `icicle-lighter-truncation', ;; `icicle-list-use-nth-parts', `icicle-menu-map', ;; `icicle-minibuf-act-on-all-menu-map', ;; `icicle-minibuf-candidate-set-menu-map', ;; `icicle-minibuf-edit-menu-map' `icicle-minibuffer-message-ok-p', ;; `icicle-minibuf-history-menu-map', ;; `icicle-minibuf-save-retrieve-menu-map', ;; `icicle-minor-mode-map-entry', `icicle-mode-line-help', ;; `icicle-mode-map', `icicle-ms-windows-drive-hash', ;; `icicle-multi-completing-p', `icicle-multi-inputs-action-fn', ;; `icicle-must-match-regexp', `icicle-must-not-match-regexp', ;; `icicle-must-pass-after-match-predicate', ;; `icicle-must-pass-predicate', `icicle-named-colors', ;; `icicle-narrow-regexp', ;; `icicle-nb-candidates-before-truncation', ;; `icicle-nb-of-other-cycle-candidates', `icicle-new-last-cmd', ;; `icicle-next-apropos-complete-cycles-p', ;; `icicle-next-prefix-complete-cycles-p', ;; `icicle-options-menu-map', `icicle-orig-buff', ;; `icicle-ORIG-crm-local-completion-map', ;; `icicle-ORIG-crm-local-must-match-map', ;; `icicle-orig-extra-cands', `icicle-orig-font', ;; `icicle-orig-frame', `icicle-orig-menu-bar', ;; `icicle-orig-must-pass-after-match-pred', ;; `icicle-orig-pixelsize', `icicle-orig-pointsize', ;; `icicle-orig-pt-explore', `icicle-orig-read-file-name-fn', ;; `icicle-orig-show-initially-flag', ;; `icicle-orig-sort-orders-alist', `icicle-orig-window', ;; `icicle-other-window', `icicle-path-variables', ;; `icicle-plist-last-initial-cand-set', ;; `icicle-pre-minibuffer-buffer', `icicle-post-command-hook', ;; `icicle-pre-command-hook', `icicle-predicate-types-alist', ;; `icicle-previous-raw-file-name-inputs', ;; `icicle-previous-raw-non-file-name-inputs', ;; `icicle-progressive-completing-p', `icicle-prompt', ;; `icicle-proxy-candidate-regexp', `icicle-proxy-candidates', ;; `icicle-read-expression-map', `icicle-read-char-history', ;; `icicle-read-file-name-internal-fn' (Emacs 24+), ;; `icicle-remove-icicles-props-p', `icicle-re-no-dot', ;; `icicle-require-match-p', `icicle-reverse-multi-sort-p', ;; `icicle-reverse-sort-p', `icicle-saved-candidate-overlays', ;; `icicle-saved-candidates-variables-obarray', ;; `icicle-saved-completion-candidate', ;; `icicle-saved-completion-candidates', ;; `icicle-saved-completion-candidates-internal', ;; `icicle-saved-ignored-extensions', ;; `icicle-saved-kmacro-ring-max', `icicle-saved-proxy-candidates', ;; `icicle-saved-regexp-search-ring-max', ;; `icicle-saved-region-background', ;; `icicle-saved-search-ring-max', ;; `icicle-scroll-Completions-reverse-p', `icicle-search-command', ;; `icicle-search-complement-domain-p', ;; `icicle-search-context-level', `icicle-search-context-regexp', ;; `icicle-search-current-overlay', `icicle-search-final-choice', ;; `icicle-search-history', `icicle-search-in-context-fn', ;; `icicle-searching-p', `icicle-search-level-overlays', ;; `icicle-search-map', `icicle-search-modes', ;; `icicle-search-menu-map', `icicle-search-tags-menu-map', ;; `icicle-search-overlays', `icicle-search-refined-overlays', ;; `icicle-search-replacement', ;; `icicle-search-replacement-history', ;; `icicle-successive-grab-count', ;; `icicle-text-property-value-history', ;; `icicle-thing-at-pt-fns-pointer', `icicle-this-cmd-keys', ;; `icicle-transform-before-sort-p', `icicle-transform-function', ;; `icicle-toggle-transforming-message', ;; `icicle-universal-argument-map', ;; `icicle-vardoc-last-initial-cand-set', ;; `icicle-variable-name-history', ;; `icicle-whole-candidate-as-text-prop-p', ;; `lacarte-menu-items-alist'. ;; ;; Emacs functions defined in Icicles for older Emacs versions: ;; ;; `select-frame-set-input-focus'. ;; ;; Widgets (customization types) defined in Icicles: ;; ;; `icicle-key-definition'. ;; ;; ;; ***** NOTE: These EMACS PRIMITIVES have been REDEFINED in Icicles: ;; ;; `completing-read' - (See below and doc string.) ;; `display-completion-list' - (See below and doc string.) ;; `exit-minibuffer' - Remove *Completion* window. ;; `minibuffer-complete-and-exit' - Remove *Completion* window. ;; `read-file-name' - (See below and doc string.) ;; `read-from-minibuffer' - (See below and doc string.) ;; `read-string' - (See below and doc string.) ;; ;; ;; ***** NOTE: The following functions defined in `dabbrev.el' have ;; been REDEFINED in Icicles: ;; ;; `dabbrev-completion' - Use Icicles completion when you repeat ;; (`C-M-/'). ;; ;; ;; ***** NOTE: The following functions defined in `lisp.el' have ;; been REDEFINED in Icicles: ;; ;; `lisp-complete-symbol' - Selects `*Completions*' window even if on ;; another frame. ;; ;; ;; ***** NOTE: The following functions defined in `mouse.el' have ;; been REDEFINED in Icicles: ;; ;; `mouse-choose-completion' - Return the number of the completion. ;; ;; ;; ***** NOTE: The following functions defined in `simple.el' have ;; been REDEFINED in Icicles: ;; ;; `choose-completion-string' - ;; Don't exit minibuffer after `lisp-complete-symbol' completion. ;; `completion-setup-function' - 1. Put faces on inserted string(s). ;; 2. Help on help. ;; `switch-to-completions' - Always selects `*Completions*' window. ;; ;; `next-history-element' (advised only) - ;; Depending on `icicle-default-value', select minibuffer ;; contents. ;; ;; `repeat-complex-command' - Use `completing-read' to read command. ;; ;; For descriptions of changes to this file, see `icicles-chg.el'. ;; ;; ****************** ;; NOTE: Whenever you update Icicles (i.e., download new versions of ;; Icicles source files), I recommend that you do the following: ;; ;; 1. Delete all existing byte-compiled Icicles files ;; (icicles*.elc). ;; 2. Load Icicles (`load-library' or `require'). ;; 3. Byte-compile the source files. ;; ;; In particular, always load `icicles-mac.el' (not ;; `icicles-mac.elc') before you byte-compile new versions of the ;; files, in case there have been any changes to Lisp macros (in ;; `icicles-mac.el'). ;; ****************** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: ;;;;;;;;;;;;; ;;; Load other Icicles files (except documentation) ------------------ (eval-when-compile (or (condition-case nil ;; Use load-library to ensure latest .elc. (load-library "icicles-mac") (error nil)) ;; Require, so can load separately if not on `load-path'. (require 'icicles-mac))) (require 'icicles-face) (require 'icicles-opt) ;; Requires face (require 'icicles-var) ;; Requires opt (require 'icicles-fn) ;; Requires mac, opt, var (require 'icicles-mcmd) ;; Requires opt, var, fn, mac (require 'icicles-cmd1) ;; Requires mac, opt, var, fn, mcmd (require 'icicles-cmd2) ;; Requires mac, opt, var, fn, mcmd, cmd1 (require 'icicles-mode) ;; Requires face, opt, cmd ;;(@* "Miscellaneous") ;;; Miscellaneous ----------------------------------------- ;; Make Emacs-Lisp mode fontify definitions of Icicles commands. (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(" (regexp-opt '("icicle-define-add-to-alist-command" "icicle-define-bookmark-command" "icicle-define-bookmark-other-window-command" "icicle-define-command" "icicle-define-file-command" "icicle-define-search-bookmark-command" "icicle-define-sort-command") t) (if (> emacs-major-version 21) "\\_>[ \t'\(]*\\(\\(\\sw\\|\\s_\\)+\\)?" "\\>[ \t'\(]*\\(\\sw+\\)?")) (1 font-lock-keyword-face) ;; Index (2 or 3) depends on whether or not shy groups are supported. ,(list (if (string-match "\\(?:\\)" "") 2 5) 'font-lock-function-name-face nil t)) ("(\\(icicle-condition-case-no-debug\\)\\>" 1 font-lock-keyword-face) ("(\\(icicle-user-error\\)\\>" 1 font-lock-warning-face))) ;; Make Icicles macros indent better. (put 'icicle-define-add-to-alist-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-bookmark-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-bookmark-other-window-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-file-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-search-bookmark-command 'common-lisp-indent-function '(4 &body)) (put 'icicle-define-sort-command 'common-lisp-indent-function '(4 4 &body)) (put 'icicle-with-selected-window 'common-lisp-indent-function '(4 &body)) (put 'icicle-condition-case-no-debug 'common-lisp-indent-function '(4 4 &body)) ;; You might also want to use the following or something similar. ;; (defun lisp-indentation-hack () ;; "Better Lisp indenting. Use in Lisp mode hooks ;; such as `lisp-mode-hook', `emacs-lisp-mode-hook', and ;; `lisp-interaction-mode-hook'." ;; (load "cl-indent" nil t) ;; (set (make-local-variable 'lisp-indent-function) 'common-lisp-indent-function) ;; (setq lisp-indent-maximum-backtracking 10) ;; (put 'define-derived-mode 'common-lisp-indent-function '(4 4 4 2 &body)) ;; (put 'if 'common-lisp-indent-function '(nil nil &body))) ;; ;; (add-hook 'emacs-lisp-mode-hook 'lisp-indentation-hack) ;; (add-hook 'lisp-mode-hook 'lisp-indentation-hack) ;; (add-hook 'lisp-interaction-mode-hook 'lisp-indentation-hack) ;;; Icicles autoloads - provide information as doc string for `icicle-mode. ;;; ;;;###autoload (autoload 'icy-mode "icicles" "Toggle Icicle mode - see `icicle-mode'." t nil) ;;;###autoload (autoload 'icicle-mode "icicles" ;;;###autoload"Icicle mode: Toggle minibuffer input completion and cycling. ;;;###autoload Non-nil prefix ARG turns mode on if ARG > 0, else turns it off. ;;;###autoload Icicle mode is a global minor mode. It binds keys in the minibuffer. ;;;###autoload \ ;;;###autoload For more information, use `\\\\[icicle-minibuffer-help]' \ ;;;###autoload when the minibuffer is active. ;;;###autoload \ ;;;###autoload Depending on your platform, if you use Icicles in a text terminal ;;;###autoload \(that is, without a window system/manager), you might need to change ;;;###autoload some of the key bindings if some of the default bindings are not ;;;###autoload available to you. ;;;###autoload \ ;;;###autoload Icicle mode defines many top-level commands. For a list, see the ;;;###autoload Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'." ;;;###autoload t nil) ;;;;;;;;;;;;;;;;;;;;;;; (provide 'icicles) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; icicles.el ends here