Function: package--autosuggest-install-and-enable
package--autosuggest-install-and-enable is a byte-compiled function
defined in package.el.gz.
Signature
(package--autosuggest-install-and-enable SUG)
Documentation
Install and enable a package suggestion SUG.
SUG should be of the form as described in package--suggestion-applies-p.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
;;;; Package Suggestions
(defun package--autosuggest-install-and-enable (sug)
"Install and enable a package suggestion SUG.
SUG should be of the form as described in `package--suggestion-applies-p'."
(let ((buffers-to-update '()))
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (and (eq major-mode 'fundamental-mode) (buffer-file-name)
(package--suggestion-applies-p sug))
(push buf buffers-to-update))))
(with-demoted-errors "Failed to install package: %S"
(package-install (car sug))
(dolist (buf buffers-to-update)
(with-demoted-errors "Failed to enable major mode: %S"
(with-current-buffer buf
(funcall-interactively (or (cadddr sug) (car sug)))))))))