emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix several byte-compile warnings in org-contrib files
@ 2013-04-01  2:24 Aaron Ecay
  2013-04-01 14:27 ` Nicolas Goaziou
  2013-04-03 11:13 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron Ecay @ 2013-04-01  2:24 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix several byte-compile warnings in org-contrib files
  2013-04-01  2:24 [PATCH] Fix several byte-compile warnings in org-contrib files Aaron Ecay
@ 2013-04-01 14:27 ` Nicolas Goaziou
  2013-04-03 11:13 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2013-04-01 14:27 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Hello,

Thanks for your patch. Here are a few comments.

Aaron Ecay <aaronecay@gmail.com> writes:

> +(require 'cl-lib)

This is not an option since Org has to support Emacsen older than 24.3.

> -      (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=)))

Here, we can use `org-remove-if' and `org-uniquify'.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix several byte-compile warnings in org-contrib files
  2013-04-01  2:24 [PATCH] Fix several byte-compile warnings in org-contrib files Aaron Ecay
  2013-04-01 14:27 ` Nicolas Goaziou
@ 2013-04-03 11:13 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2013-04-03 11:13 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Hi Aaron,

Aaron Ecay <aaronecay@gmail.com> writes:

> * 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

I applied some of the changes above:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=137fd3
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=69eb39

Thanks!

Please help us with the Changelog formatting, there are
many tiny issues with your changelogs -- see details:

  http://orgmode.org/worg/org-contribute.html#sec-5

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-03 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-01  2:24 [PATCH] Fix several byte-compile warnings in org-contrib files Aaron Ecay
2013-04-01 14:27 ` Nicolas Goaziou
2013-04-03 11:13 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).