]> code.delx.au - gnu-emacs-elpa/commitdiff
* GNUmakefile: Rename from Makefile. Add targets for in-place use.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 27 Jun 2013 04:22:16 +0000 (00:22 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 27 Jun 2013 04:22:16 +0000 (00:22 -0400)
(all, all-in-place): New targets.
* admin/archive-contents.el (archive--simple-package-p): Ignore autosave files.
(archive--refresh-pkg-file): New function.
(archive--write-pkg-file): Print with ' and ` shorthands.
* packages/company/company-pysmell.el: Don't require pysmell during compile.
* packages/muse/htmlize-hack.el: Don't require htmlize during compile.
* packages/shen-mode/shen-mode.el (shen-functions): Define during compile.
* smart-operator/smart-operator.el (smart-operator-insert-1): Use pcase.

GNUmakefile [new file with mode: 0644]
Makefile [deleted file]
admin/archive-contents.el
packages/company/company-pysmell.el
packages/muse/htmlize-hack.el
packages/shen-mode/shen-mode.el
packages/smart-operator/smart-operator.el

diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644 (file)
index 0000000..5d45065
--- /dev/null
@@ -0,0 +1,149 @@
+# Makefile for GNU Emacs Lisp Package Archive.
+
+EMACS=emacs
+
+ARCHIVE_TMP=archive-tmp
+SITE_DIR=site
+
+.PHONY: archive-tmp changelogs process-archive archive-full org-fetch clean all do-it
+
+all: all-in-place
+
+## Set up the source files for direct usage, by pointing
+## `package-directory-list' to the site/ directory.
+site: packages
+       mkdir -p $(SITE_DIR)
+       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
+         --eval "(batch-make-site-dir \"packages\" \"$(SITE_DIR)\")"
+
+site/%: do-it
+       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
+         --eval "(progn (setq debug-on-error t) (batch-make-site-package \"$@\"))"
+
+## Deploy the package archive to archive/, with packages in
+## archive/packages/:
+archive: archive-tmp
+       $(MAKE) $(MFLAGS) process-archive
+
+archive-tmp: packages changelogs
+       -rm -r $(ARCHIVE_TMP)
+       mkdir -p $(ARCHIVE_TMP)
+       cp -a packages/. $(ARCHIVE_TMP)/packages
+
+# Refresh the ChangeLog files.  This needs to be done in
+# the source tree, because it needs the Bzr data!
+changelogs:
+       cd packages; \
+       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
+                       -f batch-prepare-packages
+
+process-archive:
+       # FIXME, we could probably speed this up significantly with
+       # rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages
+       # that have indeed changed.
+       cd $(ARCHIVE_TMP)/packages; $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el -f batch-make-archive
+       @cd $(ARCHIVE_TMP)/packages; \
+       for pt in *; do \
+           if [ -d $$pt ]; then \
+               echo "Creating tarball $${pt}.tar" && \
+               tar -cf $${pt}.tar $$pt --remove-files; \
+           fi; \
+       done
+       mkdir -p archive/packages
+       mv archive/packages archive/packages-old
+       mv $(ARCHIVE_TMP)/packages archive/packages
+       chmod -R a+rX archive/packages
+       rm -rf archive/packages-old
+       rm -rf $(ARCHIVE_TMP)
+
+## Deploy the package archive to archive/ including the Org daily:
+archive-full: archive-tmp org-fetch
+       $(MAKE) $(MFLAGS) process-archive
+       #mkdir -p archive/admin
+       #cp admin/* archive/admin/
+
+org-fetch: archive-tmp
+       cd $(ARCHIVE_TMP)/packages; \
+       pkgname=`curl -s http://orgmode.org/elpa/|perl -ne 'push @f, $$1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$$f[-1]\n"}'`; \
+       wget -q http://orgmode.org/elpa/$${pkgname}.tar -O $${pkgname}.tar; \
+       if [ -f $${pkgname}.tar ]; then \
+               tar xf $${pkgname}.tar; \
+               rm -f $${pkgname}.tar; \
+               mv $${pkgname} org; \
+       fi
+
+clean:
+       rm -rf archive $(ARCHIVE_TMP) $(SITE_DIR)
+
+########## Rules for in-place installation ##########
+pkgs := $(foreach pkg, $(wildcard packages/*), \
+          $(if $(shell [ -d "$(pkg)" ] && echo true), $(pkg)))
+
+define SET-diff
+$(shell echo "$(1)" "$(2)" "$(2)" | tr ' ' '\n' | sort | uniq -u)
+endef
+
+define FILTER-nonsrc
+$(filter-out %-autoloads.el %-pkg.el, $(1))
+endef
+
+define RULE-srcdeps
+$(1): $$(call FILTER-nonsrc, $$(wildcard $$(dir $(1))/*.el))
+endef
+
+# Compute the set of autolods files and their dependencies.
+autoloads := $(foreach pkg, $(pkgs), $(pkg)/$(notdir $(pkg))-autoloads.el)
+
+$(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al))))
+%-autoloads.el:
+       @echo 'EMACS -f package-generate-autoloads $@'
+       @cd $(dir $@); \
+       $(EMACS) --batch \
+           -l $(CURDIR)/admin/archive-contents.el \
+           --eval "(archive--refresh-pkg-file)" \
+           --eval "(require 'package)" \
+           --eval "(package-generate-autoloads '$$(basename $$(pwd)) \
+                                               \"$$(pwd)\")"
+
+# Put into elcs the set of elc files we need to keep up-to-date.
+# I.e. one for each .el file except for the -pkg.el, the -autoloads.el, and
+# the .el files that are marked "no-byte-compile".
+els := $(call FILTER-nonsrc, $(wildcard packages/*/*.el))
+naive_elcs := $(patsubst %.el, %.elc, $(els))
+current_elcs := $(wildcard packages/*/*.elc)
+
+extra_els := $(call SET-diff, $(els), $(patsubst %.elc, %.el, $(current_elcs)))
+nbc_els := $(foreach el, $(extra_els), \
+             $(if $(shell grep '^;.*no-byte-compile: t' "$(el)"), $(el)))
+elcs := $(call SET-diff, $(naive_elcs), $(patsubst %.el, %.elc, $(nbc_els)))
+
+# '(dolist (al (quote ($(patsubst %, "%", $(autoloads))))) (load (expand-file-name al) nil t))'
+%.elc: %.el $(autoloads)
+       @echo 'EMACS -f batch-byte-compile $<'
+       @$(EMACS) --batch \
+           --eval "(setq package-directory-list '(\"$(abspath packages)\"))" \
+           --eval '(package-initialize)' \
+           -L $(dir $@) -f batch-byte-compile $<
+
+# Remove .elc files that don't have a corresponding .el file any more.
+extra_elcs := $(call SET-diff, $(current_elcs), $(naive_elcs))
+.PHONY: $(extra_elcs)
+$(extra_elcs):; rm $@
+
+# # Put into single_pkgs the set of -pkg.el files we need to keep up-to-date.
+# # I.e. all the -pkg.el files for the single-file packages.
+# single_pkgs:=$(foreach pkg, $(pkgs), \
+#                $(word $(words $(call FILTER-nonsrc, \
+#                                      $(wildcard $(pkg)/*.el))), \
+#                   $(pkg)/$(notdir $(pkg))-pkg.el))
+# #$(foreach al, $(single_pkgs), $(eval $(call RULE-srcdeps, $(al))))
+# %-pkg.el: %.el
+#      @echo 'EMACS -f package-generate-description-file $@'
+#      @$(EMACS) --batch \
+#          --eval '(require (quote package))' \
+#          --eval '(setq b (find-file-noselect "$<"))' \
+#          --eval '(setq d (with-current-buffer b (package-buffer-info)))' \
+#          --eval '(package-generate-description-file d "$(dir $@)")'
+
+
+all-in-place: $(extra_elcs) $(autoloads) $(elcs) # $(single_pkgs)
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index b9b49fa..0000000
--- a/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-# Makefile for GNU Emacs Lisp Package Archive.
-
-EMACS=emacs
-
-ARCHIVE_TMP=archive-tmp
-SITE_DIR=site
-
-.PHONY: archive-tmp changelogs process-archive archive-full org-fetch clean all do-it
-
-## Set up the source files for direct usage, by pointing
-## `package-directory-list' to the site/ directory.
-site: packages
-       mkdir -p $(SITE_DIR)
-       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
-         --eval "(batch-make-site-dir \"packages\" \"$(SITE_DIR)\")"
-
-site/%: do-it
-       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
-         --eval "(progn (setq debug-on-error t) (batch-make-site-package \"$@\"))"
-
-## Deploy the package archive to archive/, with packages in
-## archive/packages/:
-archive: archive-tmp
-       $(MAKE) $(MFLAGS) process-archive
-
-archive-tmp: packages changelogs
-       -rm -r $(ARCHIVE_TMP)
-       mkdir -p $(ARCHIVE_TMP)
-       cp -a packages/. $(ARCHIVE_TMP)/packages
-
-# Refresh the ChangeLog files.  This needs to be done in
-# the source tree, because it needs the Bzr data!
-changelogs:
-       cd packages; \
-       $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
-                       -f batch-prepare-packages
-
-process-archive:
-       # FIXME, we could probably speed this up significantly with
-       # rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages
-       # that have indeed changed.
-       cd $(ARCHIVE_TMP)/packages; $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el -f batch-make-archive
-       @cd $(ARCHIVE_TMP)/packages; \
-       for pt in *; do \
-           if [ -d $$pt ]; then \
-               echo "Creating tarball $${pt}.tar" && \
-               tar -cf $${pt}.tar $$pt --remove-files; \
-           fi; \
-       done
-       mkdir -p archive/packages
-       mv archive/packages archive/packages-old
-       mv $(ARCHIVE_TMP)/packages archive/packages
-       chmod -R a+rX archive/packages
-       rm -rf archive/packages-old
-       rm -rf $(ARCHIVE_TMP)
-
-## Deploy the package archive to archive/ including the Org daily:
-archive-full: archive-tmp org-fetch
-       $(MAKE) $(MFLAGS) process-archive
-       #mkdir -p archive/admin
-       #cp admin/* archive/admin/
-
-org-fetch: archive-tmp
-       cd $(ARCHIVE_TMP)/packages; \
-       pkgname=`curl -s http://orgmode.org/elpa/|perl -ne 'push @f, $$1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$$f[-1]\n"}'`; \
-       wget -q http://orgmode.org/elpa/$${pkgname}.tar -O $${pkgname}.tar; \
-       if [ -f $${pkgname}.tar ]; then \
-               tar xf $${pkgname}.tar; \
-               rm -f $${pkgname}.tar; \
-               mv $${pkgname} org; \
-       fi
-
-clean:
-       rm -rf archive $(ARCHIVE_TMP) $(SITE_DIR)
-
-all: site
index 28a949d7a7df0a413ccf12c34f2e1fb4102857d1..56daa8edb35392a1b6cc8635a9ade280c5eef839 100644 (file)
@@ -1,6 +1,6 @@
 ;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive.
 
-;; Copyright (C) 2011, 2012  Free Software Foundation, Inc
+;; Copyright (C) 2011, 2012, 2013  Free Software Foundation, Inc
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
@@ -132,7 +132,7 @@ Otherwise, return nil."
          (files (directory-files dir nil archive-re-no-dot))
         version description req commentary)
     (dolist (file (prog1 files (setq files ())))
-      (unless (string-match "\\.elc\\'" file)
+      (unless (string-match "\\(?:\\.elc\\|~\\)\\'" file)
         (push file files)))
     (setq files (delete (concat pkg "-pkg.el") files))
     (setq files (delete (concat pkg "-autoloads.el") files))
@@ -242,7 +242,7 @@ PKG-readme.txt.  Return the descriptor."
     (cons (intern pkg) (vector (version-to-list vers) req (nth 3 exp) 'tar))))
 
 (defun archive--multi-file-package-def (dir pkg)
-  "Reurn the `define-package' form in the file DIR/PKG-pkg.el."
+  "Return the `define-package' form in the file DIR/PKG-pkg.el."
   (let ((pkg-file (expand-file-name (concat pkg "-pkg.el") dir)))
     (with-temp-buffer
       (unless (file-exists-p pkg-file)
@@ -284,6 +284,17 @@ PKG-readme.txt.  Return the descriptor."
           ;; FIXME: Don't compile the -pkg.el files!
           (byte-recompile-directory dir 0))))))
 
+(defun archive--refresh-pkg-file ()
+  (let* ((dir (directory-file-name default-directory))
+         (pkg (file-name-nondirectory dir))
+         (simple-p (archive--simple-package-p dir pkg)))
+    (if simple-p
+        (progn
+          ;; (message "Refreshing pkg description of %s" pkg)
+          (apply 'archive--write-pkg-file dir pkg simple-p))
+      ;; (message "Not refreshing pkg description of %s" pkg)
+      )))
+
 (defun batch-make-site-package (sdir)
   (let* ((dest (car (file-attributes sdir)))
          (pkg (file-name-nondirectory (directory-file-name (or dest sdir))))
@@ -297,6 +308,7 @@ PKG-readme.txt.  Return the descriptor."
 (defun archive--write-pkg-file (pkg-dir name version desc requires &rest ignored)
   (let ((pkg-file (expand-file-name (concat name "-pkg.el") pkg-dir))
        (print-level nil)
+        (print-quoted t)
        (print-length nil))
     (write-region
      (concat (format ";; Generated package description from %s.el\n"
index 063d8eafcd89baf5dd79c7a6859b85f1e500fa76..5c44f06aafa799a522dcfac1546f8e6776d31f50 100644 (file)
@@ -1,6 +1,6 @@
 ;;; company-pysmell.el --- company-mode completion back-end for pysmell.el
 
-;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011, 2013  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
@@ -28,7 +28,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(require 'pysmell)
+(if t (require 'pysmell))               ;Don't load during compilation.
 
 (defvar company-pysmell--available-p 'unknown)
 (make-variable-buffer-local 'company-pysmell--available-p)
index 4c9e5e8f57d9c7742f532d03eba695ddfb288357..e6239464658580979622f046af95f86e9dcec1ea 100644 (file)
@@ -2,7 +2,8 @@
 ;; To use it, add the path to this directory to your load path and
 ;; add (require 'htmlize-hack) to your Emacs init file.
 
-(require 'htmlize)
+(eval-when-compile (require 'cl))
+(if t (require 'htmlize))               ; Don't load during compilation.
 
 (when (equal htmlize-version "1.34")
   (defun htmlize-face-size (face)
index 45d4262334c989503980f9b573704ffc79f9f2b2..747679c3a9c81b3b942586aafd2d10f233ebd349 100644 (file)
@@ -1,6 +1,6 @@
 ;;; shen-mode.el --- A major mode for editing shen source code
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2013 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte <schulte.eric@gmail.com>
 ;; Version: 0.1
@@ -44,6 +44,7 @@
     map)
   "Currently just inherits from `lisp-mode-shared-map'.")
 
+(eval-and-compile
 (defconst shen-functions
   '((* "number --> number --> number" "Number multiplication.")
     (+ "number --> number --> number" "Number addition.")
     (warn "string --> string" "Prints the string as a warning and returns \"done\".  See strong-warning")
     (write-to-file "string --> A --> string" "Writes the second input into a file named in the first input. If the file does not exist, it is created, else it is overwritten. If the second input is a string then it is written to the file without the enclosing quotes.  The first input is returned.")
     (y-or-n\? "string --> boolean" "Prints the string as a question and returns true for y and false for n."))
-  "Shen functions taken largely from the Qi documentation by Dr. Mark Tarver.")
+  "Shen functions taken largely from the Qi documentation by Dr. Mark Tarver."))
 
 \f
 ;;; Fontification
index e707e492ce9af7bffc919d1bf631544cfc6c10a8..68332dd44efce0909cfa7bc2d99071f6046b8130 100644 (file)
@@ -1,6 +1,6 @@
 ;;; smart-operator.el --- Insert operators with surrounding spaces smartly
 
-;; Copyright (C) 2004, 2005, 2007-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2007-2013 Free Software Foundation, Inc.
 
 ;; Author: William Xu <william.xwl@gmail.com>
 ;; Version: 4.0
@@ -106,11 +106,11 @@ e.g., `=' becomes ` = ', `+=' becomes ` += '.
 When `only-where' is 'after, we will insert space at back only;
 when `only-where' is 'before, we will insert space at front only;
 when `only-where' is 'middle, we will not insert space."
-  (case only-where
-    ((before) (insert " " op))
-    ((middle) (insert op))
-    ((after) (insert op " "))
-    (t
+  (pcase only-where
+    (`before (insert " " op))
+    (`middle (insert op))
+    (`after (insert op " "))
+    (_
      (let ((begin? (bolp)))
        (unless (or (looking-back (regexp-opt smart-operator-list)
                                  (line-beginning-position))