ido-describe-fns.el 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ;;; ido-describe-fns.el --- -*- lexical-binding: t -*-
  2. ;; Copyright (C) 2017 Ryan C. Thompson
  3. ;; Filename: ido-describe-fns.el
  4. ;; Author: Ryan C. Thompson
  5. ;; Created: Tue May 16 18:23:13 2017 (-0400)
  6. ;; Version: 3.17
  7. ;; Package-Requires: ((emacs "26") (ido-completing-read+ 3.17) (ido-ubiquitous 3.17))
  8. ;; URL: https://github.com/DarwinAwardWinner/ido-ubiquitous
  9. ;; Keywords: ido, completion, convenience
  10. ;; This file is NOT part of GNU Emacs.
  11. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  12. ;;
  13. ;;; Commentary:
  14. ;; This package is an extension for ido-ubiquitous that implements ido
  15. ;; completion for the new `describe-*' family of commands. In recent
  16. ;; Emacs versions, these commands no longer work with ido-ubiquitous
  17. ;; because they now use a function-based collection argument to
  18. ;; implement auto-loading of the file corresponding to the prefix you
  19. ;; entered in order to offer completions of symbols from that file.
  20. ;; Note that there is no separate mode to enable. If
  21. ;; `ido-ubiquitous-mode' is already enabled, then simply loading this
  22. ;; package will enable it as well.
  23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  24. ;;
  25. ;; This program is free software: you can redistribute it and/or modify
  26. ;; it under the terms of the GNU General Public License as published by
  27. ;; the Free Software Foundation, either version 3 of the License, or (at
  28. ;; your option) any later version.
  29. ;;
  30. ;; This program is distributed in the hope that it will be useful, but
  31. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  32. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  33. ;; General Public License for more details.
  34. ;;
  35. ;; You should have received a copy of the GNU General Public License
  36. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  37. ;;
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. ;;
  40. ;;; Code:
  41. (defconst ido-describe-fns-version "3.17"
  42. "Currently running version of ido-describe-fns.
  43. Note that when you update ido-describe-fns, this variable may not
  44. be updated until you restart Emacs.")
  45. (require 'ido)
  46. (require 'ido-completing-read+)
  47. (require 'ido-ubiquitous)
  48. (defvar ido-descfns-orig-predicate nil
  49. "Original predicate from the current completion call.")
  50. (defun ido-descfns-maybe-load-prefixes (string)
  51. "Load any files needed to complete the current input.
  52. This function auto-loads new files in the same way as
  53. `help--symbol-completion-table', but without doing any
  54. completion.
  55. Returns non-nil if any new files were loaded."
  56. (let ((old-load-history load-history)
  57. (prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
  58. (help--load-prefixes prefixes)
  59. (not (eq load-history old-load-history))))
  60. ;; `ido-exhibit' is the ido post-command hook
  61. (defadvice ido-exhibit (before ido-descfns activate)
  62. "Maybe load new files and update possible ido completions.
  63. Has no effect unless `ido-descfns-enable-this-call' is non-nil."
  64. (when (and (ido-ubiquitous-active)
  65. (ido-descfns-maybe-load-prefixes ido-text))
  66. (with-no-warnings
  67. (setq ido-cur-list
  68. (all-completions "" obarray ido-descfns-orig-predicate))
  69. (ido-ubiquitous--debug-message "ido-describe-fns loaded new files. `ido-cur-list' now has %i items" (length ido-cur-list)))))
  70. (provide 'ido-describe-fns)
  71. ;;; ido-describe-fns.el ends here