make functions in org-fixup.el more robust, add full build functionality
* UTILITIES/org-fixup.el(org-make-org-version): Use temporary buffer. * UTILITIES/org-fixup.el(org-make-org-install): Use temporary buffer. * UTILITIES/org-fixup.el(org-make-autoloads): New function, generates autoload files using (org-make-org-version) and (org-make-org-install). Uses (org-fixup) to determine version strings. * UTILITIES/org-fixup.el(org-make-autoloads-compile): New function, generates autoload files using (org-make-autoloads) and byte-compiles files in lisp. Optional argument forces re-compilation of all files. * UTILITIES/org-fixup.el(org-fixup): Clean up whitespace and correct the unwind form.
This commit is contained in:
parent
40a789ecd1
commit
7b33d9f56b
|
@ -28,9 +28,8 @@
|
|||
(require 'autoload)
|
||||
|
||||
(defun org-make-org-version (org-release org-git-version odt-dir)
|
||||
(find-file "org-version.el")
|
||||
(erase-buffer)
|
||||
(insert "\
|
||||
(with-temp-buffer
|
||||
(insert "\
|
||||
;;; org-version.el --- autogenerated file, do not edit
|
||||
;;
|
||||
;;; Code:
|
||||
|
@ -52,19 +51,46 @@
|
|||
\f\n;; Local Variables:\n;; version-control: never
|
||||
;; no-byte-compile: t
|
||||
;; coding: utf-8\n;; End:\n;;; org-version.el ends here\n")
|
||||
(save-buffer))
|
||||
(toggle-read-only 0)
|
||||
(write-file "org-version.el")))
|
||||
|
||||
(defun org-make-org-install (absfile)
|
||||
(find-file absfile)
|
||||
(erase-buffer)
|
||||
(insert ";;; org-install.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
|
||||
(let ((files (directory-files (file-name-directory absfile) 'full "^[^.#~]*\\.el$")))
|
||||
(mapc (lambda (f) (generate-file-autoloads f)) files))
|
||||
(insert "\f\n(provide 'org-install)\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-install.el ends here\n")
|
||||
(save-buffer))
|
||||
(with-temp-buffer
|
||||
(set-visited-file-name absfile)
|
||||
(insert ";;; org-install.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
|
||||
(let ((files (directory-files (file-name-directory absfile) 'full "^[^.#~]*\\.el$")))
|
||||
(mapc (lambda (f) (generate-file-autoloads f)) files))
|
||||
(insert "\f\n(provide 'org-install)\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-install.el ends here\n")
|
||||
(toggle-read-only 0)
|
||||
(write-file absfile)))
|
||||
|
||||
(defun org-make-autoloads ()
|
||||
(let* ((origin default-directory)
|
||||
(dirlisp (org-find-library-dir "org"))
|
||||
(dirorg (concat dirlisp "../" ))
|
||||
(dirodt (if (boundp 'org-odt-data-dir)
|
||||
org-odt-data-dir
|
||||
(concat dirorg "etc/"))))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(cd dirlisp)
|
||||
(org-fixup)
|
||||
(org-make-org-version (org-release) (org-git-version) dirodt)
|
||||
(org-make-org-install (concat dirlisp "org-install.el")))
|
||||
(cd origin))))
|
||||
|
||||
(defun org-make-autoloads-compile (&rest force)
|
||||
(let* ((origin default-directory)
|
||||
(dirlisp (org-find-library-dir "org")))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(cd dirlisp)
|
||||
(org-make-autoloads)
|
||||
(byte-recompile-directory dirlisp 0 force))
|
||||
(cd origin))))
|
||||
|
||||
(defmacro org-fixup ()
|
||||
(let* ((origin default-directory)
|
||||
|
@ -81,14 +107,14 @@
|
|||
(unwind-protect
|
||||
(progn
|
||||
(cd dirorg)
|
||||
(let (( git6 (substring (shell-command-to-string "git describe --abbrev=6 HEAD") 0 -1))
|
||||
( git0 (substring (shell-command-to-string "git describe --abbrev=0 HEAD") 0 -1))
|
||||
( gitd (string-match "\\S-" (shell-command-to-string "git status -uno --porcelain"))))
|
||||
(let ((git6 (substring (shell-command-to-string "git describe --abbrev=6 HEAD") 0 -1))
|
||||
(git0 (substring (shell-command-to-string "git describe --abbrev=0 HEAD") 0 -1))
|
||||
(gitd (string-match "\\S-" (shell-command-to-string "git status -uno --porcelain"))))
|
||||
(setq org-git-version (concat git6 (when gitd ".dirty")))
|
||||
(if (string-match "^release_" git0)
|
||||
(setq org-version (substring git0 8))
|
||||
(setq org-version git0)))
|
||||
(cd origin)))))
|
||||
(setq org-version git0))))
|
||||
(cd origin))))
|
||||
`(progn
|
||||
(defun org-release () ,org-version)
|
||||
(defun org-git-version () ,org-git-version)
|
||||
|
|
Loading…
Reference in New Issue