From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glenn Morris Subject: bug#10125: 24.0.91; package.el (org): Macros in tar packages & order of byte compilation Date: Thu, 24 Nov 2011 14:53:04 -0500 Message-ID: References: <81pqgh90sp.fsf@gmail.com> <81ipm9l9kd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTfMQ-0004hE-VN for emacs-orgmode@gnu.org; Thu, 24 Nov 2011 14:53:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTfMP-0005bO-UT for emacs-orgmode@gnu.org; Thu, 24 Nov 2011 14:53:30 -0500 Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-Message-ID: In-Reply-To: (Glenn Morris's message of "Thu, 24 Nov 2011 14:09:38 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jambunathan K Cc: 10125@debbugs.gnu.org, stelian.iancu@gmail.com Glenn Morris wrote: > fresh Emacs instance. There's no reason the "package manager" could not > spawn a separate Emacs in batch-mode as a sub-job to do the compilation. Very lightly tested version: *** lisp/emacs-lisp/package.el 2011-11-20 03:48:53 +0000 --- lisp/emacs-lisp/package.el 2011-11-24 19:48:49 +0000 *************** *** 595,600 **** --- 595,612 ---- (error "Package does not untar cleanly into directory %s/" dir)))) (tar-untar-buffer)) + (defun package-compile (directory) + "Compile the Lisp files in DIRECTORY." + (with-current-buffer (get-buffer-create "*package-compile*") + (goto-char (point-max)) + (pop-to-buffer (current-buffer)) + (or (zerop (call-process "emacs" nil t t "--batch" "--eval" + (format + "(progn (setq load-path (cons \"%s\" load-path)) + (batch-byte-recompile-directory 0))" directory) + directory)) + (error "Compiling the package gave an error")))) + (defun package-unpack (name version) (let* ((dirname (concat (symbol-name name) "-" version)) (pkg-dir (expand-file-name dirname package-user-dir))) *************** *** 603,610 **** (let* ((default-directory (file-name-as-directory package-user-dir))) (package-untar-buffer dirname) (package-generate-autoloads (symbol-name name) pkg-dir) ! (let ((load-path (cons pkg-dir load-path))) ! (byte-recompile-directory pkg-dir 0 t))))) (defun package--write-file-no-coding (file-name) (let ((buffer-file-coding-system 'no-conversion)) --- 615,621 ---- (let* ((default-directory (file-name-as-directory package-user-dir))) (package-untar-buffer dirname) (package-generate-autoloads (symbol-name name) pkg-dir) ! (package-compile pkg-dir)))) (defun package--write-file-no-coding (file-name) (let ((buffer-file-coding-system 'no-conversion)) *************** *** 645,652 **** pkg-file nil nil nil 'excl)) (package-generate-autoloads file-name pkg-dir) ! (let ((load-path (cons pkg-dir load-path))) ! (byte-recompile-directory pkg-dir 0 t))))) (defmacro package--with-work-buffer (location file &rest body) "Run BODY in a buffer containing the contents of FILE at LOCATION. --- 656,662 ---- pkg-file nil nil nil 'excl)) (package-generate-autoloads file-name pkg-dir) ! (package-compile pkg-dir)))) (defmacro package--with-work-buffer (location file &rest body) "Run BODY in a buffer containing the contents of FILE at LOCATION.