X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/001903b5498d4898455e1a69bff166a9cc699ec0..8db39aebe862bf2384a13b69e309115d92524853:/lisp/iswitchb.el diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index 70dda5442d..13ab41cf83 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el @@ -1,6 +1,6 @@ ;;; iswitchb.el --- switch between buffers using substrings -;; Copyright (C) 1996-1997, 2000-2011 Free Software Foundation, Inc. +;; Copyright (C) 1996-1997, 2000-2012 Free Software Foundation, Inc. ;; Author: Stephen Eglen ;; Maintainer: Stephen Eglen @@ -122,7 +122,7 @@ ;; t IN | INBOX ;; t In | [No match] -;;; Customisation +;;; Customization ;; See the User Variables section below for easy ways to change the ;; functionality of the program. These are accessible using the @@ -163,7 +163,7 @@ ;; Font-Lock ;; font-lock is used to highlight the first matching buffer. To -;; switch this off, set (setq iswitchb-use-faces nil). Colouring of +;; switch this off, set (setq iswitchb-use-faces nil). Coloring of ;; the matching buffer name was suggested by Carsten Dominik ;; (dominik@strw.leidenuniv.nl) @@ -233,7 +233,7 @@ ;;; TODO -;;; Acknowledgements +;;; Acknowledgments ;; Thanks to Jari Aalto for help with the ;; first version of this package, iswitch-buffer. Thanks also to many @@ -372,9 +372,14 @@ See also `iswitchb-newbuffer'." :type 'string :group 'iswitchb) -(defvar iswitchb-all-frames 'visible - "*Argument to pass to `walk-windows' when finding visible buffers. -See documentation of `walk-windows' for useful values.") +(defcustom iswitchb-all-frames 'visible + "Argument to pass to `walk-windows' when iswitchb is finding buffers. +See documentation of `walk-windows' for useful values." + :type '(choice (const :tag "Selected frame only" nil) + (const :tag "All existing frames" t) + (const :tag "All visible frames" visible) + (const :tag "All frames on this terminal" 0)) + :group 'iswitchb) (defcustom iswitchb-minibuffer-setup-hook nil "Iswitchb-specific customization of minibuffer setup. @@ -522,33 +527,6 @@ selected.") ;;; FUNCTIONS -;;; ISWITCHB KEYMAP -(defun iswitchb-define-mode-map () - "Set up the keymap for `iswitchb-buffer'." - (interactive) - (let (map) - ;; generated every time so that it can inherit new functions. - ;;(or iswitchb-mode-map - - (setq map (copy-keymap minibuffer-local-map)) - (define-key map "?" 'iswitchb-completion-help) - (define-key map "\C-s" 'iswitchb-next-match) - (define-key map "\C-r" 'iswitchb-prev-match) - (define-key map "\t" 'iswitchb-complete) - (define-key map "\C-j" 'iswitchb-select-buffer-text) - (define-key map "\C-t" 'iswitchb-toggle-regexp) - (define-key map "\C-x\C-f" 'iswitchb-find-file) - (define-key map "\C-n" 'iswitchb-toggle-ignore) - (define-key map "\C-c" 'iswitchb-toggle-case) - (define-key map "\C-k" 'iswitchb-kill-buffer) - (define-key map "\C-m" 'iswitchb-exit-minibuffer) - (setq iswitchb-mode-map map) - (run-hooks 'iswitchb-define-mode-map-hook))) - -(make-obsolete 'iswitchb-define-mode-map - "use M-x iswitchb-mode or customize the variable `iswitchb-mode'." - "21.1") - ;;; MAIN FUNCTION (defun iswitchb () "Switch to buffer matching a substring. @@ -614,14 +592,25 @@ If START is a string, the selection process is started with that string. If MATCHES-SET is non-nil, the buflist is not updated before the selection process begins. Used by isearchb.el." - (let - ( - buf-sel - iswitchb-final-text - (icomplete-mode nil) ;; prevent icomplete starting up - ) - - (iswitchb-define-mode-map) + ;; The map is generated every time so that it can inherit new + ;; functions. + (let ((map (copy-keymap minibuffer-local-map)) + buf-sel iswitchb-final-text map + icomplete-mode) ; prevent icomplete starting up + (define-key map "?" 'iswitchb-completion-help) + (define-key map "\C-s" 'iswitchb-next-match) + (define-key map "\C-r" 'iswitchb-prev-match) + (define-key map "\t" 'iswitchb-complete) + (define-key map "\C-j" 'iswitchb-select-buffer-text) + (define-key map "\C-t" 'iswitchb-toggle-regexp) + (define-key map "\C-x\C-f" 'iswitchb-find-file) + (define-key map "\C-n" 'iswitchb-toggle-ignore) + (define-key map "\C-c" 'iswitchb-toggle-case) + (define-key map "\C-k" 'iswitchb-kill-buffer) + (define-key map "\C-m" 'iswitchb-exit-minibuffer) + (setq iswitchb-mode-map map) + (run-hooks 'iswitchb-define-mode-map-hook) + (setq iswitchb-exit nil) (setq iswitchb-default (if (bufferp default) @@ -1110,7 +1099,7 @@ Return the modified list with the last element prepended to it." (if (fboundp 'set-buffer-major-mode) (set-buffer-major-mode newbufcreated)) (iswitchb-visit-buffer newbufcreated)) - ;; else wont create new buffer + ;; else won't create new buffer (message "no buffer matching `%s'" buf)))) (defun iswitchb-window-buffer-p (buffer) @@ -1424,10 +1413,13 @@ See the variable `iswitchb-case' for details." ;;;###autoload (define-minor-mode iswitchb-mode - "Toggle Iswitchb global minor mode. -With arg, turn Iswitchb mode on if ARG is positive, otherwise turn it off. -This mode enables switching between buffers using substrings. See -`iswitchb' for details." + "Toggle Iswitchb mode. +With a prefix argument ARG, enable Iswitchb mode if ARG is +positive, and disable it otherwise. If called from Lisp, enable +the mode if ARG is omitted or nil. + +Iswitchb mode is a global minor mode that enables switching +between buffers using substrings. See `iswitchb' for details." nil nil iswitchb-global-map :global t :group 'iswitchb (if iswitchb-mode (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)