all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob e5dee9a89e6ac59440d719f7e7bb3ff793ecebeb 7067 bytes (raw)
name: mk/org-fixup.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
 
;;; org-fixup.el --- make life easier for folks without GNU make
;;
;; Author: Achim Gratz
;; Keywords: orgmode
;; Homepage: http://orgmode.org
;;
;; This file is not 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 'autoload)
(require 'org-compat "org-compat.el")

(defun org-make-org-version (org-release org-git-version odt-dir)
  "Make the file org-version.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 present (except directly from
the Git work tree)."
  (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
\(defvar org-odt-data-dir \"" odt-dir "\"
  \"The location of ODT styles.\")
\f\n\(provide 'org-version\)
\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-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."
  (write-region (autoload-rubric "org-install.el" nil "org-install") nil "org-install.el")
  (write-region (autoload-rubric "org-loaddefs.el" nil "org-loaddefs") nil "org-install.el")
  (let ((generated-autoload-file (expand-file-name "org-install.el" default-directory)))
    (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.
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
manual install when the build system can't be used."
  (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-loaddefs)
	  (when compile (byte-recompile-directory dirlisp 0 force)))
      (cd origin))))

(defun org-make-autoloads-compile ()
  "Call org-make-autoloads with compile argument.
Convenience function for easier invocation from command line."
  (org-make-autoloads 'compile nil))

(defun org-make-autoloads-compile-force ()
  "Call org-make-autoloads with compile force arguments.
Convenience function for easier invocation from command line."
  (org-make-autoloads 'compile 'force))

;; Internal functions

(defun org-make-local-mk ()
  "Internal function for the build system."
  (let ((default "mk/default.mk")
	(local   "local.mk"))
    (unwind-protect
	(with-temp-buffer
	  (insert-file-contents default)
	  (goto-char (point-min))
	  (when (search-forward "-8<-" nil t)
	    (forward-line 1)
	    (delete-region (point-min) (point)))
	  (when (search-forward "->8-" nil t)
	    (forward-line 0)
	    (delete-region (point) (point-max)))
	  (goto-char (point-min))
	  (insert "
# Remove \"oldorg:\" to switch to \"all\" as the default target.
# Change \"oldorg:\" to an existing target to make that target the default,
# or define your own target here to become the default target.
oldorg:	# do what the old Makefile did by default.

##----------------------------------------------------------------------
")
	  (goto-char (point-max))
	  (insert "\
# See default.mk for further configuration options.
")
	  (toggle-read-only 0)
	  (write-file local))
      nil)))

(defun org-make-letterformat (a4name lettername)
  "Internal function for the build system."
  (unwind-protect
      (with-temp-buffer
	(insert-file-contents a4name)
	(goto-char (point-min))
	(while (search-forward "\\pdflayout=(0l)" nil t)
	  (replace-match "\\pdflayout=(1l)" nil t))
	(toggle-read-only 0)
	(write-file lettername))
    nil))

;; redefine version functions

(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 (and (boundp 'org-fake-release)     (stringp org-fake-release)
	     (boundp 'org-fake-git-version) (stringp org-fake-git-version))
	(setq org-version     org-fake-release
	      org-git-version org-fake-git-version)
      (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") "-git"))
		  (if (string-match "^release_" git0)
		      (setq org-version (substring git0 8))
		    (setq org-version git0))))
	    (cd origin)))))
    (message "org-fixup.el: redefined Org version")
    `(progn
       (defun org-release () ,org-version)
       (defun org-git-version () ,org-git-version))))

(provide 'org-fixup)
\f
;; Local Variables:
;; no-byte-compile: t
;; coding: utf-8
;; End:
;;; org-fixup.el ends here

debug log:

solving e5dee9a ...
found e5dee9a in https://yhetil.org/emacs/87625vhwu6.fsf@Rainer.invalid/
found 7b59efb in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 7b59efb881a9fd37d1637472588a914ee2a6db41	mk/org-fixup.el

applying [1/1] https://yhetil.org/emacs/87625vhwu6.fsf@Rainer.invalid/
diff --git a/mk/org-fixup.el b/mk/org-fixup.el
index 7b59efb..e5dee9a 100644

Checking patch mk/org-fixup.el...
Applied patch mk/org-fixup.el cleanly.

index at:
100644 e5dee9a89e6ac59440d719f7e7bb3ff793ecebeb	mk/org-fixup.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.