emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Standardized code block syntax and Property Accumulation merged into Master
@ 2011-11-15 15:58 Eric Schulte
  2011-11-17 11:09 ` Sebastien Vauban
  2011-11-17 13:23 ` Sebastien Vauban
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Schulte @ 2011-11-15 15:58 UTC (permalink / raw)
  To: Org Mode

Hi,

The standard-code-block-syntax branch has been merged into the master
branch of the git repository.  This brings two much discussed changes to
Org-mode, first a standard set of keywords for code blocks and second
the ability to accumulate properties by appending a "+" to the end of
the property name.  For much more information on both of these changes
see the relevant commits [1] and [2] respectively.  A function for
updating existing Org-mode files to use the new standardized code block
keywords is inline below [3], additionally I've updated my collection of
Org-mode code block scraps [4].

Thanks to Tom Dye the documentation has been updated to reflect these
change.

All tests are passing after this merge.

Cheers -- Eric

Footnotes: 
[1]  http://orgmode.org/w/?p=org-mode.git;a=commit;h=7e93b90f8816346a16ad49cee22870b17c05b211

[2]  http://orgmode.org/w/?p=org-mode.git;a=commit;h=3af89e696a32afcc39f2e3bdb6132ac588d530ae

[3]  Function to update Org-mode buffers to use the new code block syntax.
     (defun update-org-buffer ()
       "Update an Org-mode buffer to the new data, code block and call line syntax."
       (interactive)
       (save-excursion
         (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
                                     "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
                (update (re new)
                        (goto-char (point-min))
                        (while (re-search-forward re nil t)
                          (replace-match new nil nil nil 1))))
           (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
                 (lob-re (to-re '("LOB")))
                 (case-fold-search t))
             (update old-re "name")
             (update lob-re "call")))))

[4]  http://eschulte.github.com/org-scraps/

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Standardized code block syntax and Property Accumulation merged into Master
  2011-11-15 15:58 Standardized code block syntax and Property Accumulation merged into Master Eric Schulte
@ 2011-11-17 11:09 ` Sebastien Vauban
  2011-11-17 16:16   ` Eric Schulte
  2011-11-17 13:23 ` Sebastien Vauban
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastien Vauban @ 2011-11-17 11:09 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric Schulte wrote:
> The standard-code-block-syntax branch has been merged into the master
> branch of the git repository.  This brings two much discussed changes to
> Org-mode, first a standard set of keywords for code blocks and second
> the ability to accumulate properties by appending a "+" to the end of
> the property name.  For much more information on both of these changes
> see the relevant commits [1] and [2] respectively.  A function for
> updating existing Org-mode files to use the new standardized code block
> keywords is inline below [3], additionally I've updated my collection of
> Org-mode code block scraps [4].

Nice to see it's finally in!

However, I have to report a _tiny_ feature of applying your function:

> [3]  Function to update Org-mode buffers to use the new code block syntax.
>      (defun update-org-buffer ()
>        "Update an Org-mode buffer to the new data, code block and call line syntax."
>        (interactive)
>        (save-excursion
>          (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
>                                      "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
>                 (update (re new)
>                         (goto-char (point-min))
>                         (while (re-search-forward re nil t)
>                           (replace-match new nil nil nil 1))))
>            (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
>                  (lob-re (to-re '("LOB")))
>                  (case-fold-search t))
>              (update old-re "name")
>              (update lob-re "call")))))

When run on a buffer containing:

    #+property: var  foo=1

    #+begin_src emacs-lisp
     foo
    #+end_src

    #+results:
    : 1

it will translate `#+results' to `#+name':

    #+property: var  foo=1

    #+begin_src emacs-lisp
     foo
    #+end_src

    #+name:
    : 1

Further evaluations of that *un-named* code block will leave the `#+name'
line.

To get back the expected `#+results' line, you have to manually remove that
results line, and re-evaluate the code block.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Standardized code block syntax and Property Accumulation merged into Master
  2011-11-15 15:58 Standardized code block syntax and Property Accumulation merged into Master Eric Schulte
  2011-11-17 11:09 ` Sebastien Vauban
@ 2011-11-17 13:23 ` Sebastien Vauban
  2011-11-17 16:15   ` Eric Schulte
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastien Vauban @ 2011-11-17 13:23 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric Schulte wrote:
> The standard-code-block-syntax branch has been merged into the master branch
> of the git repository. [...] Additionally I've updated my collection of
> Org-mode code block scraps [4].
>
> [4]  http://eschulte.github.com/org-scraps/

I just looked at a couple of them, and it occurred to me that this one can't
work (anymore?) as the name of the *data* table is the same as the name of the
*source* block:

http://eschulte.github.com/org-scraps/scraps/2011-08-19-replacing-a-table.html

Changing one name or the other does cure this.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Standardized code block syntax and Property Accumulation merged into Master
  2011-11-17 13:23 ` Sebastien Vauban
@ 2011-11-17 16:15   ` Eric Schulte
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2011-11-17 16:15 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> Eric Schulte wrote:
>> The standard-code-block-syntax branch has been merged into the master branch
>> of the git repository. [...] Additionally I've updated my collection of
>> Org-mode code block scraps [4].
>>
>> [4]  http://eschulte.github.com/org-scraps/
>
> I just looked at a couple of them, and it occurred to me that this one can't
> work (anymore?) as the name of the *data* table is the same as the name of the
> *source* block:
>
> http://eschulte.github.com/org-scraps/scraps/2011-08-19-replacing-a-table.html
>

Indeed, this change actually isn't directly related to the syntax
changes but is rather a result of a recent bug fix, as whenever there
are both data and code with the same name, the code should be primary
because the data could simply be un-cached results of the code.

>
> Changing one name or the other does cure this.
>

Thanks, I've simply removed this example.

Cheers -- Eric

>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Standardized code block syntax and Property Accumulation merged into Master
  2011-11-17 11:09 ` Sebastien Vauban
