all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Tim Cross <theophilusx@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Package.el and specifying alternative dependencies
Date: Tue, 11 Apr 2017 22:37:29 +0000	[thread overview]
Message-ID: <CAFyQvY27g_TbZPUCcV6uPS36vspD0ooLWfwou0EDPZ9C3LvpxQ@mail.gmail.com> (raw)
In-Reply-To: <CAC=50j9TEkTSnzeQo_WQGCuQ2ot2OcgW7_vHE-cU_CpZYsOooQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4425 bytes --]

Hi Tim,

I just discovered a bug in this advice.. I needed to fix the order of
packages in the new-ret list that is returned. The bug was that the order
of pkgs in new-ret was flipped compared to that in orig-ret.. so I needed
to flip it back using reverse.

Here is the fixed function:

;; http://emacs.stackexchange.com/a/26513/115
(defun modi/package-dependency-check-ignore (orig-ret)
  "Remove the `black listed packages' from ORIG-RET.

Packages listed in the let-bound `pkg-black-list' will not be auto-installed
even if they are found as dependencies.

It is known that this advice is not effective when installed packages
asynchronously using `paradox'. Below is effective on synchronous
package installations."
  (let ((pkg-black-list '(org))
        new-ret
        pkg-name)
    (dolist (pkg-struct orig-ret)
      (setq pkg-name (package-desc-name pkg-struct))
      (if (member pkg-name pkg-black-list)
          (message (concat "Package `%s' will not be installed. "
                           "See `modi/package-dependency-check-ignore'.")
                   pkg-name)
        (push pkg-struct new-ret)))
    ;; Tue Apr 11 17:48:16 EDT 2017 - kmodi
    ;; It's *very* critical that the order of packages stays the same in
NEW-RET
    ;; as in ORIG-RET. The `push' command flips the order, so use `reverse'
    ;; to flip the order back to the original.
    ;;   Without this step, you will get errors like below when installing
    ;; packages with dependencies:
    ;;   Debugger entered--Lisp error: (error "Unable to activate package
‘nim-mode’.
    ;;   Required package ‘flycheck-28’ is unavailable")
    (setq new-ret (reverse new-ret))
    new-ret))
(advice-add 'package-compute-transaction :filter-return
#'modi/package-dependency-check-ignore)

On Sat, Mar 4, 2017 at 6:44 PM Tim Cross <theophilusx@gmail.com> wrote:

> Nice and useful idea.
>
> thanks
>
> On 5 March 2017 at 09:46, Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> I have this in my config which works very well. I use this just for org :)
> I build org from its master branch, so I do not want the dependency check
> to auto-install older versions from Elpa.
>
> ;; http://emacs.stackexchange.com/a/26513/115
> (defun modi/package-dependency-check-ignore (orig-ret)
>   "Remove the `black listed packages' from ORIG-RET.
> Packages listed in the let-bound `pkg-black-list' will not be
> auto-installed
> even if they are found as dependencies.
> It is known that this advice is not effective when installed packages
> asynchronously using `paradox'. Below is effective on synchronous
> package installations."
>   (let ((pkg-black-list '(org))
>         new-ret
>         pkg-name)
>     (dolist (pkg-struct orig-ret)
>       (setq pkg-name (package-desc-name pkg-struct))
>       (if (member pkg-name pkg-black-list)
>           (message (concat "Package `%s' will not be installed. "
>                            "See `modi/package-dependency-check-ignore'.")
>                    pkg-name)
>         ;; (message "Package to be installed: %s" pkg-name)
>         (push pkg-struct new-ret)))
>     new-ret))
> (advice-add 'package-compute-transaction :filter-return
> #'modi/package-dependency-check-ignore)
>
> https://github.com/kaushalmodi/.emacs.d/blob/master/setup-packages.el
>
> On Thu, Mar 2, 2017 at 7:41 PM Tim Cross <theophilusx@gmail.com> wrote:
>
> Is there a way to specify alternative dependencies in a package?
>
> Situation: installing a package is resulting in an additional package
> being installed even though the dependencies for the package have already
> been satisfied by another package. This results in two packages being
> installed which provide overlapping functionality.
>
> Example. I have installed org-plus-contrib. I then install elfeed-org,
> which has a dependency on org. This results in the org package being
> installed, but org is already installed as part of the org-plus-contrib
> package.
>
> I'm trying to work out if this is a problem with how dependencies are
> defined in the elfeed-org package or is it a problem with how
> org-plus-conrib is specifying what dependency it satisfies? Need to know in
> order to determine where this issue needs to be logged.
>
> --
>
> Kaushal Modi
>
>
>
>
> --
> regards,
>
> Tim
>
> --
> Tim Cross
>
> --

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 9710 bytes --]

  reply	other threads:[~2017-04-11 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  0:41 Package.el and specifying alternative dependencies Tim Cross
2017-03-04 21:57 ` Mark Oteiza
2017-03-04 22:32   ` Tim Cross
2017-03-04 22:46 ` Kaushal Modi
2017-03-04 23:44   ` Tim Cross
2017-04-11 22:37     ` Kaushal Modi [this message]
2017-04-12  7:35       ` Tim Cross
2017-04-12  7:44       ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY27g_TbZPUCcV6uPS36vspD0ooLWfwou0EDPZ9C3LvpxQ@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=theophilusx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.