I do intend on (slowly!) improving BiwaScheme (and of course submitting pull requests to the project) to add missing functionality. I have a fork ready but haven't yet made any improvements (https://github.com/mgkennard/biwascheme).
Documentation is lacking for both BiwaScheme and what beorg offers in terms of Scheme. Both of these I hope to address.
Also over time I hope to expose things such as the date dialog (I've added this to my possible future improvements list) via Scheme. Hopefully if I can see how people are using Scheme on the forum that will provide lots of ideas for improvement.
Clock in and clock out
#+BEGIN_SRC scheme (define (clock-in) (insert ":LOGBOOK:\nCLOCK: \n:END:\n") (goto-char (- (point) (string-length "\n:END:\n"))) (insert (date->string (current-date) "[~Y-~m-~d ~a ~H:~M]")) (goto-char (+ (point) (string-length "\n:END:\n"))) ) (define (clock-out) (insert (date->string (current-date) "--[~Y-~m-~d ~a ~H:~M]")) (goto-char (point-max))) (set! editor-toolbar-items '(("icon-time" (clock-in)) ("icon-clock" (clock-out)) ("icon-left" (backward-char)) ("icon-right" (forward-char)) ("icon-list" (insert "+ ")) ("icon-change" (show-transform-commands)) ("icon-settings" (insert-code-snippet)))) #+END_SRC
Back to the "inserting some date" function.
Thanks to the date picker availability, that's just too easy now
(define (insert-some-date-with-date-picker) (date-picker (current-date) #f (lambda (removed date includes-time) (if (not removed) (insert (date->string date "[~Y-~m-~d ~a]"))))))
Increment / decrement number: (...) then I realized that ">" and "<" can be used to move cursor if nothing is selected, or increment/decrement if a number is selected. I think I will soon do some pattern matching on (region), to be able to do other stuff (cycle between TODO status, change "Thu" to "Fri", whatever).
About this one, I think rxmatch would be nice, but it doesn't look implemented in BiwaScheme now (actually, there is some code but it is commented). So that will wait :)
Date insertion, final version:
(define (insert-some-date-with-date-picker-from-selection) (let ((starting-date (if (string=? (region) "") (current-date) (parse-date (region))))) (date-picker starting-date #f (lambda (cancelled date includes-time) (if (not cancelled) (if (not includes-time) (insert (date->string date "[~Y-~m-~d ~a]")) (insert (date->string date "[~Y-~m-~d ~a ~H:~M]"))))))))
I suggest we use this topic to share the scheme code that we write in init.org to add cool stuff.
This will allow others to use it, give some new ideas, and maybe some gurus will suggest better ways to do things.
Here is what I have now:
- Inserting src_calc entry and a simple table. No rocket science here, but someday I hope I will be able to write something to parse and get the calculations done, at least for src_calc.
- Transform commands: I added bold / italic / underline. I had no luck with capitalize / titlecase, maybe not implemented in BiwaScheme.
- Increment / decrement number: I wanted that to change a date easily from today to tomorrow, etc. First I made a separate function bundled to a separate button, then I realized that ">" and "<" can be used to move cursor if nothing is selected, or increment/decrement if a number is selected. I think I will soon do some pattern matching on (region), to be able to do other stuff (cycle between TODO status, change "Thu" to "Fri", whatever).
- Insert a date, today or any day. Ok, you will tell me that the outline edit box has something like this, but only to add schedule or deadline dates at the top of comments. I want to insert any date, inactive, at any point in the text.
I started with today, and then I am quite stuck, as I don't know how to display a date choice dialog box, and as it seems that date functions such as add-duration or current-seconds, or most functions from SRFI section 19, are not implemented in BiwaScheme.