[Refactor] Use expand-file-name instead of concat where possible

This commit is contained in:
Gergely Polonkai 2019-02-19 11:03:18 +01:00
parent f05711f5bf
commit 180ae79080
1 changed files with 14 additions and 25 deletions

View File

@ -568,8 +568,7 @@ name."
(defun gpolonkai/visit-org-index () (defun gpolonkai/visit-org-index ()
"Visit the root of Org-mode notes." "Visit the root of Org-mode notes."
(interactive) (interactive)
(find-file-other-window (concat (file-name-as-directory org-directory) (find-file-other-window (expand-file-name "index.org" org-directory)))
"index.org")))
#+END_SRC #+END_SRC
** Frame manipulation ** Frame manipulation
@ -1177,7 +1176,7 @@ Because Im a sysadmin, too.
:ensure nil :ensure nil
:config :config
(run-at-time nil (* 5 60) 'recentf-save-list) (run-at-time nil (* 5 60) 'recentf-save-list)
(add-to-list 'recentf-exclude (concat user-emacs-directory "elpa"))) (add-to-list 'recentf-exclude (expand-file-name "elpa" user-emacs-directory)))
#+END_SRC #+END_SRC
** ~files~ ** ~files~
@ -1355,7 +1354,7 @@ The cookies are from the Hungarian version an ancient MS-DOS based program calle
(use-package cookie1 (use-package cookie1
:demand t :demand t
:config :config
(setq cookie-file (concat user-emacs-directory "fortune-cookies.txt")) (setq cookie-file (expand-file-name "fortune-cookies.txt" user-emacs-directory))
:bind :bind
(:map gpolonkai/pers-map (:map gpolonkai/pers-map
("k" . cookie))) ("k" . cookie)))
@ -2665,11 +2664,11 @@ This is a big one; I use a lot of customisation here.
;; Set up capture templates for blog posts and GT2 related notes ;; Set up capture templates for blog posts and GT2 related notes
(add-to-list 'org-capture-templates (add-to-list 'org-capture-templates
'("p" "Blog post" entry '("p" "Blog post" entry
(file+olp+datetree (lambda () (concat org-directory "blog.org"))) (file+olp+datetree (lambda () (expand-file-name "blog.org" org-directory)))
"* %^{Title} :blog:\n:PROPERTIES:\n:CREATED: %T\n:END:\n\n%i%?")) "* %^{Title} :blog:\n:PROPERTIES:\n:CREATED: %T\n:END:\n\n%i%?"))
(add-to-list 'org-capture-templates (add-to-list 'org-capture-templates
'("g" "GT2 note" entry '("g" "GT2 note" entry
(file+headline (lambda () (concat org-directory "gt2-notes.org")) "Captures") (file+headline (lambda () (expand-file-name "gt2-notes.org" org-directory)) "Captures")
"** %^{Title}\n:PROPERTIES:\n:CREATED: %T\n:END:\n\n%a\n\n%i%?")) "** %^{Title}\n:PROPERTIES:\n:CREATED: %T\n:END:\n\n%a\n\n%i%?"))
(add-to-list 'org-capture-templates (add-to-list 'org-capture-templates
'("c" "Item to current Clocked Task" item '("c" "Item to current Clocked Task" item
@ -2725,15 +2724,9 @@ This is a big one; I use a lot of customisation here.
:after :after
org org
:config :config
(setq org-ref-bibliography-notes (concat user-documents-directory (setq org-ref-bibliography-notes (expand-file-name "bibliography-notes" org-directory)
(convert-standard-filename org-ref-default-bibliography '((expadn-file-name "references.bib" org-directory))
"/orgmode/bibliography-notes")) org-ref-pdf-directory (expand-file-name "bibtex-pdfs" org-directory)))
org-ref-default-bibliography '((concat user-documents-directory
(convert-standard-filename
"/orgmode/references.bib")))
org-ref-pdf-directory (concat user-documents-directory
(convert-standard-filename
"/orgmode/bibtex-pdfs"))))
#+END_SRC #+END_SRC
And set up a function to open PDF files with the system pdf viewer, using ~xdg-open~. And set up a function to open PDF files with the system pdf viewer, using ~xdg-open~.
@ -3073,15 +3066,11 @@ See previous versions of the current file.
:after :after
org org
:config :config
(setq bibtex-completion-bibliography (concat user-documents-directory (setq bibtex-completion-bibliography (expand-file-name "references.bib" org-directory)
(convert-standard-filename bibtex-completion-library-path (expand-file-name "bibtex-pdfs" org-directory)
"/orgmode/references.bib")) bibtex-completion-notes-path (expand-file-name
bibtex-completion-library-path (concat user-documents-directory (convert-standard-filename "bibliography/helm-bibtex-notes")
(convert-standard-filename org-directory)
"/orgmode/bibtex-pdfs"))
bibtex-completion-notes-path (concat user-documents-directory
(convert-standard-filename
"/orgmode/bibliography/helm-bibtex-notes"))
bibtex-completion-pdf-open-function 'org-open-file)) bibtex-completion-pdf-open-function 'org-open-file))
#+END_SRC #+END_SRC
@ -3208,7 +3197,7 @@ directory. It is available from [[http://plantuml.com/download][here]].
;; Make sure we have a download location even if XDG is not working ;; Make sure we have a download location even if XDG is not working
(cond (cond
((xdg-user-dir "DOWNLOAD") ((xdg-user-dir "DOWNLOAD")
(concat (xdg-user-dir "DOWNLOAD") "/plantuml.jar")) (expand-file-name "plantuml.jar" (xdg-user-dir "DOWNLOAD")))
(t (t
"~/Downloads/plantuml.jar")))) "~/Downloads/plantuml.jar"))))
(defvaralias 'org-plantuml-jar-path 'plantuml-jar-path) (defvaralias 'org-plantuml-jar-path 'plantuml-jar-path)