Reload: Only load files that were loaded before

The command org-reload did not only reload any loaded files, but all
lisp files in the Org distribution.  Also, it actually never reloaded
any files from the contrib directory.  Both of these problems are now
fixed.
This commit is contained in:
Carsten Dominik 2009-04-06 07:23:46 +02:00
parent 9b594be48e
commit 61530a1db1
5 changed files with 71 additions and 16 deletions

View File

@ -16,6 +16,7 @@ org-bookmark.el --- Links to bookmarks
org-browser-url.el --- Store links to webpages directly from Firefox/Opera
org-choose.el --- Use TODO keywords to mark decision states
org-collector.el --- Collect properties into tables
org-contribdir.el --- Dummy file to mark the org contrib Lisp directory
org-depend.el --- TODO dependencies for Org-mode
org-elisp-symbol.el --- Org links to emacs-lisp symbols
org-eval.el --- The <lisp> tag, adapted from Muse

View File

@ -0,0 +1,38 @@
;;; org-contribdir.el --- Mark the location of the contrib directory
;; Copyright (C) 2009 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 0.01
;;
;; This file is not yet part of GNU Emacs.
;;
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; The sole purpose of this file is to be located in the same place
;; as where the contributed Org files are located, typically in the
;; contrib/lisp directory of the Org-mode distribution. This is to
;; make sure that the command `org-reload' can reliably locate
;; contributed org files.
(provide 'org-contribdir)
;;; org-contribdir.el ends here

View File

@ -1,7 +1,10 @@
2009-04-06 Carsten Dominik <carsten.dominik@gmail.com>
* org-compat.el (org-find-library-name): New function.
* org.el (org-pre-cycle-hook): New hook.
(org-cycle): Call the new hook in appropriate places.
(org-reload): Only reload files that have been loaded before.
2009-04-05 Carsten Dominik <carsten.dominik@gmail.com>

View File

@ -33,6 +33,8 @@
(require 'org-macs)
(declare-function find-library-name "find-func" (library))
(defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
(defconst org-format-transports-properties-p
(let ((x "a"))
@ -295,6 +297,16 @@ that can be added."
(org-no-properties (substring string (or from 0) to))
(substring-no-properties string from to)))
(defun org-find-library-name (library)
(if (fboundp 'find-library-name)
(file-name-directory (find-library-name library))
; XEmacs does not have `find-library-name'
(flet ((find-library-name-helper (filename ignored-codesys)
filename)
(find-library-name (library)
(find-library library nil 'find-library-name-helper)))
(file-name-directory (find-library-name library)))))
(defun org-count-lines (s)
"How many lines in string S?"
(let ((start 0) (n 1))
@ -304,6 +316,8 @@ that can be added."
(setq n (1- n)))
n))
(provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe

View File

@ -2750,7 +2750,6 @@ Normal means, no org-mode-specific context."
(defvar mark-active)
;; Various packages
(declare-function find-library-name "find-func" (library))
(declare-function calendar-absolute-from-iso "cal-iso" (date))
(declare-function calendar-forward-day "cal-move" (arg))
(declare-function calendar-goto-date "cal-move" (date))
@ -7474,7 +7473,7 @@ Org-mode syntax."
(defun org-open-at-point (&optional in-emacs reference-buffer)
"Open link at or after point.
If there is no link at point, this function will search forward up to
the end of the current subtree.
the end of the current line.
Normally, files will be opened by an appropriate application. If the
optional argument IN-EMACS is non-nil, Emacs will visit the file.
With a double prefix argument, try to open outside of Emacs, in the
@ -14727,16 +14726,15 @@ With optional NODE, go directly to that node."
With prefix arg UNCOMPILED, load the uncompiled versions."
(interactive "P")
(require 'find-func)
(let* ((dir
(if (fboundp 'find-library-name)
(file-name-directory (find-library-name "org"))
(flet ((find-library-name-helper (filename ignored-codesys)
filename)
(find-library-name
(library)
(find-library library nil 'find-library-name-helper)))
(file-name-directory (find-library-name "org")))))
(files (directory-files dir t "\\.el\\'"))
(let* ((file-re "^\\(org\\|orgtbl\\)\\(\\.el\\|-.*\\.el\\)")
(dir-org (file-name-directory (org-find-library-name "org")))
(dir-org-contrib (ignore-errors
(file-name-directory
(org-find-library-name "org-contribdir"))))
(files
(append (directory-files dir-org t file-re)
(and dir-org-contrib
(directory-files dir-org-contrib t file-re))))
(remove-re (concat (if (featurep 'xemacs)
"org-colview" "org-colview-xemacs")
"\\'")))
@ -14747,10 +14745,11 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(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)))
(when (featurep (intern (file-name-nondirectory 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