[O] Setup Org-mode to write diary.

2014-07-25 Thread stardiviner
I want to know how to configure Org-mode to write diary with a easy way.
I hope someone can provide his way.

Here is what I think what Org-mode write diary should have.

- [ ] *open/create* a buffer to write current day's diary quickly.
- [ ] *navigate* diary entry like viewing day entries in Calendar.
- [ ] *manage* diary files with some kind of style like (date, folder, etc).
- [ ] *search* diary content.

If you have some hints, welcome to tell me, thanks in advance.



Re: [O] how to enter ==

2014-07-25 Thread stardiviner
You should use Org-mode Symbols.

~\ equal~ (without space hehind ~\~). If you have string behind it, you
should append ~{}~, like this: ~\ equal{}test~ (without space too).


Rustom Mody  writes:

> If I enter code inline that has an == that is taken as an escape for code
> So how to enter '==' literally




Re: [O] How to setup this custom function with Org-mode functions? (org-habit)

2014-07-26 Thread stardiviner

This is what I want, thanks very much.

Marcin Borkowski  writes:

> Dnia 2014-03-28, o godz. 16:09:01
> stardiviner  napisał(a):
>
>> 
>> I want to create a custom keybinding to custom function which will
>> execute all necessary steps for creating an org habit.
>> The bellowing is my code, but seems it doesn't work at all.
>> I don't know how to write this custom function actually. (I just put
>> some keybindings corresponding functions in the custom function
>> body.) And some org-mode functions are interactively.
>> 
>> #+BEGIN_SRC emacs-lisp
>> ;; TODO: create an key binding for all necessary steps for create a
>> habit. (reference in Org-mode.org file) (defun org-habit-apply ()
>>   "Apply org-habit on this task."
>>   (interactive)
>>   (lambda ()
>> (org-todo "HABIT")
>> (org-insert-property-drawer); TODO: :STYLE: habit (value)
>> (org-schedule)))
>> 
>> (define-key org-mode-map (kbd "C-c C-x h") 'org-habit-apply)
>> #+END_SRC
>> 
>> Does anybody can help me this? and thanks in advance.
>
> Is this of any help?
>
> http://mbork.pl/2013-09-23_Automatic_insertion_of_habit_templates_%28en%29
>
> Hth,




[O] How to make Org-mode support file completion for file+sys: prefix?

2014-07-29 Thread stardiviner

I found Org-mode support file completion in `file:` prefix. But not `file+sys:`,
Why?

- [ ] If it is not enabled by default. Then how to enable it?
- [ ] If Org-mode does not support it, then how can I enable it?

Why do I need it?
When I add a link to a PDF file, I need to use filename completion, so I have to
use `file:` completion, then use =[C-c C-l]= to edit the link again to add 
`+sys`
for `file:`, this is painful.



[O] make slim auto-complete work in Org-mode (delete some ac-source in Org-mode).

2014-07-29 Thread stardiviner
I setup default =ac-sources= for auto-complete like this:

#+BEGIN_SRC emacs-lisp
(setq-default ac-sources
  '(ac-source-yasnippet
ac-source-abbrev
ac-source-filename
ac-source-files-in-current-dir
ac-source-dictionary
ac-source-words-in-same-mode-buffers
))
#+END_SRC

And I found =ac-source-dictionary= and =ac-source-words-in-same-mode-buffers= is
heavy for Org-mode, So I try to remove them only in Org-mode.

This is my try:

