From 4dfcc52acdf179c3c1f80f8db9b4841999af65e1 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 15 Feb 2014 15:06:56 -0500 Subject: ENH: Remove path from choices when renaming PDF Only files in `bog-stage-directory' are options, so the only relevant information to present is the file name. --- bog.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bog.el') diff --git a/bog.el b/bog.el index 857f747..00354ff 100644 --- a/bog.el +++ b/bog.el @@ -254,9 +254,10 @@ The citekey will be taken from the text under point if it matches (defun bog-rename-staged-pdf (citekey) (let* ((pdf-file (bog-citekey-as-pdf citekey)) - (choices + (staged-pdfs (file-expand-wildcards (concat (file-name-as-directory bog-stage-directory) "*.pdf"))) + (choices (-map 'file-name-nondirectory staged-pdfs)) (num-choices (length choices)) staged-pdf) (cond @@ -266,8 +267,10 @@ The citekey will be taken from the text under point if it matches ((= 1 num-choices) (setq staged-pdf (car choices))) (t - (setq staged-pdf (funcall bog-completing-read - "Select PDF file to rename: " choices)))) + (setq staged-pdf + (expand-file-name (funcall bog-completing-read + "Select PDF file to rename: " choices) + bog-stage-directory)))) (rename-file staged-pdf pdf-file) (message "Renamed %s to %s" staged-pdf pdf-file))) -- cgit v1.2.3