123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- ;;; org-fixup.el - to make life easier for folks without GNU make
- ;;
- ;; Author: Achim Gratz
- ;; Keywords: outlines, hypermedia, calendar, wp
- ;; Homepage: http://orgmode.org
- ;;
- ;; This file is not yet part of GNU Emacs.
- ;;
- ;; GNU Emacs is free software; you can redistribute it and/or modify
- ;; it under the terms of the GNU General Public License as published by
- ;; the Free Software Foundation; either version 3, or (at your option)
- ;; any later version.
- ;; GNU Emacs is distributed in the hope that it will be useful,
- ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;; GNU General Public License for more details.
- ;; You should have received a copy of the GNU General Public License
- ;; along with GNU Emacs; see the file COPYING. If not, write to the
- ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- ;; Boston, MA 02110-1301, USA.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;;; Commentary:
- (require 'org-compat)
- (require 'autoload)
- (defun org-make-org-version (org-release org-git-version odt-dir)
- (with-temp-buffer
- (insert "\
- ;;; org-version.el --- autogenerated file, do not edit
- ;;
- ;;; Code:
- ;;;\#\#\#autoload
- \(defun org-release ()
- \"The release version of org-mode.
- Inserted by installing org-mode or when a release is made.\"
- (let ((org-release \"" org-release "\"))
- org-release))
- ;;;\#\#\#autoload
- \(defun org-git-version ()
- \"The Git version of org-mode.
- Inserted by installing org-mode or when a release is made.\"
- (let ((org-git-version \"" org-git-version "\"))
- org-git-version))
- ;;;\#\#\#autoload
- \(defconst org-odt-data-dir \"" odt-dir "\"
- \"The location of ODT styles.\")
- \f\n;; Local Variables:\n;; version-control: never
- ;; no-byte-compile: t
- ;; coding: utf-8\n;; End:\n;;; org-version.el ends here\n")
- (toggle-read-only 0)
- (write-file "org-version.el")))
- (defun org-make-org-install (absfile)
- (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)
- (dirlisp (org-find-library-dir "org"))
- (dirorg (concat dirlisp "../" ))
- (dirgit (concat dirorg ".git/" ))
- (org-version "N/A-fixup")
- (org-git-version "N/A-fixup !!check installation!!"))
- (if (load (concat dirlisp "org-version.el") 'noerror 'nomessage 'nosuffix)
- (setq org-version (org-release)
- org-git-version (org-git-version))
- (when (and (file-exists-p dirgit)
- (executable-find "git"))
- (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"))))
- (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))))
- `(progn
- (defun org-release () ,org-version)
- (defun org-git-version () ,org-git-version)
- "org-fixup.el: redefined org version.")))
- (provide 'org-fixup)
- ;; Local Variables:
- ;; no-byte-compile: t
- ;; coding: utf-8
- ;; End:
- ;;; org-fixup.el ends here
|