* [babel][patch] C++ inconsistencies
@ 2011-02-18 10:58 Martyn Jago
2011-02-18 16:36 ` Martyn Jago
0 siblings, 1 reply; 9+ messages in thread
From: Martyn Jago @ 2011-02-18 10:58 UTC (permalink / raw)
To: emacs-orgmode
Hi
I've noticed a couple of minor inconsistencies with C++ export...
- According to the Org manual (section 14.7 Languages) the identifier
for C++ is C++ (upper-case), but in practice this fails and the
identifier c++ (lower-case) must be used. In general, identifiers
appear to be lower-case words or upper-case single characters (such
as C and R) so perhaps this is a bug?
- Within org-babel cpp is used to identify C++, however using cpp as an
identifier actually exports as if it were a C block.
If it is desired the following patch changes the C++ identifier to C++,
and maps cpp identifier also to C++, although perhaps it is better to
maintain c++ also for backward compatibility?
Regards
Martyn
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index da0e768..86ec783 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -56,10 +56,10 @@ is currently being evaluated.")
(defun org-babel-execute:cpp (body params)
"Execute BODY according to PARAMS. This function calls
-`org-babel-execute:C'."
- (org-babel-execute:C body params))
+`org-babel-execute:C++'."
+ (org-babel-execute:C++ body params))
-(defun org-babel-execute:c++ (body params)
+(defun org-babel-execute:C++ (body params)
"Execute a block of C++ code with org-babel. This function is
called by `org-babel-execute-src-block'."
(let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
---
Org-mode version 7.4
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
2011-02-18
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [babel][patch] C++ inconsistencies
2011-02-18 10:58 [babel][patch] C++ inconsistencies Martyn Jago
@ 2011-02-18 16:36 ` Martyn Jago
2011-02-20 8:25 ` Eric Schulte
0 siblings, 1 reply; 9+ messages in thread
From: Martyn Jago @ 2011-02-18 16:36 UTC (permalink / raw)
To: emacs-orgmode
Martyn Jago <martyn.jago@btinternet.com> writes:
> Hi
>
> I've noticed a couple of minor inconsistencies with C++ export...
>
> - According to the Org manual (section 14.7 Languages) the identifier
> for C++ is C++ (upper-case), but in practice this fails and the
> identifier c++ (lower-case) must be used. In general, identifiers
> appear to be lower-case words or upper-case single characters (such
> as C and R) so perhaps this is a bug?
>
> - Within org-babel cpp is used to identify C++, however using cpp as an
> identifier actually exports as if it were a C block.
>
> If it is desired the following patch changes the C++ identifier to C++,
> and maps cpp identifier also to C++, although perhaps it is better to
> maintain c++ also for backward compatibility?
>
> Regards
>
> Martyn
>
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index da0e768..86ec783 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -56,10 +56,10 @@ is currently being evaluated.")
>
> (defun org-babel-execute:cpp (body params)
> "Execute BODY according to PARAMS. This function calls
> -`org-babel-execute:C'."
> - (org-babel-execute:C body params))
> +`org-babel-execute:C++'."
> + (org-babel-execute:C++ body params))
>
> -(defun org-babel-execute:c++ (body params)
> +(defun org-babel-execute:C++ (body params)
> "Execute a block of C++ code with org-babel. This function is
> called by `org-babel-execute-src-block'."
> (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
>
>
> ---
>
> Org-mode version 7.4
> GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
> 2011-02-18
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Hi
After further inspection and testing the following patch is more
complete (apologies for the noise).
In addition I have a very simple Yaml template if it is of any interest
to anybody. I have a strong use case for tangling Yaml for 'literate
configuration' purposes since I come across some particularly hairy yaml
configuration files for the unit-test libraries Unity, CMock and
Ceedling.
Regards
Martyn
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index da0e768..5aa750c 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -38,7 +38,7 @@
(declare-function org-entry-get "org"
(pom property &optional inherit literal-nil))
-(add-to-list 'org-babel-tangle-lang-exts '("c++" . "cpp"))
+(add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
(defvar org-babel-default-header-args:C '())
@@ -46,8 +46,8 @@
"Command used to compile a C source code file into an
executable.")
-(defvar org-babel-c++-compiler "g++"
- "Command used to compile a c++ source code file into an
+(defvar org-babel-C++-compiler "g++"
+ "Command used to compile a C++ source code file into an
executable.")
(defvar org-babel-c-variant nil
@@ -56,15 +56,15 @@ is currently being evaluated.")
(defun org-babel-execute:cpp (body params)
"Execute BODY according to PARAMS. This function calls
-`org-babel-execute:C'."
- (org-babel-execute:C body params))
+`org-babel-execute:C++'."
+ (org-babel-execute:C++ body params))
-(defun org-babel-execute:c++ (body params)
+(defun org-babel-execute:C++ (body params)
"Execute a block of C++ code with org-babel. This function is
called by `org-babel-execute-src-block'."
(let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
-(defun org-babel-expand-body:c++ (body params)
+(defun org-babel-expand-body:C++ (body params)
"Expand a block of C++ code with org-babel according to it's
header arguments (calls `org-babel-C-expand')."
(let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params)))
@@ -81,7 +81,7 @@ header arguments (calls `org-babel-C-expand')."
(defun org-babel-C-execute (body params)
"This function should only be called by `org-babel-execute:C'
-or `org-babel-execute:c++'."
+or `org-babel-execute:C++'."
(let* ((tmp-src-file (org-babel-temp-file
"C-src-"
(cond
@@ -98,7 +98,7 @@ or `org-babel-execute:c++'."
(format "%s -o %s %s %s"
(cond
((equal org-babel-c-variant 'c) org-babel-C-compiler)
- ((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
+ ((equal org-babel-c-variant 'cpp) org-babel-C++-compiler))
(org-babel-process-file-name tmp-bin-file)
(mapconcat 'identity
(if (listp flags) flags (list flags)) " ")
---
Org-mode version 7.4
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
2011-02-18
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Re: [babel][patch] C++ inconsistencies
2011-02-18 16:36 ` Martyn Jago
@ 2011-02-20 8:25 ` Eric Schulte
2011-02-21 13:37 ` Martyn Jago
0 siblings, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2011-02-20 8:25 UTC (permalink / raw)
To: Martyn Jago; +Cc: emacs-orgmode
[...]
>
> Hi
>
> After further inspection and testing the following patch is more
> complete (apologies for the noise).
>
> In addition I have a very simple Yaml template if it is of any interest
> to anybody. I have a strong use case for tangling Yaml for 'literate
> configuration' purposes since I come across some particularly hairy yaml
> configuration files for the unit-test libraries Unity, CMock and
> Ceedling.
>
> Regards
>
> Martyn
>
Hi Martyn,
Thanks for sharing this patch, it looks great. Also, I would love to
include your YAML support. It's better to have partial YAML support
than none, and any skeleton can serve as the foundation for more
sophisticated support.
Would you be willing to sign the FSF copyright attribution? If so then
I can apply the patch and add the YAML support as soon as the process
begins. See http://orgmode.org/worg/org-contribute.html
Thanks! -- Eric
>
>
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index da0e768..5aa750c 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -38,7 +38,7 @@
> (declare-function org-entry-get "org"
> (pom property &optional inherit literal-nil))
>
> -(add-to-list 'org-babel-tangle-lang-exts '("c++" . "cpp"))
> +(add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
>
> (defvar org-babel-default-header-args:C '())
>
> @@ -46,8 +46,8 @@
> "Command used to compile a C source code file into an
> executable.")
>
> -(defvar org-babel-c++-compiler "g++"
> - "Command used to compile a c++ source code file into an
> +(defvar org-babel-C++-compiler "g++"
> + "Command used to compile a C++ source code file into an
> executable.")
>
> (defvar org-babel-c-variant nil
> @@ -56,15 +56,15 @@ is currently being evaluated.")
>
> (defun org-babel-execute:cpp (body params)
> "Execute BODY according to PARAMS. This function calls
> -`org-babel-execute:C'."
> - (org-babel-execute:C body params))
> +`org-babel-execute:C++'."
> + (org-babel-execute:C++ body params))
>
> -(defun org-babel-execute:c++ (body params)
> +(defun org-babel-execute:C++ (body params)
> "Execute a block of C++ code with org-babel. This function is
> called by `org-babel-execute-src-block'."
> (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
>
> -(defun org-babel-expand-body:c++ (body params)
> +(defun org-babel-expand-body:C++ (body params)
> "Expand a block of C++ code with org-babel according to it's
> header arguments (calls `org-babel-C-expand')."
> (let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params)))
> @@ -81,7 +81,7 @@ header arguments (calls `org-babel-C-expand')."
>
> (defun org-babel-C-execute (body params)
> "This function should only be called by `org-babel-execute:C'
> -or `org-babel-execute:c++'."
> +or `org-babel-execute:C++'."
> (let* ((tmp-src-file (org-babel-temp-file
> "C-src-"
> (cond
> @@ -98,7 +98,7 @@ or `org-babel-execute:c++'."
> (format "%s -o %s %s %s"
> (cond
> ((equal org-babel-c-variant 'c) org-babel-C-compiler)
> - ((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
> + ((equal org-babel-c-variant 'cpp) org-babel-C++-compiler))
> (org-babel-process-file-name tmp-bin-file)
> (mapconcat 'identity
> (if (listp flags) flags (list flags)) " ")
>
> ---
>
> Org-mode version 7.4
> GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
> 2011-02-18
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [babel][patch] C++ inconsistencies
2011-02-20 8:25 ` Eric Schulte
@ 2011-02-21 13:37 ` Martyn Jago
2011-02-21 17:10 ` Eric Schulte
2011-02-22 11:20 ` Bastien
0 siblings, 2 replies; 9+ messages in thread
From: Martyn Jago @ 2011-02-21 13:37 UTC (permalink / raw)
To: emacs-orgmode
"Eric Schulte" <schulte.eric@gmail.com> writes:
[...]
> Hi Martyn,
>
> Thanks for sharing this patch, it looks great. Also, I would love to
> include your YAML support. It's better to have partial YAML support
> than none, and any skeleton can serve as the foundation for more
> sophisticated support.
>
> Would you be willing to sign the FSF copyright attribution? If so then
> I can apply the patch and add the YAML support as soon as the process
> begins. See http://orgmode.org/worg/org-contribute.html
>
> Thanks! -- Eric
Hi Eric
The FSF process is in progress - I'm currently waiting for the agreement
to sign. I'll tidy up the YAML export.
Regards
Martyn
---
Org-mode version 7.4
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
2011-02-18
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: [babel][patch] C++ inconsistencies
2011-02-21 13:37 ` Martyn Jago
@ 2011-02-21 17:10 ` Eric Schulte
2011-02-22 22:07 ` Martyn Jago
2011-02-22 11:20 ` Bastien
1 sibling, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2011-02-21 17:10 UTC (permalink / raw)
To: Martyn Jago; +Cc: emacs-orgmode
Martyn Jago <martyn.jago@btinternet.com> writes:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
> [...]
>
>> Hi Martyn,
>>
>> Thanks for sharing this patch, it looks great. Also, I would love to
>> include your YAML support. It's better to have partial YAML support
>> than none, and any skeleton can serve as the foundation for more
>> sophisticated support.
>>
>> Would you be willing to sign the FSF copyright attribution? If so then
>> I can apply the patch and add the YAML support as soon as the process
>> begins. See http://orgmode.org/worg/org-contribute.html
>>
>> Thanks! -- Eric
>
> Hi Eric
>
> The FSF process is in progress - I'm currently waiting for the agreement
> to sign. I'll tidy up the YAML export.
>
Hi Martyn,
That's great news. A just had trouble trying to apply your earlier
patch, could you reproduce the patch with
git diff > cpp.patch
then re-send the resulting patch as an attachment?
Thanks -- Eric
>
> Regards
>
> Martyn
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [babel][patch] C++ inconsistencies
2011-02-21 17:10 ` Eric Schulte
@ 2011-02-22 22:07 ` Martyn Jago
2011-02-23 4:21 ` Eric Schulte
0 siblings, 1 reply; 9+ messages in thread
From: Martyn Jago @ 2011-02-22 22:07 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Martyn Jago <martyn.jago@btinternet.com> writes:
>
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>
>> [...]
>>
> Hi Martyn,
>
> That's great news. A just had trouble trying to apply your earlier
> patch, could you reproduce the patch with
>
> git diff > cpp.patch
>
> then re-send the resulting patch as an attachment?
>
> Thanks -- Eric
>
>>
Hi Eric
Apologies, I'm still familiarising myself with Gnus but hopefully this
will work.
Also thanks for Babel, I think its got a great future!
Regards
Martyn
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cpp.patch --]
[-- Type: text/x-diff, Size: 2296 bytes --]
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index da0e768..5aa750c 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -38,7 +38,7 @@
(declare-function org-entry-get "org"
(pom property &optional inherit literal-nil))
-(add-to-list 'org-babel-tangle-lang-exts '("c++" . "cpp"))
+(add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
(defvar org-babel-default-header-args:C '())
@@ -46,8 +46,8 @@
"Command used to compile a C source code file into an
executable.")
-(defvar org-babel-c++-compiler "g++"
- "Command used to compile a c++ source code file into an
+(defvar org-babel-C++-compiler "g++"
+ "Command used to compile a C++ source code file into an
executable.")
(defvar org-babel-c-variant nil
@@ -56,15 +56,15 @@ is currently being evaluated.")
(defun org-babel-execute:cpp (body params)
"Execute BODY according to PARAMS. This function calls
-`org-babel-execute:C'."
- (org-babel-execute:C body params))
+`org-babel-execute:C++'."
+ (org-babel-execute:C++ body params))
-(defun org-babel-execute:c++ (body params)
+(defun org-babel-execute:C++ (body params)
"Execute a block of C++ code with org-babel. This function is
called by `org-babel-execute-src-block'."
(let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
-(defun org-babel-expand-body:c++ (body params)
+(defun org-babel-expand-body:C++ (body params)
"Expand a block of C++ code with org-babel according to it's
header arguments (calls `org-babel-C-expand')."
(let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params)))
@@ -81,7 +81,7 @@ header arguments (calls `org-babel-C-expand')."
(defun org-babel-C-execute (body params)
"This function should only be called by `org-babel-execute:C'
-or `org-babel-execute:c++'."
+or `org-babel-execute:C++'."
(let* ((tmp-src-file (org-babel-temp-file
"C-src-"
(cond
@@ -98,7 +98,7 @@ or `org-babel-execute:c++'."
(format "%s -o %s %s %s"
(cond
((equal org-babel-c-variant 'c) org-babel-C-compiler)
- ((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
+ ((equal org-babel-c-variant 'cpp) org-babel-C++-compiler))
(org-babel-process-file-name tmp-bin-file)
(mapconcat 'identity
(if (listp flags) flags (list flags)) " ")
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Re: [babel][patch] C++ inconsistencies
2011-02-21 13:37 ` Martyn Jago
2011-02-21 17:10 ` Eric Schulte
@ 2011-02-22 11:20 ` Bastien
2011-02-22 22:14 ` Martyn Jago
1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2011-02-22 11:20 UTC (permalink / raw)
To: Martyn Jago; +Cc: emacs-orgmode
Hi Martyn,
Martyn Jago <martyn.jago@btinternet.com> writes:
> The FSF process is in progress - I'm currently waiting for the agreement
> to sign. I'll tidy up the YAML export.
I confirm the assignment/disclaimer process with the FSF is complete.
I added you to the list of contributors on Worg:
http://orgmode.org/worg/org-contribute.html#contributors_with_fsf_papers
(We need to wait a bit before the Worg repo is published on the
website.)
Thanks for contributing!
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [babel][patch] C++ inconsistencies
2011-02-22 11:20 ` Bastien
@ 2011-02-22 22:14 ` Martyn Jago
0 siblings, 0 replies; 9+ messages in thread
From: Martyn Jago @ 2011-02-22 22:14 UTC (permalink / raw)
To: emacs-orgmode
Bastien <bastien.guerry@wikimedia.fr> writes:
> Hi Martyn,
>
> Martyn Jago <martyn.jago@btinternet.com> writes:
>
>> The FSF process is in progress - I'm currently waiting for the agreement
>> to sign. I'll tidy up the YAML export.
>
> I confirm the assignment/disclaimer process with the FSF is complete.
>
> I added you to the list of contributors on Worg:
>
> http://orgmode.org/worg/org-contribute.html#contributors_with_fsf_papers
>
> (We need to wait a bit before the Worg repo is published on the
> website.)
>
> Thanks for contributing!
Hi Bastien
I hope to help with Org mode where I can, although I have much to
learn. In a way I see Org mode as the evolution of Emacs (which I've
been using for several years to program Embedded C and Ruby) but that's
another story.
Thank you!
Martyn
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-02-23 4:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18 10:58 [babel][patch] C++ inconsistencies Martyn Jago
2011-02-18 16:36 ` Martyn Jago
2011-02-20 8:25 ` Eric Schulte
2011-02-21 13:37 ` Martyn Jago
2011-02-21 17:10 ` Eric Schulte
2011-02-22 22:07 ` Martyn Jago
2011-02-23 4:21 ` Eric Schulte
2011-02-22 11:20 ` Bastien
2011-02-22 22:14 ` Martyn Jago
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).