summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-11-01 01:03:32 -0400
committerKyle Meyer <kyle@kyleam.com>2014-11-01 01:22:59 -0400
commit70e7d04b1b3767487b33df53489a3651f9f0cc2f (patch)
treea63b69b812ff59f14e9cc9fce65c506d6b2de214
parent794f943564f5676bbae425e1ddf7e67ec95955e2 (diff)
downloadbog-70e7d04b1b3767487b33df53489a3651f9f0cc2f.tar.gz
Replace some cond instances with case
-rw-r--r--bog.el35
1 files changed, 14 insertions, 21 deletions
diff --git a/bog.el b/bog.el
index 75fe9d3..6a08350 100644
--- a/bog.el
+++ b/bog.el
@@ -355,16 +355,13 @@ opened if locating a citekey from context fails."
(citekey-files (bog-citekey-files citekey))
(citekey-file-names (-map 'file-name-nondirectory citekey-files))
(num-choices (length citekey-file-names)))
- (cond
- ((= 0 num-choices)
- (user-error "No file found for %s" citekey))
- ((= 1 num-choices)
- (setq citekey-file (car citekey-files)))
- (t
- (setq citekey-file
- (expand-file-name (org-icompleting-read "Select file: "
- citekey-file-names)
- bog-file-directory))))
+ (case num-choices
+ (0 (user-error "No file found for %s" citekey))
+ (1 (setq citekey-file (car citekey-files)))
+ (t (setq citekey-file (expand-file-name
+ (org-icompleting-read "Select file: "
+ citekey-file-names)
+ bog-file-directory))))
(org-open-file citekey-file)))
(defun bog-citekey-files (citekey)
@@ -397,17 +394,13 @@ If the citekey file prompt is slow to appear, consider enabling
(staged-file-names (-map 'file-name-nondirectory staged-files))
(num-choices (length staged-file-names))
staged-file)
- (cond
- ((= 0 num-choices)
- (setq staged-file (org-iread-file-name "Select file to rename: ")))
- ((= 1 num-choices)
- (setq staged-file (car staged-files)))
- (t
- (setq staged-file
- (expand-file-name
- (org-icompleting-read "Select file to rename: "
- staged-file-names)
- bog-stage-directory))))
+ (case num-choices
+ (0 (setq staged-file (org-iread-file-name "Select file to rename: ")))
+ (1 (setq staged-file (car staged-files)))
+ (t (setq staged-file (expand-file-name
+ (org-icompleting-read "Select file to rename: "
+ staged-file-names)
+ bog-stage-directory))))
(message "Renamed %s to %s" staged-file
(funcall bog-file-renaming-func staged-file citekey))))