What should I use:
(when (package-installed-p 'ivy) (global-set-key (kbd "C-x b") #'ivy-switch-buffer))
(when (fboundp 'ivy-switch-buffer) (global-set-key (kbd "C-x b") #'ivy-switch-buffer))
(eval-after-load ivy ...) ; haven't tested it yet
I try to rebind key based on a package presence. We are in 2021 so it is safe to assume of presence of
package.el but what if I installed a package from git/hg?
fboundp & compilation of
.emacs it doesn't redefine key.
package-installed-p though... I haven't
(ivy-mode +1) so function definition
ivy-switch-buffer can be in form of