unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15201: 24.2; extensions/enhancements to package.el
@ 2013-08-27 23:37 Ryan Davis
  2013-08-28  1:12 ` Stefan Monnier
  2021-07-15  6:00 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Ryan Davis @ 2013-08-27 23:37 UTC (permalink / raw)
  To: 15201

I know that using cl is frowned upon... but I'm writing this code to be
compatible with 24.2 so I can't rely on cl-lib (since this is an
extension to the system used to install cl-lib). I'm only using it for
set-difference and am open to modifications to make it more
portable/acceptable. You can see this code in:

https://github.com/zenspider/package/blob/master/package%2B.el#L70-L104

  (require 'cl)

  (defun package-version-for (name)
    "Returns the installed version for a package with a given NAME."
    (package-desc-vers (cdr (assoc name package-alist))))

  (defun package-delete-by-name (name)
    "Deletes a package by NAME"
    (message "Removing %s" name)
    (package-delete (symbol-name name)
                    (package-version-join (package-version-for name))))

  (defun package-maybe-install (name)
    "Installs a package by NAME, but only if it isn't already installed."
    (unless (package-installed-p name)
      (message "Installing %s" name)
      (package-install name)))

  (defun package-deps-for (pkg)
    "Returns the dependency list for PKG or nil if none or the PKG doesn't exist."
    (let ((v (cdr (assoc pkg package-alist))))
      (and v (package-desc-reqs v))))

  (defun package-transitive-closure (pkgs)
    (let ((deps '()))
      (dolist (pkg pkgs deps)
        (add-to-list 'deps pkg)
        (dolist (new-pkg (mapcar 'car (package-deps-for pkg)))
          (add-to-list 'deps new-pkg)))))

  (defun package-cleanup (packages)
    "Delete installed packages not explicitly declared in PACKAGES."
    (let ((removes (set-difference (mapcar 'car package-alist)
                                   (package-transitive-closure packages))))
      (mapc 'package-delete-by-name removes)))

;;; finis

In GNU Emacs 24.2.1 (x86_64-apple-darwin12.2.0, NS apple-appkit-1187.34)
of 2012-09-20 on greed.local
Windowing system distributor `Apple', version 10.3.1187
Configured using:
`configure '--prefix=/usr/local/Cellar/emacs/24.2' '--without-dbus'
'--enable-locallisppath=/usr/local/share/emacs/site-lisp'
'--infodir=/usr/local/Cellar/emacs/24.2/share/info/emacs' '--with-ns'
'--disable-ns-self-contained''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
s-x <escape> x r e p <tab> o <tab> r <tab> <return
>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
kill-region: The mark is not set now, so there is no region
Quit
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-mode easymenu view time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#15201: 24.2; extensions/enhancements to package.el
  2013-08-27 23:37 bug#15201: 24.2; extensions/enhancements to package.el Ryan Davis
@ 2013-08-28  1:12 ` Stefan Monnier
  2021-07-15  6:00 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2013-08-28  1:12 UTC (permalink / raw)
  To: Ryan Davis; +Cc: 15201

> I know that using cl is frowned upon... but I'm writing this code to be
> compatible with 24.2 so I can't rely on cl-lib (since this is an
> extension to the system used to install cl-lib). I'm only using it for
> set-difference and am open to modifications to make it more
> portable/acceptable. You can see this code in:

Use of CL is generally discouraged, and is not allowed at run-time for
packages included in Emacs.  IOW As long as your code is not meant to be
included in Emacs you don't need to worry too much about it.

OTOH, the code you sent doesn't work with the package.el that's in
Emacs's current trunk (e.g. package-delete now only takes a single argument).

One more thing: I like the idea of having a declarative list of
"packages that should be installed" so as to be able to delete packages
that were installed as dependencies but aren't needed any more.  So I'd
welcome patches that add such functionality to package.el.


        Stefan





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#15201: 24.2; extensions/enhancements to package.el
  2013-08-27 23:37 bug#15201: 24.2; extensions/enhancements to package.el Ryan Davis
  2013-08-28  1:12 ` Stefan Monnier
@ 2021-07-15  6:00 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-15  6:00 UTC (permalink / raw)
  To: Ryan Davis; +Cc: 15201

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

It seems like the conclusion here was that the proposed helper functions
didn't seem very vital to add, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-15  6:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-27 23:37 bug#15201: 24.2; extensions/enhancements to package.el Ryan Davis
2013-08-28  1:12 ` Stefan Monnier
2021-07-15  6:00 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).