Skip to content

Commit

Permalink
Merge pull request dimitri#901 from danielsz/master
Browse files Browse the repository at this point in the history
el-get-cleanup function
  • Loading branch information
dimitri committed Oct 1, 2012
2 parents aa9c583 + cf56a1f commit 28b7c55
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 18 deletions.
11 changes: 11 additions & 0 deletions el-get.el
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,17 @@ itself.")
(el-get-remove package)
(el-get-install package))

(defun el-get-cleanup (packages)
"Removes packages absent from the argument list
'packages. Useful, for example, when we
want to remove all packages not explicitly declared
in the user-init-file (.emacs)."
(let* ((packages-to-keep (el-get-dependencies (mapcar 'el-get-as-symbol packages)))
(packages-to-remove (set-difference (mapcar 'el-get-as-symbol
(el-get-list-package-names-with-status
"installed")) packages-to-keep)))
(mapc 'el-get-remove packages-to-remove)))

;;;###autoload
(defun el-get-cd (package)
"Open dired in the package directory."
Expand Down
48 changes: 31 additions & 17 deletions el-get.info
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ File: el-get.info, Node: Distributed Setup, Next: Setup Customization, Prev:

When you are sharing your emacs setup between several machines (work
and home destops, laptop, etc); it's usual to manage your `.emacs.d'
setup in a distributed repository (such as `git'). El-Get then provide
and easy canonical list of packages you depend on to run emacs, and
this documentation is usable as-is.
setup in a distributed repository (such as `git'). El-Get then provides
an easy canonical list of packages you depend on to run emacs, and this
documentation is usable as-is.

(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(require 'el-get)
Expand Down Expand Up @@ -456,6 +456,20 @@ this documentation is usable as-is.

(el-get 'sync my-packages)

Please note that when you unreference a package from `my-packages',
it remains locally installed.

Going one step further with the idea of a canonical list, el-get
provides the command `el-get-cleanup', which will remove all packages
absent from `my-packages'. This allows, in effect, to put under version
control only the user init file, instead of the whole `.emacs.d'
directory, and still enjoy a truly portable emacs configuration.

In the code example above, replace the last line with the following:

(el-get-cleanup my-packages)
(el-get 'sync my-packages)


File: el-get.info, Node: Setup Customization, Prev: Distributed Setup, Up: Setup

Expand Down Expand Up @@ -787,19 +801,19 @@ Node: Setup11900
Node: Basic Setup12296
Node: The el-get function13535
Node: Distributed Setup14811
Node: Setup Customization16122
Node: User Init17268
Node: Before and After properties17955
Node: Initialization files19463
Node: Recipes20116
Node: Organizing recipes20591
Node: Getting more recipes22106
Node: Overriding package files22804
Node: Authoring Recipes23187
Node: Recipe format23618
Node: Dependencies24287
Node: Byte Compilation24633
Node: Autoloads25199
Node: Build26325
Node: Setup Customization16705
Node: User Init17851
Node: Before and After properties18538
Node: Initialization files20046
Node: Recipes20699
Node: Organizing recipes21174
Node: Getting more recipes22689
Node: Overriding package files23387
Node: Authoring Recipes23770
Node: Recipe format24201
Node: Dependencies24870
Node: Byte Compilation25216
Node: Autoloads25782
Node: Build26908

End Tag Table
19 changes: 18 additions & 1 deletion el-get.texi
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ list of already installed packages is considered.
When you are sharing your emacs setup between several machines (work
and home destops, laptop, etc); it's usual to manage your
@code{.emacs.d} setup in a distributed repository (such as
@code{git}). El-Get then provide and easy canonical list of packages
@code{git}). El-Get then provides an easy canonical list of packages
you depend on to run emacs, and this documentation is usable
as-is.

Expand Down Expand Up @@ -456,6 +456,23 @@ as-is.
(el-get 'sync my-packages)
@end example

Please note that when you unreference a package from
@code{my-packages}, it remains locally installed.

Going one step further with the idea of a canonical list, el-get
provides the command @code{el-get-cleanup}, which will remove all
packages absent from @code{my-packages}. This allows, in effect, to
put under version control only the user init file, instead of the
whole @code{.emacs.d} directory, and still enjoy a truly portable
emacs configuration.

In the code example above, replace the last line with the following:

@example
(el-get-cleanup my-packages)
(el-get 'sync my-packages)
@end example

@node Setup Customization
@section Setup Customization

Expand Down

0 comments on commit 28b7c55

Please sign in to comment.