emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Re: Can't make org-install.el
Date: Sat, 19 May 2012 19:56:28 +0200	[thread overview]
Message-ID: <874nrcxdf7.fsf_-_@Rainer.invalid> (raw)
In-Reply-To: 808vgoqoff.fsf@somewhere.org

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: more robust org-fixup.el --]
[-- Type: text/x-patch, Size: 4760 bytes --]

From 7a6bcf54b0263a5afeafddf1a0121e2c8ac7d42a Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
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


[-- Attachment #3: Type: text/plain, Size: 325 bytes --]


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

  parent reply	other threads:[~2012-05-19 17:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 20:49 Can't make org-install.el Sebastien Vauban
2012-05-19  8:54 ` Achim Gratz
2012-05-19 10:42   ` Sebastien Vauban
2012-05-19 12:00     ` Achim Gratz
2012-05-19 13:40       ` Sebastien Vauban
2012-05-19 15:11         ` Achim Gratz
2012-05-19 17:56         ` Achim Gratz [this message]
2012-05-19 18:05           ` [PATCH] " Bastien
2012-05-19 19:00             ` Sebastien Vauban
2012-05-19 19:17               ` Achim Gratz
2012-05-19 19:41               ` Achim Gratz
2012-05-19 20:27                 ` Achim Gratz
2012-05-21  8:37                   ` Sebastien Vauban
2012-05-21  8:59                     ` Sebastien Vauban
2012-05-23 22:01                       ` Achim Gratz
2012-05-21 13:34                   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874nrcxdf7.fsf_-_@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).