emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tangling does not detect src blocks with capital BEGIN_SRC/END_SRC when case-fold-search nil
@ 2014-12-13 23:49 Christopher Genovese
  2014-12-14  8:42 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Genovese @ 2014-12-13 23:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]

When tangling a file whose source code blocks have capitalized BEGIN_SRC and
END_SRC (as produced by <s-TAB for instance),  org-babel-tangle will not
detect the source code blocks when case-fold-search is nil.

The variable org-babel-src-block-regexp has the begin_src and end_src in
lower
case, and neither the code generated by the macro org-babel-map-src-blocks
(in
ob-core.el) nor its caller org-babel-tangle-collect-blocks (in
ob-tangle.el) set
case-fold-search dynamically to make this regex match the capitalized
blocks in
org-babel-map-src-blocks.

I've included a minimal sample file below, but it's pretty simple to
reproduce
with Emacs -q. I also included a simple patch to ob-core.el (in
org-babel-map-src-blocks)
that I tested quickly, in case it helps.

For reference, I'm running org 8.2.10 and GNU Emacs 24.4.1 on Mac OS X
10.7.5.

  -- Chris

### Small example
The source code block is not detected by =org-babel-tangle= when
=case-fold-search= is nil. Then change the begin/end to lower case.

#+BEGIN_SRC R
  matrix(c(1:9), ncol=3)
#+END_SRC

#+RESULTS:
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |

See =org-babel-src-block-regexp=,  =org-babel-map-src-blocks=, and its
caller
=org-babel-tangle-collect-blocks=.

#+PROPERTY: header-args :tangle yes :comments org

# Local Variables:
# org-confirm-babel-evaluate: nil
# End:


### Quick patch (only tested quickly)
*** ~/.emacs.d/elpa/org-20141027/ob-core.el    Sun Nov  2 16:58:38 2014
--- /tmp/ob-core.el    Sat Dec 13 18:42:21 2014
*************** beg-body --------- point at the beginnin
*** 995,1001 ****
  end-body --------- point at the end of the body"
    (declare (indent 1))
    (let ((tempvar (make-symbol "file")))
!     `(let* ((,tempvar ,file)
          (visited-p (or (null ,tempvar)
                 (get-file-buffer (expand-file-name ,tempvar))))
          (point (point)) to-be-removed)
--- 995,1002 ----
  end-body --------- point at the end of the body"
    (declare (indent 1))
    (let ((tempvar (make-symbol "file")))
!     `(let* ((case-fold-search t)
!             (,tempvar ,file)
          (visited-p (or (null ,tempvar)
                 (get-file-buffer (expand-file-name ,tempvar))))
          (point (point)) to-be-removed)

[-- Attachment #2: Type: text/html, Size: 2769 bytes --]

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

* Re: Tangling does not detect src blocks with capital BEGIN_SRC/END_SRC when case-fold-search nil
  2014-12-13 23:49 Tangling does not detect src blocks with capital BEGIN_SRC/END_SRC when case-fold-search nil Christopher Genovese
@ 2014-12-14  8:42 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2014-12-14  8:42 UTC (permalink / raw)
  To: Christopher Genovese; +Cc: emacs-orgmode

Hello,

Christopher Genovese <genovese@cmu.edu> writes:

> When tangling a file whose source code blocks have capitalized BEGIN_SRC and
> END_SRC (as produced by <s-TAB for instance),  org-babel-tangle will not
> detect the source code blocks when case-fold-search is nil.
>
> The variable org-babel-src-block-regexp has the begin_src and end_src in
> lower
> case, and neither the code generated by the macro org-babel-map-src-blocks
> (in
> ob-core.el) nor its caller org-babel-tangle-collect-blocks (in
> ob-tangle.el) set
> case-fold-search dynamically to make this regex match the capitalized
> blocks in
> org-babel-map-src-blocks.
>
> I've included a minimal sample file below, but it's pretty simple to
> reproduce
> with Emacs -q. I also included a simple patch to ob-core.el (in
> org-babel-map-src-blocks)
> that I tested quickly, in case it helps.

I applied this change along with its inline source block counterpart.
Thank you.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2014-12-14  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-13 23:49 Tangling does not detect src blocks with capital BEGIN_SRC/END_SRC when case-fold-search nil Christopher Genovese
2014-12-14  8:42 ` Nicolas Goaziou

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).