Re: [O] [feature] prepend comment char before org-babel-ref

2018-01-26 Thread numbch...@gmail.com
Sorry, I miss typed my header argument `:dir "data/code/src-coderef.rb"`.
It should be `:tangle`.

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Fri, Jan 26, 2018 at 8:34 PM, numbch...@gmail.com 
wrote:

> Because it is not good for tangling.
> For example, tangle the bellowing src block, the tangled source code file
> will has `(ref:hello)` too.
> ```
> #+begin_src emacs-lisp :tangle "data/code/src-coderef.el"
> (message "hello, world") (ref:hello)
> #+end_src
> ```
> The tangled source code file looks like this:
> ```
> (message "hello, world") (ref:hello)
> ```
> This absolutely is not a good idea.
>
>
>
> And after a test, I found I can't tangle the bellowing src block:
> ```
> #+begin_src ruby :dir "data/code/src-coderef.rb"
> puts "hello, world" (ref:hello)
> #+end_src
> ```
> Even with a comment char prefix:
> ```
> #+begin_src ruby :dir "data/code/src-coderef.rb"
> puts "hello, world" # (ref:hello)
> #+end_src
>
> ```
>
> [stardiviner] GPG key ID: 47C32433
> IRC(freeenode): stardiviner Twitter:  @numbchild
> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
> Blog: http://stardiviner.github.io/
>
> On Fri, Jan 26, 2018 at 4:19 AM, Nicolas Goaziou 
> wrote:
>
>> Hello,
>>
>> "numbch...@gmail.com"  writes:
>>
>> > I see. Seems current ob-core.el can filter out the `src-coderef`.
>> > Like the following:
>>
>> [...]
>>
>> > My wanted feature is simple, just `(insert (concat comment-char
>> > coderef-format))`
>>
>> Per the above, may I ask why you do need it?
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou0x80A93738
>>
>
>


Re: [O] How to dynamically change org-clock-mode-line-total?

2018-01-26 Thread Nick Dokos
Marcin Borkowski  writes:

> Hi all,
>
> I want to be able to dynamically switch between various settings of
> org-clock-mode-line-total.  To this end, I wrote the following code.
>
> (setq org-clock-mode-line-total-settings
>   '((current . "time spent in this chunk on the current task")
>   (today . "time spent today on the current task")
>   (all . "total time spent on the current task")))
> (setq org-clock-mode-line-total-setting-number 0)
>
> (defun toggle-org-clock-mode-line-total-setting (setting-number)
>   "Toggle between org-clock-mode-line-total settings.
> With a numeric argument, use setting SETTING-NUMBER."
>   (interactive "P")
>   (if (numberp setting-number)
>   (setq org-clock-mode-line-total-setting-number
>   (mod setting-number (length org-clock-mode-line-total-settings)))
> (setq org-clock-mode-line-total-setting-number
> (mod (1+ org-clock-mode-line-total-setting-number)
>  (length org-clock-mode-line-total-settings
>   (let ((org-clock-mode-line-total-setting (nth 
> org-clock-mode-line-total-setting-number
>   
> org-clock-mode-line-total-settings)))
> (setq org-clock-mode-line-total (car org-clock-mode-line-total-setting))
> (org-clock-update-mode-line)
> (message "Modeline shows %s."
>(cdr org-clock-mode-line-total-setting
>
> Unfortunately, it doesn't work.  I checked that the variable
> org-clock-mode-line-total is modified correctly, but even after saying
> (org-clock-update-mode-line), nothing gets updated.  Am I doing
> something wrong?
>

AFAICT, org-clock-mode-line-total is not used by
org-clock-update-mode-line at all.  It may be that the name of the
variable is misleading. The only place I see it used is
org-clock-get-sum-start.

-- 
Nick




Re: [O] [feature] prepend comment char before org-babel-ref

2018-01-26 Thread numbch...@gmail.com
Because it is not good for tangling.
For example, tangle the bellowing src block, the tangled source code file
will has `(ref:hello)` too.
```
#+begin_src emacs-lisp :tangle "data/code/src-coderef.el"
(message "hello, world") (ref:hello)
#+end_src
```
The tangled source code file looks like this:
```
(message "hello, world") (ref:hello)
```
This absolutely is not a good idea.



And after a test, I found I can't tangle the bellowing src block:
```
#+begin_src ruby :dir "data/code/src-coderef.rb"
puts "hello, world" (ref:hello)
#+end_src
```
Even with a comment char prefix:
```
#+begin_src ruby :dir "data/code/src-coderef.rb"
puts "hello, world" # (ref:hello)
#+end_src

```

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Fri, Jan 26, 2018 at 4:19 AM, Nicolas Goaziou 
wrote:

> Hello,
>
> "numbch...@gmail.com"  writes:
>
> > I see. Seems current ob-core.el can filter out the `src-coderef`.
> > Like the following:
>
> [...]
>
> > My wanted feature is simple, just `(insert (concat comment-char
> > coderef-format))`
>
> Per the above, may I ask why you do need it?
>
> Regards,
>
> --
> Nicolas Goaziou0x80A93738
>


[O] How to dynamically change org-clock-mode-line-total?

2018-01-26 Thread Marcin Borkowski
Hi all,

I want to be able to dynamically switch between various settings of
org-clock-mode-line-total.  To this end, I wrote the following code.

--8<---cut here---start->8---
(setq org-clock-mode-line-total-settings
  '((current . "time spent in this chunk on the current task")
(today . "time spent today on the current task")
(all . "total time spent on the current task")))
(setq org-clock-mode-line-total-setting-number 0)

(defun toggle-org-clock-mode-line-total-setting (setting-number)
  "Toggle between org-clock-mode-line-total settings.
With a numeric argument, use setting SETTING-NUMBER."
  (interactive "P")
  (if (numberp setting-number)
  (setq org-clock-mode-line-total-setting-number
(mod setting-number (length org-clock-mode-line-total-settings)))
(setq org-clock-mode-line-total-setting-number
  (mod (1+ org-clock-mode-line-total-setting-number)
   (length org-clock-mode-line-total-settings
  (let ((org-clock-mode-line-total-setting (nth 
org-clock-mode-line-total-setting-number

org-clock-mode-line-total-settings)))
(setq org-clock-mode-line-total (car org-clock-mode-line-total-setting))
(org-clock-update-mode-line)
(message "Modeline shows %s."
 (cdr org-clock-mode-line-total-setting
--8<---cut here---end--->8---

Unfortunately, it doesn't work.  I checked that the variable
org-clock-mode-line-total is modified correctly, but even after saying
(org-clock-update-mode-line), nothing gets updated.  Am I doing
something wrong?

TIA,

--
Marcin Borkowski



Re: [O] [RFC] Moving "manual.org" into core

2018-01-26 Thread Nicolas Goaziou
Hello,

Yasushi SHOJI  writes:

> Also, the code converts all lower case "#+title",  "+begin_src" and
> other "#+"s to
> the UPCASE.  Is this intended?  I thought we are moving away from CAP
> to lower?

This was changed a few days ago. See commit
13424336a6f30c50952d291e7a82906c1210daf0.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] executing org-table TBLFM form changes (resets) language settings

2018-01-26 Thread Rainer Stengele

Am 25.01.2018 um 20:27 schrieb Nick Dokos:

Rainer Stengele  writes:


All,

My current-language-environment is "German".
Having an Org table with a TBLFM attached:

| IM Startzeit  | IM Endezeit   | Stunden | delta(x,16) | Anm. |
|---+---+-+-+--|
| [2018-01-22 Mo 19:30] | [2018-01-23 Di 14:30] |   19.00 |3.00 |  |
|   |   | | |  |

#+TBLFM: $3=24*(date(<$2>)-date(<$1>)); %.2f::$4=$3-16.0; %.2f

entering a new timestamp correctly inserts German dayname abbrevs: ("Do", German for 
"Thu", English):

| IM Startzeit  | IM Endezeit   | Stunden | delta(x,16) | Anm. |
|---+---+-+-+--|
| [2018-01-22 Mo 19:30] | [2018-01-23 Di 14:30] |   19.00 |3.00 |  |
| [2018-01-25 Do 14:19] |   | | |  |

#+TBLFM: $3=24*(date(<$2>)-date(<$1>)); %.2f::$4=$3-16.0; %.2f

Executing the TBLFM line with C-c C-c changes (resets) the language environment 
to English.

Now inserting a timestamp inserts "Thu" instead of "Do", that is it uses the 
English day name abbrevs:

| IM Startzeit  | IM Endezeit   |  Stunden |  delta(x,16) | 
Anm. |
|---+---+--+--+--|
| [2018-01-22 Mo 19:30] | [2018-01-23 Di 14:30] |19.00 | 3.00 | 
 |
| [2018-01-25 Thu 14:21]|   |  |  | 
 |

#+TBLFM: $3=24*(date(<$2>)-date(<$1>)); %.2f::$4=$3-16.0; %.2f

Believe me it took me some time to find out what action in Emacs changes the 
whole lang environment.

Is that a bug or is there a language setting in the TBLFM form?

Thanks for any hint.

Regards,
Rainer



I can reproduce this if I start emacs like this:

emacs -q -l ~/src/minimal/min.org.el /tmp/dates.org &

set the language environment inside emacs and then do C-c C-c on the TBLFM line
and try to add another date.

I cannot reproduce it when invoking emacs like this:

LANG=de_DE.UTF-8 emacs -q -l ~/src/minimal/min.org.el /tmp/dates.org

so it seems you are right that in the first case, something changes the language
environment.


Hi Nick,

thanks for confirming.
I am running under Windows and cannot apply your environment setting like this.

Does anyboday have a chance to correct the misbehaviour in the TBLFM table code 
that changes the language settings?
I will not be able to do it on my own.

Thank you.
Regards, Rainer



Re: [O] [RFC] Moving "manual.org" into core

2018-01-26 Thread Yasushi SHOJI
Hi Nicolas,

On Wed, Jan 24, 2018 at 8:28 PM, Nicolas Goaziou  wrote:
> Org Lint is not a formatter. It detects common mistakes or hypothetical
> mistakes in an Org document, e.g., invalid links. In particular, it
> doesn't detect stylistic issues like those discussed above.

Oh, OK.

> It doesn't mean we couldn't run it automatically. However, it also emits
> warnings (see `trust' property) on perfectly valid syntax.
>
> As a side note, writing an Org formatter is trivial:
>
> (when (yes-or-no-p "Really format current buffer ? ")
>   (let ((document (org-element-interpret-data 
> (org-element-parse-buffer
> (erase-buffer)
> (insert document)
> (goto-char (point-min

You know, this is a mind-blowing.  Org already has everything it needs ;-)

Anyway, I tried the code and it took 2.4 second to reformat the whole document
on my i5-3360M 2.80GHz CPU.  It's a bit long for every commit, i guess.
But, could be installed on received hook, perhaps?

Also, the code converts all lower case "#+title",  "+begin_src" and
other "#+"s to
the UPCASE.  Is this intended?  I thought we are moving away from CAP to lower?
-- 
 yashi