@ 2011-11-17 16:16   ` Eric Schulte
  2011-11-18  8:56     ` Sebastien Vauban
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2011-11-17 16:16 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> Eric Schulte wrote:
>> The standard-code-block-syntax branch has been merged into the master
>> branch of the git repository.  This brings two much discussed changes to
>> Org-mode, first a standard set of keywords for code blocks and second
>> the ability to accumulate properties by appending a "+" to the end of
>> the property name.  For much more information on both of these changes
>> see the relevant commits [1] and [2] respectively.  A function for
>> updating existing Org-mode files to use the new standardized code block
>> keywords is inline below [3], additionally I've updated my collection of
>> Org-mode code block scraps [4].
>
> Nice to see it's finally in!
>

Thanks, me too.

>
> However, I have to report a _tiny_ feature of applying your function:
>
>> [3]  Function to update Org-mode buffers to use the new code block syntax.
>>      (defun update-org-buffer ()
>>        "Update an Org-mode buffer to the new data, code block and call line syntax."
>>        (interactive)
>>        (save-excursion
>>          (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
>>                                      "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
>>                 (update (re new)
>>                         (goto-char (point-min))
>>                         (while (re-search-forward re nil t)
>>                           (replace-match new nil nil nil 1))))
>>            (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
>>                  (lob-re (to-re '("LOB")))
>>                  (case-fold-search t))
>>              (update old-re "name")
>>              (update lob-re "call")))))
>
> When run on a buffer containing:
>
>     #+property: var  foo=1
>
>     #+begin_src emacs-lisp
>      foo
>     #+end_src
>
>     #+results:
>     : 1
>
> it will translate `#+results' to `#+name':
>
>     #+property: var  foo=1
>
>     #+begin_src emacs-lisp
>      foo
>     #+end_src
>
>     #+name:
>     : 1
>
> Further evaluations of that *un-named* code block will leave the `#+name'
> line.
>
> To get back the expected `#+results' line, you have to manually remove that
> results line, and re-evaluate the code block.
>

This, given that results and name are technically still synonyms this
isn't necessarily a bug, however I do agree that a version of the
functions which left the #+results: lines immediately following code
blocks unchanged would be preferable.

Cheers -- Eric

>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Standardized code block syntax and Property Accumulation merged into Master
  2011-11-17 16:16   ` Eric Schulte
@ 2011-11-18  8:56     ` Sebastien Vauban
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Vauban @ 2011-11-18  8:56 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric Schulte wrote:
> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Eric Schulte wrote:
>>> The standard-code-block-syntax branch has been merged into the master
>>> branch of the git repository.  This brings two much discussed changes to
>>> Org-mode, first a standard set of keywords for code blocks and second
>>> the ability to accumulate properties by appending a "+" to the end of
>>> the property name.  For much more information on both of these changes
>>> see the relevant commits [1] and [2] respectively.  A function for
>>> updating existing Org-mode files to use the new standardized code block
>>> keywords is inline below [3], additionally I've updated my collection of
>>> Org-mode code block scraps [4].
>>
>> Nice to see it's finally in!
>
> Thanks, me too.
>
>> However, I have to report a _tiny_ feature of applying your function:
>>
>>> [3]  Function to update Org-mode buffers to use the new code block syntax.
>>>      (defun update-org-buffer ()
>>>        "Update an Org-mode buffer to the new data, code block and call line syntax."
>>>        (interactive)
>>>        (save-excursion
>>>          (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
>>>                                      "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
>>>                 (update (re new)
>>>                         (goto-char (point-min))
>>>                         (while (re-search-forward re nil t)
>>>                           (replace-match new nil nil nil 1))))
>>>            (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
>>>                  (lob-re (to-re '("LOB")))
>>>                  (case-fold-search t))
>>>              (update old-re "name")
>>>              (update lob-re "call")))))
>>
>> When run on a buffer containing:
>>
>>     #+property: var  foo=1
>>
>>     #+begin_src emacs-lisp
>>      foo
>>     #+end_src
>>
>>     #+results:
>>     : 1
>>
>> it will translate `#+results' to `#+name':
>>
>>     #+property: var  foo=1
>>
>>     #+begin_src emacs-lisp
>>      foo
>>     #+end_src
>>
>>     #+name:
>>     : 1
>>
>> Further evaluations of that *un-named* code block will leave the `#+name'
>> line.
>>
>> To get back the expected `#+results' line, you have to manually remove that
>> results line, and re-evaluate the code block.
>
> This, given that results and name are technically still synonyms this
> isn't necessarily a bug

I fully agree. That's why I used the term "tiny feature" ;-)

> however I do agree that a version of the functions which left the #+results:
> lines immediately following code blocks unchanged would be preferable.

I would say "left the #+results: lines immediately following *un-named* code
blocks", as we would want `#+name:' to be used in all the other cases (that
is, for results of named code blocks).

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-18  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15 15:58 Standardized code block syntax and Property Accumulation merged into Master Eric Schulte
2011-11-17 11:09 ` Sebastien Vauban
2011-11-17 16:16   ` Eric Schulte
2011-11-18  8:56     ` Sebastien Vauban
2011-11-17 13:23 ` Sebastien Vauban
2011-11-17 16:15   ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).