From 0dbc1db6e2fedffc4725c6cd8680fa8f08098d67 Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Thu, 26 Mar 2015 08:04:35 +0900 Subject: [PATCH] Use cl-lib macros instead of cl.el macros --- doi-utils.el | 2 +- isbn.el | 6 ++-- org-ref.el | 94 ++++++++++++++++++++++++++-------------------------- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/doi-utils.el b/doi-utils.el index a0af934..7873687 100644 --- a/doi-utils.el +++ b/doi-utils.el @@ -603,7 +603,7 @@ Optional argument NODELIM see `bibtex-make-field'." (defun plist-get-keys (plist) "Return keys in a PLIST." - (loop + (cl-loop for key in results by #'cddr collect key)) (defun doi-utils-update-bibtex-entry-from-doi (doi) diff --git a/isbn.el b/isbn.el index cb73f68..a759bc0 100644 --- a/isbn.el +++ b/isbn.el @@ -88,9 +88,9 @@ entry with the generated key already exists in the file." (concat "\n@book{,\n" (mapconcat 'identity - (loop for field in (-sort 'string-lessp (mapcar 'car metadata)) - collect - (format " %s={%s}," field (cdr (assoc field metadata)))) + (cl-loop for field in (-sort 'string-lessp (mapcar 'car metadata)) + collect + (format " %s={%s}," field (cdr (assoc field metadata)))) "\n") "\n}\n")) diff --git a/org-ref.el b/org-ref.el index 71252eb..46dfbe2 100644 --- a/org-ref.el +++ b/org-ref.el @@ -499,11 +499,11 @@ Format according to the type in `org-ref-bibliography-entry-format'." (file) (entry) (bibtex-entry) (entry-type) (format)) (setq file (catch 'result - (loop for file in org-ref-bibliography-files do - (if (org-ref-key-in-file-p key (file-truename file)) - (throw 'result file) - (message "%s not found in %s" - key (file-truename file)))))) + (cl-loop for file in org-ref-bibliography-files do + (if (org-ref-key-in-file-p key (file-truename file)) + (throw 'result file) + (message "%s not found in %s" + key (file-truename file)))))) (with-temp-buffer (insert-file-contents file) @@ -574,7 +574,7 @@ Format according to the type in `org-ref-bibliography-entry-format'." (file) (entry) (bibtex-entry) (entry-type) (format)) (setq file (catch 'result - (loop for file in org-ref-bibliography-files do + (cl-loop for file in org-ref-bibliography-files do (if (org-ref-key-in-file-p key (file-truename file)) (throw 'result file) (message "%s not found in %s" key (file-truename file)))))) @@ -866,11 +866,11 @@ ARG does nothing." (string-match-p "[^.]*\\.\\(png\\|jpg\\|eps\\|pdf\\)$" (org-element-property :path link))) - (incf counter) + (cl-incf counter) (let* ((start (org-element-property :begin link)) (parent (car (cdr (org-element-property :parent link)))) - (caption (caaar (plist-get parent :caption))) + (caption (cl-caaar (plist-get parent :caption))) (name (plist-get parent :name))) (if caption (format @@ -909,10 +909,10 @@ ARG does nothing." (org-element-map (org-element-parse-buffer 'element) 'table (lambda (table) "create a link for to the table" - (incf counter) + (cl-incf counter) (let ((start (org-element-property :begin table)) (name (org-element-property :name table)) - (caption (caaar (org-element-property :caption table)))) + (caption (cl-caaar (org-element-property :caption table)))) (if caption (format "[[elisp:(progn (switch-to-buffer \"%s\")(widen)(goto-char %s))][table %s: %s]] %s\n" @@ -1223,19 +1223,19 @@ Use C-u C-u to insert a [[#custom-id]] link" (helm :input (thing-at-point 'word) :sources `(((name . "Available labels to ref") - (candidates . ,(loop for label in labels - for context in contexts - ;; we do some kludgy adding spaces - ;; and bars to make it "easier" to - ;; see in helm. - collect (cons (concat - label "\n" - (mapconcat - (lambda (x) - (concat " |" x)) - (split-string context "\n") - "\n" - ) "\n\n") label))) + (candidates . ,(cl-loop for label in labels + for context in contexts + ;; we do some kludgy adding spaces + ;; and bars to make it "easier" to + ;; see in helm. + collect (cons (concat + label "\n" + (mapconcat + (lambda (x) + (concat " |" x)) + (split-string context "\n") + "\n" + ) "\n\n") label))) ;; default action to replace or insert ref link. (action . (lambda (label) (switch-to-buffer ,cb) @@ -1507,9 +1507,9 @@ falling back to what the user has set in `org-ref-default-bibliography'" (unless key (setq key (org-ref-get-bibtex-key-under-cursor))) (setq file (catch 'result - (loop for file in org-ref-bibliography-files do - (if (org-ref-key-in-file-p key (file-truename file)) - (throw 'result file))))) + (cl-loop for file in org-ref-bibliography-files do + (if (org-ref-key-in-file-p key (file-truename file)) + (throw 'result file))))) (cons key file))) ;; *** key at point functions @@ -2092,8 +2092,8 @@ This assumes you are in an article." (bibtex-beginning-of-entry) (let* ((cb (current-buffer)) (bibtex-expand-strings t) - (entry (loop for (key . value) in (bibtex-parse-entry t) - collect (cons (downcase key) value))) + (entry (cl-loop for (key . value) in (bibtex-parse-entry t) + collect (cons (downcase key) value))) (title (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "title" entry))) (year (reftex-get-bib-field "year" entry)) (author (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "author" entry))) @@ -2113,8 +2113,8 @@ This assumes you are in an article." (bibtex-beginning-of-entry) (let* ((cb (current-buffer)) (bibtex-expand-strings t) - (entry (loop for (key . value) in (bibtex-parse-entry t) - collect (cons (downcase key) value))) + (entry (cl-loop for (key . value) in (bibtex-parse-entry t) + collect (cons (downcase key) value))) (title (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "title" entry))) (year (reftex-get-bib-field "year" entry)) (author (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "author" entry))) @@ -2164,8 +2164,8 @@ construct the heading by hand." (bibtex-beginning-of-entry) (let* ((cb (current-buffer)) (bibtex-expand-strings t) - (entry (loop for (key . value) in (bibtex-parse-entry t) - collect (cons (downcase key) value))) + (entry (cl-loop for (key . value) in (bibtex-parse-entry t) + collect (cons (downcase key) value))) (title (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "title" entry))) (year (reftex-get-bib-field "year" entry)) (author (replace-regexp-in-string "\n\\|\t\\|\s+" " " (reftex-get-bib-field "author" entry))) @@ -2222,7 +2222,7 @@ key author journal year volume pages doi url key org-ref-pdf-directory key)) (re-search-forward (format ":Custom_ID: %s$" - (first (reftex-citation t)) nil 'end)) + (cl-first (reftex-citation t)) nil 'end)) (funcall org-ref-open-notes-function)) ;; ** Open bibtex entry in browser @@ -3081,16 +3081,16 @@ User is prompted for tags. This function is called from `helm-bibtex'. Argument CANDIDATES helm candidates." (message "") (let ((keywords (read-string "Keywords (comma separated): "))) - (loop for key in (helm-marked-candidates) - do - (save-window-excursion - (helm-bibtex-show-entry key) - (bibtex-set-field - "keywords" - (concat - keywords - ", " (bibtex-autokey-get-field "keywords"))) - (save-buffer))))) + (cl-loop for key in (helm-marked-candidates) + do + (save-window-excursion + (helm-bibtex-show-entry key) + (bibtex-set-field + "keywords" + (concat + keywords + ", " (bibtex-autokey-get-field "keywords"))) + (save-buffer))))) (setq helm-source-bibtex '((name . "BibTeX entries") @@ -3316,10 +3316,10 @@ Checks for pdf and doi, and add appropriate functions." (email-bibtex-entry)))) t) ;; finally return a numbered list of the candidates - (loop for i from 0 - for cell in candidates - collect (cons (format "%2s. %s" i (car cell)) - (cdr cell))))) + (cl-loop for i from 0 + for cell in candidates + collect (cons (format "%2s. %s" i (car cell)) + (cdr cell))))) (defvar org-ref-helm-user-candidates '() -- 2.39.2