#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook
  (lambda ()
;; use `delq' in a loop.
(mapc (lambda (x) (setq-local ac-sources (delq x ac-sources)))
  '(ac-source-dictionary 
ac-source-words-in-same-mode-buffers
#+END_SRC

But this code will use =delq= to delete *global default* =ac-sources= too. But 
I only
want to delete in Org-mode.
So is there some other ways to do it?



Re: [O] How to get notify from Org-mode's clock, timestamps, and appointments etc with in modeline or with notify-send etc programs ?

2013-11-20 Thread stardiviner
Excerpts from [ Alexander Baier ]  On [2013-11-20 11:49:48 +0100]:

> chris  writes:
> 
> 
> You might want to take a look at this library:
> https://github.com/djcb/sauron
> 
> 
> Regards,
>   Alex
> 

This is really great. Thanks very much.

-- 
[ stardiviner ] Kill the world if you want. That's it.
IRC(freenode): stardiviner \\ Twitter:  @numbchild \\


signature.asc
Description: Digital signature


[O] Org-mode Babel does not show syntax highlight when open with another mode

2015-10-05 Thread stardiviner

I try to configure Org-mode to open ruby source code block with `enh-ruby-mode`.

configuration as following:

#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'enh-ruby-mode
  (add-to-list 'org-src-lang-modes '("ruby" . enh-ruby)))
#+END_SRC

This will open code block in `enh-ruby-mode` when you edit with [C-c '].

You can see the syntax highlighting failed result screenshot at here:

http://emacs.stackexchange.com/questions/17042/org-mode-babel-failed-syntax-highlight-after-change-org-src-lang-modes

I hope to keep the syntax highlight, (If can use enh-ruby-mode syntax highlight
will be better).



[O] Org-mode Babel does not show syntax highlight when open with another mode

2015-10-05 Thread stardiviner

I try to configure Org-mode to open ruby source code block with `enh-ruby-mode`.

configuration as following:

#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'enh-ruby-mode
  (add-to-list 'org-src-lang-modes '("ruby" . enh-ruby)))
#+END_SRC

This will open code block in `enh-ruby-mode` when you edit with [C-c '].

You can see the syntax highlighting failed result screenshot at here:

http://emacs.stackexchange.com/questions/17042/org-mode-babel-failed-syntax-highlight-after-change-org-src-lang-modes

I hope to keep the syntax highlight, (If can use enh-ruby-mode syntax highlight
will be better).




[O] some org-contacts icons property value questions

2015-10-17 Thread stardiviner
How to edit the org-contacts property ~:ICON~ value?

I tried use `filename.jpg` which file is in same directory with contacts file.
And what kind of image size should I use for icon?

Can I use a custom function to show this icon?
Can I show multiple icons for one contact?



[O] a patch to ob-lisp.el

2016-03-27 Thread stardiviner

Here is my repo, and I also created an recipe on MELPA.

- http://gituhb.com/stardiviner/ob-lisp
- https://github.com/melpa/melpa/pull/3682

I hope to merge this patch to Org-mode `ob-lisp.el`.

1c1
< ;;; ob-lisp.el --- org-babel functions for common lisp evaluation with SLY or SLIME.
---
> ;;; ob-lisp.el --- org-babel functions for common lisp evaluation
3c3
< ;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
---
> ;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
5,11c5,9
< ;; Authors: stardiviner 
< ;; Maintainer: stardiviner 
< ;; Keywords: org babel lisp sly slime
< ;; URL: https://github.com/stardiviner/ob-lisp
< ;; Created: 1th March 2016
< ;; Version: 0.0.1
< ;; Package-Requires: ((org "8"))
---
> ;; Authors: Joel Boehland
> ;;	 Eric Schulte
> ;;	 David T. O'Toole 
> ;; Keywords: literate programming, reproducible research
> ;; Homepage: http://orgmode.org
30c28
< ;;; Support for evaluating Common Lisp code, relies on SLY or SLIME for all eval.
---
> ;;; support for evaluating common lisp code, relies on slime for all eval
34,37c32,33
< ;; Requires SLY (Sylvester the Cat's Common Lisp IDE) and SLIME
< ;; See:
< ;; - https://github.com/capitaomorte/sly
< ;; - http://common-lisp.net/project/slime/
---
> ;; Requires SLIME (Superior Lisp Interaction Mode for Emacs.)
> ;; See http://common-lisp.net/project/slime/
42,50c38
< (defcustom org-babel-lisp-eval-fn "sly-eval"
<   "The function to be called to evaluate code on the Lisp side."
<   :group 'org-babel
<   :version "24.1"
<   :options '("sly-eval" "slime-eval")
<   :type 'stringp)
< 
< 
< ;; (declare-function sly-eval "ext:sly" (sexp &optional package))
---
> (declare-function slime-eval "ext:slime" (sexp &optional package))
70,80c58,68
<  (result-params (cdr (assoc :result-params params)))
<  (print-level nil) (print-length nil)
<  (body (org-babel-trim
< (if (> (length vars) 0)
< (concat "(let ("
< (mapconcat
<  (lambda (var)
<(format "(%S (quote %S))" (car var) (cdr var)))
<  vars "\n  ")
< ")\n" body ")")
<   body
---
> 	 (result-params (cdr (assoc :result-params params)))
> 	 (print-level nil) (print-length nil)
> 	 (body (org-babel-trim
> 		(if (> (length vars) 0)
> 		(concat "(let ("
> 			(mapconcat
> 			 (lambda (var)
> 			   (format "(%S (quote %S))" (car var) (cdr var)))
> 			 vars "\n  ")
> 			")\n" body ")")
> 		  body
82,83c70,71
< (member "pp" result-params))
< (format "(pprint %s)" body)
---
> 	(member "pp" result-params))
> 	(format "(pprint %s)" body)
86d73
< ;;;###autoload
88,91c75,76
<   "Execute a block `BODY' with `PARAMS' of Common Lisp code with Babel."
<   (pcase org-babel-lisp-eval-fn
< ("slime-eval" (require 'slime))
< ("sly-eval" (require 'sly)))
---
>   "Execute a block of Common Lisp code with Babel."
>   (require 'slime)
94,108c79,92
<   (funcall (if (member "output" (cdr (assoc :result-params params)))
<#'car #'cadr)
<(with-temp-buffer
<  (insert (org-babel-expand-body:lisp body params))
<  (funcall org-babel-lisp-eval-fn
<   `(swank:eval-and-grab-output
< ,(let ((dir (if (assoc :dir params)
< (cdr (assoc :dir params))
<   default-directory)))
<(format
< (if dir (format org-babel-lisp-dir-fmt dir)
<   "(progn %s\n)")
< (buffer-substring-no-properties
<  (point-min) (point-max)
<   (cdr (assoc :package params)))
---
> 	  (funcall (if (member "output" (cdr (assoc :result-params params)))
> 		   #'car #'cadr)
> 		   (with-temp-buffer
> 		 (insert (org-babel-expand-body:lisp body params))
> 		 (slime-eval `(swank:eval-and-grab-output
>    ,(let ((dir (if (assoc :dir params)
> 		   (cdr (assoc :dir params))
> 		 default-directory)))
>   (format
>    (if dir (format org-babel-lisp-dir-fmt dir)
> 	 "(progn %s\n)")
>    (buffer-substring-no-properties
> 	(point-min) (point-max)
>  (cdr (assoc :package params)))
115c99
< (cdr (assoc :colnames params)))
---
> 			(cdr (assoc :colnames params)))
117c101
< (cdr (assoc :rownames params)
---
> 			(cdr (assoc :rownames params)


signature.asc
Description: PGP signature


Re: [O] first step of newbe: *TODO

2013-12-14 Thread stardiviner
You can set global todo keywords with:

(setq org-todo-keywords
  '((sequence "TODO(t@/!)" "|" "DONE(d@/!)")))

Here @ will add timestamp, and ! will prompt for input.

John Kitchin writes:

> you need to put this in your init.el (or other configuration file) I think:
>
> (setq org-log-done 'time)
>
> or add this to the top of the org-file
> #+STARTUP: logdone
>
>
>
> John
>
> ---
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Fri, Dec 13, 2013 at 12:11 PM, Renato  wrote:
>
>> Hi,
>> as I already told, I'm a really newbe (to org-mode, as well as emacs)
>> I'm starting from the very beginning:
>> following the Doc (here: http://orgmode.org/worg/org-
>> tutorials/orgtutorial_dto.html)
>> I wrote my firs TODO list.
>> But when I press C-c C-t over a TODO element, it appear DONE, write near
>> the task, but not the CLOSED [time...] on the line after that.
>>
>> What I have to do?
>>
>> TIA
>>
>> Renato
>>
>> ps
>> sorry, for the stupid question, but it is really my very firs experimet :-(
>>
>>


-- 
[ stardiviner ] Kill the world if you want. That's it.
IRC(freenode): stardiviner \ Twitter:  @numbchild \



[O] How to setup this custom function with Org-mode functions? (org-habit)

2014-03-28 Thread stardiviner

I want to create a custom keybinding to custom function which will execute all
necessary steps for creating an org habit.
The bellowing is my code, but seems it doesn't work at all.
I don't know how to write this custom function actually. (I just put some 
keybindings
corresponding functions in the custom function body.) And some org-mode
functions are interactively.

#+BEGIN_SRC emacs-lisp
;; TODO: create an key binding for all necessary steps for create a habit. 
(reference in Org-mode.org file)
(defun org-habit-apply ()
  "Apply org-habit on this task."
  (interactive)
  (lambda ()
(org-todo "HABIT")
(org-insert-property-drawer); TODO: :STYLE: habit (value)
(org-schedule)))

(define-key org-mode-map (kbd "C-c C-x h") 'org-habit-apply)
#+END_SRC

Does anybody can help me this? and thanks in advance.

-- 
[ stardiviner ] I want to save myself from this world.
IRC(freenode): stardiviner \ Google+:  numbchild \
http://about.me/Evanescence/




Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-09-23 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> `org-insert-link` should be smart on decide whether current buffer is the 
>> same buffer with `org-store-link` source buffer, if yes, use [[(set the temp 
>> buffer to unibyte)]]. If no, use:
>>
>> [[file:~/Org/elquery.org::(set%20the%20temp%20buffer%20to%20unibyte)][(set 
>> the temp buffer to unibyte)]]
>>
>> WDYT?
>
> It sounds like a good idea. Do you want to implement it?
>
> Regards,


I take a look at the org.el code of functions `org-store-link`, 
`org-insert-link`, they can't inherit the original buffer file name 
`buffer-file-name`. So can't use `org-link-file-path-type 'adaptive` case. But 
I found `org-insert-link` function definition has this snippet of code:

```
(defun org-insert-link ...
...

(cond
   ((or (eq org-link-file-path-type 'absolute)
(equal complete-file '(16)))
(setq path (abbreviate-file-name (expand-file-name path
   ((eq org-link-file-path-type 'noabbrev)
(setq path (expand-file-name path)))
   ((eq org-link-file-path-type 'relative)
(setq path (file-relative-name path)))
  
 ;; I tried to add this, but failed. because `coderef` is executed in 
`org-edit-src-code` which invokes `org-src--edit-element`, it create a 
dedicated buffer which does not have `buffer-file-name`. I don't know how to 
archive what I want now.
   ;; ((eq org-link-file-path-type 'adaptive)
   ;;  (setq path (file-relative-name path)))
 
   (t
(save-match-data
  (if (string-match (concat "^" (regexp-quote
 (expand-file-name
  (file-name-as-directory
   default-directory
(expand-file-name path))
  ;; We are linking a file with relative path name.
  (setq path (substring (expand-file-name path)
(match-end 0)))
(setq path (abbreviate-file-name (expand-file-name path)))

.
```

I don't know which function should I change to let `org-insert-link` and 
`org-store-link` can inherit the original buffer filename info. Because 
'adaptive org-link-file-path-type need compare two pathes like this:

```
(let ((coderef-path PATH) ; TODO:
(org-unbracket-string "<" ">" (
   (org-link-prettify (first 
(reverse org-stored-links)

(same-directory? (not (string=
   (expand-file-name default-directory)
   (expand-file-name
(file-name-directory (or coderef-path 
"")))
(if (and default-directory same-directory?)
(if (eq org-link-file-path-type 'adaptive)
(format "[[file:%s::%s][%s]]"
(file-relative-name
 (expand-file-name (or coderef-path "")
   default-directory)
 (file-name-directory buffer-file-name))
label ; (format coderef-format label)
label ; (format coderef-format label)
)
  (expand-file-name coderef-path default-directory
```

This is a snippet of code I adapted from my original commit:

"49a8de4ffd2d0fc50c975ff3edac15d2bb37a809"

Can you help me on this? Thanks :) :)

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] pcomplete error inside of headline asterisks when typing asterisk

2018-10-10 Thread stardiviner


When I create a new headline with =[Alt-Enter]= Under a headline. It looks like 
this:

#+begin_src org
,** headline 1
,** headline 2
#+end_src

Then I move point between two asterisks of headline 2. Then I type * again. It 
report
following error:

#+begin_example
Debugger entered--Lisp error: (args-out-of-range "" 1 nil)
  substring("" 1)
  (pcomplete--here (function (lambda nil (save-excursion (goto-char 
(point-min)) (let (tbl) (let ((case-fold-search nil)) (while (re-search-forward 
org-todo-line-regexp nil t) (setq tbl (cons (org-make-org-heading-search-string 
(match-string-no-properties 3)) tbl (pcomplete-uniquify-list tbl) 
(substring pcomplete-stub 1) nil nil)
  (while (pcomplete--here (function (lambda nil (save-excursion (goto-char 
(point-min)) (let (tbl) (let ((case-fold-search nil)) (while (re-search-forward 
org-todo-line-regexp nil t) (setq tbl (cons (org-make-org-heading-search-string 
(match-string-no-properties 3)) tbl (pcomplete-uniquify-list tbl) 
(substring pcomplete-stub 1) nil nil))
  pcomplete/org-mode/searchhead()
  pcomplete-completions()
  pcomplete-completions-at-point()
  completion--capf-wrapper(pcomplete-completions-at-point optimist)
  run-hook-wrapped(completion--capf-wrapper pcomplete-completions-at-point 
optimist)
  company--capf-data-real()
  company--capf-data()
  company-capf(prefix)
  apply(company-capf prefix)
  company-call-backend-raw(prefix)
  apply(company-call-backend-raw prefix)
  company--force-sync(company-call-backend-raw (prefix) company-capf)
  company-call-backend(prefix)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(# # 182 2857)
  apply(company-idle-begin (# # 182 
2857))
  timer-event-handler([t 23486 42991 304203 nil company-idle-begin (# # 182 2857) nil 151000])
#+end_example

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-14 Thread stardiviner
When I open a big Org file which contains many different languages source 
blocks. And when the Org file buffer is fontified when option 
`org-src-fontify-natively` is enabled. Org will try to load those major modes. 
Including major-mode-hook like "clojure-mode-hook", "emacs-lisp-mode-hook", 
"python-mode-hook" etc. But for fontify the source blocks, I don't think it is 
necessary to load those major-mode-hooks. Also they are slow. Like in my case, 
most of time is used for loading source blocks major-mode-hooks.

- clojure-mode-hook has CIDER etc
- python-mode-hook has elpy etc
- emacs-lisp-mode-hook has some utilities.

Temporary disable those major-mode-hooks by set-local them to nil is a good 
solution to speed-up Org.

WDYT? If I'm wrong, please give out some thought from you. Thanks.

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-17 Thread stardiviner

Nicolas Goaziou  writes:

> Some major modes may use major mode hooks to finish setting up their
> fontification process, who knows.
>
> In any case, it could be worth trying it. Do you want to provide a patch
> for that?
>
> Regards,

I dived into the source code of two functions which are related to
defcustom variable ~org-src-fontify-natively~.

Here is my try:

#+begin_src diff
modified   lisp/org-src.el
@@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
(erase-buffer)
;; Add string and a final space to ensure property change.
(insert string " "))
- (unless (eq major-mode lang-mode) (funcall lang-mode))
+ (unless (eq major-mode lang-mode)
+   (message "%s enabled in source block" lang-mode)
+   ;; (make-local-variable (intern (format "%s-hook" lang-mode)))
+   ;; (set (intern (format "%s-hook" lang-mode)) nil)
+   (message "%s is %s"
+(intern (format "%s-hook" lang-mode))
+(symbol-value (intern (format "%s-hook" lang-mode
+   (funcall lang-mode))
  (org-font-lock-ensure)
  (let ((pos (point-min)) next)
(while (setq next (next-property-change pos))
#+end_src

But it seems does not work as I expected.

Can't find out which real function is invoked when fontify every source blocks.

>From cd43cd7c4c4e98d2b62af84a0729f82fb361c25f Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 18 Oct 2018 12:55:30 +0800
Subject: [PATCH] Set all lang-mode-hook to nil to speedup source blocks
 fontify.

---
 lisp/org-src.el | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9c462b7e7..271ca82b9 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
 	(erase-buffer)
 	;; Add string and a final space to ensure property change.
 	(insert string " "))
-	  (unless (eq major-mode lang-mode) (funcall lang-mode))
+	  (unless (eq major-mode lang-mode)
+	(message "%s enabled in source block" lang-mode)
+	;; (make-local-variable (intern (format "%s-hook" lang-mode)))
+	;; (set (intern (format "%s-hook" lang-mode)) nil)
+	(message "%s is %s"
+		 (intern (format "%s-hook" lang-mode))
+		 (symbol-value (intern (format "%s-hook" lang-mode
+	(funcall lang-mode))
 	  (org-font-lock-ensure)
 	  (let ((pos (point-min)) next)
 	(while (setq next (next-property-change pos))
-- 
2.19.1


--
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


Re: [O] How to make agenda generation faster

2018-10-18 Thread stardiviner


>> However, before it could be suitable as a possible replacement, it will
>> likely require more optimization.  Some queries, especially more complex
>> ones, are slower than the equivalent searches and agendas in the current
>> Org Agenda code.  This is because of the way the queries run predicates
>> on each heading.  Despite the current Org Agenda code's complexity, it
>> is well optimized and hard to beat.
>
> Are you saying that queries are turned into regexp searches within Org
> files? If so, I don't think they should.
>
> Queries should only operate on the output of the data extraction,
> possibly a list of defstructs. I.e., you first extract all meaningful
> data from the document (during idle time, with cache, or whatever
> optimization would be chosen), store it in an appropriate format, then
> query it.
>

I think the same way. In some language library like Clojure's enlive
handle the HTML string the same way.

--
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-18 Thread stardiviner


Nicolas Goaziou  writes:

>
> Did you try to set the hook to a different value before (funcall lang-mode)?
>

Yes, like I said in previous messages, I want to make lang-mode-hook empty. It 
tested a few times, with restarting Emacs (loading a refresh Org Mode). It 
failed to fontify source blocks.

Reports error:

Failed to fontify source block.

I can see all source blocks are not fontified. Until I manually load the mode 
with [M-x load-library RET clojure-mode RET]. Then I reopen the Org file, the 
clojure source blocks are fontified.

Also I improved my code:

#+begin_src diff
modified   lisp/org-src.el
@@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
(erase-buffer)
;; Add string and a final space to ensure property change.
(insert string " "))
- (unless (eq major-mode lang-mode) (funcall lang-mode))
+ (unless (eq major-mode lang-mode)
+   ;; FIXME: Org mode fontification error in # at 203
+   ;; (let (hook (intern (format "%s-hook" lang-mode)))
+   ;;   (message "%s enabled in source block" lang-mode)
+   ;;   (make-local-variable hook)
+   ;;   (set hook nil)
+   ;;   (message "%s is %s" hook (symbol-value hook)))
+   (funcall lang-mode))
  (org-font-lock-ensure)
  (let ((pos (point-min)) next)
(while (setq next (next-property-change pos))
#+end_src

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] (no subject)

2018-10-20 Thread stardiviner
Org source block header argument :var does not support quoted string with space 
separator like bellowing example:

For example

 encrypt text -- ~<<< [TEXT]~

#+NAME: base64 encrypt text
#+begin_src sh
base64 <<< "stardiviner "
#+end_src

#+RESULTS: base64 encrypt text
: c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==

 decrypt text -- ~-d~

#+begin_src sh :var encrypted="base64 encrypt text"
# base64 -d <<< c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==
base64 -d <<< $encrypted
#+end_src

If I use #+NAME: base64-encrypt-text and :var encrypted=base64-encrypt-text, 
then it works fine.

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] Org source block header argument :var does not support space separated string

2018-10-20 Thread stardiviner


Org source block header argument :var does not support quoted string with space 
separator like bellowing example:

For example

 encrypt text -- ~<<< [TEXT]~

#+NAME: base64 encrypt text
#+begin_src sh
base64 <<< "stardiviner "
#+end_src

#+RESULTS: base64 encrypt text
: c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==

 decrypt text -- ~-d~

#+begin_src sh :var encrypted="base64 encrypt text"
# base64 -d <<< c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==
base64 -d <<< $encrypted
#+end_src

If I use #+NAME: base64-encrypt-text and :var encrypted=base64-encrypt-text, 
then it works fine.

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Org source block header argument :var does not support space separated string

2018-10-21 Thread stardiviner


Nicolas Goaziou  writes:

> Anyway, I tried the following block:
>
> #+begin_src emacs-lisp :var encrypted="base64 encrypt text"
> encrypted
> #+end_src
>
> and the output is
>
> #+results:
> : base64 encrypt text
>
> which means there doesn't seem to be a problem with strings within
> quotes.
>
> Regards,

Oops, I misunderstand the :var variable="literal quoted string".
I want to reference the named source's result in variable.

Like:

 encrypt text -- ~<<< [TEXT]~

#+NAME: base64 encrypt text
#+begin_src sh
base64 <<< "stardiviner "
#+end_src

#+RESULTS: base64 encrypt text
: c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==

 decrypt text -- ~-d~

#+begin_src sh :var encrypted=
# base64 -d <<< c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==
# base64 -d <<< $encrypted
echo $encrypted
#+end_src

#+RESULTS[<2018-10-20 16:46:10> 6e5d3875d0928eb95ec1356661f965bdf4882244]:

I can use #+NAME: base64-encrypt-text for first source block, and :var 
encrypted=base64-encrypt-text for second source block. So it can work. But is 
it possible to allow space in source block name and make it still can be 
referenced? Like quote it with <> around the name as my upper example?

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Org source block header argument :var does not support space separated string

2018-10-23 Thread stardiviner




Berry, Charles  writes:
>
> This works 
>
> #+begin_src sh :var encrypted=(org-babel-ref-resolve "base64 encrypt text()")
> echo $encrypted
> #+end_src
>
> You might write a wrapper, so something like (quote-ref "base64 encrypt 
> text")will handle it.
>

Thanks very much! this solved my problem.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] electric-pair, autopair, smartparens, etc in org-mode

2018-10-23 Thread stardiviner


Roland Everaert  writes:

> Hi,
>
> I use the following configuration:
>
>  parenthèses, accolades et brackets ;;
> (setq skeleton-pair t)
> (global-set-key "[" 'skeleton-pair-insert-maybe)
> (global-set-key "{" 'skeleton-pair-insert-maybe)
> (global-set-key "(" 'skeleton-pair-insert-maybe)
> (global-set-key "\"" 'skeleton-pair-insert-maybe)
> (global-set-key "'" 'skeleton-pair-insert-maybe)
>
> This will only close the defined characters.
>
>
> Hope this will help.
>
> Roland.
>

This is really helpful for me, I use smartparens before, but it is a little 
heavy. So I disabled it. I found your solution is simple and fast. I modified a 
little:

#+begin_src emacs-lisp
(require 'skeleton)
(setq skeleton-pair t)

(define-key org-mode-map (kbd "~") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "=") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "*") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "+") 'skeleton-pair-insert-maybe)

(define-key org-mode-map (kbd "[") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "{") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "(") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "\"") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "'") 'skeleton-pair-insert-maybe)
#+end_src

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [PATCH] migrate ob-clojure initiate session code from ob-clojure-literate.el into ob-clojure.el

2018-10-23 Thread stardiviner

Nicolas Goaziou  writes:

Hi, sorry for late response, because I'm a little lazy on give effort on
review my patch and improve it again. But now I finished it. Actually I
corrected my patch as soon as you replied email with mentioned. Today I
pick up this task again, and add a new improve which support CIDER new
API which using sesman to manage REPL sessions.

>
> Would it make sense to add a few tests for this?
>
> Regards,

It is hard for me to write tests for CIDER session. It has some kind of 
interactive and don't know how to verify it.

>From f495c5b4e65fd8c6a64e8619d974d6eb051fb1f7 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 19 Apr 2018 18:16:27 +0800
Subject: [PATCH 1/2] ob-clojure.el: Support `org-babel-initiate-session' to
 initialize.

* ob-clojure.el (org-babel-clojure-initiate-session): Initialize session
for src block.
(org-babel-prep-session:clojure): Prepare Clojure session.
(org-babel-clojure-var-to-clojure): Convert header argument :var into
clojure variables definitions.
(org-babel-variable-assignments:clojure): Support assign variables when
initialize session.
---
 contrib/lisp/ob-clojure-literate.el | 56 -
 lisp/ob-clojure.el  | 55 +
 testing/lisp/test-ob-clojure.el | 77 +
 3 files changed, 132 insertions(+), 56 deletions(-)
 create mode 100644 testing/lisp/test-ob-clojure.el

diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el
index 4c4d38a0f..b1cc386ee 100644
--- a/contrib/lisp/ob-clojure-literate.el
+++ b/contrib/lisp/ob-clojure-literate.el
@@ -184,62 +184,6 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
  (lambda (cons) (if (eq (car cons) :session) t cons))
  org-babel-default-header-args:clojure)
 
-;;; Support `org-babel-initiate-session' / [C-c C-v z] to initialize Clojure session.
-
-(defun org-babel-clojure-initiate-session (&optional session _params)
-  "Initiate a session named SESSION according to PARAMS."
-  (when (and session (not (string= session "none")))
-(save-window-excursion
-  (unless (org-babel-comint-buffer-livep session)
-;; CIDER jack-in to the Clojure project directory.
-(cond
- ((eq org-babel-clojure-backend 'cider)
-  (require 'cider)
-  (let ((session-buffer (save-window-excursion
-  (cider-jack-in t)
-  (current-buffer
-(if (org-babel-comint-buffer-livep session-buffer)
-(progn (sit-for .25) session-buffer
- ((eq org-babel-clojure-backend 'slime)
-  (error "Session evaluation with SLIME is not supported"))
- (t
-  (error "Session initiate failed")))
-)
-  (get-buffer session)
-  )))
-
-(defun org-babel-prep-session:clojure (session params)
-  "Prepare SESSION according to the header arguments specified in PARAMS."
-  (let* ((session (org-babel-clojure-initiate-session session))
- (var-lines (org-babel-variable-assignments:clojure params)))
-(when session
-  (org-babel-comint-in-buffer session
-(mapc (lambda (var)
-(insert var) (comint-send-input nil t)
-		(org-babel-comint-wait-for-output session)
-		(sit-for .1) (goto-char (point-max))) var-lines)))
-session))
-
-(defun org-babel-clojure-var-to-clojure (var)
-  "Convert src block's `VAR' to Clojure variable."
-  (if (listp var)
-  (replace-regexp-in-string "(" "'(" var)
-(cond
- ((stringp var)
-  ;; wrap org-babel passed in header argument value with quote in Clojure.
-  (format "\"%s\"" var))
- (t
-  (format "%s" var
-  )
-
-(defun org-babel-variable-assignments:clojure (params)
-  "Return a list of Clojure statements assigning the block's variables in `PARAMS'."
-  (mapcar
-   (lambda (pair)
- (format "(def %s %s)"
- (car pair)
- (org-babel-clojure-var-to-clojure (cdr pair
-   (org-babel--get-vars params)))
 
 ;;; Support header arguments  :results graphics :file "image.png" by inject Clojure code.
 (defun ob-clojure-literate-inject-code (args)
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index d5b918b01..048ba3735 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -43,6 +43,7 @@
 (require 'ob)
 (require 'org-macs)
 
+(declare-function cider-jack-in "ext:cider" (&optional prompt-project cljs-too))
 (declare-function cider-current-connection "ext:cider-client" (&optional type))
 (declare-function cider-current-ns "ext:cider-client" ())
 (declare-function nrepl--merge "ext:nrepl-client" (dict1 dict2))
@

Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-10-23 Thread stardiviner

Nicolas Goaziou  writes:

>>  ;; I tried to add this, but failed. because `coderef` is executed in 
>> `org-edit-src-code` which invokes `org-src--edit-element`, it create a 
>> dedicated buffer which does not have `buffer-file-name`. I don't know how to 
>> archive what I want now.
>> ;; ((eq org-link-file-path-type 'adaptive)
>
> In "org-src.el", we create local variables to store information from
> original buffer. See, e.g., `org-src--src-type' or `org-src--tab-width'.
> Anyway, see my first question.

Thanks for this hint, I added a new entry in org-src--babel-info list to
pass the original parent file path.

>From 6e8469545185a41d22b8046ebb367c3c742f0ff4 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Wed, 24 Oct 2018 10:45:40 +0800
Subject: [PATCH] org.el: fix org-coderef does not support adaptive file path
 link type.

* org.el (org-insert-link): support option org-link-file-path-type
  'adaptive value.
* ob-core.el (org-babel-get-src-block-info): add an new entry into src
  block info list to pass parent file path.
---
 lisp/ob-core.el | 5 +++--
 lisp/org.el | 9 ++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 42360d618..73117f1a7 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -578,7 +578,7 @@ object instead.
 Return nil if point is not on a source block.  Otherwise, return
 a list with the following pattern:
 
-  (language body arguments switches name start coderef)"
+  (language body arguments switches name start coderef parent-file-path)"
   (let* ((datum (or datum (org-element-context)))
 	 (type (org-element-type datum))
 	 (inline (eq type 'inline-src-block)))
@@ -609,7 +609,8 @@ a list with the following pattern:
 	   name
 	   (org-element-property (if inline :begin :post-affiliated)
  datum)
-	   (and (not inline) (org-src-coderef-format datum)
+	   (and (not inline) (org-src-coderef-format datum))
+	   buffer-file-name)))
 	(unless light
 	  (setf (nth 2 info) (org-babel-process-params (nth 2 info
 	(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
diff --git a/lisp/org.el b/lisp/org.el
index 0b5e8d739..37524bce0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9249,13 +9249,14 @@ non-nil."
 		(interactive?
 		 (let ((label (read-string "Code line label: ")))
 		   (end-of-line)
-		   (setq link (format coderef-format label))
 		   (let ((gc (- 79 (length link
 		 (if (< (current-column) gc)
 			 (org-move-to-column gc t)
 		   (insert " ")))
-		   (insert link)
-		   (setq link (concat "(" label ")"))
+		   (insert (format coderef-format label))
+		   (setq link (format "file:%s::%s"
+  (car (last org-src--babel-info))
+  (concat "(" label ")")))
 		   (setq desc nil)))
 		(t (setq link nil)
 
@@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 	(setq path (expand-file-name path)))
 	   ((eq org-link-file-path-type 'relative)
 	(setq path (file-relative-name path)))
+	   ((eq org-link-file-path-type 'adaptive)
+	(setq path (file-relative-name path)))
 	   (t
 	(save-match-data
 	  (if (string-match (concat "^" (regexp-quote
-- 
2.19.1


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


Re: [O] Inline code block syntax highlighting absence

2018-10-23 Thread stardiviner


Garreau, Alexandre  writes:

> Why is there no syntax highlighting for *inline* source/code blocks?
>
> For instance, if I type the following:
>
> #+BEGIN_SRC org
>   src_emacs-lisp{(foo bar (quux))}
> #+END_SRC
>
> The underscore is not displayed, “emacs” is displayed in face
> ~org-latex-and-related~ *and* in subscript display (smaller and
> negatively raised), and all the rest in default face, with no syntax
> highlighting, even inside the braces (that I would expect as it is done
> inside non-inline blocks).

I used to asked similar question, and answered my own question with a font-lock 
solution. This link might be helpful. 
https://stackoverflow.com/questions/20309842/how-to-syntax-highlight-for-org-mode-inline-source-code-src-lang

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Inline code block syntax highlighting absence

2018-10-24 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Garreau, Alexandre  writes:
>>
>>> Why is there no syntax highlighting for *inline* source/code blocks?
>>>
>>> For instance, if I type the following:
>>>
>>> #+BEGIN_SRC org
>>>   src_emacs-lisp{(foo bar (quux))}
>>> #+END_SRC
>>>
>>> The underscore is not displayed, “emacs” is displayed in face
>>> ~org-latex-and-related~ *and* in subscript display (smaller and
>>> negatively raised), and all the rest in default face, with no syntax
>>> highlighting, even inside the braces (that I would expect as it is done
>>> inside non-inline blocks).
>>
>> I used to asked similar question, and answered my own question with
>> a font-lock solution. This link might be helpful.
>> https://stackoverflow.com/questions/20309842/how-to-syntax-highlight-for-org-mode-inline-source-code-src-lang
>
> Would you want to provide a patch for that?
>
> Thank you.
>
> Regards,

I did a search of "font-lock-add-keywords", "begin_src", "src_" etc in
Org Mode source code, but have not found exact place where fontify
function are. So I don't know where to modify the source code. Now I put
my current config here:

#+begin_src emacs-lisp
;; inline code face => src_ruby{require 'something'}
;;
;; (REGEXP . FACE)
;; Highlight REGEXP with FACE
;; (REGEXP N FACE)
;; Highlight group N in REGEXP with FACE
;; (REGEXP (N1 FACE1) (N2 FACE2) (N3 FACE3) …)
;; Highlight group Ni in REGEXP with FACEi
;;
;; src_lang{code...}[:header arguments] / NOTE: override by `org-verbatim'.
;; result in following =[result]=

;; src_
(font-lock-add-keywords
 'org-mode
 '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\)\\({\\)\\([^}]*\\)\\(}\\)"
(1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part
(2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light 
gray"))) ; "lang" part.
(3 '(:foreground "#55" :height 0.7)) ; [:header arguments] part.
(4 '(:foreground "#33")) ; {
(5 'org-code) ; "code..." part.
(6 '(:foreground "#33")) ; }
))
 'append)

;; src without arguments
(font-lock-add-keywords
 'org-mode
 '(("\\(src_\\)\\([^[{]+\\)\\({\\)\\([^}]*\\)\\(}\\)"
(1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part
(2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light 
gray"))) ; "lang" part.
(3 '(:foreground "#33")) ; {
(4 'org-code) ; "code..." part.
(5 '(:foreground "#33")) ; }
))
 'append)

;; inline babel call
;; ... call_[]()[] ...
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))\\[\\(.*\\)\\]"
;; "\\(call_\\)\\([^[(]*\\)\\([([][^)]*]\\)+"
(1 '(:foreground "orange red" :height 0.6)) ; call_
(2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; 
(3 '(:foreground "gray" :height 0.6)) ; []
(4 '(:foreground "cyan" :weight 'bold)) ; ()
(5 '(:foreground "gray" :height 0.6)) ; []
))
 'append)

;; call_[]()
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))"
(1 '(:foreground "orange red" :height 0.6)) ; call_
(2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; 
(3 '(:foreground "gray" :height 0.6)) ; []
(4 '(:foreground "cyan" :weight 'bold)) ; ()
))
 'append)

;; call_(arguments)
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\((.*)\\)"
(1 '(:foreground "orange red" :height 0.6)) ; call_
(2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; 
(3 '(:foreground "cyan" :weight 'bold)) ; ()
))
 'append)
#+end_src

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [PATCH] migrate ob-clojure initiate session code from ob-clojure-literate.el into ob-clojure.el

2018-10-24 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Nicolas Goaziou  writes:
>>
>> Hi, sorry for late response, because I'm a little lazy on give effort on
>> review my patch and improve it again. But now I finished it. Actually I
>> corrected my patch as soon as you replied email with mentioned. Today I
>> pick up this task again, and add a new improve which support CIDER new
>> API which using sesman to manage REPL sessions.
>
> OK. So does it qualify as a bug fix, i.e., should that go into master
> branch, or is it a new feature, for next branch?
>
> BTW, there are some compilation warning:
>
> --8<---cut here---start->8---
> Compiling /home/ngz/dev/org-mode/lisp/ob-clojure.el...
>
> In toplevel form:
> ob-clojure.el:215:1:Warning: Unused lexical variable ‘sesman-system’
>
> In org-babel-clojure-initiate-session:
> ob-clojure.el:225:47:Warning: reference to free variable ‘cider-version’
>
> In end of data:
> ob-clojure.el:278:1:Warning: the function ‘cider-repls’ is not known to be
> defined.
> --8<---cut here---end--->8---
>
> Could you fix them?
>
> Thank you.
>
> Regards,

Hi, Nicolas. I fixed those warning. I think this should be a feature. not a 
patch.

And run `make test`. Here is the result:

```
...
executing Vala source code block
Code block evaluation complete.
   passed  138/814  ob-vala/static-output
   failed  139/814  org-missing-dependency/test-ob-R
   failed  140/814  org-missing-dependency/test-ob-clojure
   failed  141/814  org-missing-dependency/test-ob-lua
   failed  142/814  org-missing-dependency/test-ob-maxima
   failed  143/814  org-missing-dependency/test-ob-plantuml
   failed  144/814  org-missing-dependency/test-ob-ruby
   failed  145/814  org-missing-dependency/test-ob-scheme
   failed  146/814  org-missing-dependency/test-org-attach-annex
   failed  147/814  org-missing-dependency/test-org-protocol
   passed  148/814  test-ob-exp/org-babel-exp-src-blocks/w-no-file
   passed  149/814  test-ob-exp/org-babel-exp-src-blocks/w-no-headers
   passed  150/814  test-ob-exp/org-babel-exp-src-blocks/w-no-headers2
executing Emacs-Lisp code block...
.
.
6 unexpected results:
   FAILED  ob-D/inhomogeneous_table
   FAILED  ob-D/list-list-var
   FAILED  ob-D/list-var
   FAILED  ob-D/vector-var
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-colview/columns-width
```
Also I added an entry in ORG-NEWS mentioned about this new feature.


>From f495c5b4e65fd8c6a64e8619d974d6eb051fb1f7 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 19 Apr 2018 18:16:27 +0800
Subject: [PATCH 1/2] ob-clojure.el: Support `org-babel-initiate-session' to
 initialize.

* ob-clojure.el (org-babel-clojure-initiate-session): Initialize session
for src block.
(org-babel-prep-session:clojure): Prepare Clojure session.
(org-babel-clojure-var-to-clojure): Convert header argument :var into
clojure variables definitions.
(org-babel-variable-assignments:clojure): Support assign variables when
initialize session.
---
 contrib/lisp/ob-clojure-literate.el | 56 -
 lisp/ob-clojure.el  | 55 +
 testing/lisp/test-ob-clojure.el | 77 +
 3 files changed, 132 insertions(+), 56 deletions(-)
 create mode 100644 testing/lisp/test-ob-clojure.el

diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el
index 4c4d38a0f..b1cc386ee 100644
--- a/contrib/lisp/ob-clojure-literate.el
+++ b/contrib/lisp/ob-clojure-literate.el
@@ -184,62 +184,6 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
  (lambda (cons) (if (eq (car cons) :session) t cons))
  org-babel-default-header-args:clojure)
 
-;;; Support `org-babel-initiate-session' / [C-c C-v z] to initialize Clojure session.
-
-(defun org-babel-clojure-initiate-session (&optional session _params)
-  "Initiate a session named SESSION according to PARAMS."
-  (when (and session (not (string= session "none")))
-(save-window-excursion
-  (unless (org-babel-comint-buffer-livep session)
-;; CIDER jack-in to the Clojure project directory.
-(cond
- ((eq org-babel-clojure-backend 'cider)
-  (require 'cider)
-  (let ((session-buffer (save-window-excursion
-  (cider-jack-in t)
-  (current-buffer
-(if (org-babel-comint-buffer-livep session-buffer)
-(progn (sit-for .25) session-buffer
- ((eq org-babel-clojure-backend 'slime)
-  (error "Session evaluation with SLIME is not supported"))
- (t
-  (error "Session initiate 

Re: [O] [PATCH 2/4] ob-clojure.el: Add ClojureScript interface

2018-10-24 Thread stardiviner


roberthambr...@gmail.com writes:

> From: Robert Hambrock 
>
> * lisp/ob-clojure.el (org-babel-execute:clojure): Implemented :target,
> which allows selection of connection.
> * lisp/ob-clojure.el (org-babel-execute:clojurescript): New
> ClojureScript interface that uses :target flag to specify `cljs`
> evaluation target.
> ---
>  lisp/ob-clojure.el | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
> index 93674b552..7f7c24ff1 100644
> --- a/lisp/ob-clojure.el
> +++ b/lisp/ob-clojure.el
> @@ -129,7 +129,8 @@ using the :show-process parameter."
>(cider
> (require 'cider)
> (let ((result-params (cdr (assq :result-params params)))
> -  (show (cdr (assq :show-process params
> +  (show (cdr (assq :show-process params)))
> +  (connection (cider-current-connection (cdr (assq :target 
> params)
>   (if (member show '(nil "no"))
>;; Run code without showing the process.
>(progn
> @@ -137,7 +138,7 @@ using the :show-process parameter."
>(let ((nrepl-sync-request-timeout
>   org-babel-clojure-sync-nrepl-timeout))
>  (nrepl-sync-request:eval expanded
> - (cider-current-connection
> + connection)))
>  (setq result
>(concat
> (nrepl-dict-get response
> @@ -171,7 +172,7 @@ using the :show-process parameter."
>   (nrepl--merge response resp)
>   ;; Update the status of the nREPL output session.
>   (setq status (nrepl-dict-get response "status")))
> -   (cider-current-connection))
> +   connection)
>
>;; Wait until the nREPL code finished to be processed.
>(while (not (member "done" status))
> @@ -211,6 +212,9 @@ using the :show-process parameter."
>(condition-case nil (org-babel-script-escape result)
>   (error result)
>
> +(defun org-babel-execute:clojurescript (body params)
> +  (org-babel-execute:clojure body (cons '(:target . "cljs") params)))
> +
>  (provide 'ob-clojure)
>
>  ;;; ob-clojure.el ends here

Hi, @roberthambrock. I would like to have ob-clojure support
ClojureScript too. But seems this patch is not merged yet, for a long
time. Can I modify this patch and send to Org Mode? @Nicolas, can I do
this? set Git commit author as "roberthambrock", and commiter as me.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] ob-core.el macro org-babel-comint-with-output has error

2018-10-24 Thread stardiviner


stardiviner  writes:

> When I try to evaluate js src block code with session.
> I found it is suspended. After edebug, found the problem is on macro 
> org-babel-comint-with-output.
>
> Here is a minimal reproduce code:
>
> #+begin_src emacs-lisp
> (org-babel-comint-with-output
> ("*skewer-repl*" (format "%S" org-babel-js-eoe) t "x.innerHTML=\"Hello, 
> Welcome!\";")
>   (mapc
>(lambda (line)
>  (insert (org-babel-chomp line))
>  (comint-send-input nil t))
>(list "x.innerHTML=\"Hello, Welcome!\";" (format "%S" org-babel-js-eoe
> #+end_src
>
> Hope someone can fix it. I can't help on elisp macro

Anyone can help me on this?

Why this email does not have any reply? Maybe because my old invalid
mu4e message sign configuration?

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [PATCH] migrate ob-clojure initiate session code from ob-clojure-literate.el into ob-clojure.el

2018-10-25 Thread stardiviner
org-id-track-globally t) (org-test-selector (if org-test-sele
  org-test-run-batch-tests("\\(org\\|ob\\)")
  eval((org-test-run-batch-tests org-test-select-re))
  command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
  command-line()
  normal-top-level()
Test ob-D/list-list-var condition:
(ert-test-failed
 ((should
   (equal '...
(org-babel-execute-src-block)))
  :form
  (equal
   ((1 3)
(2 4))
   nil)
  :value nil :explanation
  (different-types
   ((1 3)
(2 4))
   nil)))
   FAILED   14/814  ob-D/list-list-var
executing D code block (list_var)...
Babel evaluation exited with code 1
nil
Test ob-D/list-var backtrace:
  signal(ert-test-failed (((should (string= "abcdef2" (org-babel-execu
  ert-fail(((should (string= "abcdef2" (org-babel-execute-src-block)))
  (if (unwind-protect (setq value-64 (apply fn-62 args-63)) (setq form
  (let (form-description-66) (if (unwind-protect (setq value-64 (apply
  (let ((value-64 'ert-form-evaluation-aborted-65)) (let (form-descrip
  (let* ((fn-62 (function string=)) (args-63 (condition-case err (let
  (save-restriction (org-babel-next-src-block 2) (let* ((fn-62 (functi
  (progn (org-id-goto "cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5") (setq to
  (unwind-protect (progn (org-id-goto "cc65d6b3-8e8e-4f9c-94cd-f5a00cd
  (let ((save-match-data-internal (match-data))) (unwind-protect (prog
  (progn (let ((save-match-data-internal (match-data))) (unwind-protec
  (unwind-protect (progn (let ((save-match-data-internal (match-data))
  (let ((wconfig (current-window-configuration))) (unwind-protect (pro
  (unwind-protect (let ((wconfig (current-window-configuration))) (unw
  (let* ((id-location (org-id-find "cc65d6b3-8e8e-4f9c-94cd-f5a00cdece
  (if (executable-find org-babel-D-compiler) (let* ((id-location (org-
  (lambda nil (if (executable-find org-babel-D-compiler) (let* ((id-lo
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name ob-D/list-var :documentation "Test of
  ert-run-or-rerun-test(#s(ert--stats :selector "\\(org\\|ob\\)" :test
  ert-run-tests("\\(org\\|ob\\)" #f(compiled-function (event-type &res
  ert-run-tests-batch("\\(org\\|ob\\)")
  ert-run-tests-batch-and-exit("\\(org\\|ob\\)")
  (let ((org-id-track-globally t) (org-test-selector (if org-test-sele
  org-test-run-batch-tests("\\(org\\|ob\\)")
  eval((org-test-run-batch-tests org-test-select-re))
  command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
  command-line()
  normal-top-level()
Test ob-D/list-var condition:
(ert-test-failed
 ((should
   (string= "abcdef2"
(org-babel-execute-src-block)))
  :form
  (string= "abcdef2" nil)
  :value nil))
   FAILED   15/814  ob-D/list-var
Babel evaluation exited with code 1
nil
Test ob-D/vector-var backtrace:
  signal(ert-test-failed (((should (equal 122 (org-babel-execute-src-b
  ert-fail(((should (equal 122 (org-babel-execute-src-block))) :form (
  (if (unwind-protect (setq value-74 (apply fn-72 args-73)) (setq form
  (let (form-description-76) (if (unwind-protect (setq value-74 (apply
  (let ((value-74 'ert-form-evaluation-aborted-75)) (let (form-descrip
  (let* ((fn-72 (function equal)) (args-73 (condition-case err (let ((
  (save-restriction (org-babel-next-src-block 4) (let* ((fn-72 (functi
  (progn (org-id-goto "cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5") (setq to
  (unwind-protect (progn (org-id-goto "cc65d6b3-8e8e-4f9c-94cd-f5a00cd
  (let ((save-match-data-internal (match-data))) (unwind-protect (prog
  (progn (let ((save-match-data-internal (match-data))) (unwind-protec
  (unwind-protect (progn (let ((save-match-data-internal (match-data))
  (let ((wconfig (current-window-configuration))) (unwind-protect (pro
  (unwind-protect (let ((wconfig (current-window-configuration))) (unw
  (let* ((id-location (org-id-find "cc65d6b3-8e8e-4f9c-94cd-f5a00cdece
  (if (executable-find org-babel-D-compiler) (let* ((id-location (org-
  (lambda nil (if (executable-find org-babel-D-compiler) (let* ((id-lo
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name ob-D/vector-var :documentation "Test
  ert-run-or-rerun-test(#s(ert--stats :selector "\\(org\\|ob\\)" :test
  ert-run-tests("\\(org\\|ob\\)" #f(compiled-function (event-type &res
  ert-run-tests-batch("\\(org\\|ob\\)")
  ert-run-tests-batch-and-exit("\\(org\\|ob\\)")
  (let ((org-id-track-globally t) (org-test-selector (if org-test-sele
  org-test-run-batch-tests("\\(org\\|ob\\)")
  eval((org-test-run-batch-tests org-test-select-re))
  command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
  command-line()
  normal-top-level()
Test ob-D/vector-var condition:
(ert-test-failed
 ((should
   (equal 122
  (org-babel-execute-src-block)))
  :form
  (equal 122 nil)
  :value nil :explanation
  (different-types 122 nil)))
   FAILED   20/814  ob-D/vector-var

>>FAILED  test-org-clock/clocktable/lang
>>FAILED  test-org-colview/columns-width

For this two failed test, after I run it again 3 times, it does not appears 
anymore.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-10-26 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Thanks for this hint, I added a new entry in org-src--babel-info list to
>> pass the original parent file path.
>
> Thank you. Some comments follow.
>
>> -  (language body arguments switches name start coderef)"
>> +  (language body arguments switches name start coderef  parent-file-path)"
>
> This is not needed. It would be better to create a new variable, e.g.
> `org-src-source-file', get the file name at the beginning of the
> function `org-src--edit-element', and set it from its INITIALIZE
> argument.
>
>> +   (insert (format coderef-format label))
>> +   (setq link (format "file:%s::%s"
>> +  (car (last org-src--babel-info))
>> +  (concat "(" label ")")))
>
> You can get the file name by reading `org-src-source-file' value.
>
> Does that make sense?
>
> Could you also provide some tests?
>
> Regards,

I regenerated the patch.

>From da491e12fcbf75d9b016f58fbcdeb74d601a1b91 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Wed, 24 Oct 2018 10:45:40 +0800
Subject: [PATCH] org.el: fix org-coderef does not support adaptive file path
 link type.

* org-src.el (org-src-source-file): Add a variable to get the file path
   at the beginning of the function `org-src--edit-element'.
* org.el (org-insert-link): support option org-link-file-path-type
  'adaptive value.
---
 lisp/org-src.el | 9 -
 lisp/org.el | 9 ++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 42e1225ed..0426ff96a 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -277,6 +277,11 @@ issued in the language major mode buffer."
   "Type of element being edited, as a symbol.")
 (put 'org-src--source-type 'permanent-local t)
 
+(defvar org-src--source-file nil
+  "A variable used to store the source file path before entering
+  source block dedicated buffer.")
+(put 'org-src--source-file 'permanent-local t)
+
 (defvar-local org-src--tab-width nil
   "Contains `tab-width' value from Org source buffer.
 However, if `indent-tabs-mode' is nil in that buffer, its value
@@ -995,7 +1000,9 @@ name of the sub-editing buffer."
 (let* ((lang
 	(if (eq type 'src-block) (org-element-property :language element)
 	  "example"))
-	   (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang)))
+	   (lang-f (progn
+		 (setq-local org-src--source-file (buffer-file-name))
+		 (and (eq type 'src-block) (org-src--get-lang-mode lang
 	   (babel-info (and (eq type 'src-block)
 			(org-babel-get-src-block-info 'light)))
 	   deactivate-mark)
diff --git a/lisp/org.el b/lisp/org.el
index 0b5e8d739..ab86345bf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9249,13 +9249,14 @@ non-nil."
 		(interactive?
 		 (let ((label (read-string "Code line label: ")))
 		   (end-of-line)
-		   (setq link (format coderef-format label))
 		   (let ((gc (- 79 (length link
 		 (if (< (current-column) gc)
 			 (org-move-to-column gc t)
 		   (insert " ")))
-		   (insert link)
-		   (setq link (concat "(" label ")"))
+		   (insert (format coderef-format label))
+		   (setq link (format "file:%s::%s"
+  org-src--source-file
+  (concat "(" label ")")))
 		   (setq desc nil)))
 		(t (setq link nil)
 
@@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 	(setq path (expand-file-name path)))
 	   ((eq org-link-file-path-type 'relative)
 	(setq path (file-relative-name path)))
+	   ((eq org-link-file-path-type 'adaptive)
+	(setq path (file-relative-name path)))
 	   (t
 	(save-match-data
 	  (if (string-match (concat "^" (regexp-quote
-- 
2.19.1


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


Re: [O] Inline code block syntax highlighting absence

2018-10-26 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> I did a search of "font-lock-add-keywords", "begin_src", "src_" etc in
>> Org Mode source code, but have not found exact place where fontify
>> function are. So I don't know where to modify the source code. Now I put
>> my current config here:
>
> [...]
>
>> (font-lock-add-keywords
>>  'org-mode
>>  '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\)\\({\\)\\([^}]*\\)\\(}\\)"
>> (1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part
>> (2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light 
>> gray"))) ; "lang" part.
>> (3 '(:foreground "#55" :height 0.7)) ; [:header arguments] part.
>> (4 '(:foreground "#33")) ; {
>> (5 'org-code) ; "code..." part.
>> (6 '(:foreground "#33")) ; }
>> ))
>>  'append)
>
> The first thing is to define new faces, or re-use existing one, instead
> of creating them ad-hoc.
>
> Then you need to create a function like `org-fontify-entities'.
>
> For example:
>
> --8<---cut here---start->8---
> (defun org-fontify-inline-code (limit)
>   (when (re-search-forward "src_..." limit t)
> ;; here you need to make as sure as possible that you are really
> ;; at some inline code.  You cannot really parse inline source code
> ;; or inline Babel calls with a regexp only.
> (org-remove-flyspell-overlays-in beg end)
> (add-text-properties beg end (list 'font-lock-fontified t 'face ...))
> t))
> --8<---cut here---end--->8---
>
> You then register the function above in `org-set-font-lock-defaults.
>
> Do you want to implement this?
>
> Regards,


I will take a try. Maybe later in few days.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] An Org-based productivity tool

2018-10-27 Thread stardiviner


Peter Neilson  writes:

> Maybe I need a brain-wave detector, connecting through emacs-lisp AI code to 
> a huge
> Pomodoro-style graphic display, that will alert me when I am goofing off, 
> falling asleep,
> or practicing mental evasion.

This is what I want too. I'd like to see one day this is implemented.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] An Org-based productivity tool

2018-10-27 Thread stardiviner


Sacha Chua  writes:

> I find time analysis useful for things like calibrating my estimates and 
> expectations,
> learning about my revealed preferences and trends over time, and feeling more 
> satisfied
> about my days/weeks/months. I liked using the data to build on my strengths 
> and work
> around my limits instead of giving in to the temptation to use it as a harsh 
> taskmaster.
> :) I wonder if something similar might be helpful for you.

I agree on this point that should be a harsh taskmaster if I understand it 
correctly. After I spent lot of time on configuring Emacs and Org Mode to fit 
what I want, then I reduce my setup to small again. I found it's time to keep 
it simple and clean now. Currently I only use Org Agenda and org clock to 
record all my activities.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-10-30 Thread stardiviner


Hi, Nicolas, just a remind that have you reviewed my patch? Is it what you said 
in `INITIALIZE` argument? Is it fine to merge?

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] ox-epub exported EPUB file source block indent error maybe reason in ox-html

2018-10-31 Thread stardiviner


Here is the original issue link which describe my debug steps:

https://github.com/ofosos/ox-epub/issues/25

Because there are lot of content and some images, so I don't copy them to here. 
Sorry for this distribute.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-11-01 Thread stardiviner


Nicolas Goaziou  writes:

>> ---
>>  lisp/org-src.el | 9 -
>>  lisp/org.el | 9 ++---
>>  2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/lisp/org-src.el b/lisp/org-src.el
>> index 42e1225ed..0426ff96a 100644
>> --- a/lisp/org-src.el
>> +++ b/lisp/org-src.el
>
> Why not using `defvar-local' instead? Also, since it is meant to be used
> in other libraries, it should be `org-src-source-file'.

Because the variable `org-src-source-file' is a bridge to pass info between two 
buffers "source buffer" and source block opened "dedicated buffer". So this 
variable must be global. Otherwise the "dedicated buffer" can't read it.

>
>> +   (lang-f (progn
>> + (setq-local org-src--source-file (buffer-file-name))
>> + (and (eq type 'src-block) (org-src--get-lang-mode lang
>
> I don't think this is the right place to set `org-src--source-file': it
> is unrelated to LANG-F.
>

I tried this:

#+begin_src diff
@@ -1000,9 +1000,11 @@ name of the sub-editing buffer."
 (let* ((lang
(if (eq type 'src-block) (org-element-property :language element)
  "example"))
-  (lang-f (progn
-(setq-local org-src--source-file (buffer-file-name))
-(and (eq type 'src-block) (org-src--get-lang-mode lang
+  (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang)))
+  (org-src-source-file (buffer-file-name))
+  (initialize (lambda ()
+(setq org-src-source-file (buffer-file-name))
+(funcall lang-f)))
   (babel-info (and (eq type 'src-block)
(org-babel-get-src-block-info 'light)))
   deactivate-mark)
#+end_src

Put it into initialize function. This is the best way I can come up with.

> Also, the value comes from the source buffer, but the variable needs to
> be set in the edit buffer. AFAIU, here you set it in the source buffer,
> not in the edit buffer.
>
>> +   (insert (format coderef-format label))
>> +   (setq link (format "file:%s::%s"
>> +  org-src--source-file
>> +  (concat "(" label ")")))
>
> Should we check if `org-src-source-file' is the same as the current
> file, and offer a simplified link in this case?

Don't know which part you mean, I just insert the source file path into the 
link. About the final link is modified by bellowing `org-link-file-path-type' 
variable.

>
>> (setq desc nil)))
>>  (t (setq link nil)
>>  
>> @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for 
>> type-specific completion support
>>  (setq path (expand-file-name path)))
>> ((eq org-link-file-path-type 'relative)
>>  (setq path (file-relative-name path)))
>> +   ((eq org-link-file-path-type 'adaptive)
>> +(setq path (file-relative-name path)))
>> (t
>>  (save-match-data
>>(if (string-match (concat "^" (regexp-quote
>
> Would you writing a few tests?
>
> Thank you.
>
> Regards,


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] dynamic block :block thismonth seems not correct

2018-11-02 Thread stardiviner
at 21:01]
:END:

#+BEGIN: clocktable :maxlevel 5 :scope agenda-with-archives :block thismonth 
:fileskip0 t :indent t
#+CAPTION: Clock summary at [2018-11-02 Fri 14:41], for November 2018.
| File | Headline   | 
Time |  |  |
|--++--+--+--|
|  | ALL *Total time* | 
*8:18* |  |  |
|--++--+--+--|
| Code.org | *File time*  | 
**   |  |  |
|  | Config [15/42] | 
0:11 |  |  |
|  | \_  Firefox can't input Chinese [3/3]  |   
   | 0:11 |  |
|  | Issues [14/49] | 
7:43 |  |  |
|  | \_  Org export to iPad Clojure...  |   
   | 5:43 |  |
|  | \_ox-epub export inline image error [1/1]  |   
   |  | 0:52 |
|  | \_ox-epub exported source block has big... |   
   |  | 4:51 |
|  | \_  org coderef does not support use file...   |   
   | 2:00 |  |
|--++--+--+--|
| Programming Projects.org | *File time*  | 
**   |  |  |
|  | Web Scraping (Crawler) [5/30]  | 
0:24 |  |  |
#+END:
```

But don't know why the second month clocktable `:block thismonth` is not 
correct. Obvious the first week dynamic block is much more than second month 
dynamic block. So I think there is problem here.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [SOLVED] Re: dynamic block :block thismonth seems not correct

2018-11-04 Thread stardiviner


This is because my today limited scope in :block thismonth.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [SOLVED] Re: coderef does not provide file path for org-insert-link when not in original buffre

2018-11-05 Thread stardiviner


Thanks, Nicolas.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-11-05 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Because the variable `org-src-source-file' is a bridge to pass info
>> between two buffers "source buffer" and source block opened "dedicated
>> buffer". So this variable must be global. Otherwise the "dedicated
>> buffer" can't read it.
>
> The variable is set in the "dedicated buffer", and is local to it. OTOH,
> the source buffer doesn't need to read it, ever.
>
> I committed a change in "master" branch. Could you tell me if it fixes
> your issue?
>
> Regards,

I tested, confirm that it works.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] How to advice around org-insert-link to disable desc part of link?

2018-11-10 Thread stardiviner
I use org-attach to add/download image file from local or web url. Then [C-c 
C-l] (org-insert-link) to insert link from previous added attach image file.

In some places like ox-html, ox-epub, they use inline images without desc to 
display image. If has `[desc]` part, the image will become a link. So I hope 
can add an advice around function `org-insert-link` or somewhere should.

Anybody knows how to do this? Can you show the code? I checked out 
`org-insert-link` source code, don't know how to add advice around it.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-11-15 Thread stardiviner
In package `orgtbl-aggregate` has bellowing command to insert different dynamic 
blocks.

#+begin_src emacs-lisp
(defun org-insert-dblock ()
  "Inserts an org table dynamic block.
This is a dispatching function which prompts for the type
of dynamic block to insert. It dispatches to functions
which names matches the pattern `org-insert-dblock:*'"
  (interactive)
  (let ((fun
 (intern
  (format
   "org-insert-dblock:%s" 
   (org-icompleting-read
"Kind of dynamic block: "
(mapcar (lambda (x)
  (replace-regexp-in-string
   "^org-insert-dblock:"
   ""
   (symbol-name x)))
(apropos-internal "^org-insert-dblock:")))
(if (functionp fun)
(funcall fun)
  (message "No such dynamic block: %s" fun
#+end_src

This command matches Org Mode API style.

I hope Org Mode can have this built-in. Because there are some other dynamic 
blocks. They can use this dispatcher function.

For example org-gantt dynamic block, I write a function manually:

#+begin_src emacs-lisp
(defun org-insert-dblock:org-gantt ()
  "Insert org-gantt dynamic block."
  (interactive)
  (org-create-dblock
   (list :name "org-gantt"
 :file "data/images/project-gantt-chart.png"
 :imagemagick t
 :tikz-options "scale=1.5, every node/.style={scale=1.5}"
 :weekend-style "{draw=blue!10, line width=1pt}"
 :workday-style "{draw=blue!5, line width=.75pt}"
 :show-progress 'if-value
 :progress-source 'cookie-clocksum
 :no-date-headlines 'inactive
 :parameters "y unit title=.7cm, y unit chart=.9cm"
 :tags-group-style '(("test"."group label font=\\color{blue}")
 ("toast"."group label font=\\color{green}"))
 :tags-bar-style '(("test"."bar label font=\\color{blue}")
       ("toast"."bar label font=\\color{green}")
#+end_src

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] Display org-clock info in header line

2018-11-17 Thread stardiviner


I found there are configuration like this:

#+begin_src emacs-lisp
;;; display org-clock in head-line.
(setq org-clock-clocked-in-display nil)
(defun my/show-org-clock-in-header-line ()
  (setq-default header-line-format '((" " org-mode-line-string " "
(defun my/remove-org-clock-in-header-line ()
  (setq-default header-line-format nil))
(add-hook 'org-clock-in-hook #'my/show-org-clock-in-header-line)
(add-hook 'org-clock-out-hook #'my/remove-org-clock-in-header-line)
(add-hook 'org-clock-cancel-hook #'my/remove-org-clock-in-header-line)
#+end_src

But this header-line is displayed in every window. I wish there is a global 
header-line to display org-clock info.

Why I want this?

Because my notebook screen is small, when I split window, the mode-line is very 
small not enough to display much info for org-clock. I don't want to display 
org-clock info in frame-title. That's not the right place.

I saw some Emacs extensions like tabs package (for example: nerdtab 
https://github.com/casouri/nerdtab) display a global top line instead of 
per-window.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] CUSTOM_ID property does not support Chinese

2018-11-25 Thread stardiviner
Here is the example:

#+begin_src org
* headline
  :CUSTOM_ID: 测试
#+end_src

I use org-store-link, and org-insert-link keybindings. But it reports error:

Position saved to mark ring, go back with ‘M-,’.
if: No match for custom ID: 
%E5%AE%BD%E5%BA%A6%E4%BC%98%E5%85%88%E6%9C%89%E5%88%A9%E4%BA%8E%E5%A4%9A%E4%B8%AA%E7%88%AC%E8%99%AB%E5%8D%8F%E5%90%8C%E6%8A%93%E5%8F%96
Position saved to mark ring, go back with ‘M-,’.
if: No match for custom ID: 
%E5%AE%BD%E5%BA%A6%E4%BC%98%E5%85%88%E6%9C%89%E5%88%A9%E4%BA%8E%E5%A4%9A%E4%B8%AA%E7%88%AC%E8%99%AB%E5%8D%8F%E5%90%8C%E6%8A%93%E5%8F%96

Seems Org Mode can't handle Chinese correctly.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Feature request - Decouple org's keybindings from their functions

2018-11-28 Thread stardiviner


Decoupling is not a good idea. Because it will let user define too much
keybindings. And User can define keybinding in Emacs easily. Emacs is
powerful for customization.

And user need convention for Org default keybindings so that when Org
users communications can know what he did. For example, when I said [C-c
C-c] in Org, Every Org users know it.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] [Need Help] I need help, someone can help me debug on this?

2018-11-28 Thread stardiviner


Check out my previous email. (Because I lost the screenshot image file...)

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2018-11-30 Thread stardiviner


The ob-clojure tangle will insert ~(ns ..)~ from babel header argument :ns or 
use defualt ~(ns user)~.

   #+begin_src clojure :eval no :ns "" :tangle 
"data/code/xunfei-clj-demo/project.clj" :results link :file 
"data/code/xunfei-clj-demo/project.clj"
   (defproject xunfei-clj-demo "0.1.0-SNAPSHOT"
 :description "xunfei-clj demo"
 :url "http://example.com/FIXME";
 :license {:name "Eclipse Public License"
   :url  "http://www.eclipse.org/legal/epl-v10.html"}
 :dependencies [[org.clojure/clojure "1.9.0"]
[xunfei-clj "0.1.4-SNAPSHOT"]]
 :resource-paths ["lib/Msc.jar"])
   #+end_src

In upper case, obviously I don't want insert the ~(ns ..)~ line of code.

I hope the ob-clojure header argument ~:ns~ should detect value like
"nil", "" (empty string) or something else. Or when ~:ns~ header
argument is not specified. So that the tangling will not auto insert
~(ns ..)~ line.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2018-12-02 Thread stardiviner


Tim Cross  writes:

> I think the problem here is that really, project.clj is not a valid
> clojure source file. It is really a clojure data file or clojure
> snippet (I mean in the sense that you cannot execute it or include it as
> a dependency within a clojure program - it is input data for the lein
> build tool). If lein was being developed from scratch today, rather than
> project.clj, you would probably have project.edn.

Actually a few months ago, Sean on Slack clojurians helped me out for
using clj and deps.edn. Just because of habit inertia. I'm still using
Leiningen. As you said, the Clojure community is moving to clj/clojure +
deps.edn. I decide to following the trend. Start to use it now.

>
> The question is, should we allow setting ns to nil/"", preventing
> inclusion of a ns line, which would make 'real' clojure source files
> invalid just to support this edge case or should we consider an
> alternative solution e.g.
>
> - have a 'lein-project' source type which could perhaps provide
>   additional support for editing project.clj files (as I suspect lein is
>   on the way out - replaced with things like clj or boot)
> - try using edn-mode and having support for edn as a valid language
>   type. I've never used edn mode and I'm not 100% certain project.clj
>   and edn are completely compatible.
>
> It seems to me that the preferred build tool is likely to become clj or
> derivatives of clj. I've noticed increasingly longer delays in new lein
> releases (the 'reflection' warning has been there for nearly 12 months
> now, as has the incorrect classpath warning on some platforms).
>
> In the long-term, I think org would probably benefit from integration
> with clj rather than cider for ob-clojure as it is likely to be more
> stable and less complex. Using cider has always felt like pushing a
> square peg into a round hole to me.

I remember we have a short discussion about ob-clojure use clj instead
of CIDER before. I totally agree on this. Seems already has an Emacs
package named "inf-clojure". I added this "integrate inf-clojure to
ob-clojure" as my task. But not sure when to check it out. I have many
tasks on my list. I have an idea, would you create an GitHub repo for
this? I would like to contribute on it.

As I said previous, if I use "deps.edn", use `edn-mode' would solve this
problem. But there is no `edn-mode'. I checked out MELPA, only has
package named "edn" which is used to Support for reading and writing the
edn data format from elisp. I also did a search on GitHub. No luck.

Anyway, I'm going to switch to clj + deps.edn

And Thanks, @Tim.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-02 Thread stardiviner


Nicolas Goaziou  writes:

> I think we could do something similar to links, i.e., populate
> a variable (for links, it is `org-link-parameters') with a command
> (`org-link-set-parameters'), so the dispatcher knows what dynamic blocks
> can be provided.

This is an good idea. Nicolas, do you want to implement it?
I still have some unfinished code in my Org Mode local repo. Like org
inline src block fontify. And ob-diff.el and another one. I become a little 
lazy currently. :) I know should not use excuse.

Anyway, if you think it's better let me submit PR, I still will add this task 
in my list.

UPDATE:

I just checked out `org-link-parameters' related source code. I found it is not 
that complicated. I would like to have a try.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2018-12-05 Thread stardiviner


Tim Cross  writes:

> Sorry, only just noticed this response in my spam folder - gmail is
> tagging your messages as spam because it could not verify it was legit.

Yeah, I found some other's emails in Gmail Spam too. I usually regularly
check Spam folder a week. Might because GPG sign? I don't know why.

> I will have leave in the early year and will likely re-visit this. I too
> need to move from lein to clj + edn. It would be really good to simplify
> the org interface for clojre and clojurescript and I suspect clj + edn
> will be the way to go. The older inf-clojure was OK, but it lacked some
> higher level features we do need as well, so it will take a bit of work.

I'm currently switched to clj-new utility. I'm considering create an
Emacs extension to invoke "clj-new". I'll start work on it in a few days.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-19 Thread stardiviner

I add code patch in attachment. Nicolas, can you review it? Any
suggestion welcome.

After running test with "make test", I got some failed test might related to my 
code changing. But I checked out the tests, have not found anywhere invoking 
the renamed functions.

Ran 814 tests, 808 results as expected, 6 unexpected (2018-12-20 09:57:41+0800)
9 expected failures

6 unexpected results:
   FAILED  ob-D/inhomogeneous_table
   FAILED  ob-D/list-list-var
   FAILED  ob-D/list-var
   FAILED  ob-D/vector-var
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-colview/columns-width


>From 16ff083a475b7f125136a7bbd131e85833ad822d Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 20 Dec 2018 09:21:38 +0800
Subject: [PATCH] org.el: Add dispatch command for inserting dynamic blocks

* lisp/org.el (org-dynamic-block-insert-dispatch): The dispatch command
  for inserting dynamic blocks.

  (org-dynamic-block-parameters, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-set-parameters,
  org-dynamic-block-get-parameter): New custom option, and new functions
  about dynamic blocks.

  (org-clock-report, org-columns-insert-dblock) Those functions are
  renamed to new name, and removed corresponding keybinding, take
  controled by dispatch command org-dynamic-block-insert-dispatch.

* doc/org-manual.org: Add manual for dispatch command
  ~org-dynamic-block-insert-dispatch~.
---
 doc/org-manual.org  |  9 ---
 etc/ORG-NEWS| 20 +++
 lisp/org-clock.el   |  2 +-
 lisp/org-colview.el |  2 +-
 lisp/org-compat.el  |  2 --
 lisp/org.el | 59 -
 6 files changed, 81 insertions(+), 13 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 051ffaa4d..37afad5b2 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19872,9 +19872,12 @@ users mailing list, at mailto:emacs-orgmode@gnu.org.
 
 Org supports /dynamic blocks/ in Org documents.  They are inserted
 with begin and end markers like any other code block, but the contents
-are updated automatically by a user function.  For example, {{{kbd(C-c
-C-x C-r)}}} inserts a dynamic table that updates the work time (see
-[[*Clocking Work Time]]).
+are updated automatically by a user function. You can use dispatch
+command ~org-dynamic-block-insert-dispatch~ which is bind to
+keybinding {{{kbd(C-c C-x i)}}} by default.
+
+For example, {{{kbd(C-c C-x i)}}} + ~clocktable~ inserts a dynamic
+table that updates the work time (see [[*Clocking Work Time]]).
 
 Dynamic blocks can have names and function parameters.  The syntax is
 similar to source code block specifications:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 811e98147..5bce606f9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.2
 ** Incompatible changes
+*** Renamed some dynamic block generate functions name
+
+- Renamed ~org-clock-report~ to ~org-insert-dblock:clocktable~
+- Renamed ~org-columns-insert-dblock~ to ~org-insert-dblock:columnview~
+
 *** Removal of OrgStruct mode mode and radio lists
 
 OrgStruct minor mode and radio lists mechanism (~org-list-send-list~
@@ -170,6 +175,15 @@ This is consistent with the naming of =org-dblock-write:columnview=
 options, where =:match= is also used as a headlines filter.
 
 ** New features
+
+*** Add a dispatcher command to insert dynamic blocks
+
+You can add dynamic block into ~org-dynamic-block-parameters~ with
+function ~org-dynamic-block-set-parameters~ just like
+~org-link-set-parameters~. All dynamic blocks in
+~org-dynamic-block-set-parameters~ can be used by
+~org-dynamic-block-insert-dispatch~ command.
+
 *** Add ~:results link~ support for Babel
 
 With this output format, create a link to the file specified in
@@ -314,6 +328,12 @@ remove it.
 
 ** New commands and functions
 
+*** ~org-dynamic-block-insert-dispatch~
+
+Use default keybinding =[C-c C-x i]= to run command
+~org-dynamic-block-insert-dispatch~. It will prompt user to select
+dynamic block in ~org-dynamic-block-parameters~.
+
 *** ~org-insert-structure-template~
 
 This function can be used to wrap existing text of Org elements in
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 494423e4e..ebe7b8637 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2024,7 +2024,7 @@ fontified, and then returned."
 (point-at-bol)
 
 ;;;###autoload
-(defun org-clock-report (&optional arg)
+(defun org-insert-dblock:clocktable (&optional arg)
   "Update or create a table containing a report about clocked time.
 
 If point is inside an existing clocktable block, update it.
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 932275836..6a9a8a601 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1489,7 +1489,7 @@ PARAMS is a property list of parameters:
 	(org-table-align)
 
 ;;;###autoload
-(defun org-columns-insert-dblock ()
+(def

Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-22 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> I add code patch in attachment. Nicolas, can you review it?
>
> Thank you. Some comments follow.
>
>> After running test with "make test", I got some failed test might
>> related to my code changing. But I checked out the tests, have not
>> found anywhere invoking the renamed functions.
>
> They are not related.

I run `make test` (after adding my commit) again on `next` branch.

Got failed tests:

12 unexpected results:
   FAILED  ob-D/inhomogeneous_table
   FAILED  ob-D/list-list-var
   FAILED  ob-D/list-var
   FAILED  ob-D/vector-var
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-colview/columns-move-left
   FAILED  test-org-colview/columns-move-right
   FAILED  test-org-colview/columns-new
   FAILED  test-org-colview/columns-next-allowed-value
   FAILED  test-org-colview/columns-scope
   FAILED  test-org-colview/columns-width
   FAILED  test-org-colview/dblock

All are not related to my commit. about test-org-{clock,colview}/* tests, they 
are failed because of void functions.

>
>> Ran 814 tests, 808 results as expected, 6 unexpected (2018-12-20 
>> 09:57:41+0800)
>> 9 expected failures
>>
>> 6 unexpected results:
>>FAILED  ob-D/inhomogeneous_table
>>FAILED  ob-D/list-list-var
>>FAILED  ob-D/list-var
>>FAILED  ob-D/vector-var
>
> I don't use D, so I cannot help here.
>
>>FAILED  test-org-clock/clocktable/lang
>>FAILED  test-org-colview/columns-width
>
> This is probably due to a non-default variable leaking in the test. The
> full error may help.
>
>> * lisp/org.el (org-dynamic-block-insert-dispatch): The dispatch command
>>   for inserting dynamic blocks.
>
> "New function." is enough.

Fixed.

>>
>>   (org-dynamic-block-parameters, org-dynamic-block-functions,
>>   org-dynamic-block-types, org-dynamic-block-set-parameters,
>>   org-dynamic-block-get-parameter): New custom option, and new functions
>>   about dynamic blocks.
>
> New variables... New functons, etc.

Fixed

>
>> +are updated automatically by a user function. You can use dispatch
>
> You need two spaces at the end of sentences.

Fixed

>
>> +command ~org-dynamic-block-insert-dispatch~ which is bind to
>> +keybinding {{{kbd(C-c C-x i)}}} by default.
>
> command ~org-dynamic-block-insert-dispatch~, which is bound to
> {{{kbd(C-c C-x i)}}} by default.

Fixed

>
>> +For example, {{{kbd(C-c C-x i)}}} + ~clocktable~ inserts a dynamic
>
> For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}}

Fixed

>
>> +table that updates the work time (see [[*Clocking Work Time]]).
>>
>>  Dynamic blocks can have names and function parameters.  The syntax is
>>  similar to source code block specifications:
>> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
>> index 811e98147..5bce606f9 100644
>> --- a/etc/ORG-NEWS
>> +++ b/etc/ORG-NEWS
>> @@ -12,6 +12,11 @@ Please send Org bug reports to 
>> mailto:emacs-orgmode@gnu.org.
>>
>>  * Version 9.2
>>  ** Incompatible changes
>> +*** Renamed some dynamic block generate functions name
>> +
>> +- Renamed ~org-clock-report~ to ~org-insert-dblock:clocktable~
>> +- Renamed ~org-columns-insert-dblock~ to ~org-insert-dblock:columnview~
>> +
>
> This change will not go in Org 9.2. You need to apply it on top of 9.3,
> aka, "next" branch.

Fixed

>
>> +*** ~org-dynamic-block-insert-dispatch~
>> +
>> +Use default keybinding =[C-c C-x i]= to run command
>
> ==

Fixed

>
>> -(defun org-clock-report (&optional arg)
>> +(defun org-insert-dblock:clocktable (&optional arg)
>>"Update or create a table containing a report about clocked time.
>
> This function is in the wrong namespace. It should be `org-clock-*'.

Fixed. I restored original function names.

>
>>  ;;;###autoload
>> -(defun org-columns-insert-dblock ()
>> +(defun org-insert-dblock:columnview ()
>
> Ditto.

Fixed

>
>> -(define-obsolete-function-alias 'org-insert-columns-dblock
>> -  'org-columns-insert-dblock "Org 9.0")
>
> Since you replaced `org-columns-insert-dblock', you need to update the
> alias, not remove it.

Fixed. I restored original function names.

>
> You also need to introduce other aliases for the functions you renamed.
>
>> +(defcustom org-dynamic-block-parameters
>> +  '(("columnview" :function org-insert-dblock:columnview)
>> +("clocktable" :function org-insert-dblock:clocktable))
>
> Why loading them by default? Org clock may not be availa

Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-22 Thread stardiviner

I forgot my patch.

Here it is.

>From a14546b26a085e6f8342341e40e185e75358f306 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 23 Dec 2018 13:35:38 +0800
Subject: [PATCH] * lisp/org.el (org-dynamic-block-insert-dispatch): New
 function.

  (org-dynamic-block-parameters, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-set-parameters,
  org-dynamic-block-get-parameter): New variables, New functions.

* lisp/org-keys.el: (org-dynamic-block-insert-dispatch) New
  functions. (org-clock-report, org-columns-insert-dblock) Remove
  functions.

* doc/org-manual.org: Add manual for dispatch command
  ~org-dynamic-block-insert-dispatch~.
---
 doc/org-manual.org  |  9 ++---
 etc/ORG-NEWS| 14 ++
 lisp/org-clock.el   |  5 +
 lisp/org-colview.el |  6 +-
 lisp/org-keys.el|  6 ++
 lisp/org.el | 46 +
 6 files changed, 78 insertions(+), 8 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index aad190b3b..2f0f5f136 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19926,9 +19926,12 @@ users mailing list, at mailto:emacs-orgmode@gnu.org.
 
 Org supports /dynamic blocks/ in Org documents.  They are inserted
 with begin and end markers like any other code block, but the contents
-are updated automatically by a user function.  For example, {{{kbd(C-c
-C-x C-r)}}} inserts a dynamic table that updates the work time (see
-[[*Clocking Work Time]]).
+are updated automatically by a user function.  You can use dispatch
+command ~org-dynamic-block-insert-dispatch~, which is bind to
+keybinding {{{kbd(C-c C-x i)}}} by default.
+
+For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a
+dynamic table that updates the work time (see [[*Clocking Work Time]]).
 
 Dynamic blocks can have names and function parameters.  The syntax is
 similar to source code block specifications:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index f9bea4b56..16e8884f5 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -40,6 +40,14 @@ arguments no longer imply a "file" result is expected.
 See [[git:3367ac9457]] for details.
 
 ** New features
+*** Add a dispatcher command to insert dynamic blocks
+
+You can add dynamic block into ~org-dynamic-block-parameters~ with
+function ~org-dynamic-block-set-parameters~ just like
+~org-link-set-parameters~. All dynamic blocks in
+~org-dynamic-block-set-parameters~ can be used by
+~org-dynamic-block-insert-dblock~ command.
+
 *** Babel
  Add LaTeX output support in PlantUML
 *** New property =HTML_HEADLINE_CLASS= in HTML export
@@ -79,6 +87,12 @@ system than the main Org document.  For example:
 the corresponding direction by swapping with the adjacent cell.
 
 ** New functions
+*** ~org-dynamic-block-insert-dblock~
+
+Use default keybinding == to run command
+~org-dynamic-block-insert-dblock~.  It will prompt user to select
+dynamic block in ~org-dynamic-block-parameters~.
+
 *** ~org-table-cell-up~
 *** ~org-table-cell-down~
 *** ~org-table-cell-left~
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 1ebfa0201..404d346b3 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2052,6 +2052,11 @@ in the buffer and update it."
 (start (goto-char start)))
   (org-update-dblock))
 
+;;;###autoload
+(org-dynamic-block-set-parameters
+ "clocktable"
+ :function 'org-clock-report)
+
 (defun org-day-of-week (day month year)
   "Returns the day of the week as an integer."
   (nth 6
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 507c58a6a..a1345144f 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1237,7 +1237,7 @@ When PRINTF is non-nil, use it to format the result."
   "Summarize CHECK-BOXES with a check-box cookie."
   (format "[%d/%d]"
 	  (cl-count-if (lambda (b) (or (equal b "[X]")
-  (string-match-p "\\[\\([1-9]\\)/\\1\\]" b)))
+   (string-match-p "\\[\\([1-9]\\)/\\1\\]" b)))
 		   check-boxes)
 	  (length check-boxes)))
 
@@ -1537,6 +1537,10 @@ PARAMS is a property list of parameters:
 		 (id)
   (org-update-dblock))
 
+;;;###autoload
+(org-dynamic-block-set-parameters
+ "columnview"
+ :function 'org-columns-insert-dblock)
 
 
 ;;; Column view in the agenda
diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index bed2f2ad4..5d12ce274 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -49,10 +49,8 @@
 (declare-function org-clock-in "org" (&optional select start-time))
 (declare-function org-clock-in-last "org" (&optional arg))
 (declare-function org-clock-out "org" (&optional switch-to-state fail-quietly at-time))
-(declare-function org-clock-report "org" (&optional arg))
 (declare-function org-clone-subtree-with-time-shift "org" (n &optional shift))
 (declare-function org-columns "org" (&optional global c

Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-23 Thread stardiviner

stardiviner  writes:

I found `make test` report error void function on
`org-dynamic-block-insert-dblock`.

So I removed autoload cookies.

The re-generated patch is in attachment.

>From 96faa0ec9e0849e051542d89a78b376c52ee2ded Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 23 Dec 2018 13:35:38 +0800
Subject: [PATCH] * lisp/org.el (org-dynamic-block-insert-dispatch): New
 function.

  (org-dynamic-block-parameters, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-set-parameters,
  org-dynamic-block-get-parameter): New variables, New functions.

* lisp/org-keys.el: (org-dynamic-block-insert-dispatch) New
  functions. (org-clock-report, org-columns-insert-dblock) Remove
  functions.

* doc/org-manual.org: Add manual for dispatch command
  ~org-dynamic-block-insert-dispatch~.
---
 doc/org-manual.org  |  9 ++---
 etc/ORG-NEWS| 14 ++
 lisp/org-clock.el   |  5 +
 lisp/org-colview.el |  6 +-
 lisp/org-keys.el|  6 ++
 lisp/org.el | 46 +
 6 files changed, 78 insertions(+), 8 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index aad190b3b..2f0f5f136 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19926,9 +19926,12 @@ users mailing list, at mailto:emacs-orgmode@gnu.org.
 
 Org supports /dynamic blocks/ in Org documents.  They are inserted
 with begin and end markers like any other code block, but the contents
-are updated automatically by a user function.  For example, {{{kbd(C-c
-C-x C-r)}}} inserts a dynamic table that updates the work time (see
-[[*Clocking Work Time]]).
+are updated automatically by a user function.  You can use dispatch
+command ~org-dynamic-block-insert-dispatch~, which is bind to
+keybinding {{{kbd(C-c C-x i)}}} by default.
+
+For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a
+dynamic table that updates the work time (see [[*Clocking Work Time]]).
 
 Dynamic blocks can have names and function parameters.  The syntax is
 similar to source code block specifications:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index f9bea4b56..16e8884f5 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -40,6 +40,14 @@ arguments no longer imply a "file" result is expected.
 See [[git:3367ac9457]] for details.
 
 ** New features
+*** Add a dispatcher command to insert dynamic blocks
+
+You can add dynamic block into ~org-dynamic-block-parameters~ with
+function ~org-dynamic-block-set-parameters~ just like
+~org-link-set-parameters~. All dynamic blocks in
+~org-dynamic-block-set-parameters~ can be used by
+~org-dynamic-block-insert-dblock~ command.
+
 *** Babel
  Add LaTeX output support in PlantUML
 *** New property =HTML_HEADLINE_CLASS= in HTML export
@@ -79,6 +87,12 @@ system than the main Org document.  For example:
 the corresponding direction by swapping with the adjacent cell.
 
 ** New functions
+*** ~org-dynamic-block-insert-dblock~
+
+Use default keybinding == to run command
+~org-dynamic-block-insert-dblock~.  It will prompt user to select
+dynamic block in ~org-dynamic-block-parameters~.
+
 *** ~org-table-cell-up~
 *** ~org-table-cell-down~
 *** ~org-table-cell-left~
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 1ebfa0201..531a76d63 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -36,6 +36,7 @@
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-table-goto-line "org-table" (n))
+(declare-function org-dynamic-block-set-parameters "org" (type &rest rest))
 
 (defvar org-frame-title-format-backup frame-title-format)
 (defvar org-time-stamp-formats)
@@ -2052,6 +2053,10 @@ in the buffer and update it."
 (start (goto-char start)))
   (org-update-dblock))
 
+(org-dynamic-block-set-parameters
+ "clocktable"
+ :function 'org-clock-report)
+
 (defun org-day-of-week (day month year)
   "Returns the day of the week as an integer."
   (nth 6
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 507c58a6a..f898c9695 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -41,6 +41,7 @@
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-restriction "org-element" (element))
 (declare-function org-element-type "org-element" (element))
+(declare-function org-dynamic-block-set-parameters "org" (type &rest rest))
 
 (defvar org-agenda-columns-add-appointments-to-effort-sum)
 (defvar org-agenda-columns-compute-summary-properties)
@@ -1237,7 +1238,7 @@ When PRINTF is non-nil, use it to format the result."
   "Summarize CHECK-BOXES with a check-box cookie."
   (format "[%d/%d]"
 	  (cl-count-if (lambda (b) (or (equal b "[X]")
-  (string-match-p "\\[\\([1-9]\\)/\\1\\]" b)))
+		

Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-27 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> The re-generated patch is in attachment.
>
> Thank you!

:)

>
>> ---
>>  doc/org-manual.org  |  9 ++---
>>  etc/ORG-NEWS| 14 ++
>>  lisp/org-clock.el   |  5 +
>>  lisp/org-colview.el |  6 +-
>>  lisp/org-keys.el|  6 ++
>>  lisp/org.el | 46 +
>
> You forgot to mark removed functions, e.g., `org-clock-report', as
> obsolete in "org-compat.el".
>
>>  Org supports /dynamic blocks/ in Org documents.  They are inserted
>>  with begin and end markers like any other code block, but the contents
>> -are updated automatically by a user function.  For example, {{{kbd(C-c
>> -C-x C-r)}}} inserts a dynamic table that updates the work time (see
>> -[[*Clocking Work Time]]).
>> +are updated automatically by a user function.  You can use dispatch
>> +command ~org-dynamic-block-insert-dispatch~, which is bind to
>> +keybinding {{{kbd(C-c C-x i)}}} by default.
>
> which is bound to {{{kbd(C-c C-x i)}}} by default.
>
> Don't forget the #+kindex and #+findex entries above.

Done, I have not really looked the "doc/org-manual.org" seriously. So
have not realized need to add #+kindex and #findex. Added now.

>
>> +(defcustom org-dynamic-block-parameters nil
>> +  "An alist of properties that defines all the Org dynamic blocks."
>
> What is the key of the alist? The possible keywords for the plist? This
> should appear in the docstring.

I improved the docstring. It should be clear now.

>
> So far, only :function is supported. If there is no plan for extending
> that, maybe a plain alist, e.g., ("type" . function) should suffice?
> I.e., isn't mimicking `org-link-set-parameters' a bit too much? WDYT?
>

Indeed, I mimicked `org-link-set-parameters' almost all. About this, I
originally just lazy, now I have a thought about this alist of plist
design, I think adding snippet-like text template string. This idea is
still coarse. I will update this idea in my org agenda todo list.

And I have another reason, I think use same structure can make user feel
comfortable, because it is same as `org-link-set-parameters`. It's a
good reason. If you this is acceptable, I think I would like to keep
this.

>> +(defun org-dynamic-block-insert-dblock (dblock-type)
>> +  "Select and insert an Org type dynamic block DBLOCK-TYPE.
>
> Insert a dynamic block of type DBLOCK-TYPE.

Modified.

>
>> +This is a dispatching function which prompts for the type of
>> +dynamic block to insert."
>
> When used interactively, select the dynamic block types among defined
> types, per `org-dynamic-block-set-parameters'.

Dito

>
> Also, once we agree on the design, would you mind writing some tests?

About test, would you allow me to write it later? I remember I watched
the org clock dynamic block test once, the literal string is complex,
and I remember I used to wrote a test about similar thing. Make me feel
hard. Give me a little time. I will add it. I promise. Can you merge
this at first? (Keep this commit behind, to merge all new commits, might
need to solve conflicts, Huu.) WDYT?

>
> Regards,

:) I found you're kind than I think. If I'm wrong, don't tell me.

At last, present my updated patch. Merry Christmas.

>From e3397a665261bb2c9f9396b16e0100132a3275d5 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 23 Dec 2018 13:35:38 +0800
Subject: [PATCH] * lisp/org.el (org-dynamic-block-insert-dblock): New
 function.

  (org-dynamic-block-parameters, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-set-parameters,
  org-dynamic-block-get-parameter): New variables, New functions.

* lisp/org-keys.el: (org-dynamic-block-insert-dblock) New
  functions. (org-clock-report, org-columns-insert-dblock) Remove
  functions.

* doc/org-manual.org: Add manual for dispatch command
  ~org-dynamic-block-insert-dblock~.
---
 doc/org-manual.org  | 13 +---
 etc/ORG-NEWS| 14 +
 lisp/org-clock.el   |  5 +
 lisp/org-colview.el |  6 +-
 lisp/org-keys.el|  6 ++
 lisp/org.el | 50 +
 6 files changed, 86 insertions(+), 8 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index aad190b3b..817b0ac25 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19926,9 +19926,16 @@ users mailing list, at mailto:emacs-orgmode@gnu.org.
 
 Org supports /dynamic blocks/ in Org documents.  They are inserted
 with begin and end markers like any other code block, but the contents
-are updated automatically by a user function.  For example, {{{kbd(C-c
-C-x C-r)}}} inserts

Re: [O] Org-drill edit feature request

2018-12-27 Thread stardiviner


Leu Zhe  writes:

I want org-drill can add a feature to auto pronounce the word. That's
standard functionality in word-drill Apps.

> Hi,
>
> Making drill editing seems be very painful by the current way
> org-drill offers.
> I make a lot of notes on most of the drilled entries, as for now,
> 1). press e (or other key to reveal the collapsed headlines) , e
> twice to go back to the original buffer.
> 2) add notes. (Even more keys pressing: if i collapsed the headlines
> before calling org-drill, i need to press tab to show all the
> contents at current headline.)
> 3) call org-drill-resume to go back.
>
> I would like to consider more intuitive ways to edit the drill
> entries. How do you think the workflow below?
> 1) press e to switch to edit mode like "helm-swoop", which keeps
> exactly same narrow, child headline showing as before.
> 2) add the notes.
> 3) Ctrl-c Ctrl-s to resume.
>
> Do you think my workflow is more reasonable?
> And i would like to hear more advices about the idea above. Thanks.
>
> LLCC


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] New "next" branch has issue on LaTeX block fontify

2018-12-28 Thread stardiviner

I'm using the "next" branch version Org Mode, but found the LaTeX block has 
fontify issue.

You can see in the attachment screenshot:



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] Org mode at 34C3: my demo + request for help

2018-12-28 Thread stardiviner


I'd like to see a statistics of Org Mode and Emacs users too.

How about use Org Mode to organize the project source code and publish
as Org file?

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] New "next" branch has issue on LaTeX block fontify

2018-12-29 Thread stardiviner


After long time bisect init files, I found which config caused this problem:

~(setq org-highlight-latex-and-related '(latex entities))~

This option caused that fontify issue.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] How about Org Mode invalid link handling strategy for exporting?

2019-01-01 Thread stardiviner
When I use package "ox-epub" to export current Org buffer to EPUB file,
it is based on "ox-html", I got some issues. One issue is about the
external file resource link which can't add into EPUB, or internal link
but invalid (I use narrow to subtree to debug Org buffer when using
ox-epub, so some internal links to other headlines will be invalid).

I hope Org Mode can enhance this invalid link handling strategy to not
interrupt user exporting process. Just display warning to user. Or add
an option to controlled by user?

Because I'm exporting a big Clojure language reference to EPUB, so
really hard to handling those invalid links.

About the handling strategy, I have some ideas:

- raise warning about invalid links no matter internal links or external
  links.

- don't interrupt process when meet invalid links.

- keep link description part as link part. Replace the original link
  part with an empty link.

Do you any ideas?

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2019-01-01 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Indeed, I mimicked `org-link-set-parameters' almost all. About this, I
>> originally just lazy, now I have a thought about this alist of plist
>> design, I think adding snippet-like text template string. This idea is
>> still coarse. I will update this idea in my org agenda todo list.
>
> We are not sure this would end up as a good idea anyway. Meanwhile,
> I think the alist of plists idea is a bit complicated.

Ok, I changed data structure into alist now.

>
>> And I have another reason, I think use same structure can make user feel
>> comfortable, because it is same as `org-link-set-parameters`. It's a
>> good reason.
>
> Org uses a lot of data types in its defcustoms. I don't think there is
> more comfort in sticking to a particular one. OTOH, a simpler structure
> means simpler code.

Ditto

>
> So if we have no other property than :function, I'd rather have a simple
> alist (KEY . FUNCTION). If we ever need more properties, we can change
> the structure, as long as it is in master, it is not set in stone.
>
>> About test, would you allow me to write it later?
>
> No problem. They do not need to be complex, tho.

I added a test by insert clocktable. It's passed.

>
>> At last, present my updated patch. Merry Christmas.
>
> Thank you.
>
>> -are updated automatically by a user function.  For example, {{{kbd(C-c
>> -C-x C-r)}}} inserts a dynamic table that updates the work time (see
>> -[[*Clocking Work Time]]).
>> +are updated automatically by a user function.  You can use dispatch
>> +command ~org-dynamic-block-insert-dblock~, which is bound to
>> +keybinding {{{kbd(C-c C-x i)}}} by default.
>> +
>> +#+kindex: C-c C-x i
>> +#+findex: org-dynamic-block-insert-dblock
>> +Select one type of dynamic block to insert.
>> +
>> +For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a
>> +dynamic table that updates the work time (see [[*Clocking Work
>> Time]]).
>
> by a user function.
>
> #+kindex: C-c C-x x
> #+findex: org-dynamic-block-insert-dblock
> You can insert a dynamic block with ~org-dynamic-block-insert-dblock~,
> which is bound to {{{kbd(C-c C-x i)}}} by default. For example,
> {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a table that
> updates the work time (see [[*Clocking Work Time]]).

Copied.

>
>> +(org-dynamic-block-set-parameters
>> + "clocktable"
>> + :function 'org-clock-report)
>
> The function could be, e.g.,
>
>   (org-dynamic-block-define "clocktable" #'org-clock-report)

Updated.

>
>> +(defun org-dynamic-block-get-parameter (type key)
>> +  "Get TYPE dynamic block property for KEY.
>> +TYPE is a string and KEY is a plist keyword."
>> +  (plist-get
>> +   (cdr (assoc type org-dynamic-block-parameters))
>> +   key))
>
> Simply
>
>   (cdr (assoc type org-dynamic-block-parameters))
>
> if you simplify the structure.

Updated.

>
>> +(defun org-dynamic-block-set-parameters (type &rest parameters)
>> +  "Set dynamic block TYPE properties to PARAMETERS.
>> +PARAMETERS should be :key val pairs.
>> +The key is usually is `:function', and the value is a function name symbol."
>> +  (let ((data (assoc type org-dynamic-block-parameters)))
>> +(if data (setcdr data (org-combine-plists (cdr data) parameters))
>> +  (push (cons type parameters) org-dynamic-block-parameters
>
> Ditto. It could be
>
> (defun org-dynamic-block-define (type fun)
>   (push (cons type fun) org-dynamic-block-parameters))

Updated.

>
>> +(defun org-dynamic-block-types ()
>> +  "Return a list of known dynamic block types."
>> +  (mapcar #'car org-dynamic-block-parameters))
>> +
>> +(defun org-dynamic-block-functions ()
>> +  "Return a list of functions that are called to insert dynamic block."
>> +  (cl-loop for dblock in org-dynamic-block-parameters
>> +   with insert-func
>> +   do (setq insert-func (org-dynamic-block-get-parameter (car 
>> dblock) :function))
>> +   if insert-func
>> +   collect insert-func))
>
> Is this function necessary?

Updated.

>
>> +(defun org-dynamic-block-insert-dblock (dblock-type)
>> +  "Insert a dynamic block of type DBLOCK-TYPE.
>> +When used interactively, select the dynamic block types among
>> +defined types, per `org-dynamic-block-set-parameters'."
>> +  (interactive (list (completing-read "dynamic block: "
&

Re: [O] Org-drill edit feature request

2019-01-03 Thread stardiviner


John Kitchin  writes:

> My experience with this is that you have to get the word by some means
> (e.g. it is a property, or it is selected some how) and then send it to
> a platform specific speech program. It is easy on a mac as there is a
> command line tool called "say". So, something like this
>
> (shell-command "say \"Hello\")
>
> will say the word Hello out loud. I guess there are windows and linux
> equivalents.
>

Indeed have similar command under Linux. The trouble is how to get the
word every time org-drill change word when in recite single word mode.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2019-01-03 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> As always, add patch as attachment.
>
> Thank you! I applied your patch, with minor tweaks.
>
> Regards,

Thanks Nicolas.

I will continue contribute in Org Mode.


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [SOLVED] How about Org Mode invalid link handling strategy for exporting?

2019-01-03 Thread stardiviner


I have not found that option. Thanks.

I checked the org-manual.org now, it's mentioned.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [FEATURE] exporting with write partially to solve big Org file slowing exporting

2019-01-03 Thread stardiviner


When I export a big Org file which is a big reference has about 36285
lines to epub format through package "ox-epub". I found it write to HTML
is very slow.

Is there any solution to solve this?

I guess this could be Org exporter problem. If Org exporter can write
partly to file one by one. it will be better.

If you have any other idea, please tell me. Thanks.

Regards.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] [PATCH] fix org-num-mode detect enabled already issue

2019-01-05 Thread stardiviner


When I execute command `[M-x org-mode]` on an Org buffer which is
already have `org-num-mode` enabled. It will re-generate overlay.

Here is a quick patch:

modified   lisp/org-num.el
@@ -438,17 +438,16 @@ NUMBERING is a list of numbers."
 (define-minor-mode org-num-mode
   "Dynamic numbering of headlines in an Org buffer."
   :lighter " o#"
-  (cond
-   (org-num-mode
+  (if org-num-mode
+  (progn
+   (mapc #'delete-overlay org-num--overlays)
+   (setq org-num--overlays nil)
+   (remove-hook 'after-change-functions #'org-num--verify t))
 (unless (derived-mode-p 'org-mode)
   (user-error "Cannot activate headline numbering outside Org mode"))
 (setq org-num--numbering nil)
 (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
-(add-hook 'after-change-functions #'org-num--verify nil t))
-   (t
-(mapc #'delete-overlay org-num--overlays)
-(setq org-num--overlays nil)
-(remove-hook 'after-change-functions #'org-num--verify t
+    (add-hook 'after-change-functions #'org-num--verify nil t)))

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Org-drill broken with Org 9.2

2019-01-06 Thread stardiviner


Confirmed, I got same problem.

I'm using the latest master branch of Org source code.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [PATCH] fix org-num-mode detect enabled already issue

2019-01-06 Thread stardiviner

Here is the screenshot which can demostrate this issue:



And here is the steps to reproduce this issue:

my config:

(require 'org-num)
(setq org-num-skip-footnotes t)
(add-hook 'org-mode-hook #'org-num-mode)

1. Then open an Org file, it has `org-num-mode` enabled because upper
   config added to hook.

2. Execute command with `[M-x org-mode]` again, then it will become as
   in screenshot.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] [PATCH] fix org-num-mode detect enabled already issue

2019-01-06 Thread stardiviner


I fixed my previous patch which work in reverse direction.

modified   lisp/org-num.el
@@ -438,17 +438,16 @@ NUMBERING is a list of numbers."
 (define-minor-mode org-num-mode
   "Dynamic numbering of headlines in an Org buffer."
   :lighter " o#"
-  (cond
-   (org-num-mode
-(unless (derived-mode-p 'org-mode)
-  (user-error "Cannot activate headline numbering outside Org mode"))
-(setq org-num--numbering nil)
-(setq org-num--overlays (nreverse (org-num--number-region nil nil)))
-(add-hook 'after-change-functions #'org-num--verify nil t))
-   (t
+  (if org-num-mode
+  (progn
+   (unless (derived-mode-p 'org-mode)
+ (user-error "Cannot activate headline numbering outside Org mode"))
+   (setq org-num--numbering nil)
+   (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
+   (add-hook 'after-change-functions #'org-num--verify nil t))
 (mapc #'delete-overlay org-num--overlays)
 (setq org-num--overlays nil)
-(remove-hook 'after-change-functions #'org-num--verify t
+(remove-hook 'after-change-functions #'org-num--verify t)))
 

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] recently header argument :file does not respect :dir anymore

2019-01-08 Thread stardiviner


For example, like this source block:

#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file 
"awesome-cl-software/README.md" :async
if [ -d awesome-cl-software ]; then
  cd awesome-cl-software ; git pull
else
  git clone --recursive https://github.com/azzamsa/awesome-cl-software.git 
awesome-cl-software
fi
#+end_src

It will report no directory or file "awesome-cl-software/README.md".

A few days ago, it works. But now, I have to specify dir in ~:file~ too, like 
this:

#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file 
"data/code/awesome-cl-software/README.md" :async
if [ -d awesome-cl-software ]; then
  cd awesome-cl-software ; git pull
else
  git clone --recursive https://github.com/azzamsa/awesome-cl-software.git 
awesome-cl-software
fi
#+end_src

#+RESULTS[<2019-01-09 09:20:17> 1cce5f5d251b5bf7b32b1db410185ee6b9a80fde]:
[[file:data/code/awesome-cl-software/README.md]]

I checked out recently Git commits, but have not found any commits
related to ~:dir~. Only found one change on ~:file~ and ~:file-ext~
related with ~:results file~. I checked, it's hasn't changed ~:dir~
neither.


And also, I hope ~:tangle~ can respect ~:dir~ header argument too.

Like this example:

#+begin_src clojure :dir "data/code/clj-crawler-demo" :tangle 
"src/clj_crawler_demo/core.clj"
(ns clj-crawler-demo.core
  (:require [clj-http.client :as http])
  (:require [net.cgrand.enlive-html :as html]))

(html/select
 (-> (http/get "https://www.baidu.com";)
 :body
 html/html-snippet)
 [:div])
#+end_src

Why need this? If ~:tangle~ respect ~:dir~, it will don't need the complete 
path to
tangled file. And when the source block has other header argument need dir like
~:file~, this will make ~:tangle~ and other related header arguments shorter.

WDYT?

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] exporting code blocks with continued line numbers?

2019-01-08 Thread stardiviner


This solved a problem in my todo list. Thanks for sharing. John.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [PATCH] Add feature to org-drill to auto pronounce word

2019-01-09 Thread stardiviner
I spend a little time to check out org-drill source code, to find out
where I can insert hook to run function when presenting word.

Then I finally found the place in ~org-drill-entry~. Here is my patch.

>From 81765e9395f5c0bec21d44aeaf16919d35a39eee Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Wed, 9 Jan 2019 16:25:38 +0800
Subject: [PATCH] org-drill.el: Add feature let org-drill auto pronounce

* contrib/lisp/org-drill.el (org-drill-entry,
  org-drill-entry-before-hook, org-drill-entry-after-hook): Add two
  hooks around ~org-drill-entry~.
  (org-drill-auto-pronounce): option to toggle this functionality.
  (org-drill-pronounce-word): The real function to pronounce word.
  (org-drill-hide-subheadings-if): fix issue in Org 9.2 version.

* etc/ORG-NEWS: mentioned this new feature.
---
 contrib/lisp/org-drill.el | 31 ++-
 etc/ORG-NEWS  |  3 +++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
index c7f509bff..29a0cd8c9 100644
--- a/contrib/lisp/org-drill.el
+++ b/contrib/lisp/org-drill.el
@@ -1486,7 +1486,7 @@ the current topic."
 (funcall test))
  (hide-subtree))
(push (point) drill-sections)))
-   "" 'tree))
+   nil 'tree))
 (reverse drill-sections)))
 
 
@@ -2163,6 +2163,33 @@ If ANSWER is supplied, set the global variable `drill-answer' to its value."
 (prog1 (org-drill-presentation-prompt)
   (org-drill-hide-subheadings-if 'org-drill-entry-p)
 
+(defcustom org-drill-entry-before-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-entry-after-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-auto-pronounce t
+  "Auto pronounce org-drill word if non-nil."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'org-drill)
+
+(defun org-drill-pronounce-word ()
+  "Pronounce word after querying."
+  (if org-drill-auto-pronounce
+  (shell-command-to-string
+   (format "%s %s %s &"
+	   org-drill-pronounce-command org-drill-pronounce-command-args
+	   (shell-quote-argument
+		(substring-no-properties
+		 (org-get-heading 'no-tags 'no-todo 'no-priority 'no-comment)))
+
+(add-hook 'org-drill-entry-after-hook #'org-drill-pronounce-word)
 
 (defun org-drill-entry ()
   "Present the current topic for interactive review, as in `org-drill'.
@@ -2202,6 +2229,7 @@ See `org-drill' for more details."
'org-drill-present-default-answer)
  present-empty-cards (third presentation-fn)
  presentation-fn (first presentation-fn)))
+	  (run-hook-with-args 'org-drill-entry-before-hook)
   (prog1
   (cond
((null presentation-fn)
@@ -2223,6 +2251,7 @@ See `org-drill' for more details."
   (save-excursion
 (funcall answer-fn
  (lambda () (org-drill-reschedule
+	(run-hook-with-args 'org-drill-entry-after-hook)
 (org-remove-latex-fragment-image-overlays)))
 
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e06d0c09b..1bb485ad1 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -49,6 +49,9 @@ alternative was removed and there is no more a :use-xcolor options
 since now it's implicitly always true.
 
 ** New features
+*** Org-drill support auto pronounce word
+You can set option ~org-drill-auto-pronounce~ to ~t~ to enable it
+(This is default). You can disable it by setting it to ~nil~.
 *** Add a dispatcher command to insert dynamic blocks
 
 You can add dynamic block into ~org-dynamic-block-alist~ with function
-- 
2.20.1



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-09 Thread stardiviner

stardiviner  writes:

> The ob-clojure tangle will insert ~(ns ..)~ from babel header argument :ns or 
> use defualt ~(ns user)~.
>
>#+begin_src clojure :eval no :ns "" :tangle 
> "data/code/xunfei-clj-demo/project.clj" :results link :file 
> "data/code/xunfei-clj-demo/project.clj"
>(defproject xunfei-clj-demo "0.1.0-SNAPSHOT"
>  :description "xunfei-clj demo"
>  :url "http://example.com/FIXME";
>  :license {:name "Eclipse Public License"
>:url  "http://www.eclipse.org/legal/epl-v10.html"}
>  :dependencies [[org.clojure/clojure "1.9.0"]
> [xunfei-clj "0.1.4-SNAPSHOT"]]
>  :resource-paths ["lib/Msc.jar"])
>#+end_src
>
> In upper case, obviously I don't want insert the ~(ns ..)~ line of code.
>
> I hope the ob-clojure header argument ~:ns~ should detect value like
> "nil", "" (empty string) or something else. Or when ~:ns~ header
> argument is not specified. So that the tangling will not auto insert
> ~(ns ..)~ line.

I added an patch to detect :ns is not specified which is `nil'. This
will be better for tangling.

>From 749e85a30ca6226c4b3aaef85ae0d72b51d6018e Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 10 Jan 2019 09:34:39 +0800
Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
 statement

* lisp/ob-clojure.el: (org-babel-expand-body:clojure,
  org-babel-header-args:clojure): whether auto prepend Clojure (ns ..)
  statement depend on whether have :ns header argument specified.

* etc/ORG-NEWS: mentioned this changed in ORG-NEWS.
---
 etc/ORG-NEWS   |  5 +
 lisp/ob-clojure.el | 34 +++---
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1bb485ad1..2eea00d97 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 * Version 9.3
 
 ** Incompatible changes
+*** ob-clojure will not auto prepend ~(ns ..)~ statement now
+When tangling, user usually just want to tangle literally code instead
+of prepend inserting a ~(ns ..)~ statement before source block
+code. Now, when you have no ~:ns~ header argument specified, this
+behavior will not happend automatically.
 *** Change in behavior on exit from an Org edit buffer
 Org will no longer attempt to restore the window configuration in the
 frame to which the user returns after editing a source block with
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 2088ab375..55a4c3eb4 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -63,7 +63,11 @@
 (add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
 
 (defvar org-babel-default-header-args:clojure '())
-(defvar org-babel-header-args:clojure '((package . :any)))
+(defvar org-babel-header-args:clojure '((package . :any))
+  "For the :ns header argument, when you don't specify it, it
+  will not auto prepend (ns ..) statement before source block
+  code. If you have a :ns specified, the (ns ..) statement will
+  be auto prepended before source block code.")
 
 (defcustom org-babel-clojure-sync-nrepl-timeout 10
   "Timeout value, in seconds, of a Clojure sync call.
@@ -103,20 +107,20 @@ If the value is nil, timeout is disabled."
 	 (result-params (cdr (assq :result-params params)))
 	 (print-level nil)
 	 (print-length nil)
-	 (body
-	  (org-trim
-	   (format "(ns %s)\n%s"
-		   ;; Source block specified namespace :ns.
-		   ns
-		   ;; Variables binding.
-		   (if (null vars) (org-trim body)
-		 (format "(let [%s]\n%s)"
-			 (mapconcat
-			  (lambda (var)
-(format "%S (quote %S)" (car var) (cdr var)))
-			  vars
-			  "\n  ")
-			 body))
+	 (body (org-trim
+		(concat
+		 ;; Source block specified namespace :ns.
+		 (if (not (null (cdr (assq :ns params
+		 (format "(ns %s)\n" ns))
+		 ;; Variables binding.
+		 (if (null vars) (org-trim body)
+		   (format "(let [%s]\n%s)"
+			   (mapconcat
+			(lambda (var)
+			  (format "%S (quote %S)" (car var) (cdr var)))
+			vars
+			    "\n  ")
+			   body))
 (if (or (member "code" result-params)
 	(member "pp" result-params))
 	(format "(clojure.pprint/pprint (do %s))" body)
-- 
2.20.1



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] manual: stale bindings for org-clock-report and org-columns-insert-dblock

2019-01-11 Thread stardiviner


Kyle Meyer  writes:

> Hello,
>
> 34b71a0ca (Add a dispatcher command for inserting dynamic blocks,
> 2018-12-23) removed the key bindings of org-clock-report and
> org-columns-insert-dblock, but these bindings are still listed in
> org-manual.org.  stardiviner, could you please have a look at updating
> the manual to fully capture the changes from 34b71a0ca?  I think it'd
> also be good to mention these removed key bindings in ORG-NEWS.
>
> Thanks.

You're right, I have not noticed them. I will add a patch to submit
soon. Thanks for your mention, Kyle.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-13 Thread stardiviner

I updated the patch by adding a test.

With command "make test" I got:

```
Tangled 0 code blocks from babel.org
   passed  132/828  ob-tangle/no-excessive-id-insertion-on-tangle
   passed  133/828  ob-test/org-babel-combine-header-arg-lists
   failed  134/828  org-missing-dependency/test-ob-R
   failed  135/828  org-missing-dependency/test-ob-clojure
   failed  136/828  org-missing-dependency/test-ob-eshell
   failed  137/828  org-missing-dependency/test-ob-lua
   failed  138/828  org-missing-dependency/test-ob-maxima
   failed  139/828  org-missing-dependency/test-ob-plantuml
   failed  140/828  org-missing-dependency/test-ob-ruby
   failed  141/828  org-missing-dependency/test-ob-scheme
   failed  142/828  org-missing-dependency/test-ob-vala
   failed  143/828  org-missing-dependency/test-org-attach-annex
   failed  144/828  org-missing-dependency/test-org-protocol
   passed  145/828  test-ob-exp/org-babel-exp-src-blocks/w-no-file
   passed  146/828  test-ob-exp/org-babel-exp-src-blocks/w-no-headers
   passed  147/828  test-ob-exp/org-babel-exp-src-blocks/w-no-headers2
executing Emacs-Lisp code block...
```

With command:

$ make BTEST_RE="ob-clojure/tangle-without-ns" test-dirty

I got:

```
Loading 
/home/stardiviner/Code/Emacs/org-mode/testing/lisp/test-property-inheritance.el 
(source)...
selected tests: ob-clojure/tangle-without-ns
Running 0 tests (2019-01-14 13:27:58+0800)

Ran 0 tests, 0 results as expected (2019-01-14 13:27:58+0800)

make cleantest
```

I don't know why it report missing requirement, so the test failed.

Nicolas, do you have any idea why this? You can check out the test code.

>From 8a64ccf659afcbd510e69eaa4ac175946f1ae311 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 10 Jan 2019 09:34:39 +0800
Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
 statement

* lisp/ob-clojure.el: (org-babel-expand-body:clojure,
  org-babel-header-args:clojure): whether auto prepend Clojure (ns ..)
  statement depend on whether have :ns header argument specified.

* etc/ORG-NEWS: mentioned this changed in ORG-NEWS.

* testing/test-ob-clojure.el: add a test for tangled clojure code
  without (ns ..).
---
 etc/ORG-NEWS|  5 +
 lisp/ob-clojure.el  | 34 ++---
 testing/lisp/test-ob-clojure.el | 14 ++
 3 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1bb485ad1..2eea00d97 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 * Version 9.3
 
 ** Incompatible changes
+*** ob-clojure will not auto prepend ~(ns ..)~ statement now
+When tangling, user usually just want to tangle literally code instead
+of prepend inserting a ~(ns ..)~ statement before source block
+code. Now, when you have no ~:ns~ header argument specified, this
+behavior will not happend automatically.
 *** Change in behavior on exit from an Org edit buffer
 Org will no longer attempt to restore the window configuration in the
 frame to which the user returns after editing a source block with
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 2088ab375..55a4c3eb4 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -63,7 +63,11 @@
 (add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
 
 (defvar org-babel-default-header-args:clojure '())
-(defvar org-babel-header-args:clojure '((package . :any)))
+(defvar org-babel-header-args:clojure '((package . :any))
+  "For the :ns header argument, when you don't specify it, it
+  will not auto prepend (ns ..) statement before source block
+  code. If you have a :ns specified, the (ns ..) statement will
+  be auto prepended before source block code.")
 
 (defcustom org-babel-clojure-sync-nrepl-timeout 10
   "Timeout value, in seconds, of a Clojure sync call.
@@ -103,20 +107,20 @@ If the value is nil, timeout is disabled."
 	 (result-params (cdr (assq :result-params params)))
 	 (print-level nil)
 	 (print-length nil)
-	 (body
-	  (org-trim
-	   (format "(ns %s)\n%s"
-		   ;; Source block specified namespace :ns.
-		   ns
-		   ;; Variables binding.
-		   (if (null vars) (org-trim body)
-		 (format "(let [%s]\n%s)"
-			 (mapconcat
-			  (lambda (var)
-(format "%S (quote %S)" (car var) (cdr var)))
-			  vars
-			  "\n  ")
-			 body))
+	 (body (org-trim
+		(concat
+		 ;; Source block specified namespace :ns.
+		 (if (not (null (cdr (assq :ns params
+		 (format "(ns %s)\n" ns))
+		 ;; Variables binding.
+		 (if (null vars) (org-trim body)
+		   (format "(let [%s]\n%s)"
+			   (mapconcat
+			(lambda (var)
+			  (format "%S (quote %S)" (car var) (cdr var)))
+			vars
+			"\n  ")
+			   body))
 (if (or (member &q

Re: [O] [Patch] [Feature request] Add option to natively fontify latex snippets and environment

2019-01-14 Thread stardiviner


Carlos Pita  writes:

> Hi Nicolas,
>
> I was thinking that maybe it would be nicer to make this depend on the
> value of org-src-fontify-natively. What do you think?
>
> Regards

I don't think so. BTW, I found this patch cause my Org Mode buffer
fontify error.

After some raw latex block, all following fontify wrong. This is
happened when I use latest master branch a few days ago. I disable the
option to disable this fontify. I have `org-src-fontify-natively`
enabled by default. It might cause my Org Mode buffer fontify failed
again.

At least, I think this patch should need more test.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] [SOLVED] Re: recently header argument :file does not respect :dir anymore

2019-01-15 Thread stardiviner


This is solved, I found this problem is on package "ob-async" can't
handled the :dir correctly. And it's fixed in latest ob-async now.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] How to pass shell command result to :post source-block?

2019-01-18 Thread stardiviner
I want to processing the shell ANSI escaping characters correctly or
just filter them out for display result correctly in Emacs.

Here is my try:

#+NAME: ansi-escape-filter
#+begin_src emacs-lisp
(ansi-color-apply-on-region (point-min) (point-max))
#+end_src

#+begin_src sh :dir /sudo:: :post ansi-escape-filter
sudo tree /var/spool/postfix/
#+end_src

#+RESULTS[<2019-01-19 10:58:39> f6d16244322abbd4fbe01bfaa084ac6bdd66a62c]:
: nil

The second source block's result is supposed to be result of command
=sudo tree /var/spool/postfix/= instead of =nil=.

Can someone help me how to do this correctly?

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [SOLVED] Re: How to pass shell command result to :post source-block?

2019-01-18 Thread stardiviner
I solved my own problem.

Here is the complete code:

#+NAME: ansi-escape-filter
#+begin_src emacs-lisp :var data=""
(with-temp-buffer
  (insert data)
  (ansi-color-apply-on-region (point-min) (point-max))
  (buffer-substring-no-properties (point-min) (point-max)))
#+end_src

#+begin_src sh :dir /sudo:: :post ansi-escape-filter(data=*this*) :results 
output
sudo tree /var/spool/postfix/
#+end_src

#+RESULTS[<2019-01-19 11:12:30> b3add6b3fce7b13d8c63ef78d92b311cc919d300]:
#+begin_example
/var/spool/postfix/
├── active
├── bounce
├── corrupt
├── defer
│   ├── 6
│   ├── 8
│   ├── A
│   ├── B
│   │   └── BDD0D201C2A
│   ├── D
│   └── F
├── deferred
│   ├── 6
│   ├── 8
│   ├── A
│   ├── B
│   ├── D
│   └── F
├── flush
├── hold
├── incoming
├── maildrop
├── pid
│   ├── master.pid
│   ├── unix.bounce
│   ├── unix.cleanup
│   ├── unix.defer
│   ├── unix.showq
│   └── unix.smtp
├── private
│   ├── anvil
│   ├── bounce
│   ├── defer
│   ├── discard
│   ├── error
│   ├── lmtp
│   ├── local
│   ├── proxymap
│   ├── proxywrite
│   ├── relay
│   ├── retry
│   ├── rewrite
│   ├── scache
│   ├── smtp
│   ├── tlsmgr
│   ├── trace
│   ├── verify
│   └── virtual
├── public
│   ├── cleanup
│   ├── flush
│   ├── pickup
│   ├── qmgr
│   └── showq
├── saved
└── trace

26 directories, 30 files
#+end_example


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] How to pass shell command result to :post source-block?

2019-01-19 Thread stardiviner


Ihor Radchenko  writes:

> See the code below:
>
> #+NAME: ansi-escape-filter
> #+begin_src emacs-lisp :var data=""
> (with-temp-buffer
>   (insert data)
>   (ansi-color-apply-on-region (point-min) (point-max))
>   (buffer-string))
> #+end_src
>
> #+RESULTS: ansi-escape-filter
>
> #+begin_src sh :dir /sudo::  :results output :post  
> ansi-escape-filter(data=*this*)
> tree /var/spool/postfix/
> #+end_src
>
> `:results output` is needed to avoid parsing the shell output as a
> table.
> `data=*this*` is needed to pass the output to `ansi-escape-filter`. You
> can also check the example in the org info page for the :post header
> argument.
>
>
> Best,
> Ihor
>

Thanks for your detailed explanation. After your hint, I just checked
out =org-manual.org= about the Post-processing :post example. It's a
good example.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [PATCH] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-20 Thread stardiviner
After few days later, I re-run "make test", it's fine now.

6 unexpected results:
   FAILED  ob-D/inhomogeneous_table
   FAILED  ob-D/list-list-var
   FAILED  ob-D/list-var
   FAILED  ob-D/vector-var
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-colview/columns-width

Because few days passed, make sure the patch is the latest version. I
attached my patch again.

>From 8a64ccf659afcbd510e69eaa4ac175946f1ae311 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 10 Jan 2019 09:34:39 +0800
Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
 statement

* lisp/ob-clojure.el: (org-babel-expand-body:clojure,
  org-babel-header-args:clojure): whether auto prepend Clojure (ns ..)
  statement depend on whether have :ns header argument specified.

* etc/ORG-NEWS: mentioned this changed in ORG-NEWS.

* testing/test-ob-clojure.el: add a test for tangled clojure code
  without (ns ..).
---
 etc/ORG-NEWS|  5 +
 lisp/ob-clojure.el  | 34 ++---
 testing/lisp/test-ob-clojure.el | 14 ++
 3 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1bb485ad1..2eea00d97 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 * Version 9.3
 
 ** Incompatible changes
+*** ob-clojure will not auto prepend ~(ns ..)~ statement now
+When tangling, user usually just want to tangle literally code instead
+of prepend inserting a ~(ns ..)~ statement before source block
+code. Now, when you have no ~:ns~ header argument specified, this
+behavior will not happend automatically.
 *** Change in behavior on exit from an Org edit buffer
 Org will no longer attempt to restore the window configuration in the
 frame to which the user returns after editing a source block with
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 2088ab375..55a4c3eb4 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -63,7 +63,11 @@
 (add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
 
 (defvar org-babel-default-header-args:clojure '())
-(defvar org-babel-header-args:clojure '((package . :any)))
+(defvar org-babel-header-args:clojure '((package . :any))
+  "For the :ns header argument, when you don't specify it, it
+  will not auto prepend (ns ..) statement before source block
+  code. If you have a :ns specified, the (ns ..) statement will
+  be auto prepended before source block code.")
 
 (defcustom org-babel-clojure-sync-nrepl-timeout 10
   "Timeout value, in seconds, of a Clojure sync call.
@@ -103,20 +107,20 @@ If the value is nil, timeout is disabled."
 	 (result-params (cdr (assq :result-params params)))
 	 (print-level nil)
 	 (print-length nil)
-	 (body
-	  (org-trim
-	   (format "(ns %s)\n%s"
-		   ;; Source block specified namespace :ns.
-		   ns
-		   ;; Variables binding.
-		   (if (null vars) (org-trim body)
-		 (format "(let [%s]\n%s)"
-			 (mapconcat
-			  (lambda (var)
-(format "%S (quote %S)" (car var) (cdr var)))
-			  vars
-			  "\n  ")
-			 body))
+	 (body (org-trim
+		(concat
+		 ;; Source block specified namespace :ns.
+		 (if (not (null (cdr (assq :ns params
+		 (format "(ns %s)\n" ns))
+		 ;; Variables binding.
+		 (if (null vars) (org-trim body)
+		   (format "(let [%s]\n%s)"
+			   (mapconcat
+			(lambda (var)
+			  (format "%S (quote %S)" (car var) (cdr var)))
+			vars
+			"\n  ")
+			   body))
 (if (or (member "code" result-params)
 	(member "pp" result-params))
 	(format "(clojure.pprint/pprint (do %s))" body)
diff --git a/testing/lisp/test-ob-clojure.el b/testing/lisp/test-ob-clojure.el
index f917ca4cc..a5391dcb3 100644
--- a/testing/lisp/test-ob-clojure.el
+++ b/testing/lisp/test-ob-clojure.el
@@ -71,6 +71,20 @@
 (should (string=
 	 ": 1"
 	 (buffer-substring-no-properties (point-at-bol) (point-at-eol))
+(ert-deftest ob-clojure/tangle-without-ns ()
+  (org-test-with-temp-text
+   "#+begin_src clojure :tangle /tmp/test.clj
+(print 1)
+#+end_src"
+   (org-babel-next-src-block)
+   (org-babel-tangle)
+   (should
+    (string=
+ "(print 1)
+"
+ (with-temp-buffer
+   (insert-file-contents "/tmp/test.clj")
+   (buffer-substring-no-properties (point-min) (point-max)))
 
 (provide 'test-ob-clojure)
 
-- 
2.20.1



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] [PATCH] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-21 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> From 8a64ccf659afcbd510e69eaa4ac175946f1ae311 Mon Sep 17 00:00:00 2001
>> From: stardiviner 
>> Date: Thu, 10 Jan 2019 09:34:39 +0800
>> Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
>>  statement
>
> Applied, with tiny changes. Thank you.

Thanks as always, Nicolas.

>
> Regards,


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] ob-clojure with tangling current broken

2019-01-21 Thread stardiviner


Frederick Giasson  writes:

> Hi,
>
> I updated org-mode to latest dev version recently and I was wondering why I 
> was
> seeing namespaces appended to each [clojure] code block I was tangling (which
> generates unusable tangled Clojure source files)


That's why I added a patch recently. Now Nicolas already applied my
patch. You should already seen it now.

>
> It turns out that the culprit is the following line:
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-clojure.el#L108
>
> I am wondering why is there such code injection in
> "org-babel-expand-body:clojure". It looks like to be related to the Clojure 
> code
> block execution, but it also appears to be called from the tangling function.
> Clearly those two different use cases needs to be properly handled at the 
> level
> of "ob-clojure.el"
>

Expanding clojure code is necessary to tangling, because when user have
noweb reference etc in source block, expanding here is necessary.

> I didn't follow all the changes to the "ob-clojure" mode in the last year or 
> so,
> so please pardon my ignorance if the module is taking a different direction 
> than
> I am used to. Is there a rational behind this behaviour or is there a new 
> feature
> that I am not aware of which properly handle those two use cases?
>

Which part you don't understand, I might can answer your question,
because I did most of those changes in last year.

> Thanks,
>
> Take care,
>
> Fred


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] ob-clojure with tangling current broken

2019-01-22 Thread stardiviner


Frederick Giasson  writes:

> Hi,
>
>  That's why I added a patch recently. Now Nicolas already applied my
>  patch. You should already seen it now.
>
> Yeah I just received that email right after I sent mine. Didn't know it was 
> in the pipeline, I just re-subscribed to the mailing list.
>  
>  >
>  > It turns out that the culprit is the following line:
>  > https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-clojure.el#L108
>  >
>  > I am wondering why is there such code injection in
>  > "org-babel-expand-body:clojure". It looks like to be related to the 
> Clojure code
>  > block execution, but it also appears to be called from the tangling 
> function.
>  > Clearly those two different use cases needs to be properly handled at the 
> level
>  > of "ob-clojure.el"
>  >
>
>  Expanding clojure code is necessary to tangling, because when user have
>  noweb reference etc in source block, expanding here is necessary.
>
> Yes, that is right. What I was referring to I guess is to handle that case 
> (tangling vs. code block execution within Emacs), which is what this patch is 
> about,
> thanks!
>  
>  
>  > I didn't follow all the changes to the "ob-clojure" mode in the last year 
> or so,
>  > so please pardon my ignorance if the module is taking a different 
> direction than
>  > I am used to. Is there a rational behind this behaviour or is there a new 
> feature
>  > that I am not aware of which properly handle those two use cases?
>  >
>
>  Which part you don't understand, I might can answer your question,
>  because I did most of those changes in last year.
>
> The only thing I meant here is that the last time I looked into this code, it 
> was quite different, you guys appears to have worked a lot on it.
>
> Another thing I discovered is the =ob-clojure-literate=, but even after 
> reading its [sparse] doc and its code, I am not sure what it concretely adds 
> to =ob-clojure=
>
> Thanks for this work!

Well, about this, you can read related things, here is the original
repo: https://github.com/stardiviner/ob-clojure-literate. In the README,
I describe my motivation.

Before CIDER added "sesman" session manager, CIDER was not able to
manage sessions easily. But ob-clojure need a session. So I created it,
then I added some thing that I need for Clojure literate programming in
Org Mode.

About this extra library, here is what I think, keep it for a while,
until no one or very rare use it, I will remove it from Org Mode
contrib. Until now, no one except you asked me about what it is.

BTW, I migrated some features into core/ob-clojure.el already, like
session initialization. Specify session.

Here is the list I collate right now.

- [X] auto start REPL if necessary
  - [X] It's taken by CIDER sesman [Commit 2c5df17ed]
- [X] use default session
  - [X] It's taken by CIDER sesman, now can easily switch session.
- [ ] specify session in header argument :session, Org Babel has =[C-c C-v C-j]=
  by default.
  - [ ] provide interactive completion candidates of CIDER REPL connections
- [X] initiate session =[C-c C-v z]= [Commit 4456dc880]
  - [X] CIDER use sesman to manage REPL session now.
- [ ] support ob-core.el switch to corresponding session REPL buffer =[C-c C-v 
z]=
- [X] dynamic clojure ns [Commit d7e12d1df]
  - [X] implemented with ~:ns~ header argument [Commit d7e12d1df]
- [X] generate plot image in specific directory
  - [X] pass dir as variable into Clojure code
- [X] org babel support graphics image file link as result [Commit b088389c6]
  - [X] I add this header argument value in commit already. [Commit 296b0de4e]

If you want to read ob-clojure-literate.el source code, I suggest you
read one commit by one. It will be much clear. You can search my name
"stardiviner" and filter commits with "ob-clojure,ob-clojure-literate"
in log.

>
> Take care,
>
> Fred

Hope this will help you, Regards.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [PATCH] Add feature to org-drill to auto pronounce word

2019-01-24 Thread stardiviner


A gentle ping..

stardiviner  writes:

> I spend a little time to check out org-drill source code, to find out
> where I can insert hook to run function when presenting word.
>
> Then I finally found the place in ~org-drill-entry~. Here is my patch.
>
> From 81765e9395f5c0bec21d44aeaf16919d35a39eee Mon Sep 17 00:00:00 2001
> From: stardiviner 
> Date: Wed, 9 Jan 2019 16:25:38 +0800
> Subject: [PATCH] org-drill.el: Add feature let org-drill auto pronounce
>
> * contrib/lisp/org-drill.el (org-drill-entry,
>   org-drill-entry-before-hook, org-drill-entry-after-hook): Add two
>   hooks around ~org-drill-entry~.
>   (org-drill-auto-pronounce): option to toggle this functionality.
>   (org-drill-pronounce-word): The real function to pronounce word.
>   (org-drill-hide-subheadings-if): fix issue in Org 9.2 version.
>
> * etc/ORG-NEWS: mentioned this new feature.
> ---
>  contrib/lisp/org-drill.el | 31 ++-
>  etc/ORG-NEWS  |  3 +++
>  2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
> index c7f509bff..29a0cd8c9 100644
> --- a/contrib/lisp/org-drill.el
> +++ b/contrib/lisp/org-drill.el
> @@ -1486,7 +1486,7 @@ the current topic."
>  (funcall test))
>   (hide-subtree))
> (push (point) drill-sections)))
> -   "" 'tree))
> +   nil 'tree))
>  (reverse drill-sections)))
>  
>  
> @@ -2163,6 +2163,33 @@ If ANSWER is supplied, set the global variable 
> `drill-answer' to its value."
>  (prog1 (org-drill-presentation-prompt)
>(org-drill-hide-subheadings-if 'org-drill-entry-p)
>  
> +(defcustom org-drill-entry-before-hook nil
> +  "A hook to run functions when every org-drill entry."
> +  :type 'hook
> +  :group 'org-drill)
> +
> +(defcustom org-drill-entry-after-hook nil
> +  "A hook to run functions when every org-drill entry."
> +  :type 'hook
> +  :group 'org-drill)
> +
> +(defcustom org-drill-auto-pronounce t
> +  "Auto pronounce org-drill word if non-nil."
> +  :type 'boolean
> +  :safe #'booleanp
> +  :group 'org-drill)
> +
> +(defun org-drill-pronounce-word ()
> +  "Pronounce word after querying."
> +  (if org-drill-auto-pronounce
> +  (shell-command-to-string
> +   (format "%s %s %s &"
> +org-drill-pronounce-command org-drill-pronounce-command-args
> +(shell-quote-argument
> + (substring-no-properties
> +  (org-get-heading 'no-tags 'no-todo 'no-priority 
> 'no-comment)))
> +
> +(add-hook 'org-drill-entry-after-hook #'org-drill-pronounce-word)
>  
>  (defun org-drill-entry ()
>"Present the current topic for interactive review, as in `org-drill'.
> @@ -2202,6 +2229,7 @@ See `org-drill' for more details."
> 'org-drill-present-default-answer)
>   present-empty-cards (third presentation-fn)
>   presentation-fn (first presentation-fn)))
> +   (run-hook-with-args 'org-drill-entry-before-hook)
>(prog1
>(cond
> ((null presentation-fn)
> @@ -2223,6 +2251,7 @@ See `org-drill' for more details."
>(save-excursion
>  (funcall answer-fn
>   (lambda () (org-drill-reschedule
> + (run-hook-with-args 'org-drill-entry-after-hook)
>  (org-remove-latex-fragment-image-overlays)))
>  
>  
> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> index e06d0c09b..1bb485ad1 100644
> --- a/etc/ORG-NEWS
> +++ b/etc/ORG-NEWS
> @@ -49,6 +49,9 @@ alternative was removed and there is no more a :use-xcolor 
> options
>  since now it's implicitly always true.
>  
>  ** New features
> +*** Org-drill support auto pronounce word
> +You can set option ~org-drill-auto-pronounce~ to ~t~ to enable it
> +(This is default). You can disable it by setting it to ~nil~.
>  *** Add a dispatcher command to insert dynamic blocks
>  
>  You can add dynamic block into ~org-dynamic-block-alist~ with function
> -- 
> 2.20.1


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] org-tempo violating org-mode conventions since 9.2

2019-01-26 Thread stardiviner


Tim Cross  writes:

> I totally agree that block delimiters should be case
> insensitive. However, I think the ability for a user to set their
> preference for either upper case or lower case is reasonable. It does
> not need to affect the syntactic interpretation, just whether the
> template system does it in upper case or lower case. I have no idea how
> much more complex this would make the tempo definitions though.
>
> Tim
>
> Michael Welle  writes:
>
>> Hello,
>>
>> Amin Bandali  writes:
>> [...]
>>> I think it would be nice to provide a defcusom to allow choosing between
>>> upper vs. lowercase.
>> that would make the exchange of Org files with colleagues and other Org
>> aficionados complicated, wouldn't it? As Nicolas said, blocks are
>> case-insensitive, meaning one could write them down according to one's
>> liking ;). 
>>
>> Regards
>> hmw

I agree. I upvote an option for this option. I remember there is an
option before, but someday it's gone. Now still has a similar option
`org-babel-uppercase-example-markers'. They can be merged if someone
want to add a patch.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [PATCH] Add feature to org-drill to auto pronounce word

2019-01-26 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> A gentle ping..
>
> I'm not sure "org-drill.el" is still actively maintained. I'm Cc'ing
> Paul Sexton. In the long run, I think this package could be packaged
> through ELPA instead.

It is indeed not actively maintained. But still has some user are using
it. I found some recently used in Org Mode ML mentioned it.

I will ping the author Paul Sexton, I would like to particited in
maintain it. If he agree to publish it to MELPA, I could help.

>
>>> * etc/ORG-NEWS: mentioned this new feature.
>
> Changes to "contrib/" directory are usually not mentioned in this
> file.

Removed now.

>
>>> +(defun org-drill-pronounce-word ()
>>> +  "Pronounce word after querying."
>>> +  (if org-drill-auto-pronounce
>>> +  (shell-command-to-string
>>> +   (format "%s %s %s &"
>>> +  org-drill-pronounce-command org-drill-pronounce-command-args
>
> What are `org-drill-pronounce-command' and
> `org-drill-pronounce-command-args'? I don't see them defined anywhere.
>

I missed that. Now added.

> Also, please prefer `when' to one-armed `if'.

Modified.

>
>>> +  (shell-quote-argument
>>> +   (substring-no-properties
>>> +(org-get-heading 'no-tags 'no-todo 'no-priority 
>>> 'no-comment)))
>>> +
>>> +(add-hook 'org-drill-entry-after-hook #'org-drill-pronounce-word)
>
> Could it be more integrated? Using hook is usually for users. If you can
> modify the code, you probably can do better.

Modified now.

Those two hooks I think is necessary for user to add custom actions. So
keep them.

>
> Regards,

Regards :)

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [PATCH] Add feature to org-drill to auto pronounce word

2019-01-29 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Nicolas Goaziou  writes:
>>
>>> Hello,
>>>
>>> stardiviner  writes:
>>>
>>>> A gentle ping..
>>>
>>> I'm not sure "org-drill.el" is still actively maintained. I'm Cc'ing
>>> Paul Sexton. In the long run, I think this package could be packaged
>>> through ELPA instead.
>>
>> It is indeed not actively maintained. But still has some user are using
>> it. I found some recently used in Org Mode ML mentioned it.
>>
>> I will ping the author Paul Sexton, I would like to particited in
>> maintain it. If he agree to publish it to MELPA, I could help.
>
> Did you forget to add the new patch? Or is it intentional?
>
>
> Regards,

Oh, sorry, seems yes.

>From b95a90cbecdf4fa2f47079eed08d2395f2700d41 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 27 Jan 2019 10:43:37 +0800
Subject: [PATCH] org-drill.el: Add feature let org-drill auto pronounce

* contrib/lisp/org-drill.el (org-drill-entry,
  org-drill-entry-before-hook, org-drill-entry-after-hook): Add two
  hooks around ~org-drill-entry~.
  (org-drill-auto-pronounce): option to toggle this functionality.
  (org-drill-pronounce-command,org-drill-pronounce-command-args): option
  to specify the pronounce command and arguments.
  (org-drill-pronounce-word): The real function to pronounce word.
  (org-drill-hide-subheadings-if): fix issue in Org 9.2 version.
---
 contrib/lisp/org-drill.el | 45 +--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
index c7f509bff..39785e7e3 100644
--- a/contrib/lisp/org-drill.el
+++ b/contrib/lisp/org-drill.el
@@ -532,6 +532,35 @@ exponential effect on inter-repetition spacing."
   :type 'float)
 
 
+(defcustom org-drill-entry-before-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-entry-after-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-auto-pronounce t
+  "Auto pronounce org-drill word if non-nil."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'org-drill)
+
+(defcustom org-drill-pronounce-command ""
+  "Org-drill pronounce command."
+  :type 'string
+  :safe #'stringp
+  :group 'org-drill)
+
+(defcustom org-drill-pronounce-command-args ""
+  "Org-drill pronounce command arguments."
+  :type 'string
+  :safe #'stringp
+  :group 'org-drill)
+
+
 (defvar drill-answer nil
   "Global variable that can be bound to a correct answer when an
 item is being presented. If this variable is non-nil, the default
@@ -1486,7 +1515,7 @@ the current topic."
 (funcall test))
  (hide-subtree))
(push (point) drill-sections)))
-   "" 'tree))
+   nil 'tree))
 (reverse drill-sections)))
 
 
@@ -2163,6 +2192,15 @@ If ANSWER is supplied, set the global variable `drill-answer' to its value."
 (prog1 (org-drill-presentation-prompt)
   (org-drill-hide-subheadings-if 'org-drill-entry-p)
 
+(defun org-drill-pronounce-word ()
+  "Pronounce word after querying."
+  (when org-drill-auto-pronounce
+(shell-command-to-string
+ (format "%s %s %s &"
+	 org-drill-pronounce-command org-drill-pronounce-command-args
+	 (shell-quote-argument
+	  (substring-no-properties
+	   (org-get-heading 'no-tags 'no-todo 'no-priority 'no-comment)))
 
 (defun org-drill-entry ()
   "Present the current topic for interactive review, as in `org-drill'.
@@ -2202,6 +2240,7 @@ See `org-drill' for more details."
'org-drill-present-default-answer)
  present-empty-cards (third presentation-fn)
  presentation-fn (first presentation-fn)))
+	  (run-hook-with-args 'org-drill-entry-before-hook)
   (prog1
   (cond
((null presentation-fn)
@@ -2223,7 +2262,9 @@ See `org-drill' for more details."
   (save-excursion
 (funcall answer-fn
  (lambda () (org-drill-reschedule
-    (org-remove-latex-fragment-image-overlays)))
+	(when org-drill-auto-pronounce org-drill-pronounce-word)
+	(run-hook-with-args 'org-drill-entry-after-hook)
+	(org-remove-latex-fragment-image-overlays)))
 
 
 (defun org-drill-entries-pending-p ()
-- 
2.20.1



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] [PATCH] Add feature to org-drill to auto pronounce word

2019-01-31 Thread stardiviner
Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Oh, sorry, seems yes.
>
> OK. A couple of comments if you don't mind.
>> +(defcustom org-drill-pronounce-command ""
>> +  "Org-drill pronounce command."
>> +  :type 'string
>> +  :safe #'stringp
>> +  :group 'org-drill)
>
> This is clearly not a safe command. You can remove the :safe keyword, or
> put :safe nil

Ok, I removed it. (I misunderstand it's functionality..)

>
>> +(defun org-drill-pronounce-word ()
>> +  "Pronounce word after querying."
>> +  (when org-drill-auto-pronounce
>> +(shell-command-to-string
>> + (format "%s %s %s &"
>> + org-drill-pronounce-command org-drill-pronounce-command-args
>> + (shell-quote-argument
>> +  (substring-no-properties
>> +   (org-get-heading 'no-tags 'no-todo 'no-priority 
>> 'no-comment)))
>
> Is there any reason to use `shell-command-to-string'? You don't seem to
> need the returned string anyway. Why not calling `start-process', or at
> least `async-shell-command'?

Changed to `start-process' now.

>
> Regards,

Also I add some new functionality, which can pronounce at anytime when
press the key [p] not just at start time.

I almost forgot my patch. I pressed [C-g] to interrupt it.

>From 73acb5177526f7bf5d621f45ca979ee7119c Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 27 Jan 2019 10:43:37 +0800
Subject: [PATCH] org-drill.el: Add feature let org-drill auto pronounce

* contrib/lisp/org-drill.el (org-drill-entry,
  org-drill-entry-before-hook, org-drill-entry-after-hook): Add two
  hooks around ~org-drill-entry~.
  (org-drill-auto-pronounce): option to toggle this functionality.
  (org-drill-pronounce-command,org-drill-pronounce-command-args): option
  to specify the pronounce command and arguments.
  (org-drill-pronounce-word): The real function to pronounce word.
  (org-drill-hide-subheadings-if): fix issue in Org 9.2 version.
---
 contrib/lisp/org-drill.el | 79 ---
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
index c7f509bff..70d0dee4b 100644
--- a/contrib/lisp/org-drill.el
+++ b/contrib/lisp/org-drill.el
@@ -269,6 +269,9 @@ item.")
 (defvar org-drill--tags-key ?t
   "If this character is pressed during a drill session, edit the tags for
 the current item.")
+(defvar org-drill--pronounce-key ?p
+  "If this character is pressed during a drill session, pronounce for
+the current item.")
 
 
 (defcustom org-drill-card-type-alist
@@ -532,6 +535,35 @@ exponential effect on inter-repetition spacing."
   :type 'float)
 
 
+(defcustom org-drill-entry-before-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-entry-after-hook nil
+  "A hook to run functions when every org-drill entry."
+  :type 'hook
+  :group 'org-drill)
+
+(defcustom org-drill-auto-pronounce t
+  "Auto pronounce org-drill word if non-nil."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'org-drill)
+
+(defcustom org-drill-pronounce-command (executable-find "espeak")
+  "Org-drill pronounce command."
+  :type 'string
+  :group 'org-drill)
+
+(defcustom org-drill-pronounce-command-args
+  (if (string= org-drill-pronounce-command "/usr/bin/espeak")
+  "-v en")
+  "Org-drill pronounce command arguments."
+  :type 'string
+  :group 'org-drill)
+
+
 (defvar drill-answer nil
   "Global variable that can be bound to a correct answer when an
 item is being presented. If this variable is non-nil, the default
@@ -1364,8 +1396,9 @@ of QUALITY."
   (let ((ch nil)
 (input nil)
 (next-review-dates (org-drill-hypothetical-next-review-dates))
-(key-prompt (format "(0-5, %c=help, %c=edit, %c=tags, %c=quit)"
+(key-prompt (format "(0-5, %c=help, %c=pronounce, %c=edit, %c=tags, %c=quit)"
 org-drill--help-key
+			org-drill--pronounce-key
 org-drill--edit-key
 org-drill--tags-key
 org-drill--quit-key)))
@@ -1391,7 +1424,9 @@ How well did you do? %s"
  (round (nth 4 next-review-dates))
  (round (nth 5 next-review-dates))
  key-prompt)
-   (format "How well did you do? %s" key-prompt
+   (format "How well did you do? %s" key-prompt))
+		 (if (eq ch org-d

Re: [O] [RFC] Org Num library

2019-02-03 Thread stardiviner
-overlay-p overlay)
> -(let ((next (overlay-start overlay))
> -  (last (and new-overlays (overlay-start (car new-overlays)
> -  (cond
> -   ((null org-num--missing-overlay))
> -   ((> org-num--missing-overlay next))
> -   ((or (null last) (> org-num--missing-overlay last))
> -(setq org-num--missing-overlay nil)
> -(setq new-overlays (nconc (org-num--number-region last next)
> -  new-overlays)))
> -   ;; If it is already after the last known overlay, reset it:
> -   ;; some previous invalid overlay already triggered the
> -   ;; necessary parsing.
> -   (t
> -(setq org-num--missing-overlay nil
> -;; Update OVERLAY's numbering.
> -(let* ((level (overlay-get overlay 'level))
> -   (skip (overlay-get overlay 'skip))
> -   (numbering (org-num--current-numbering level skip)))
> -  (org-num--refresh-display overlay numbering)
> -  (push overlay new-overlays)))
> +(let ((next (overlay-start overlay)))
> +   (let ((last (and new-overlays (overlay-start (car new-overlays)
> +(cond
> + ((null org-num--missing-overlay))
> + ((> org-num--missing-overlay next))
> + ((or (null last) (> org-num--missing-overlay last))
> +  (setq org-num--missing-overlay nil)
> +  (setq new-overlays (nconc (org-num--number-region last next)
> + new-overlays)))
> + ;; If it is already after the last known overlay, reset it:
> + ;; some previous invalid overlay already triggered the
> + ;; necessary parsing.
> + (t
> +  (setq org-num--missing-overlay nil
> +  ;; Update OVERLAY's numbering.
> +  (let* ((level (overlay-get overlay 'level))
> +  (skip (overlay-get overlay 'skip))
> +  (numbering (org-num--current-numbering next level skip)))
> +(org-num--refresh-display overlay numbering)
> +(push overlay new-overlays
> ;; Invalid overlay.  It indicates that the buffer needs to be
> ;; parsed again between the two surrounding valid overlays or
> ;; buffer boundaries.
> @@ -430,6 +447,13 @@ See this variable for the meaning of BEG and END."
>  (when (or org-num--missing-overlay org-num--invalid-flag)
>(org-num--update
>  
> +(defun org-num--check-narrowing ()
> +  "Check buffer narrowing; update numbering if necessary.
> +This function is meant to be used in `post-command-hook'."
> +  (when (and org-num-visible-only (/= org-num--start (point-min)))
> +(setq org-num--start (point-min))
> +(org-num--update)))
> +
>  
>  ;;; Public Functions
>  
> @@ -450,10 +474,12 @@ NUMBERING is a list of numbers."
>  (setq org-num--numbering nil)
>  (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
>  (add-hook 'after-change-functions #'org-num--verify nil t)
> +(add-hook 'post-command-hook #'org-num--check-narrowing nil t)
>  (add-hook 'change-major-mode-hook #'org-num--clear nil t))
> (t
>  (org-num--clear)
>  (remove-hook 'after-change-functions #'org-num--verify t)
> +(remove-hook 'post-command-hook #'org-num--check-narrowing t)
>  (remove-hook 'change-major-mode-hook #'org-num--clear t


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] Org can't export inline image link to PDF

2019-02-19 Thread stardiviner


I have an inline image link like this in Org file:

```org
#+ATTR_ORG: :width 300
#+ATTR_LATEX: :width 3.0in
#+ATTR_HTML: :width 300px
[[file:data/images/me_picture%2023.jpg]]
```

When I export to PDF file, others work fine, but just no image, no link
at the inline image link position. Just blank.

Do I need some extra settings to make it work?

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] [Proposal] Make Org keybinding popup buffer/window controllable?

2019-02-19 Thread stardiviner


My notebook computer is a smaller screen computer. When I open 5, 6
windows, it will make every window small. When I using
`org-insert-structure-template` or `org-export-dispatch`, They have a
long length content, if those popup buffer are display in my small size
window. I can't see part of them. This is really annoying me.

Emacs built-in has a dynamic variable `display-buffer-alist'. I hope Org
can use functions which support this. Of course there are some packages
there to control popup buffers/windows. But seems not work well on Org
popup buffers.

So, please improve Org popup buffers. Really.

--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] How to simply add tag system for org-publish blog?

2019-02-19 Thread stardiviner


I'm currently using *org-publish* for blogging. But I want it to have
tag system. About why not using other static site blogging system,
because I like Org Mode.

The tag system should have following functions:

- get blog tags from Org file headline tags, or property etc.

- show tags on blog post page.

- click on the blog tag can list out all posts having this tag.

I don't know much about web technology. So if asked a dummy question,
please forgive me about this.

And if someone have any idea, welcome to tell me. Thanks.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Org can't export inline image link to PDF

2019-02-19 Thread stardiviner


Now I figured out, because the filename contains a space, which Org auto
converted to `%20' when exit org-insert-link. That's why can't see the
inline image in exported PDF file. After I renamed image filename with
replace space with underline "_". Problem solved.

But, if possible, I still hope Org can fix this problem.

stardiviner  writes:

> I have an inline image link like this in Org file:
>
> ```org
> #+ATTR_ORG: :width 300
> #+ATTR_LATEX: :width 3.0in
> #+ATTR_HTML: :width 300px
> [[file:data/images/me_picture%2023.jpg]]
> ```
>
> When I export to PDF file, others work fine, but just no image, no link
> at the inline image link position. Just blank.
>
> Do I need some extra settings to make it work?


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [Proposal] Make Org keybinding popup buffer/window controllable?

2019-02-20 Thread stardiviner


Eric S Fraga  writes:

> On Wednesday, 20 Feb 2019 at 12:23, stardiviner wrote:
>> My notebook computer is a smaller screen computer. When I open 5, 6
>> windows, it will make every window small. When I using
>> `org-insert-structure-template` or `org-export-dispatch`, They have a
>> long length content, if those popup buffer are display in my small size
>> window. I can't see part of them. This is really annoying me.
>
> I don't know about org-insert-structure-template but you can scroll the
> org-export-dispatch window with SPC.

You're right. org-export-dispatch can navigate with SPC, Tab, DEL,
C-n/p. I noticed the headline now. Thanks.

I tried SPC in org-insert-structure-template, but not work. Because it's
taken by following keybinding. None of upper keybinding (SPC, Tab, DEL,
C-n/C-p) works.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Org can't export inline image link to PDF

2019-02-20 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Now I figured out, because the filename contains a space, which Org auto
>> converted to `%20' when exit org-insert-link. That's why can't see the
>> inline image in exported PDF file. After I renamed image filename with
>> replace space with underline "_". Problem solved.
>>
>> But, if possible, I still hope Org can fix this problem.
>
> Fixed. Thank you.
>
> Regards,

Hi, Nicolas, as always, thanks for quick fix. Still a minor issue.

Here is the screenshot in attachment, you can see the characters 23.bb
left side of the inline image.

The original Org inline image format is:

```org
#+ATTR_ORG: :width 200
#+ATTR_LATEX: :width 2.0in
#+ATTR_HTML: :id avatar :width 200px :alt 那时23岁的我
[[file:data/images/me_picture%2023.jpg]]
```



-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  


Re: [O] URL storage and search - Bookmark+ vs Org Mode

2019-02-20 Thread stardiviner


I use Org Mode to store all bookmarks. I save it as "Bookmarks.org",
then use helm-org-rifle to quick locate the category headline, if failed
find wanted bookmarks, then use Isearch to search text. You can create a
helper command to quickly auto open bookmarks org file, and auto toggle
quick locating and search. All in one command. Using Org, you can add
extra info anything you want to take note about bookmarks, not just URL
and title.

Roland Everaert  writes:

> Hello,
>
> I am still debating with myself which one is the most appropriate to store and
> search for URLs.
>
> The bookmark(+) feature is interesting because it provides a dedicate
> interface for bookmarking any kind of resources including URLs, but I
> find the interface to search for bookmarks and to jump between different
> bookmark file strange if not inefficient.
>
> On the other hand, Org-mode don't provide any dedicated interface
> for storing and searching URLs, but switching from Org Mode file to the
> next one and searching for data is much more intuitive.
>
> Hence, what is the experience of the community with both tools and how
> you store your internet bookmarks, both to store a particular article or the
> home page of a website?
>
>
> Thanks for your time,
>
> Roland Everaert.


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



[O] How to set Org to export to PDF with image background or color?

2019-02-21 Thread stardiviner


I'm writing a simple resume with Org Mode, and exporting to PDF. I want
to add an image or color as background for every page of resume PDF
file. Does anyone knows how to do that?

Or have some template for this?

Thanks in advance. Thanks.

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



  1   2   3   4   5   6   >