Skip to main content
added 401 characters in body
Source Link

I had this exact problem. I was trying to use a local version of lsp-mode but packages which depended on it were installing lsp-mode from melpa. @chenbin's solution would successfully filter out lsp-mode from the package list (i.e. when you M-x list-packages) but it would still be installed when installing any packages for which it was a dependency.

This solution will filter out any specified packages from beingI'm using (use-package) to specify the load path of my manually installed as a dependencypackages. Adding this code before (package-initialize) is called works for me:

(defvar local-only-packages '(lsp-mode) "Don't install these packages as dependencies, I will install them manually.") ;; When determining dependencies to install, filter out any packages you will ;; handle manually. (advice-add 'package-compute-transaction :filter-return (lambda (packages)   (-seq-removefilter (lambda (it) (not (memq (package-desc-name it) local-only-packages)))  packages)))   ;; When creating package-descriptions that will be initialized by ;; package.el, filter out the dependncies that are handled manually. (advice-add 'package-desc-from-define :filter-return (lambda (pkg-desc) (setf (package-desc-reqs pkg-desc) (seq-filter (lambda (it) (not (memq (car it) local-only-packages))) (package-desc-reqs pkg-desc))) pkg-desc)) 

I'm using dash's --remove to do the filtering; it just refers to the current element in the iteration.

I had this exact problem. I was trying to use a local version of lsp-mode but packages which depended on it were installing lsp-mode from melpa. @chenbin's solution would successfully filter out lsp-mode from the package list (i.e. when you M-x list-packages) but it would still be installed when installing any packages for which it was a dependency.

This solution will filter out any specified packages from being installed as a dependency:

(defvar local-only-packages '(lsp-mode) "Don't install these packages as dependencies, I will install them manually.") ;; When determining dependencies to install, filter out any packages you will ;; handle manually. (advice-add 'package-compute-transaction :filter-return (lambda (packages)   (--remove (memq (package-desc-name it) local-only-packages) packages))) 

I'm using dash's --remove to do the filtering; it just refers to the current element in the iteration.

I had this exact problem. I was trying to use a local version of lsp-mode but packages which depended on it were installing lsp-mode from melpa. @chenbin's solution would successfully filter out lsp-mode from the package list (i.e. when you M-x list-packages) but it would still be installed when installing any packages for which it was a dependency.

I'm using (use-package) to specify the load path of my manually installed packages. Adding this code before (package-initialize) is called works for me:

(defvar local-only-packages '(lsp-mode) "Don't install these packages as dependencies, I will install them manually.") ;; When determining dependencies to install, filter out any packages you will ;; handle manually. (advice-add 'package-compute-transaction :filter-return (lambda (packages) (seq-filter (lambda (it) (not (memq (package-desc-name it) local-only-packages)))  packages)))   ;; When creating package-descriptions that will be initialized by ;; package.el, filter out the dependncies that are handled manually. (advice-add 'package-desc-from-define :filter-return (lambda (pkg-desc) (setf (package-desc-reqs pkg-desc) (seq-filter (lambda (it) (not (memq (car it) local-only-packages))) (package-desc-reqs pkg-desc))) pkg-desc)) 
Source Link

I had this exact problem. I was trying to use a local version of lsp-mode but packages which depended on it were installing lsp-mode from melpa. @chenbin's solution would successfully filter out lsp-mode from the package list (i.e. when you M-x list-packages) but it would still be installed when installing any packages for which it was a dependency.

This solution will filter out any specified packages from being installed as a dependency:

(defvar local-only-packages '(lsp-mode) "Don't install these packages as dependencies, I will install them manually.") ;; When determining dependencies to install, filter out any packages you will ;; handle manually. (advice-add 'package-compute-transaction :filter-return (lambda (packages) (--remove (memq (package-desc-name it) local-only-packages) packages))) 

I'm using dash's --remove to do the filtering; it just refers to the current element in the iteration.