emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] re-introduce org-install for standalone Org
@ 2012-12-09 19:49 Achim Gratz
  2013-01-05 11:40 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Achim Gratz @ 2012-12-09 19:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]


Here's the patch to re-introduce org-install.el again, now with
compatibility code for XEmacs.  The explanations are in the commit
message, but please ask if there are further questions.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-re-introduce-org-install.el.patch --]
[-- Type: text/x-patch, Size: 13048 bytes --]

From 29e382bebad0214fcb6eae0ae8b563fc70bb785b Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sun, 9 Dec 2012 17:10:47 +0100
Subject: [PATCH] re-introduce org-install.el

* lisp/org-install.el: Delete from version control, is autogenerated
  again.  An empty file should be provided in Emacs and for ELPA as
  before since it is not used there.

* .gitignore: Ignore org-install.el again, ignore
  org-autoloads.el (for ELPA).

* mk/org-fixup.el (org-make-org-loaddefs, org-make-autoloads),
  mk/default.mk: Rename org-make-org-loaddefs to
  org-make-org-autoloads.

* mk/org-fixup.el (org--autoload-rubric, org--update-file-autoloads,
  org--update-directory-autoloads): Internal functions that implement
  functionality missing from older Emacsen, especially for XEmacs.
  The implementations drop the generality (and complexity) of the
  original functions and are only useable in the context of the Org
  build system.

* mk/org-fixup.el (org-make-org-autolods): Arrange for org-install to
  collect the "first-level" autoload definitions for standalone
  Org (like loaddefs.el for Emacs and org-autoloads.el for package
  manager).  The "second-level" autoloads in org-loaddefs.el will be
  identical for all installations.  The "first-level" autoload
  definitions are automatically loaded by Emacs or package manager,
  respectively; for standalone Org, the user has to "(require
  'org-install)", as has been customary.

* mk/org-install-empty.el: New file, provide compatibility with
  standalone Org for ELPA and Emacs integration.

* mk/server.mk: Drop in compatibility org-install.el before creating
  the archive.

* lisp/Makefile: Arrange for two autoload files to be produced and
  remove backup files for these.

* mk/targets.mk, lisp/Makefile: Rename MAKE_ORG_INSTALL to
  MAKE_ORG_AUTOLOADS.

* lisp/org.el (org-reload): Do not reload org-install.org-install part2

Rationale: The introduction of org-loaddefs has made the standalone
version of Org quite different from the versions that are integrated
in Emacs or installed via ELPA.  To get the autoload definitions, it
is necessary to load org-loaddefs for a standalone version of Org,
while it is an error to do so otherwise (since the first-level
autoload definitions can not be loaded that way and may not be
compatible with the Org installation that provides org-loaddefs).
Since there is no default place for the "first-level" autoload
definitions to go in a standalone installation, this change
re-introduces org-install.el to be that place.  Since both Emacs and
ELPA provide such a place, org-install is an empty file for these
installations, provided for backward (and forward) compatibility with
a standalone Org installation.
---
 .gitignore              |  6 +++--
 lisp/Makefile           | 12 ++++-----
 lisp/org-install.el     | 15 -----------
 lisp/org.el             |  2 +-
 mk/default.mk           |  4 +--
 mk/org-fixup.el         | 71 ++++++++++++++++++++++++++++++++++++-------------
 mk/org-install-empty.el | 21 +++++++++++++++
 mk/server.mk            |  2 ++
 mk/targets.mk           |  2 +-
 9 files changed, 88 insertions(+), 47 deletions(-)
 delete mode 100644 lisp/org-install.el
 create mode 100644 mk/org-install-empty.el

diff --git a/.gitignore b/.gitignore
index a9d73ad..4060186 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,8 +30,10 @@
 orgcard_letter.tex
 orgcard.txt
 org
-org-loaddefs.el
-org-version.el
+lisp/org-autoloads.el
+lisp/org-install.el
+lisp/org-loaddefs.el
+lisp/org-version.el
 doc/org-version.inc
 org-*.tar*
 orgplus-*.tar*
