emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] `org-load-noerror-mustsuffix´ is not defined, introduced by 5484a33b
Date: Sat, 12 Jan 2013 12:03:48 +0100	[thread overview]
Message-ID: <876232mzmz.fsf@Rainer.invalid> (raw)
In-Reply-To: 87fw27cybb.fsf@Rainer.invalid

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

Achim Gratz writes:
> The problem is that for the previous discussion "(require 'org-macs)"
> was effectively a NOP because 'org-macs was already loaded from a
> different place.  If you want to fix it, then that's where the effort
> should be directed (org-reload already does that and it's not difficult
> to do here either).

The attached patch series will implement a workaround that unloads any
features that have already been loaded with a different load-path so
that the correct files from the current load-path will prevail.  This
should solve the reported problems with the init file using parts of Org
before the load-path is set up.  The implementation uses unload-feature,
so customizations loaded previously (instead of at the very end as they
should) might vanish.  Please report if any init systems do this.

Package manager will still fail in certain situations when Org is
installed via ELPA in an Emacs session that has already used another
version of Org.  This needs to be fixed in package manager, there's no
workaround to do this from Org's side.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Revert-org.el-org-loaddefs.el-use-load-not-org-load-.patch --]
[-- Type: text/x-patch, Size: 2855 bytes --]

From c6b5e0daafb2f6e43ba936a85969b134037ff912 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 12 Jan 2013 08:55:07 +0100
Subject: [PATCH 1/3] Revert "org.el ("org-loaddefs.el"): use `load', not
 `org-load-noerror-mustsuffix'"

This reverts commit db7ece9fa2e27944d9482961af9bfd9d08bb3b51.
---
 lisp/org.el | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1c2ee9a..e979b35 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -78,11 +78,12 @@ (defvar org-table-formula-constants-local nil
 (require 'find-func)
 (require 'format-spec)
 
-(load "org-loaddefs.el" t t t)
-
 (require 'org-macs)
 (require 'org-compat)
 
+(let ((load-suffixes (list ".el")))
+  (org-load-noerror-mustsuffix "org-loaddefs"))
+
 ;; `org-outline-regexp' ought to be a defconst but is let-binding in
 ;; some places -- e.g. see the macro org-with-limited-levels.
 ;;
