diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-02-15 15:06:56 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-02-15 15:07:22 -0500 |
commit | 4dfcc52acdf179c3c1f80f8db9b4841999af65e1 (patch) | |
tree | 8c7cd1d246ba1c39051987a5260ab2c4b331254d | |
parent | dc26eb48626fdc60226834a573711ffbe840e31c (diff) | |
download | bog-4dfcc52acdf179c3c1f80f8db9b4841999af65e1.tar.gz |
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.
-rw-r--r-- | bog-todo.org | 3 | ||||
-rw-r--r-- | bog.el | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/bog-todo.org b/bog-todo.org index dbc7eb4..75b0af7 100644 --- a/bog-todo.org +++ b/bog-todo.org @@ -67,7 +67,8 @@ Avoid filtering all bib file names. If multiple PDFs for a citekey, complete read. -** ENH Map basename to full name for PDF rename +** DONE Map basename to full name for PDF rename + CLOSED: [2014-02-15 Sat 15:07] When more than one file in staged, completing read prompts with full paths, which is inconvenient if using default completing read function. @@ -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))) |