mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-20 15:18:33 +00:00
Protect the attachment directory from getting a final newline.
This is a first attempt to fix a strange bug reported by Bernt Hansen, where two attachment directories are created, one of them with a final newline.
This commit is contained in:
parent
1104da306a
commit
a1d457133e
|
@ -1,5 +1,11 @@
|
||||||
2008-11-05 Carsten Dominik <carsten.dominik@gmail.com>
|
2008-11-05 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
* org-attach.el (org-attach-dir): Remove duplicate ID creation
|
||||||
|
code.
|
||||||
|
|
||||||
|
* org-id.el (org-id-new): Use `org-trim' to extract the uuid from
|
||||||
|
shell output.
|
||||||
|
|
||||||
* org.el (org-link-abbrev-alist): Improve customization type.
|
* org.el (org-link-abbrev-alist): Improve customization type.
|
||||||
|
|
||||||
* org-attach.el (org-attach-expand-link, org-attach-expand): New
|
* org-attach.el (org-attach-expand-link, org-attach-expand): New
|
||||||
|
|
|
@ -156,11 +156,7 @@ the directory and the corresponding ID will be created."
|
||||||
(let ((uuid (org-id-get (point) create-if-not-exists-p)))
|
(let ((uuid (org-id-get (point) create-if-not-exists-p)))
|
||||||
(when (or uuid create-if-not-exists-p)
|
(when (or uuid create-if-not-exists-p)
|
||||||
(unless uuid
|
(unless uuid
|
||||||
(let ((uuid-string (shell-command-to-string "uuidgen")))
|
(error "ID retrieval/creation failed"))
|
||||||
(setf uuid-string
|
|
||||||
(substring uuid-string 0 (1- (length uuid-string))))
|
|
||||||
(org-entry-put (point) "ID" uuid-string)
|
|
||||||
(setf uuid uuid-string)))
|
|
||||||
(let ((attach-dir (expand-file-name
|
(let ((attach-dir (expand-file-name
|
||||||
(format "%s/%s"
|
(format "%s/%s"
|
||||||
(substring uuid 0 2)
|
(substring uuid 0 2)
|
||||||
|
|
|
@ -251,7 +251,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
|
||||||
(if (equal prefix ":") (setq prefix ""))
|
(if (equal prefix ":") (setq prefix ""))
|
||||||
(cond
|
(cond
|
||||||
((eq org-id-method 'uuidgen)
|
((eq org-id-method 'uuidgen)
|
||||||
(setq unique (substring (shell-command-to-string "uuidgen") 1 -1)))
|
(setq unique (org-trim (shell-command-to-string "uuidgen"))))
|
||||||
((eq org-id-method 'org)
|
((eq org-id-method 'org)
|
||||||
(let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
|
(let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
|
||||||
(postfix (if org-id-include-domain
|
(postfix (if org-id-include-domain
|
||||||
|
|
Loading…
Reference in a new issue