From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Genovese Subject: Tangling does not detect src blocks with capital BEGIN_SRC/END_SRC when case-fold-search nil Date: Sat, 13 Dec 2014 18:49:58 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3078134af6205f050a21ab9c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzwS9-0007mU-Gi for emacs-orgmode@gnu.org; Sat, 13 Dec 2014 18:50:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzwS3-0006Xe-Ot for emacs-orgmode@gnu.org; Sat, 13 Dec 2014 18:50:25 -0500 Received: from mail-vc0-x22c.google.com ([2607:f8b0:400c:c03::22c]:35003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzwS3-0006X8-I2 for emacs-orgmode@gnu.org; Sat, 13 Dec 2014 18:50:19 -0500 Received: by mail-vc0-f172.google.com with SMTP id hq11so4653825vcb.17 for ; Sat, 13 Dec 2014 15:50:18 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --20cf3078134af6205f050a21ab9c Content-Type: text/plain; charset=UTF-8 When tangling a file whose source code blocks have capitalized BEGIN_SRC and END_SRC (as produced by
When tangling a file whose source code blocks have ca= pitalized BEGIN_SRC and
END_SRC (as produced by <s-TAB for instance),= =C2=A0 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-ba= bel-tangle-collect-blocks (in ob-tangle.el) set
case-fold-search dynamic= ally to make this regex match the capitalized blocks in
org-babel-map-sr= c-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)
tha= t I tested quickly, in case it helps.

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

=C2=A0 -- Chris

### Small example
The source code block is not detected by =3Dorg-babe= l-tangle=3D when
=3Dcase-fold-search=3D is nil. Then change the begin/en= d to lower case.

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

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

See =3Dorg-babel-src-block-regexp=3D,=C2=A0 =3Dorg-babel-map-sr= c-blocks=3D, and its caller
=3Dorg-babel-tangle-collect-blocks=3D.
#+PROPERTY: header-args :tangle yes :comments org

# Local Variable= s:
# org-confirm-babel-evaluate: nil
# End:


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


--20cf3078134af6205f050a21ab9c--