emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Re: Can't make org-install.el


From: Achim Gratz
Subject: [O] [PATCH] Re: Can't make org-install.el
Date: Sat, 19 May 2012 19:56:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Sebastien Vauban writes:
> These allow me to do everything I want (I'm even admin of my machine).

Just as a comment, being admin does not necessarily mean that you can do
anything, only that you can elevate your rights so that you can
eventually do it.  Windows has quite an elaborate system for permissions
(and revocations thereof) in the file system and the point of lots of
those is precisely to restrict was an admin can do by default.

> Absolutely. You pinpoint a real un-understandable thing (at least, for now)...

While I still don't understand how this is happening exactly, I've
re-written the functions in question to work off temporary buffers,
which only runs into the problem of non-writability at the very end when
the file is to be saved and should then ask for confirmation.  At that
point it should be possible to see what is going on.

>From 7a6bcf54b0263a5afeafddf1a0121e2c8ac7d42a Mon Sep 17 00:00:00 2001
From: Achim Gratz <address@hidden>
Date: Sat, 19 May 2012 19:54:00 +0200
Subject: [PATCH] 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.
---
 UTILITIES/org-fixup.el |   64 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 45 insertions(+), 19 deletions(-)

diff --git a/UTILITIES/org-fixup.el b/UTILITIES/org-fixup.el
index bf70a80..9f56f16 100644
--- a/UTILITIES/org-fixup.el
+++ b/UTILITIES/org-fixup.el
@@ -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 @@ (defun org-make-org-version (org-release org-git-version 
odt-dir)
 \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 @@ (defmacro org-fixup ()
        (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)
-- 
1.7.9.2

I've added functions to make the autoloads and byte-compile without the
use of make for those that may not have it.


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

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

reply via email to

[Prev in Thread] Current Thread [Next in Thread]