I need to prepare org files like this
* firsth things
...
* compress files
#+begin_src shell
tar cfzv {migration-date}/{client-id}from{start-date}to{finish-date}.tar.gz 1/{soc-id}/{client-id}/
#+end_src
* more things
...
And i created this elisp function in porder to replace this strings "{strings}"
(defun fullfill-client-template (start end)
"Adapt migration template in REGION START END to client."
(interactive "r")
(let ((tenant-id (read-from-minibuffer "tenant id: "))
(soc-id (read-from-minibuffer "soc id: "))
(client-id (read-from-minibuffer "client id: "))
(migration-date (read-from-minibuffer "migration date: "))
(start-date (read-from-minibuffer "start date: "))
(finish-date (read-from-minibuffer "finish date: ")))
(replace-string-in-region "{tenant-id}" tenant-id start end)
(replace-string-in-region "{soc-id}" soc-id start end)
(replace-string-in-region "{client-id}" client-id start end)
(replace-string-in-region "{migration-date}" migration-date start end)
(replace-string-in-region "{start-date}" start-date start end)
(replace-string-in-region "{finish-date}" finish-date start end)
(message (format "Migrate client: %s/%s/%s from: %s to %s at %s"
tenant-id soc-id client-id start-date finish-date migration-date))))
I get the following error:
Selecting only the section compress files
(error "End after end of buffer")
but when I use edebug the variables start and end are always the same:
Result: "1"
Result: "2"
Result: "3"
Result: "4"
Result: "5"
Result: "6"
Result: "1"
Result: 23 (#o27, #x17, ?\C-w)
Result: 178 (#o262, #xb2, ?²)
Result: 1 (#o1, #x1, ?\C-a)
Result: "2"
Result: 23 (#o27, #x17, ?\C-w)
Result: 178 (#o262, #xb2, ?²)
Result: 1 (#o1, #x1, ?\C-a)
Result: "3"
Result: 23 (#o27, #x17, ?\C-w)
Result: 178 (#o262, #xb2, ?²)
Result: 2 (#o2, #x2, ?\C-b)
Result: "4"
Result: 23 (#o27, #x17, ?\C-w)
Result: 178 (#o262, #xb2, ?²)
error: "End after end of buffer"
file-truename: End after end of buffer
shell
, notelisp
, but assuming you are not actually trying to execute the source block, that should not make any difference: running the function on the region should just replace the strings - and IME it does.