@@ -16901,27 +16902,6 @@ (defun org-date-from-calendar ()
       (org-insert-time-stamp
        (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
 
-(defcustom org-effort-durations
-  `(("h" . 60)
-    ("d" . ,(* 60 8))
-    ("w" . ,(* 60 8 5))
-    ("m" . ,(* 60 8 5 4))
-    ("y" . ,(* 60 8 5 40)))
-  "Conversion factor to minutes for an effort modifier.
-
-Each entry has the form (MODIFIER . MINUTES).
-
-In an effort string, a number followed by MODIFIER is multiplied
-by the specified number of MINUTES to obtain an effort in
-minutes.
-
-For example, if the value of this variable is ((\"hours\" . 60)), then an
-effort string \"2hours\" is equivalent to 120 minutes."
-  :group 'org-agenda
-  :version "24.1"
-  :type '(alist :key-type (string :tag "Modifier")
-		:value-type (number :tag "Minutes")))
-
 (defun org-minutes-to-clocksum-string (m)
   "Format number of minutes as a clocksum string.
 The format is determined by `org-time-clocksum-format',
@@ -17031,6 +17011,27 @@ (defun org-hh:mm-string-to-minutes (s)
     (string-to-number (match-string 1 s)))
    (t 0)))
 
+(defcustom org-effort-durations
+  `(("h" . 60)
+    ("d" . ,(* 60 8))
+    ("w" . ,(* 60 8 5))
+    ("m" . ,(* 60 8 5 4))
+    ("y" . ,(* 60 8 5 40)))
+  "Conversion factor to minutes for an effort modifier.
+
+Each entry has the form (MODIFIER . MINUTES).
+
+In an effort string, a number followed by MODIFIER is multiplied
+by the specified number of MINUTES to obtain an effort in
+minutes.
+
+For example, if the value of this variable is ((\"hours\" . 60)), then an
+effort string \"2hours\" is equivalent to 120 minutes."
+  :group 'org-agenda
+  :version "24.1"
+  :type '(alist :key-type (string :tag "Modifier")
+		:value-type (number :tag "Minutes")))
+
 (defcustom org-image-actual-width t
   "Should we use the actual width of images when inlining them?
 
-- 
1.8.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Revert-org-load-noerror-mustsuffix-requires-an-autol.patch --]
[-- Type: text/x-patch, Size: 860 bytes --]

From 6e158e45fad2c56c37e3cacee772102aec89dbd3 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 12 Jan 2013 08:55:51 +0100
Subject: [PATCH 2/3] Revert "`org-load-noerror-mustsuffix' requires an
 autoload"

This reverts commit f94d81a17e2c947a474e0f3b274c46afc3aa99a9.
---
 lisp/org-macs.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 974a366..e5d6100 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -426,7 +426,6 @@ (defun org-make-parameter-alist (flat)
     (cons (list (car flat) (cadr flat))
 	  (org-make-parameter-alist (cddr flat)))))
 
-;;;###autoload
 (defmacro org-load-noerror-mustsuffix (file)
   "Load FILE with optional arguments NOERROR and MUSTSUFFIX.  Drop the MUSTSUFFIX argument for XEmacs, which doesn't recognize it."
   (if (featurep 'xemacs)
-- 
1.8.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-org.el-advice-around-require-to-defuse-mixed-install.patch --]
[-- Type: text/x-patch, Size: 2945 bytes --]

From dd67ebfa2366ba5a275886c7c68f96643c59280b Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 12 Jan 2013 11:50:27 +0100
Subject: [PATCH 3/3] org.el: advice around require to defuse mixed-install
 scenario

* lisp/org.el (require-reloads-when-shadowed): Advice around require
  to check and correct for the situation where some parts of Org have
  already been loaded, then the load-path has been changed and Org is
  now about to be activated.  To do this, unload the previously loaded
  feature named "org", "ob" or starting with "org-" or "ob-" so that
  the original require function does load the requested feature from
  the current load-path.  Move some requires up in the file so that
  the advice can be removed as early as possible.
---
 lisp/org.el | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e979b35..e94442d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -78,8 +78,35 @@ (defvar org-table-formula-constants-local nil
 (require 'find-func)
 (require 'format-spec)
 
+;; some parts of Org might already have been used from a different
+;; place, try to reload these parts from the current load-path
+(require 'loadhist)
+(defadvice require (before org-require-reload-when-shadowed
+			   (feature &optional filename noerror)
+			   activate compile preactivate)
+  "Check whether a required feature has been shadowed by changing
+`load-path' after it has been loaded and reload that feature from
+current load-path in this case."
+  (when (featurep feature)
+    (let ((feature-name (or filename (symbol-name feature))))
+      (when (string-match "^\\(org\\|ob\\)\\(-.*\\)?$" feature-name)
+	(let ((feature-lib  (file-name-directory (or (locate-library feature-name) "")))
+	      (feature-dir  (file-name-directory (feature-file feature))))
+	  ;(message "require-reload-when shadowed %s\n\t%s\n\t%s" feature-name feature-lib feature-dir)
+	  (when (not (string= feature-lib feature-dir))
+	    (message "Reloading %s" feature-name)
+	    (unload-feature feature t)))))))
 (require 'org-macs)
 (require 'org-compat)
+(require 'org-entities)
+(require 'org-faces)
+(require 'org-list)
+(require 'org-pcomplete)
+(require 'org-src)
+(require 'org-footnote)
+;; babel
+(require 'ob)
+(eval-and-compile (ad-unadvise 'require))
 
 (let ((load-suffixes (list ".el")))
   (org-load-noerror-mustsuffix "org-loaddefs"))
@@ -4991,17 +5018,6 @@ (defvar buffer-face-mode-face)
 (require 'easymenu)
 (require 'overlay)
 
-;; (require 'org-macs) moved higher up in the file before it is first used
-(require 'org-entities)
-;; (require 'org-compat) moved higher up in the file before it is first used
-(require 'org-faces)
-(require 'org-list)
-(require 'org-pcomplete)
-(require 'org-src)
-(require 'org-footnote)
-
-;; babel
-(require 'ob)
 
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
-- 
1.8.1


[-- Attachment #5: Type: text/plain, Size: 188 bytes --]



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

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

  parent reply	other threads:[~2013-01-12 11:04 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 16:08 [BUG] `org-load-noerror-mustsuffix´ is not defined, introduced by 5484a33b Eric Schulte
2013-01-10 16:29 ` Bastien
2013-01-10 16:38   ` Eric Schulte
2013-01-10 17:09     ` Bastien
2013-01-10 17:29       ` Eric Schulte
2013-01-10 17:44         ` Nick Dokos
2013-01-10 18:13           ` Eric Schulte
2013-01-10 18:44             ` Bastien
2013-01-10 19:28               ` Eric Schulte
2013-01-10 20:05                 ` Bastien
2013-01-10 21:12                   ` Eric Schulte
2013-01-10 22:24                     ` Eric Schulte
2013-01-10 22:45                       ` Nick Dokos
2013-01-10 23:05                       ` Bastien
2013-01-10 23:44                         ` Eric Schulte
2013-01-11  7:04                           ` Bastien
2013-01-11 12:28                             ` Bastien
2013-01-11 15:41                               ` Eric Schulte
2013-01-11 16:31                                 ` Bastien
2013-01-11 16:50                                 ` Achim Gratz
2013-01-11 16:40                               ` Achim Gratz
2013-01-11 16:58                                 ` Bastien
2013-01-11 17:04                                   ` Achim Gratz
2013-01-11 17:23                                     ` Bastien
2013-01-11 19:30                                       ` Achim Gratz
2013-01-11 20:19                                         ` Eric Schulte
2013-01-11 20:48                                           ` Achim Gratz
2013-01-12  6:57                                           ` Bastien
2013-01-12  6:56                                         ` Bastien
2013-01-12  7:44                                           ` Achim Gratz
2013-01-12  8:40                                             ` Bastien
2013-01-12 10:27                                               ` Achim Gratz
2013-01-12 11:03                                         ` Achim Gratz [this message]
2013-01-12 13:35                                           ` Bastien
2013-01-12 15:49                                             ` Achim Gratz
2013-01-12 16:06                                               ` Bastien
2013-01-12 16:17                                                 ` Achim Gratz
2013-01-12 16:12                                               ` Bastien
2013-01-12 16:24                                                 ` Achim Gratz
2013-01-11  9:12                           ` Achim Gratz
2013-01-10 23:27                       ` Stelian Iancu
2013-01-10 23:27                       ` Stelian Iancu
2013-01-10 20:09                 ` Achim Gratz
2013-01-10 22:30                   ` Eric Schulte
2013-01-10 22:55                     ` Nick Dokos
2013-01-11  8:58                     ` Achim Gratz
2013-01-10 19:37             ` Nick Dokos
2013-01-10 19:47 ` Achim Gratz
2013-01-13 22:08   ` Thorsten Jolitz
2013-01-13 23:06     ` Stelian Iancu
2013-01-13 23:22       ` Thorsten Jolitz
2013-01-14 21:44         ` Eric Schulte
2013-01-15  1:29           ` Thorsten Jolitz
2013-01-15  6:07             ` Eric Schulte
2013-01-15 11:31               ` Thorsten Jolitz
2013-01-15 12:22                 ` Nick Dokos
2013-01-15 13:36                   ` Thorsten Jolitz
2013-01-15 13:49                     ` Nick Dokos
2013-01-15 18:58                 ` Achim Gratz
2013-01-15 20:17                   ` Thorsten Jolitz

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=876232mzmz.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).