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
This commit is contained in:
Bastien Guerry 2012-04-28 22:42:31 +02:00
parent a965630293
commit b3f60f791e
1 changed files with 4 additions and 14 deletions

View File

@ -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?"