Browse Source

Don't use equalp at run-time, compare downcased strings

* org-bibtex.el (org-bibtex-headline): Don't use equalp at run-time,
compare downcased strings.

Compiler complains about using `equalp' because other than for example
`concatenate' it is not declared 'inline.

Cf. [[info:cl#Declarations]] about the 'inline declaration

...
`inline'
     The `inline' DECL-SPEC lists one or more functions whose bodies
     should be expanded "in-line" into calling functions whenever the
     compiler is able to arrange for it.  For example, the Common Lisp
     function `cadr' is declared `inline' by this package so that the
     form `(cadr X)' will expand directly into `(car (cdr X))' when it
     is called in user functions, for a savings of one (relatively
     expensive) function call.

     The following declarations are all equivalent.  Note that the
     `defsubst' form is a convenient way to define a function and
     declare it inline all at once.

          (declaim (inline foo bar))
          (eval-when (compile load eval) (proclaim '(inline foo bar)))
          (defsubst foo (...) ...)       ; instead of defun

     *Please note:*  this declaration remains in effect after the
     containing source file is done.  It is correct to use it to
     request that a function you have defined should be inlined, but it
     is impolite to use it to request inlining of an external function.

     In Common Lisp, it is possible to use `(declare (inline ...))'
     before a particular call to a function to cause just that call to
     be inlined; the current byte compilers provide no way to implement
     this, so `(declare (inline ...))' is currently ignored by this
     package.
...

Thus other than `concatenate' `equalp' is stored as a function call at
run-time.
David Maus 8 years ago
parent
commit
e144f53c9a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lisp/org-bibtex.el

+ 2 - 2
lisp/org-bibtex.el

@@ -323,8 +323,8 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
 			      (lambda (kv)
 				(let ((key (car kv)) (val (cdr kv)))
 				  (when (and (string-match org-bibtex-prefix key)
-					     (not (equalp
-						   (concat org-bibtex-prefix "TYPE") key)))
+					     (not (string=
+						   (downcase (concat org-bibtex-prefix "TYPE")) (downcase key))))
 				    (cons (downcase (replace-regexp-in-string
 						     org-bibtex-prefix "" key))
 					  val))))