From: John Wiegley Date: Mon, 13 Feb 2017 21:44:04 +0000 (-0500) Subject: Merge pull request from justbur/imenu3 X-Git-Tag: emacs-29.0.90~1306^2~15^2~277 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c287aa308581a9936fbca1c1641241c6aba91a27;p=emacs.git Merge pull request from justbur/imenu3 Improve imenu support GitHub-reference: https://github.com/jwiegley/use-package/issues/356 --- c287aa308581a9936fbca1c1641241c6aba91a27 diff --cc lisp/use-package/use-package.el index bba24d923f5,59f26158740..d993ce64530 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@@ -182,44 -176,18 +182,42 @@@ Must be set before loading use-package. :type 'boolean :group 'use-package) +(defcustom use-package-ensure-function 'use-package-ensure-elpa + "Function that ensures a package is installed. +This function is called with one argument, the package name as a +symbol, by the `:ensure' keyword. + +The default value uses package.el to install the package." + :type '(choice (const :tag "package.el" use-package-ensure-elpa) + (function :tag "Custom")) + :group 'use-package) + +(defcustom use-package-defaults + '((:config '(t) t) + (:ensure use-package-always-ensure use-package-always-ensure) + (:pin use-package-always-pin use-package-always-pin)) + "Alist of default values for `use-package' keywords. +Each entry in the alist is a list of three elements. The first +element is the `use-package' keyword and the second is a form +that can be evaluated to get the default value. The third element +is a form that can be evaluated to determine whether or not to +assign a default value; if it evaluates to nil, then the default +value is not assigned even if the keyword is not present in the +`use-package' form." + :type '(repeat (list symbol sexp sexp))) + (when use-package-enable-imenu-support - ;; Not defined in Emacs 24 - (defvar lisp-mode-symbol-regexp - "\\(?:\\sw\\|\\s_\\|\\\\.\\)+") - (add-to-list - 'lisp-imenu-generic-expression - (list "Package" - (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("use-package" "require") - t)) - "\\s-+\\(" lisp-mode-symbol-regexp "\\)")) - 2))) + (eval-after-load 'lisp-mode + `(let ((sym-regexp (or (bound-and-true-p lisp-mode-symbol-regexp) + "\\(?:\\sw\\|\\s_\\|\\\\.\\)+"))) + (add-to-list + 'lisp-imenu-generic-expression + (list "Packages" + (concat "^\\s-*(" + ,(eval-when-compile + (regexp-opt '("use-package" "require") t)) + "\\s-+\\(" sym-regexp "\\)") + 2))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;