From b3f60f791e74b880699168aec801900b60342b32 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 28 Apr 2012 22:42:31 +0200 Subject: [PATCH] Convert compatibility defun to a macro. * lisp/org-compat.el (org-find-library-name): Convert into a macro to avoid compilation of a function from XEmacs in Emacs and vice versa. Based on a not fully working proposal by A. Gratz to the orgmode mailing list: http://lists.gnu.org/archive/html/emacs-orgmode/2012-04/msg00009.html --- lisp/org-compat.el | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 735f62a72..d468942b5 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -32,10 +32,8 @@ (eval-when-compile (require 'cl)) -(require 'find-func) (require 'org-macs) -(declare-function find-library-name "find-func" (library)) (declare-function w32-focus-frame "term/w32-win" (frame)) ;; The following constant is for backward compatibility. We do not use @@ -332,20 +330,12 @@ Works on both Emacs and XEmacs." (org-no-properties (substring string (or from 0) to)) (substring-no-properties string from to))) -(defun org-find-library-name (library) +(defmacro org-find-library-name (library) (if (fboundp 'find-library-name) - (file-name-directory (find-library-name library)) + `(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) - ;; Prevent Emacs compiler to complain about calling - ;; find-library-name with three arguments, as we need need - ;; to do in Xemacs - (org-no-warnings - (find-library library nil 'find-library-name-helper)))) - (file-name-directory (find-library-name library))))) + `(flet ((flnh (lib ignore) lib)) + (file-name-directory (find-library ,library nil 'flnh))))) (defun org-count-lines (s) "How many lines in string S?"