Re: [O] Easy Template does not expand
Got it, thanks. Greetings. ZHUO QL (KDr2, http://kdr2.com) On Thursday, May 17, 2018, 9:42:00 PM GMT+8, Bernt Hansen <be...@norang.ca> wrote: "ZHUO QL (KDr2)" <zhu...@yahoo.com> writes: > I am on the bleeding edge and using the master branch of Org-mode. After > updating the source of Org a few days ago, I found the easy template can be > expanded by TAB key now, that is: > > When I press TAB after typing > Version Info: > GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.28) of 2018-02-19, > modified by Debian > Org mode version 9.0.5 (release_9.0.5-86-ga91eae @ > /home/kdr2/Work/opensrc/org-mode/lisp/) > > Does anybody know what's wrong about this? Thanks. It's not wrong - it's changed. There is a new keybinding C-c C-, for inserting templates that replaces the
[O] Easy Template does not expand
I am on the bleeding edge and using the master branch of Org-mode. After updating the source of Org a few days ago, I found the easy template can be expanded by TAB key now, that is: When I press TAB after typing http://kdr2.com)
Re: [O] Proposal: references from code to text.
Thanks, that works perfectly. I made a simple summary of this thread on my site: http://kdr2.com/tech/emacs/1805-approach-org-ref-code-to-text.html Greetings. ZHUO QL (KDr2, http://kdr2.com) On Thursday, May 17, 2018, 11:11:39 AM GMT+8, John Kitchin <jkitc...@andrew.cmu.edu> wrote: I believe you can do that with the Library of Babel (https://orgmode.org/worg/org-contrib/babel/library-of-babel.html) John --- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803@johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] Proposal: references from code to text.
Oh, that makes sense. So in this way, we must put the text into quotes, and then into a txt code block. And also we don't have a chance to do any transformation of the text(e.g. org-mode list to javadoc format). I think the direct reference from code to text is better. I will try to implement it, but I'm not very familiar with the code base and don't have much time, so I can't give any commitment. But once I have anything to show, I'll be back here :) Greetings. ZHUO QL (KDr2, http://kdr2.com) On Tuesday, May 15, 2018, 6:05:31 PM GMT+8, Eric S Fraga <esfli...@gmail.com> wrote: On Tuesday, 15 May 2018 at 04:49, ZHUO QL (KDr2) wrote: > 2. The bug Eric just found while putting a <> link within > quotes, although, it may be easy to fix. I realised afterwards that it is not a bug but is a feature: org assumes that anything before the << start of the link should be repeated on each line of the incorporated src block. This allows for easy incorporation of code into a comment block, e.g. for C or sh etc. -- Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-591-gee336b
[O] Proposal: references from code to text.
Hi all, I just post a proposal for orgmode on my website(generated by orgmode): http://kdr2.com/tech/emacs/1805-proposal-org-ref-code-to-text.html . Here is the source of the proposal: # -*- mode: org; mode: auto-fill; -*- #+TITLE: Proposal for Orgmode: references from code to text. #+AUTHOR: KDr2 #+OPTIONS: toc:nil #+OPTIONS: num:nil #+BEGIN: inc-file :file "common.inc.org" #+END: #+CALL: dynamic-header() :results raw #+CALL: meta-keywords(kws='("orgmode" "literate programming")) :results raw # - DATE <2018-05-12 Sat> Literate programming is writing out the program logic in a human language with included (separated by a primitive markup) code snippets and macros. A preprocessor is used to substitute arbitrary hierarchies, or rather "interconnected 'webs' of macros", to produce the compilable source code with one command ("tangle"), and documentation with another ("weave"). So in a literate programming source file, any chunk is either a block of code or a block of document in a human language, I'll call them *code* and *text* below. In my opinion, code and text should be able to reference each other: - *Text refers to text* \\ In the exported/woven documentation, these references act as links, make interconnections between relevant topics. - *Text refers to code* \\ The links in the exported/woven documentation can also link to a line of code if the code blocks are also included in the exported/woven documentation. - *Code refers to code* \\ That's the most important part of the literate programming. This kind of references act as placeholders or something like macro in the C-programming language. With it, literate programming provides an ability to change the order of the source code from a machine-imposed sequence to one convenient to the human mind. [[https://en.wikipedia.org/wiki/Literate_programming#Example][Here is a simple Example depicts this concept]]. - *Code refers to text* \\ So far as I know, no literate programming tool has this kind of references. However, this kind of references could be very benifical too. Many programming languages have a mechanism to support embedding documentation(usually as comments) in the source code, AKA [[https://en.wikipedia.org/wiki/Docstring][Docstring]]. These embedded documentations are widely and conveniently used in editor, REPL and IDE. For instance, the docs of any elisp function that we can read in Emacs are from the elisp source. But in literate programming we seldom embed comments into the code blocks, as an impliaction the extracted/tangled code has no docs embeded. If we can refer to chunks of text in the code blocks, we will have the chance to include these chunks of text as embeded docs in the code in the tangling process, which results in well-documented source code. This is useful especially while the programmer are authoring reusable source code, like libraries or frameworks. Here is the implementation status of these kinds of references of noweb and Org mode (~->~ means 'has the ability to make reference to'): | tool | text -> text | code -> code | text -> code | code -> text | |--+--+--++--| | noweb| No | Yes | No | No | | Org mode | Yes, links | Yes, noweb style | Yes, ~(ref:*)~ | No | As we saw, both noweb and Org mode do not implement the reference from code to text. Could we provide this feature in Org mode -- the best and widely used literate programming tool? As a proposal, in Org mode, we can mimic the labels in code blocks(i.e. text -> code reference), use something like ~(ref:text:)~ as the reference from code to text: #+BEGIN_SRC org ,#+NAME: DOC-OF-ADD We use the function add to calculate the sum of two numbers. ,#+BEGIN_SRC elisp (defun add (x y) "(ref:text:DOC-OF-ADD)" (+ x y)) ,#+END_SRC #+END_SRC The Org file above will produce the code below: #+BEGIN_SRC elisp (defun add (x y) "We use the function add to calculate the sum of two numbers." (+ x y)) #+END_SRC - Beside the ~NAME~, we could also support reference via the ~CUSTOM_ID~ property or anything else that can locate a text chunk. - In the tangling process, we should do some kind of transformation of the target text, for example, escape the quote mark. A hook may be needed to let the user customize the transformation too. What do you think? * References - https://en.wikipedia.org/wiki/Literate_programming - https://en.wikipedia.org/wiki/Noweb - https://en.wikipedia.org/wiki/Docstring - http://orgmode.org/manual/Extracting-source-code.html#Extracting-source-code - http://orgmode.org/manual/Noweb-reference-syntax.html#Noweb-reference-syntax - http://orgmode.org/manual/Literal-examples.html#Literal-ex
Re: [O] [ANN] Merge export-block type within special-block
I found this was fixed on both maint and master branch :) Thanks for all your works, but would you tell us how did you do it? or give the commit id? (Sorry I did not find it by myself...) Thank you very much. On Sun, Aug 31, 2014 at 8:56 PM, Nicolas Goaziou m...@nicolasgoaziou.fr wrote: Hello, KDr2 killy.d...@gmail.com writes: This is nice, but it brought a bug, `[N]' in HTML block is recognized as footnote, e.g.: #+BEGIN_HTML ONE[1] script console.log(v1[0]); /script #+END_HTML There are two footnotes in the generated HTML. Would you fix this please? Unfortunately, no, I cannot fix it. The problem is even deeper. Indeed, my approach is fundamentally wrong: it is impossible to postpone choosing between parsed or raw data at export time. This information must be obtained at parsing time. Yet, I think syntax should not depend on the libraries loaded. So the initial problem still needs a solution. Special blocks and export blocks are just too similar. We could make them slightly different. One solution is to mark explicitly blocks meant to insert raw code. E.g., #+BEGIN_SOMETHING :special t ... #+END_SOMETHING vs #+BEGIN_SOMETHING ... #+END_SOMETHING In the first case contents would be parsed and the block treated as a special block (i.e. depending on the back-end) whereas in the second case, contents would be inserted as-is in the buffer, provided target export back-ends accepts data from SOMETHING blocks (IOW SOMETHING = LATEX if ox-latex is used). This is clearly not backward-compatible. But it only modifies syntax for special blocks, which, I guess, are much less used than their cousins, export blocks. The :special t may be shorter, too. Cc'ing Bastien for his opinion. Regards, -- Nicolas Goaziou -- -- KDr2, http://kdr2.com
Re: [O] [ANN] Merge export-block type within special-block
Hi Nicolas, This is nice, but it brought a bug, `[N]' in HTML block is recognized as footnote, e.g.: #+BEGIN_HTML ONE[1] script console.log(v1[0]); /script #+END_HTML There are two footnotes in the generated HTML. Would you fix this please? Thanks. On Sun, Jul 27, 2014 at 8:37 PM, Nicolas Goaziou m...@nicolasgoaziou.fr wrote: Hello, Export blocks are blocks dedicated to export back-ends, e.g., #+BEGIN_LATEX. The way they are currently parsed is flawed. Export blocks are back-end dependent. At the moment, back-ends register their own export block in a variable, `org-element-block-name-alist', so the parser can know if it needs to parse an export block or not. As a consequence, the same block can be parsed differently if a given export back-end is loaded or not. E.g., #+BEGIN_HTML ... #+END_HTML will be parsed as a `special-block' if ox-html.el is not loaded, or an `export-block' otherwise. This is slightly... ugly. And it gets worse if we include the cache, which will not update the block if it is not modified. I just committed a set of patches that solve the problem: `export-block' elements do not exist anymore. Instead, such blocks are now parsed as `special-block', always. This does not depend on the libraries loaded so far. Of course, special blocks are not treated exactly as export blocks. The latter's contents are included as-is in the output whereas the former's are interpreted. Therefore, special blocks now include another property, :raw-value, which stores the pristine initial contents of the block, and ox.el provides a new function, `org-export-raw-special-block-p', which tells the difference between a former export block and a special block. This makes sense since an export-block is clearly, and only, an export concept. This is not related to Org syntax. This is more simple to handle than it sounds, and can be described with two steps: 1. `export-block' elements, translators and filters are now ignored. These can be removed from export back-ends (unless you want to preserve compatibility with Org 8.2, in which case leaving them will not hurt: they will be used in Org 8.2 and ignored in Org 8.3). 2. Translators for special blocks, e.g. `org-BACKEND-special-block' need to be updated and check first if current block is a raw special block or not. The following template is a suggestion. #+BEGIN_SRC emacs-lisp (defun org-latex-special-block (special-block contents info) (if (org-export-raw-special-block-p special-block info) (org-element-property :raw-value special-block) ;; Usual handling for special blocks goes here. )) #+END_SRC Note that if BACKEND is a derived back-end and doesn't implement its own special block translator already, there is nothing to change. The parent back-end will take care of such blocks. All back-ends in core and in contrib have been updated this way already. I included `org-export-raw-special-block-p' in Org 8.2, as a forward-compatibility measure, so back-end maintainers do not have to do the `fboundp' dance. BTW, for those in the back of the room: I didn't remove #+BEGIN_LATEX-like constructs. Regards, -- Nicolas Goaziou0x80A93738 -- -- KDr2, http://kdr2.com
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Hi, all This patch is finally merged into the master branch, we can export results of scheme code block under batch mode now. Thanks to Eric, Bastien and Oleh. On Sat, Apr 12, 2014 at 10:12 PM, Eric Schulte schulte.e...@gmail.comwrote: KDr2 killy.d...@gmail.com writes: HI, Eric You are right, I remove the usage of advice now, and use the method you (nearly) gave, only 1 little change: I found the code: (defun t1 () (message abc)) ;;(symbol-function 't1) (let ((hold #'t1)) (defun t1 () (message def)) (setq t1 hold)) ;;(symbol-function 't1) did recover the t1 function after it executed, so I use this way: (defun t1 () (message abc)) ;;(symbol-function 't1) (let ((hold (symbol-function 't1))) (defun t1 () (message def)) (fset 't1 hold)) ;;(symbol-function 't1) Using fset is more readable than my proposal. Very nice. And the new patch is attached. Thanks, however unwind-protect is not used correctly. Make sure that the value of message is reset in the unwindforms portion of unwind-protect. BTW: I received a PDF assignment form from FSF, but the developer name and the target program on it were wrong (It's for another person who contributes to GCC, I think), so I reply that mail for a new PDF assignment form, I 'll tell you after these things done. Great, let Bastien and myself know when this comes through and he'll add you to the contributors list and I'll apply the patch. Best, Thanks. On Sat, Apr 12, 2014 at 3:18 AM, Eric Schulte schulte.e...@gmail.com wrote: Hmmm, Not to be overly nitpicky here, but I see two issues. 1. You should use unwind-protect, to ensure that (ad-unadvise #'message) is run even if @body throws an error, and 2. This will remove any advise which the user has placed on #'message. How about something shaped like the following. (defmacro with-weird-message (rest body) `(let ((hold #'message) current-message) (unwind-protect (progn (defun message (rest args) (setq current-message (apply #'format args))) ,@body current-message) (setq message hold Best, P.S. I know this is a lot of process for a small patch, but from this point forward once you have the FSF assignment you can much more easily contribute to ob-scheme and org in general KDr2 killy.d...@gmail.com writes: Hi, Eric I'm sorry for that I used `flet' in the patch, It's a easy way to let function `current-message' work in batch mode, so I used it even I saw that emacs says `flet' is obsolete, I'm sorry for that. And I made a new patch(attachment) using `defadvice' for `message' to capture the message in batch mode, after the message being captured, the advice function is removed. Is this way OK? And I also sent a request email to ass...@gnu.org, and now waiting the reply. Thanks. On Fri, Apr 11, 2014 at 10:45 AM, Eric Schulte schulte.e...@gmail.com wrote: We can no longer use `flet' in the Org-mode code base, please re-work this patch w/o flet. Also, I don't see your name in the list of contributors, and (I believe) this patch is too large to apply w/o FSF assignment. See the following page on how to contribute to Org-mode. http://orgmode.org/worg/org-contribute.html KDr2 killy.d...@gmail.com writes: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org-f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D -- -- KDr2, http://kdr2.com From fe5549f3f48acf9b51aeb3706eb8dd3d76ab18c1 Mon Sep 17 00:00:00 2001 From: KDr2 killy.d...@gmail.com Date: Fri, 11 Apr 2014 12:56:24 +0800 Subject: [PATCH] lisp/ob-scheme.el: Fix scheme code blocks execution error in batch mode * lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode. `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. Modified from a patch
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
HI, Eric You are right, I remove the usage of advice now, and use the method you (nearly) gave, only 1 little change: I found the code: (defun t1 () (message abc)) ;;(symbol-function 't1) (let ((hold #'t1)) (defun t1 () (message def)) (setq t1 hold)) ;;(symbol-function 't1) did recover the t1 function after it executed, so I use this way: (defun t1 () (message abc)) ;;(symbol-function 't1) (let ((hold (symbol-function 't1))) (defun t1 () (message def)) (fset 't1 hold)) ;;(symbol-function 't1) And the new patch is attached. BTW: I received a PDF assignment form from FSF, but the developer name and the target program on it were wrong (It's for another person who contributes to GCC, I think), so I reply that mail for a new PDF assignment form, I 'll tell you after these things done. Thanks. On Sat, Apr 12, 2014 at 3:18 AM, Eric Schulte schulte.e...@gmail.comwrote: Hmmm, Not to be overly nitpicky here, but I see two issues. 1. You should use unwind-protect, to ensure that (ad-unadvise #'message) is run even if @body throws an error, and 2. This will remove any advise which the user has placed on #'message. How about something shaped like the following. (defmacro with-weird-message (rest body) `(let ((hold #'message) current-message) (unwind-protect (progn (defun message (rest args) (setq current-message (apply #'format args))) ,@body current-message) (setq message hold Best, P.S. I know this is a lot of process for a small patch, but from this point forward once you have the FSF assignment you can much more easily contribute to ob-scheme and org in general KDr2 killy.d...@gmail.com writes: Hi, Eric I'm sorry for that I used `flet' in the patch, It's a easy way to let function `current-message' work in batch mode, so I used it even I saw that emacs says `flet' is obsolete, I'm sorry for that. And I made a new patch(attachment) using `defadvice' for `message' to capture the message in batch mode, after the message being captured, the advice function is removed. Is this way OK? And I also sent a request email to ass...@gnu.org, and now waiting the reply. Thanks. On Fri, Apr 11, 2014 at 10:45 AM, Eric Schulte schulte.e...@gmail.com wrote: We can no longer use `flet' in the Org-mode code base, please re-work this patch w/o flet. Also, I don't see your name in the list of contributors, and (I believe) this patch is too large to apply w/o FSF assignment. See the following page on how to contribute to Org-mode. http://orgmode.org/worg/org-contribute.html KDr2 killy.d...@gmail.com writes: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org-f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D -- -- KDr2, http://kdr2.com From fe5549f3f48acf9b51aeb3706eb8dd3d76ab18c1 Mon Sep 17 00:00:00 2001 From: KDr2 killy.d...@gmail.com Date: Fri, 11 Apr 2014 12:56:24 +0800 Subject: [PATCH] lisp/ob-scheme.el: Fix scheme code blocks execution error in batch mode * lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode. `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. Modified from a patch proposal by KDr2(killy.d...@gmail.com) --- lisp/ob-scheme.el | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index b7117e9..6b82c6e 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -118,6 +118,19 @@ org-babel-scheme-execute-with-geiser will use a temporary session. (name result)) +(defmacro org-babel-scheme-capture-current-message (rest body) + Capture current message in both interactive and noninteractive mode + `(if noninteractive + (let ((current-message nil)) + (defadvice message (after capture-current-message activate) + (setq current-message ad-return-value)) + ,@body + (ad-unadvise #'message) + current-message
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Hi, Oleh Thanks for you reply. Here is my config steps: 0. I use Debian(sid) and Emacs 24 1. install guile (using apt): http://www.gnu.org/software/guile/ 2. install geiser(http://www.nongnu.org/geiser/) with elpa and setting for geiser: (setq geiser-active-implementations '(guile)) (setq geiser-default-implementation 'guile) That's all, there's no special settings for orgmode. Thanks again. On Thu, Apr 10, 2014 at 4:27 PM, Oleh ohwoeo...@gmail.com wrote: Hi, I tried to have a look at your patch, but ob-scheme has stopped working for me. Can you send me the minimal init.el to make your scheme-test.org work in interactive mode? regards, Oleh On Tue, Apr 8, 2014 at 3:56 PM, KDr2 killy.d...@gmail.com wrote: Hi, folks Has anyone reviewed this patch? Or is there a better way to fix the bug? Thanks. On Wed, Apr 2, 2014 at 11:48 AM, KDr2 killy.d...@gmail.com wrote: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org -f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- KDr2, http://kdr2.com -- -- KDr2, http://kdr2.com -- -- KDr2, http://kdr2.com
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Does your M-x run-geiser work? It will lead you to a scheme REPL like this: GNU Guile 2.0.9-deb+1-1 Copyright (C) 1995-2013 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user) 1 $2 = 1 scheme@(guile-user) On Thu, Apr 10, 2014 at 4:55 PM, Oleh ohwoeo...@gmail.com wrote: 0. I use Debian(sid) and Emacs 24 1. install guile (using apt): http://www.gnu.org/software/guile/ 2. install geiser(http://www.nongnu.org/geiser/) with elpa and setting for geiser: (setq geiser-active-implementations '(guile)) (setq geiser-default-implementation 'guile) I've got emacs trunk, GNU Guile 2.0.9, geiser from MELPA and I'm getting the results in a *Geiser dbg* window instead of org-mode when I eval. So the issue is either with ob-scheme or with my geiser, which is the development version, but I don't see why it shouldn't work. regards, Oleh -- -- KDr2, http://kdr2.com
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Version of geiser I installed: geiser-20140326.951, If it has been changed, it must be changed in the past 2 weeks ... On Thu, Apr 10, 2014 at 6:54 PM, Oleh ohwoeo...@gmail.com wrote: Of course it works, that's the first thing I tried. The issue probably is that the implementation of geiser functions that ob-scheme uses has been changed. Oleh On Thu, Apr 10, 2014 at 11:02 AM, KDr2 killy.d...@gmail.com wrote: Does your M-x run-geiser work? It will lead you to a scheme REPL like this: GNU Guile 2.0.9-deb+1-1 Copyright (C) 1995-2013 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user) 1 $2 = 1 scheme@(guile-user) On Thu, Apr 10, 2014 at 4:55 PM, Oleh ohwoeo...@gmail.com wrote: 0. I use Debian(sid) and Emacs 24 1. install guile (using apt): http://www.gnu.org/software/guile/ 2. install geiser(http://www.nongnu.org/geiser/) with elpa and setting for geiser: (setq geiser-active-implementations '(guile)) (setq geiser-default-implementation 'guile) I've got emacs trunk, GNU Guile 2.0.9, geiser from MELPA and I'm getting the results in a *Geiser dbg* window instead of org-mode when I eval. So the issue is either with ob-scheme or with my geiser, which is the development version, but I don't see why it shouldn't work. regards, Oleh -- -- KDr2, http://kdr2.com -- -- KDr2, http://kdr2.com
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
org-plus-contrib-20140407 And the file lisp/ob-scheme.el is the same as it in the master branch: And the error message before patched: Loading /home/kdr2/.emacs.d/init.el (source)... Loading /home/kdr2/.emacs.d/src/elisp/common.el (source)... Loading pde-load... Loading pde-loaddefs... ../.emacs.d/src/elisp/tools/init-ace-jump.el: `flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'. Loading /home/kdr2/.emacs.d/src/elisp/misc.el (source)... Loading desktop... Loading /home/kdr2/.emacs.d/src/elisp/themes/wombat-custom.el (source)... Loading vline... Evaluate this scheme code block on your system? (y or n) y executing Scheme code block... Starting Geiser REPL for guile ... Package assoc is obsolete! Package complete is obsolete! Guile REPL up and running! = Hello Scheme in OrgMode Debugger entered--Lisp error: (wrong-type-argument arrayp nil) org-babel-scheme-execute-with-geiser((display \Hello Scheme in OrgMode\) t guile nil) org-babel-execute:scheme((display \Hello Scheme in OrgMode\) ((:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . results) (:results . raw output replace) (:colname-names) (:hlines . no) (:result-params replace output raw) (:result-type . output) (:rowname-names) (:session . none))) org-babel-execute-src-block(nil (scheme (display \Hello Scheme in OrgMode\) ((:colname-names) (:rowname-names) (:result-params replace out put raw replace output raw) (:result-type . output) (:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangl e . no) (:exports . results) (:results . replace output raw) (:session . none) (:rowname-names) (:result-type . output) (:result-params repl ace output raw) (:hlines . no) (:colname-names)) nil 0 1)) org-babel-exp-results((scheme (display \Hello Scheme in OrgMode\) ((:cache . no) (:colname-names) (:comments . ) (:exports . results) ( :hlines . no) (:noweb . no) (:padline . ) (:result-params replace output raw) (:result-type . output) (:results . replace output raw) ( :rowname-names) (:session . none) (:shebang . ) (:tangle . no)) nil 0 1) block nil a01854650514fd2cec7ce6957a4622b52118fcd3) org-babel-exp-do-export((scheme (display \Hello Scheme in OrgMode\) ((:cache . no) (:colname-names) (:comments . ) (:exports . results) (:hlines . no) (:noweb . no) (:padline . ) (:result-params replace output raw) (:result-type . output) (:results . replace output raw$ (:rowname-names) (:session . none) (:shebang . ) (:tangle . no)) nil 0 1) block a01854650514fd2cec7ce6957a4622b52118fcd3) org-babel-exp-src-block((scheme :exports results :results output raw)) org-babel-exp-process-buffer() org-export-execute-babel-code() org-export-as(html nil nil nil nil) org-export-to-file(html ./test.html nil nil nil nil nil) org-html-export-to-html() call-interactively(org-html-export-to-html nil nil) command-execute(org-html-export-to-html) command-line-1((--eval=(load \~/.emacs.d/init.el\) /home/kdr2/ test.org -f org-html-export-to-html)) command-line() normal-top-level() On Thu, Apr 10, 2014 at 7:22 PM, Oleh ohwoeo...@gmail.com wrote: Version of geiser I installed: geiser-20140326.951, If it has been changed, it must be changed in the past 2 weeks ... That's exactly the version that I have. Which org-mode are you using? -- -- KDr2, http://kdr2.com
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Hi, Eric I'm sorry for that I used `flet' in the patch, It's a easy way to let function `current-message' work in batch mode, so I used it even I saw that emacs says `flet' is obsolete, I'm sorry for that. And I made a new patch(attachment) using `defadvice' for `message' to capture the message in batch mode, after the message being captured, the advice function is removed. Is this way OK? And I also sent a request email to ass...@gnu.org, and now waiting the reply. Thanks. On Fri, Apr 11, 2014 at 10:45 AM, Eric Schulte schulte.e...@gmail.comwrote: We can no longer use `flet' in the Org-mode code base, please re-work this patch w/o flet. Also, I don't see your name in the list of contributors, and (I believe) this patch is too large to apply w/o FSF assignment. See the following page on how to contribute to Org-mode. http://orgmode.org/worg/org-contribute.html KDr2 killy.d...@gmail.com writes: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org -f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D -- -- KDr2, http://kdr2.com From fe5549f3f48acf9b51aeb3706eb8dd3d76ab18c1 Mon Sep 17 00:00:00 2001 From: KDr2 killy.d...@gmail.com Date: Fri, 11 Apr 2014 12:56:24 +0800 Subject: [PATCH] lisp/ob-scheme.el: Fix scheme code blocks execution error in batch mode * lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode. `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. Modified from a patch proposal by KDr2(killy.d...@gmail.com) --- lisp/ob-scheme.el | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index b7117e9..6b82c6e 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -118,6 +118,19 @@ org-babel-scheme-execute-with-geiser will use a temporary session. (name result)) +(defmacro org-babel-scheme-capture-current-message (rest body) + Capture current message in both interactive and noninteractive mode + `(if noninteractive + (let ((current-message nil)) + (defadvice message (after capture-current-message activate) + (setq current-message ad-return-value)) + ,@body + (ad-unadvise #'message) + current-message) + (progn + ,@body + (current-message + (defun org-babel-scheme-execute-with-geiser (code output impl repl) Execute code in specified REPL. If the REPL doesn't exist, create it using the given scheme implementation. @@ -142,10 +155,11 @@ is true; otherwise returns the last value. (current-buffer) (setq geiser-repl--repl repl-buffer) (setq geiser-impl--implementation nil) - (geiser-eval-region (point-min) (point-max)) + (setq result (org-babel-scheme-capture-current-message + (geiser-eval-region (point-min) (point-max (setq result - (if (equal (substring (current-message) 0 3) = ) - (replace-regexp-in-string ^= (current-message)) + (if (and (stringp result) (equal (substring result 0 3) = )) + (replace-regexp-in-string ^= result) \An error occurred.\)) (when (not repl) (save-current-buffer (set-buffer repl-buffer) -- 1.9.2
Re: [O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
Hi, folks Has anyone reviewed this patch? Or is there a better way to fix the bug? Thanks. On Wed, Apr 2, 2014 at 11:48 AM, KDr2 killy.d...@gmail.com wrote: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org -f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- KDr2, http://kdr2.com -- -- KDr2, http://kdr2.com
Re: [O] Prepare release 8.2.6
Hi Bastien, I sent a mail [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode to the list yesterday, but I don't see it at http://news.gmane.org/gmane.emacs.orgmode, so here I sent it to you again: The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org -f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and the attached patch fixes this. Please consider to apply it, thanks. On Thu, Apr 3, 2014 at 3:53 PM, Bastien b...@altern.org wrote: Hi all, I'll spend a few hours this afternoon chasing the last bugs in maint for Org 8.2.6. This release will then be merged into the emacs-24 branch, which first pretest is to be released very soon now. If you have outstanding bugs, please point at them. As usual, thanks in advance for your help, PS: gmane.org seems to be down since April, 1st, so I could not follow the discussions since that time. -- Bastien -- -- KDr2, http://kdr2.com From cebf9fc4fe09ab22fd31ff8e5606d0f680c121e9 Mon Sep 17 00:00:00 2001 From: KDr2 killy.d...@gmail.com Date: Wed, 2 Apr 2014 10:30:38 +0800 Subject: [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode * lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode. `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. Modified from a patch proposal by KDr2 --- lisp/ob-scheme.el | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index b7117e9..3b7ceb2 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -118,6 +118,17 @@ org-babel-scheme-execute-with-geiser will use a temporary session. (name result)) +(defmacro org-babel-scheme-capture-current-message (rest body) + Capture current message in both interactive and noninteractive mode + `(if noninteractive + (let ((current-message nil)) + (flet ((message (fmt rest args) (setq current-message (apply #'format fmt args + ,@body + current-message)) + (progn + ,@body + (current-message + (defun org-babel-scheme-execute-with-geiser (code output impl repl) Execute code in specified REPL. If the REPL doesn't exist, create it using the given scheme implementation. @@ -142,10 +153,11 @@ is true; otherwise returns the last value. (current-buffer) (setq geiser-repl--repl repl-buffer) (setq geiser-impl--implementation nil) - (geiser-eval-region (point-min) (point-max)) + (setq result (org-babel-scheme-capture-current-message + (geiser-eval-region (point-min) (point-max (setq result - (if (equal (substring (current-message) 0 3) = ) - (replace-regexp-in-string ^= (current-message)) + (if (and (stringp result) (equal (substring result 0 3) = )) + (replace-regexp-in-string ^= result) \An error occurred.\)) (when (not repl) (save-current-buffer (set-buffer repl-buffer) -- 1.9.1
[O] [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode
The bug: write file ~/scheme-test.org with the content below: ---8-- #+BEGIN_SRC scheme :exports results :results output raw (display Hello Scheme in OrgMode) #+END_SRC ---8-- and run: emacs --batch --eval='(load ~/.emacs.d/init.el)' ~/scheme-test.org -f org-html-export-to-html you will find the bug: `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. -- -- KDr2, http://kdr2.com From cebf9fc4fe09ab22fd31ff8e5606d0f680c121e9 Mon Sep 17 00:00:00 2001 From: KDr2 killy.d...@gmail.com Date: Wed, 2 Apr 2014 10:30:38 +0800 Subject: [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch mode * lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode. `org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this. Modified from a patch proposal by KDr2 --- lisp/ob-scheme.el | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index b7117e9..3b7ceb2 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -118,6 +118,17 @@ org-babel-scheme-execute-with-geiser will use a temporary session. (name result)) +(defmacro org-babel-scheme-capture-current-message (rest body) + Capture current message in both interactive and noninteractive mode + `(if noninteractive + (let ((current-message nil)) + (flet ((message (fmt rest args) (setq current-message (apply #'format fmt args + ,@body + current-message)) + (progn + ,@body + (current-message + (defun org-babel-scheme-execute-with-geiser (code output impl repl) Execute code in specified REPL. If the REPL doesn't exist, create it using the given scheme implementation. @@ -142,10 +153,11 @@ is true; otherwise returns the last value. (current-buffer) (setq geiser-repl--repl repl-buffer) (setq geiser-impl--implementation nil) - (geiser-eval-region (point-min) (point-max)) + (setq result (org-babel-scheme-capture-current-message + (geiser-eval-region (point-min) (point-max (setq result - (if (equal (substring (current-message) 0 3) = ) - (replace-regexp-in-string ^= (current-message)) + (if (and (stringp result) (equal (substring result 0 3) = )) + (replace-regexp-in-string ^= result) \An error occurred.\)) (when (not repl) (save-current-buffer (set-buffer repl-buffer) -- 1.9.1
[O] Is there a way to change the home link and up link text when export to HTML?
I want to change UP | HOME to Archives | Categories for my blog, but I do not know how to, for now I use javascript to change them after the page loading in browser... Thanks -- -- KDr2, http://kdr2.com
[O] #+INCLUDE: file in code block results does not work?
I wrote a piece of code like below: #+NAME: inc-file #+BEGIN_SRC elisp :results value raw :exports results :var file= common.inc.org (concat #+INCLUDE: /path/to/include-dir/ file) ;; path is cal-ed from path of current-buffer file #+END_SRC #+CALL: inc-file(file=a.org) :results raw but this does not work, anyone knows why? By the way, #+HTML_HEAD in code block results works well: #+NAME: d-header #+BEGIN_SRC elisp :results value raw :exports results (concat #+HTML_HEAD: link rel=\stylesheet\ type=\text/css\ href=\ /style.css \ /) #+END_SRC #+CALL: d-header() :results raw Thanks. -- -- KDr2, http://kdr2.com
Re: [O] #+INCLUDE: file in code block results does not work?
Thanks very much. I use dynamic block now, by adding `org-update-all-dblocks' to `org-export-before-processing-hook'. On Wed, Mar 26, 2014 at 5:42 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Nicolas Goaziou n.goaz...@gmail.com writes: You can use a macro here: #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 {{{inc-file(a.org)}}} Err, no. Macros are also expanded after INCLUDE keywords. The only code executed before these are handled is `org-export-before-processing-hook'. -- -- KDr2, http://kdr2.com
Re: [O] #+INCLUDE: file in code block results does not work?
I wrote a blog entry to describe all the dynamic tricks I used in the exporting: http://kdr2.com/tech/emacs/orgmode-export-process.html On Wed, Mar 26, 2014 at 7:54 PM, KDr2 killy.d...@gmail.com wrote: Thanks very much. I use dynamic block now, by adding `org-update-all-dblocks' to `org-export-before-processing-hook'. On Wed, Mar 26, 2014 at 5:42 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Nicolas Goaziou n.goaz...@gmail.com writes: You can use a macro here: #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 {{{inc-file(a.org)}}} Err, no. Macros are also expanded after INCLUDE keywords. The only code executed before these are handled is `org-export-before-processing-hook'. -- -- KDr2, http://kdr2.com -- -- KDr2, http://kdr2.com
Re: [O] #+INCLUDE: file in code block results does not work?
Oh, I'll star this mail, and add it to my post later, thanks again :) On Wed, Mar 26, 2014 at 10:31 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, KDr2 killy.d...@gmail.com writes: I wrote a blog entry to describe all the dynamic tricks I used in the exporting: http://kdr2.com/tech/emacs/orgmode-export-process.html Thank you for sharing. For completeness, there is another step involved in the process before switching to back-ends: run functions in `org-export-before-parsing-hook'. I use dynamic block now, by adding `org-update-all-dblocks' to `org-export-before-processing-hook'. Also, you can also a function in the same hook that would update a generic inc-file macro in the file: (lambda (backend) (org-with-wide-buffer (goto-char (point-min)) (let ((case-fold-search nil)) (while (re-search-forward ^ *#\\+MACRO: +inc-file +\\\(PATH\\) nil t) (replace-match (get-path-dynamically) t nil nil 1) with the following generic macro: #+MACRO: inc-file PATH$1 Regards, -- Nicolas Goaziou -- -- KDr2, http://kdr2.com