diff --git a/lisp/Makefile b/lisp/Makefile
index 0e10c23..5dae2d9 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -15,7 +15,7 @@ ifneq ($(ORG_ADD_CONTRIB),)
 endif
 
 LISPV 	:= org-version.el
-LISPI 	:= org-loaddefs.el
+LISPI 	:= org-loaddefs.el org-install.el
 LISPA 	:= $(LISPV) $(LISPI)
 LISPB 	:= $(LISPA:%el=%elc) org-install.elc
 LISPF 	:= $(filter-out $(LISPA),$(sort $(wildcard *.el) $(_ORG_ADD_EL_)))
@@ -64,17 +64,15 @@ ifneq ($(ORG_ADD_CONTRIB),)
 	$(CP) $(addprefix ../contrib/lisp/,$(_ORG_ADD_EL_)) .
 endif
 
-autoloads:	cleanauto addcontrib $(LISPI) $(LISPV)
-
 $(LISPV):	$(LISPF)
 	@echo "org-version: $(ORGVERSION) ($(GITVERSION))"
 	@$(RM) $(@)
 	@$(MAKE_ORG_VERSION)
 
-$(LISPI):	$(LISPV) $(LISPF)
-	@echo "org-loaddefs: $(ORGVERSION) ($(GITVERSION))"
-	@$(RM) $(@)
-	@$(MAKE_ORG_INSTALL)
+autoloads:	cleanauto addcontrib $(LISPV) $(LISPF)
+	@echo "Autoload generation: $(ORGVERSION) ($(GITVERSION))"
+	@$(MAKE_ORG_AUTOLOADS)
+	@$(RM) $(LISPA:%=%~)
 
 install:	 compile $(LISPF)
 	if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
