(ido-everywhere): Use define-minor-mode.

This commit is contained in:
Stefan Monnier 2009-10-14 14:53:36 +00:00
parent 349b6bfe4e
commit e78e280d7d
2 changed files with 46 additions and 46 deletions

View file

@ -1,3 +1,11 @@
2009-10-14 Stefan Monnier <monnier@iro.umontreal.ca>
* ido.el (ido-everywhere): Use define-minor-mode.
* buff-menu.el (list-buffers, ctl-x-map):
Mark the entry points with ;;;###autoload cookies.
2009-10-14 Dan Nicolaescu <dann@ics.uci.edu>
* vc-git.el (vc-git-dir-extra-headers): Set the branch name
@ -172,14 +180,13 @@
2009-10-08 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
(tramp-file-name-real-host, tramp-file-name-port): Apply
`save-match-data.
(tramp-file-name-real-host, tramp-file-name-port):
Apply `save-match-data.
* net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
case both directories are remote.
(tramp-smb-handle-expand-file-name): Implement "~" expansion.
(tramp-smb-maybe-open-connection): Flush the cache only if
necessary.
(tramp-smb-maybe-open-connection): Flush the cache only if necessary.
2009-10-08 Chong Yidong <cyd@stupidchicken.com>
@ -187,8 +194,8 @@
(ede-proj-target-makefile-objectcode): Use it.
* cedet/ede/source.el (ede-want-any-source-files-p)
(ede-want-any-auxiliary-files-p, ede-want-any-files-p): Return
search result. This error was introduced while merging.
(ede-want-any-auxiliary-files-p, ede-want-any-files-p):
Return search result. This error was introduced while merging.
2009-10-07 Juanma Barranquero <lekktu@gmail.com>
@ -196,8 +203,8 @@
2009-10-07 Glenn Morris <rgm@gnu.org>
* emacs-lisp/autoload.el (batch-update-autoloads): Remove useless use of
concat.
* emacs-lisp/autoload.el (batch-update-autoloads): Remove useless use
of concat.
2009-10-07 Stefan Monnier <monnier@iro.umontreal.ca>

View file

@ -366,16 +366,6 @@ use either \\[customize] or the function `ido-mode'."
(const :tag "Switch off all" nil))
:group 'ido)
(defcustom ido-everywhere nil
"Use ido everywhere for reading file names and directories.
Setting this variable directly does not work. Use `customize' or
call the function `ido-everywhere'."
:set #'(lambda (symbol value)
(ido-everywhere (if value 1 -1)))
:initialize 'custom-initialize-default
:type 'boolean
:group 'ido)
(defcustom ido-case-fold case-fold-search
"Non-nil if searching of buffer and file names should ignore case."
:type 'boolean
@ -1449,6 +1439,25 @@ Removes badly formatted data and ignored directories."
;; ido kill emacs hook
(ido-save-history))
(define-minor-mode ido-everywhere
"Toggle using ido speed-ups everywhere file and directory names are read.
With ARG, turn ido speed-up on if arg is positive, off otherwise."
:global t
:group 'ido
(when (get 'ido-everywhere 'file)
(setq read-file-name-function (car (get 'ido-everywhere 'file)))
(put 'ido-everywhere 'file nil))
(when (get 'ido-everywhere 'buffer)
(setq read-buffer-function (car (get 'ido-everywhere 'buffer)))
(put 'ido-everywhere 'buffer nil))
(when ido-everywhere
(when (memq ido-mode '(both file))
(put 'ido-everywhere 'file (cons read-file-name-function nil))
(setq read-file-name-function 'ido-read-file-name))
(when (memq ido-mode '(both buffer))
(put 'ido-everywhere 'buffer (cons read-buffer-function nil))
(setq read-buffer-function 'ido-read-buffer))))
(defvar ido-minor-mode-map-entry nil)
;;;###autoload
@ -1492,15 +1501,21 @@ This function also adds a hook to the minibuffer."
(define-key map [remap insert-file] 'ido-insert-file)
(define-key map [remap list-directory] 'ido-list-directory)
(define-key map [remap dired] 'ido-dired)
(define-key map [remap find-file-other-window] 'ido-find-file-other-window)
(define-key map [remap find-file-read-only-other-window] 'ido-find-file-read-only-other-window)
(define-key map [remap find-file-other-frame] 'ido-find-file-other-frame)
(define-key map [remap find-file-read-only-other-frame] 'ido-find-file-read-only-other-frame))
(define-key map [remap find-file-other-window]
'ido-find-file-other-window)
(define-key map [remap find-file-read-only-other-window]
'ido-find-file-read-only-other-window)
(define-key map [remap find-file-other-frame]
'ido-find-file-other-frame)
(define-key map [remap find-file-read-only-other-frame]
'ido-find-file-read-only-other-frame))
(when (memq ido-mode '(buffer both))
(define-key map [remap switch-to-buffer] 'ido-switch-buffer)
(define-key map [remap switch-to-buffer-other-window] 'ido-switch-buffer-other-window)
(define-key map [remap switch-to-buffer-other-frame] 'ido-switch-buffer-other-frame)
(define-key map [remap switch-to-buffer-other-window]
'ido-switch-buffer-other-window)
(define-key map [remap switch-to-buffer-other-frame]
'ido-switch-buffer-other-frame)
(define-key map [remap insert-buffer] 'ido-insert-buffer)
(define-key map [remap kill-buffer] 'ido-kill-buffer)
(define-key map [remap display-buffer] 'ido-display-buffer))
@ -1513,28 +1528,6 @@ This function also adds a hook to the minibuffer."
(message "Ido mode %s" (if ido-mode "enabled" "disabled")))
(defun ido-everywhere (arg)
"Toggle using ido speed-ups everywhere file and directory names are read.
With ARG, turn ido speed-up on if arg is positive, off otherwise."
(interactive "P")
(setq ido-everywhere (if arg
(> (prefix-numeric-value arg) 0)
(not ido-everywhere)))
(when (get 'ido-everywhere 'file)
(setq read-file-name-function (car (get 'ido-everywhere 'file)))
(put 'ido-everywhere 'file nil))
(when (get 'ido-everywhere 'buffer)
(setq read-buffer-function (car (get 'ido-everywhere 'buffer)))
(put 'ido-everywhere 'buffer nil))
(when ido-everywhere
(when (memq ido-mode '(both file))
(put 'ido-everywhere 'file (cons read-file-name-function nil))
(setq read-file-name-function 'ido-read-file-name))
(when (memq ido-mode '(both buffer))
(put 'ido-everywhere 'buffer (cons read-buffer-function nil))
(setq read-buffer-function 'ido-read-buffer))))
;;; IDO KEYMAP
(defun ido-init-completion-maps ()
"Set up the completion keymaps used by `ido'."