From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: emacs -Q pkg debug helper macro Date: Tue, 12 Jul 2016 20:31:26 +0000 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114080d2ce2e6d0537762734 X-Trace: ger.gmane.org 1468355739 31710 80.91.229.3 (12 Jul 2016 20:35:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jul 2016 20:35:39 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 12 22:35:35 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bN4P0-0006LW-64 for ged-emacs-devel@m.gmane.org; Tue, 12 Jul 2016 22:35:34 +0200 Original-Received: from localhost ([::1]:43326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4Oz-00081I-Ix for ged-emacs-devel@m.gmane.org; Tue, 12 Jul 2016 16:35:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4LD-0004A6-LZ for emacs-devel@gnu.org; Tue, 12 Jul 2016 16:31:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bN4LC-0002l6-7O for emacs-devel@gnu.org; Tue, 12 Jul 2016 16:31:39 -0400 Original-Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:32886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4LC-0002kz-02 for emacs-devel@gnu.org; Tue, 12 Jul 2016 16:31:38 -0400 Original-Received: by mail-oi0-x22c.google.com with SMTP id j185so33853130oih.0 for ; Tue, 12 Jul 2016 13:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=iabDd2ORwNsSfxYuuL38KexFFUubzFRH8fuvYqTIPzI=; b=RlyxYNov5iwA2GrehBo6iuetSPlUWd5PUpR2E8vqSWDIweb8DQmsPERi0pTdkOg+e6 s9mPLu2PMNS/ntgoyG/IFlVffWgiQWub+cOxr3JixCwAF2TmsjUML4IbTQtuNv0PzHAk /jJykqvZdJov6he3P1L1/+oYPibIoXQX6QhhxriWyG1Wow469o+arPCyaacRDLGo8kzO YeNpQ1Mur8Au7qkJHEvnpljzrhMmcFlbz9jfD+lba7EIYsCxvVOLDAfwwK7x3ar3kXNI 8+bP3nO2OW2RmkX0KKJs3qOIyUn2agq6wOhZndpije1etkkxwG9N44GIcXVAaCLBsca2 zs/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=iabDd2ORwNsSfxYuuL38KexFFUubzFRH8fuvYqTIPzI=; b=TaH7us5LwJoyzAY78NCesvQiApU3TxRTuJ0cP9YSSbvbK+XkeqZ7fYspAo9cnnXJSq CiO+y1EYG4HLYH0jzi2RzrvA1lwKWRBbQ0mQwgtG0znFXXg7Qc3Vmc/1Xxv+MOHCl7+g P5GKqSJg317oKab5O+q2rfCevDq/57LQv9hCVgU/ZYGFUvhQNkse41NYBYlJ5RTIx2nj WuHB6dMVphMMcHcQ2dmp2+LzE8JHkva1z7jr6QOv4p1uyFR2ljKeanxeQA4R0onlOnT5 aHKn5JuhouSdXqSItnsa9E5Dd9chY74CQtRwSVugqFgvYG23UnjI4do3vg/DBURM74Ss haLw== X-Gm-Message-State: ALyK8tIYhj705dLS0JPCjPQU5wWgkgifz51BpuhnKV/d28DoeSYgiUSz0jHVkwQB6dPgrIF1vr8pmJqHIsxl+A== X-Received: by 10.202.231.83 with SMTP id e80mr13716400oih.159.1468355497043; Tue, 12 Jul 2016 13:31:37 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205586 Archived-At: --001a114080d2ce2e6d0537762734 Content-Type: text/plain; charset=UTF-8 Hi all, Recently while debugging the behavior of an external package in an emacs -Q session, I came up with the below. Would it be helpful to have this or something similar in the core? (defmacro emacs-pkg-debug-setup (pkg-alist &rest body) "Install packages in PKG-ALIST and evaluate BODY. Each element of PKG-ALIST has the form (((ID . LOCATION) . (PKG1 PKG2 ..)) ..). The ID and LOCATION are the same as the ones in `package-archives'. PKG1, PKG2, .. are package names from the ID archive. Example usage: 1. Launch 'emacs -Q'. 2. Copy this macro definition to its scratch buffer and evaluate it. 3. Evaluate a minimum working example using this macro as below: (emacs-pkg-debug-setup '(((\"org\" . \"http://orgmode.org/elpa/\") . (org))) (org-mode)) " (declare (indent 1) (debug t)) `(progn (require 'package) (setq user-emacs-directory (concat temporary-file-directory (getenv "USER") "/" ".emacs.d-debug/")) (setq package-user-dir (concat user-emacs-directory "elpa/")) (let ((pkgs ())) (dolist (archive-alist ,pkg-alist) (add-to-list 'package-archives (car archive-alist) :append) (setq pkgs (append pkgs (cdr archive-alist)))) (package-initialize) (package-refresh-contents) (dolist (pkg pkgs) (package-install pkg) (require pkg)) ,@body ))) That way, a user can just add something like below in their emacs bug reports: (emacs-pkg-debug-setup '((("melpa" . "http://melpa.org/packages/") . (projectile))) (projectile-global-mode)) Then anyone can safe evaluate just that little form in a fresh emacs -Q session, and let the emacs-pkg-debug-setup macro handle the package-archives updating and package installation. The packages get installed to "/tmp/$USER/.emacs.d-debug/elpa/" by default. -- -- Kaushal Modi --001a114080d2ce2e6d0537762734 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

Recently while debug= ging the behavior of an external package in an emacs -Q session, I came up = with the below.

Would it be helpful to have this o= r something similar in the core?

(defmacro em= acs-pkg-debug-setup (pkg-alist &rest body)
=C2=A0 "Insta= ll packages in PKG-ALIST and evaluate BODY.
Each element of PKG-A= LIST has the form (((ID . LOCATION) . (PKG1 PKG2 ..)) ..).
The ID= and LOCATION are the same as the ones in `package-archives'.
PKG1, PKG2, .. are package names from the ID archive.

=
Example usage:

1. Launch 'emacs -Q'.<= /div>
2. Copy this macro definition to its scratch buffer and evaluate = it.
3. Evaluate a minimum working example using this macro as bel= ow:
=C2=A0 =C2=A0 =C2=A0(emacs-pkg-debug-setup '(((\"org= \" . \"http://orgmode.org/e= lpa/\") . (org)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(org-mode))= "
=C2=A0 (declare (indent 1) (debug t))
=C2=A0 `(= progn
=C2=A0 =C2=A0 =C2=A0(require 'package)
=C2=A0= =C2=A0 =C2=A0(setq user-emacs-directory (concat temporary-file-directory
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= getenv "USER") "/" ".emacs.d-debug/"))
<= div>=C2=A0 =C2=A0 =C2=A0(setq package-user-dir (concat user-emacs-directory= "elpa/"))
=C2=A0 =C2=A0 =C2=A0(let ((pkgs ()))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(dolist (archive-alist ,pkg-alist)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(add-to-list 'package-archives (car a= rchive-alist) :append)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq pk= gs (append pkgs (cdr archive-alist))))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0(package-initialize)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(package-refre= sh-contents)

=C2=A0 =C2=A0 =C2=A0 =C2=A0(dolist (p= kg pkgs)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(package-install pkg)<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(require pkg))

=C2=A0 =C2=A0 =C2=A0 =C2=A0,@body
=C2=A0 =C2=A0 =C2=A0 = =C2=A0)))

That way, a user can just add some= thing like below in their emacs bug reports:

= (emacs-pkg-debug-setup '((("melpa" . "http://melpa.org/packages/") . (projectile)))=
=C2=A0 (projectile-global-mode))

= Then anyone can safe evaluate just that little form in a fresh emacs -Q ses= sion, and let the emacs-pkg-debug-setup macro handle the package-archives u= pdating and package installation. The packages get installed to "/tmp/= $USER/.emacs.d-debug/elpa/" by default.

--

--
Kaushal Modi

--001a114080d2ce2e6d0537762734--