Browse Source

org-reload: do not use the symbol name of the feature to map to the file name

* lisp/org.el (org-reload): Do not use the symbol name of the feature
  to map to the library name.  Use the function feature-file from
  loadhist instead.  Remove duplicate filenames from the resulting
  list since several files define multiple features, which was also
  the root cause of the reported bug.

Thanks to Rainer M. Krug for reporting this.
http://permalink.gmane.org/gmane.emacs.orgmode/61429
Achim Gratz 5 years ago
parent
commit
5451668d7b
1 changed files with 17 additions and 10 deletions
  1. 17 10
      lisp/org.el

+ 17 - 10
lisp/org.el

@@ -19999,27 +19999,34 @@ Your bug report will be posted to the Org-mode mailing list.
   "Reload all org lisp files.
 With prefix arg UNCOMPILED, load the uncompiled versions."
   (interactive "P")
+  (require 'loadhist)
   (let* ((org-dir     (org-find-library-dir "org"))
 	 (babel-dir   (or (org-find-library-dir "ob") org-dir))
 	 (contrib-dir (or (org-find-library-dir "org-contribdir") org-dir))
 	 (feature-re "^\\(org\\|ob\\)\\(-.*\\)?")
 	 (remove-re (mapconcat 'identity
-		     (list
-		      (if (featurep 'xemacs) "org-colview" "org-colview-xemacs")
-		      "^org$" "^org-infojs$" "^org-loaddefs$" "^org-version$")
-		     "\\|"))
-	 (feats features)
+			       (mapcar (lambda (f) (concat "^" f "$"))
+				       (list (if (featurep 'xemacs)
+						 "org-colview"
+					       "org-colview-xemacs")
+					     "org" "org-loaddefs" "org-version"))
+			       "\\|"))
+	 (feats (delete-dups
+		 (mapcar 'file-name-sans-extension
+			 (mapcar 'file-name-nondirectory
+				 (delq nil
+				       (mapcar 'feature-file
+					       features))))))
 	 (lfeat (append
 		 (sort
 		  (setq feats
 			(delq nil (mapcar
 				   (lambda (f)
-				     (let ((feat (symbol-name f)))
-				       (if (and (string-match feature-re feat)
-						(not (string-match remove-re feat)))
-					   feat nil)))
+				     (if (and (string-match feature-re f)
+					      (not (string-match remove-re f)))
+					 f nil))
 				   feats)))
-			'string-lessp)
+		  'string-lessp)
 		 (list "org-version" "org")))
 	 (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes))
 	 (load-misses ()))