diff --git a/lisp/org-install.el b/lisp/org-install.el
deleted file mode 100644
index aca019f..0000000
--- a/lisp/org-install.el
+++ /dev/null
@@ -1,15 +0,0 @@
-;;; org-install.el --- backward compatibility file for obsolete configuration
-;;
-;;; Code:
-(warn "The file org-install is obsolete.
-It is provided here so that (require 'org-install) does not
-trigger an error for users with obsolete Emacs configuration.
-You can safely remove (require 'org-install) from your config.")
-\f
-(provide 'org-install)
-\f
-;; Local Variables:
-;; no-byte-compile: t
-;; coding: utf-8
-;; End:
-;;; org-install.el ends here
diff --git a/lisp/org.el b/lisp/org.el
index 3797e97..c5be3c5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20224,7 +20224,7 @@ (defun org-reload (&optional uncompiled)
 				       (list (if (featurep 'xemacs)
 						 "org-colview"
 					       "org-colview-xemacs")
-					     "org" "org-loaddefs" "org-version"))
+					     "org" "org-install" "org-loaddefs" "org-version"))
 			       "\\|"))
 	 (feats (delete-dups
 		 (mapcar 'file-name-sans-extension
diff --git a/mk/default.mk b/mk/default.mk
index dcd2947..d349ff6 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -82,10 +82,10 @@ BATCHL	= $(BATCH) \
 	  --eval '(add-to-list '"'"'load-path ".")'
 
 # How to generate org-loaddefs.el
-MAKE_ORG_INSTALL = $(BATCHL) \
+MAKE_ORG_AUTOLOADS = $(BATCHL) \
 	  --eval '(load "org-compat.el")' \
 	  --eval '(load "../mk/org-fixup.el")' \
-	  --eval '(org-make-org-loaddefs)'
+	  --eval '(org-make-org-autoloads)'
 
 # How to generate org-version.el
 MAKE_ORG_VERSION = $(BATCHL) \
diff --git a/mk/org-fixup.el b/mk/org-fixup.el
index 7b59efb..4edc9e3 100644
--- a/mk/org-fixup.el
+++ b/mk/org-fixup.el
@@ -61,26 +61,59 @@ (defun org-make-org-version (org-release org-git-version odt-dir)
     (toggle-read-only 0)
     (write-file "org-version.el")))
 
-(defun org-make-org-loaddefs ()
-  "Make the file org-loaddefs.el in the current directory.
-This function is internally used by the build system and should
-be used by foreign build systems or installers to produce this
-file in the installation directory of org-mode.  Org will not
-work correctly if this file is not up-to-date."
-  (with-temp-buffer
-    (set-visited-file-name "org-loaddefs.el")
-    (insert ";;; org-loaddefs.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
-    (let ((files (directory-files default-directory nil "^\\(org\\|ob\\)\\(-.*\\)?\\.el$")))
-      (mapc (lambda (f) (generate-file-autoloads f)) files))
-    (insert "\f\n(provide 'org-loaddefs)\n")
-    (insert "\f\n;; Local Variables:\n;; version-control: never\n")
-    (insert ";; no-byte-compile: t\n;; no-update-autoloads: t\n")
-    (insert ";; coding: utf-8\n;; End:\n;;; org-loaddefs.el ends here\n")
-    (toggle-read-only 0)
-    (save-buffer)))
+(defun org--autoload-rubric (feature)
+  "Return a string giving the appropriate autoload rubric for FEATURE."
+  (let ((file (concat feature ".el")))
+    (if (functionp 'autoload-rubric)
+	(autoload-rubric file nil feature)
+      ;; fallback for older Emacsen
+      (concat
+	";;; " file " --- autogenerated file, do not edit\n;;\n;;; Code:\n\n"
+	"\f\n(provide '" feature ")\n"
+	"\f\n;; Local Variables:\n;; version-control: never\n"
+	";; no-byte-compile: t\n;; no-update-autoloads: t\n"
+	";; coding: utf-8\n;; End:\n;;; " file " ends here\n"))))
+(defun org--update-file-autoloads (file)
+  (let ((no-update-autoloads nil)
+	(generated-autoload-file (file-name-nondirectory generated-autoload-file)))
+    (find-file file)
+    (unless no-update-autoloads
+      (with-current-buffer generated-autoload-file
+	(goto-char (point-max))(forward-line -11)
+	(generate-file-autoloads file)))
+    (kill-buffer file)))
+
+(defun org--update-directory-autoloads (dir)
+  "Update autoload definitions for Lisp files in the directories DIR."
+    (if (functionp 'update-directory-autoloads)
+	(update-directory-autoloads dir)
+      ;; fallback for XEmacs
+      (defvar no-update-autoloads nil)
+      (find-file "org-install.el")
+      (find-file "org-loaddefs.el")
+      (let ((files (sort
+		    (delq nil
+			  (mapcar
+			   (lambda (f)
+			     (if (string-match "^org-\\(install\\|loaddefs\\).el" f) nil f))
+			   (directory-files dir nil "^\\(org\\|ob\\)\\(-.*\\)?\\.el$" 'nosort)))
+		    'string-lessp)))
+	(mapc (lambda (f) (org--update-file-autoloads f)) files))
+      (with-current-buffer "org-install.el"  (save-buffer)(kill-buffer "org-install.el"))
+      (with-current-buffer "org-loaddefs.el" (save-buffer)(kill-buffer "org-loaddefs.el"))))
+
+(defun org-make-org-autoloads ()
+  "Create the autoload files in the current directory.
+This function is internally used by the build system and can be
+used by foreign build systems or installers.  Org will not work
+correctly if these files are not up-to-date."
+  (write-region (org--autoload-rubric "org-install") 'ignore "org-install.el")
+  (write-region (org--autoload-rubric "org-loaddefs") nil "org-loaddefs.el")
+  (let ((generated-autoload-file (expand-file-name "org-install.el" default-directory)))
+    (org--update-directory-autoloads (file-name-directory generated-autoload-file))))
 
 (defun org-make-autoloads (&optional compile force)
-  "Make the files org-loaddefs.el and org-version.el in the install directory.
+  "Make the files org-install.el, org-loaddefs.el and org-version.el in the install directory.
 Finds the install directory by looking for library \"org\".
 Optionally byte-compile lisp files in the install directory or
 force re-compilation.  This function is provided for easier
@@ -96,7 +129,7 @@ (defun org-make-autoloads (&optional compile force)
 	  (cd dirlisp)
 	  (org-fixup)
 	  (org-make-org-version (org-release) (org-git-version) dirodt)
-	  (org-make-org-loaddefs)
+	  (org-make-org-autoloads)
 	  (when compile (byte-recompile-directory dirlisp 0 force)))
       (cd origin))))
 
diff --git a/mk/org-install-empty.el b/mk/org-install-empty.el
new file mode 100644
index 0000000..81c2bea
--- /dev/null
+++ b/mk/org-install-empty.el
@@ -0,0 +1,21 @@
+;;; org-install.el --- backward compatibility file
+;;
+;;; Code:
+\f
+;; This file contains the first-level extracted autoload definitions
+;; in a standalone Org installation and need to be required from
+;; startup configuration.  For integrated Org installations, these
+;; autoload definitions get extracted into different files (Emacs:
+;; loaddefs.el, package manager: org-autoloads.el) and are
+;; automatically required by the provided startup files.  To allow a
+;; user to switch between a standalone and an integrated version
+;; without having to change the startup configuration, this
+;; compatibility file should be present for integrated Org
+;; installations.
+(provide 'org-install)
+\f
+;; Local Variables:
+;; no-byte-compile: t
+;; coding: utf-8
+;; End:
+;;; org-install.el ends here
diff --git a/mk/server.mk b/mk/server.mk
index a0c93a5..2273997 100644
--- a/mk/server.mk
+++ b/mk/server.mk
@@ -63,6 +63,7 @@ elpa:		cleanall info card elpa-dirty
 elpa-dirty elpa-up:	ORGDIR=org-$(PKG_TAG)
 elpa-dirty:
 	@$(MAKE) GITVERSION=$(GITVERSION:release_%=%)-elpa version autoloads
+	$(CP) mk/org-install-empty.el lisp/org-install.el
 	-@$(RM) $(ORGDIR) $(ORGTAR) $(ORGZIP)
 	ln -s . $(ORGDIR)
 	echo "(define-package \"org\""                        > org-pkg.el
@@ -84,6 +85,7 @@ elpaplus-dirty elpaplus-up:	ORG_ADD_CONTRIB=org-*
 elpaplus-dirty elpaplus-up:	ORGDIR=org-plus-contrib-$(PKG_TAG)
 elpaplus-dirty:
 	@$(MAKE) GITVERSION=$(GITVERSION:release_%=%)-elpaplus version autoloads
+	$(CP) mk/org-install-empty.el lisp/org-install.el
 	-@$(RM) $(ORGDIR) $(ORGTAR) $(ORGZIP)
 	ln -s . $(ORGDIR)
 	echo "(define-package \"org-plus-contrib\""           > org-plus-contrib-pkg.el
diff --git a/mk/targets.mk b/mk/targets.mk
index 4a9ee60..e51b35a 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -37,7 +37,7 @@ CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
 CONF_DEST = lispdir infodir datadir testdir
 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
 CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
-CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
+CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_AUTOLOADS MAKE_ORG_VERSION
 config-eol:: EOL = \#
 config-eol:: config-all
 config config-all::
-- 
1.8.0.1


[-- Attachment #3: Type: text/plain, Size: 187 bytes --]



Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

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

* Re: [PATCH] re-introduce org-install for standalone Org
  2012-12-09 19:49 [PATCH] re-introduce org-install for standalone Org Achim Gratz
@ 2013-01-05 11:40 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-01-05 11:40 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Here's the patch to re-introduce org-install.el again, now with
> compatibility code for XEmacs.  The explanations are in the commit
> message, but please ask if there are further questions.

FWIW the patch does not apply on maint, only on master.  
Not a big deal though.

-- 
 Bastien

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

end of thread, other threads:[~2013-01-05 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 19:49 [PATCH] re-introduce org-install for standalone Org Achim Gratz
2013-01-05 11:40 ` Bastien

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).