From e78e280d7dbcd7b77ccba1fd1f914a45430abe0a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 14 Oct 2009 14:53:36 +0000 Subject: [PATCH] (ido-everywhere): Use define-minor-mode. --- lisp/ChangeLog | 23 +++++++++++------ lisp/ido.el | 69 +++++++++++++++++++++++--------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70c22dda440..fef454a6fa8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2009-10-14 Stefan Monnier + + * 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 * vc-git.el (vc-git-dir-extra-headers): Set the branch name @@ -172,14 +180,13 @@ 2009-10-08 Michael Albinus * 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 @@ -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 @@ -196,8 +203,8 @@ 2009-10-07 Glenn Morris - * 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 diff --git a/lisp/ido.el b/lisp/ido.el index 2336feacf9e..ce49915d17f 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -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'." -- 2.39.5