diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-02-21 08:09:47 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-02-21 08:09:47 +0100 |
commit | 825efa1ef9bcfd4276d1ff75b36fd5138a6a44d9 (patch) | |
tree | 29c4dbd9b5ee7918b28dddb1365d3f05b35de2bd | |
parent | 4be7e8e9b3855bc8784216d7153a7e9978ac9177 (diff) | |
download | org-mode-825efa1ef9bcfd4276d1ff75b36fd5138a6a44d9.tar.gz |
Better way to load uncompiled code for backtrace production
The new command `org-reload' allows to reload all Org lisp files.
By default it will load compiled files if these are available. If
not, or when called with a C-u prefix argument, uncompiled code will
be loaded. This is good for producing a meaningful backtrace when an
error occurs.
-rw-r--r-- | doc/org.texi | 13 | ||||
-rwxr-xr-x | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/org.el | 24 |
3 files changed, 33 insertions, 8 deletions
diff --git a/doc/org.texi b/doc/org.texi index 4c10a36..6298183 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -630,14 +630,11 @@ error occurred. Here is how to produce a useful backtrace: @enumerate @item -Start a fresh Emacs or XEmacs, and make sure that it will load the -original Lisp code in @file{org.el} instead of the compiled version in -@file{org.elc}. The backtrace contains much more information if it is -produced with uncompiled code. To do this, either rename @file{org.elc} -to something else before starting Emacs, or ask Emacs explicitly to load -@file{org.el} by using the command line -@example -emacs -l /path/to/org.el +Reload uncompiled versions of all Org-mode lisp files. The backtrace +contains much more information if it is produced with uncompiled code. +To do this, use +@example +C-u M-x org-reload RET @end example @item Go to the @code{Options} menu and select @code{Enter Debugger on Error} diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba83aa0..235be58 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2009-02-21 Carsten Dominik <carsten.dominik@gmail.com> + + * org.el (org-reload): New command. + 2009-02-20 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-htm-get-tag-class-name) diff --git a/lisp/org.el b/lisp/org.el index 0850277..a730df1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -14260,6 +14260,30 @@ With optional NODE, go directly to that node." org-remember org-table org-timer))) ;;;###autoload +(defun org-reload (&optional uncompiled) + "Reload all org lisp files. +With prefix arg UNCOMPILED, load the uncompiled versions." + (interactive "P") + (require 'find-func) + (let* ((dir (file-name-directory (find-library-name "org"))) + (files (directory-files dir t "\\.el\\'")) + (remove-re (concat (if (featurep 'xemacs) + "org-colview" "org-colview-xemacs") + "\\'"))) + (setq files (mapcar 'file-name-sans-extension files)) + (setq files (mapcar + (lambda (x) (if (string-match remove-re x) nil x)) + files)) + (setq files (delq nil files)) + (mapc + (lambda (f) + (if (and (not uncompiled) + (file-exists-p (concat f ".elc"))) + (load (concat f ".elc") nil nil t) + (load (concat f ".el") nil nil t))) + files))) + +;;;###autoload (defun org-customize () "Call the customize function with org as argument." (interactive) |