emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Fix several byte-compile warnings in org-contrib files


From: Aaron Ecay
Subject: [O] [PATCH] Fix several byte-compile warnings in org-contrib files
Date: Sun, 31 Mar 2013 22:24:43 -0400

* contrib/lisp/org-bibtex-extras.el: convert to using cl-lib functions
  (obe-bibtex-file),
  (obe-html-link-base): add a 'group argument to defcustoms
  (obe-citations): replace non-existent org-babel-clean-text-properties
  with org-no-properties
* contrib/lisp/org-git-link.el: add an eval-and-compile to avoid
  undefined function warnings
  (org-git-show): use with-current-buffer instead of
  save-excursion+set-buffer
---
 contrib/lisp/org-bibtex-extras.el | 17 ++++++++++-------
 contrib/lisp/org-git-link.el      | 14 +++++++-------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/contrib/lisp/org-bibtex-extras.el 
b/contrib/lisp/org-bibtex-extras.el
index e3c0f49..57a15ed 100644
--- a/contrib/lisp/org-bibtex-extras.el
+++ b/contrib/lisp/org-bibtex-extras.el
@@ -60,15 +60,18 @@
 
 ;;; Code:
 (require 'org-bibtex)
+(require 'cl-lib)
 
-(defcustom obe-bibtex-file nil "File holding bibtex entries.")
+(defcustom obe-bibtex-file nil "File holding bibtex entries."
+  :group 'org-bibtex)
 
 (defcustom obe-html-link-base nil
   "Base of citation links.
 For example, to point to your `obe-bibtex-file' use the following.
 
   (setq obe-html-link-base (format \"file:%s\" obe-bibtex-file))
-")
+"
+  :group 'org-bibtex)
 
 (defvar obe-citations nil)
 (defun obe-citations ()
@@ -78,7 +81,7 @@ For example, to point to your `obe-bibtex-file' use the 
following.
        (find-file obe-bibtex-file)
        (goto-char (point-min))
        (while (re-search-forward "  :CUSTOM_ID: \\(.+\\)$" nil t)
-         (push (org-babel-clean-text-properties (match-string 1))
+         (push (org-no-properties (match-string 1))
                obe-citations))
        obe-citations)))
 
@@ -117,18 +120,18 @@ For example, to point to your `obe-bibtex-file' use the 
following.
 (defun obe-meta-to-json (meta &optional fields)
   "Turn a list of META data from citations into a string of json."
   (let ((counter 1) nodes links)
-    (flet ((id (it) (position it nodes :test #'string= :key #'car))
+    (flet ((id (it) (cl-position it nodes :test #'string= :key #'car))
           (col (k) (mapcar (lambda (r) (cdr (assoc k r))) meta))
           (add (lst)
                (dolist (el lst) (push (cons el counter) nodes))
                (incf counter)))
       ;; build the nodes of the graph
       (add (col :title))
-      (add (remove-if (lambda (author) (string-match "others" author))
-                     (remove-duplicates (apply #'append (col :authors))
+      (add (cl-remove-if (lambda (author) (string-match "others" author))
+                     (cl-remove-duplicates (apply #'append (col :authors))
                                         :test #'string=)))
       (dolist (field fields)
-       (add (remove-duplicates (col field) :test #'string=)))
+       (add (cl-remove-duplicates (col field) :test #'string=)))
       ;; build the links in the graph
       (dolist (citation meta)
         (let ((dest (id (cdr (assoc :title citation)))))
diff --git a/contrib/lisp/org-git-link.el b/contrib/lisp/org-git-link.el
index a4759c9..b5ca96f 100644
--- a/contrib/lisp/org-git-link.el
+++ b/contrib/lisp/org-git-link.el
@@ -131,11 +131,11 @@
                 relpath (concat (file-name-as-directory (second dirlist)) 
relpath))))
       (list (expand-file-name ".git" dir) relpath))))
 
-
-(if (featurep 'xemacs)
-    (defalias 'org-git-gitrepos-p 'org-git-find-gitdir)
-  (defalias 'org-git-gitrepos-p 'org-git-find-gitdir
-  "Return non-nil if path is in git repository"))
+(eval-and-compile
+  (if (featurep 'xemacs)
+      (defalias 'org-git-gitrepos-p 'org-git-find-gitdir)
+    (defalias 'org-git-gitrepos-p 'org-git-find-gitdir
+      "Return non-nil if path is in git repository")))
 
 ;; splitting the link string
 
@@ -196,8 +196,8 @@
   (unless
       (zerop (call-process org-git-program nil buffer nil
                            "--no-pager" (concat "--git-dir=" gitdir) "show" 
object))
-    (error "git error: %s " (save-excursion (set-buffer buffer)
-                                            (buffer-string)))))
+    (error "git error: %s " (with-current-buffer buffer
+                             (buffer-string)))))
 
 (defun org-git-blob-sha (gitdir object)
   "Return sha of the referenced object"
-- 
1.8.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]