1 ;;; org-fixup.el - to make life easier for folks without GNU make
4 ;; Keywords: outlines, hypermedia, calendar, wp
5 ;; Homepage: http://orgmode.org
7 ;; This file is not yet part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 (defun org-make-org-version (org-release org-git-version odt-dir
)
33 ;;; org-version.el --- autogenerated file, do not edit
37 \(defun org-release ()
38 \"The release version of org-mode.
39 Inserted by installing org-mode or when a release is made.\"
40 (let ((org-release \"" org-release
"\"))
43 \(defun org-git-version ()
44 \"The Git version of org-mode.
45 Inserted by installing org-mode or when a release is made.\"
46 (let ((org-git-version \"" org-git-version
"\"))
49 \(defconst org-odt-data-dir \"" odt-dir
"\"
50 \"The location of ODT styles.\")
51 \f\n;; Local Variables:\n;; version-control: never
53 ;; coding: utf-8\n;; End:\n;;; org-version.el ends here\n")
55 (write-file "org-version.el")))
57 (defun org-make-org-install (absfile)
59 (set-visited-file-name absfile
)
60 (insert ";;; org-install.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
61 (let ((files (directory-files (file-name-directory absfile
) 'full
"^[^.#~]*\\.el$")))
62 (mapc (lambda (f) (generate-file-autoloads f
)) files
))
63 (insert "\f\n(provide 'org-install)\n")
64 (insert "\f\n;; Local Variables:\n;; version-control: never\n")
65 (insert ";; no-byte-compile: t\n;; no-update-autoloads: t\n")
66 (insert ";; coding: utf-8\n;; End:\n;;; org-install.el ends here\n")
68 (write-file absfile
)))
70 (defun org-make-autoloads ()
71 (let* ((origin default-directory
)
72 (dirlisp (org-find-library-dir "org"))
73 (dirorg (concat dirlisp
"../" ))
74 (dirodt (if (boundp 'org-odt-data-dir
)
76 (concat dirorg
"etc/"))))
81 (org-make-org-version (org-release) (org-git-version) dirodt
)
82 (org-make-org-install (concat dirlisp
"org-install.el")))
85 (defun org-make-autoloads-compile (&rest force
)
86 (let* ((origin default-directory
)
87 (dirlisp (org-find-library-dir "org")))
92 (byte-recompile-directory dirlisp
0 force
))
95 (defmacro org-fixup
()
96 (let* ((origin default-directory
)
97 (dirlisp (org-find-library-dir "org"))
98 (dirorg (concat dirlisp
"../" ))
99 (dirgit (concat dirorg
".git/" ))
100 (org-version "N/A-fixup")
101 (org-git-version "N/A-fixup !!check installation!!"))
102 (if (load (concat dirlisp
"org-version.el") 'noerror
'nomessage
'nosuffix
)
103 (setq org-version
(org-release)
104 org-git-version
(org-git-version))
105 (when (and (file-exists-p dirgit
)
106 (executable-find "git"))
110 (let ((git6 (substring (shell-command-to-string "git describe --abbrev=6 HEAD") 0 -
1))
111 (git0 (substring (shell-command-to-string "git describe --abbrev=0 HEAD") 0 -
1))
112 (gitd (string-match "\\S-" (shell-command-to-string "git status -uno --porcelain"))))
113 (setq org-git-version
(concat git6
(when gitd
".dirty")))
114 (if (string-match "^release_" git0
)
115 (setq org-version
(substring git0
8))
116 (setq org-version git0
))))
119 (defun org-release () ,org-version
)
120 (defun org-git-version () ,org-git-version
)
121 "org-fixup.el: redefined org version.")))
126 ;; no-byte-compile: t
129 ;;; org-fixup.el ends here