From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: [PATCH] Re: Can't make org-install.el Date: Sat, 19 May 2012 19:56:28 +0200 Message-ID: <874nrcxdf7.fsf_-_@Rainer.invalid> References: <80zk95xlj5.fsf@somewhere.org> <87sjewy2ir.fsf@Rainer.invalid> <80d360qwom.fsf@somewhere.org> <87obpkxtwv.fsf@Rainer.invalid> <808vgoqoff.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVntU-0004qy-Vt for emacs-orgmode@gnu.org; Sat, 19 May 2012 13:56:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SVntS-0005qx-KK for emacs-orgmode@gnu.org; Sat, 19 May 2012 13:56:44 -0400 Received: from plane.gmane.org ([80.91.229.3]:50158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVntS-0005qk-AN for emacs-orgmode@gnu.org; Sat, 19 May 2012 13:56:42 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SVntQ-0000RO-AI for emacs-orgmode@gnu.org; Sat, 19 May 2012 19:56:40 +0200 Received: from pd9eb2934.dip.t-dialin.net ([217.235.41.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 19 May 2012 19:56:40 +0200 Received: from Stromeko by pd9eb2934.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 19 May 2012 19:56:40 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-make-functions-in-org-fixup.el-more-robust-add-full-.patch Content-Description: more robust org-fixup.el >From 7a6bcf54b0263a5afeafddf1a0121e2c8ac7d42a Mon Sep 17 00:00:00 2001 From: Achim Gratz 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 --=-=-= Content-Type: text/plain 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 --=-=-=--