Fixing function call-style source block arguments.

style syntax. There still needs to be work done on the regexps for
recognising #+srcname lines possibly with/without parenthesised
arguments. This change makes org-babel-block-name return nil rather
than fail when it doesn't find a src block head (e.g. in a #+lob
line), which seems sensible.

The sbe test table is failing half-way down at `simple ruby
arrays'. For some reason it is making a mini table ("| |") to the
right hand, and point keeps jumping out of the table. My ability to
debug sbe-related stuff is hampered by me not understanding the
code (I need to learn about macros).
This commit is contained in:
Dan Davison 2009-07-10 18:38:12 -04:00
parent 41381781bb
commit eb7206f744
2 changed files with 10 additions and 7 deletions

View File

@ -108,7 +108,7 @@ return nil."
(if (let ((result_regexp (concat "^#\\+\\(TBL\\|RES\\)NAME:[ \t]*"
(regexp-quote ref) "[ \t]*$"))
(regexp (concat "^#\\+SRCNAME:[ \t]*"
(regexp-quote ref) "[ \t]*$")))
(regexp-quote ref) "\\(\(.*\)\\)?" "[ \t]*$")))
(or (re-search-forward result_regexp nil t)
(re-search-forward result_regexp nil t)
(re-search-forward regexp nil t)

View File

@ -256,12 +256,15 @@ replaced, and may need to be reinstated in this function. "
(defun org-babel-get-src-block-name ()
"Return the name of the current source block if one exists"
(let ((case-fold-search t))
(save-excursion
(goto-char (org-babel-where-is-src-block-head))
(if (save-excursion (forward-line -1)
(looking-at "#\\+srcname:[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]+\\)\(\\(.*\\)\)"))
(org-babel-clean-text-properties (match-string 1))))))
(let ((case-fold-search t)
(head (org-babel-where-is-src-block-head)))
(when head
(save-excursion
(goto-char head)
(if (save-excursion
(forward-line -1)
(looking-at "#\\+srcname:[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]+\\)\(\\(.*\\)\)"))
(org-babel-clean-text-properties (match-string 1)))))))
(defun org-babel-get-src-block-info ()
"Return the information of the current source block as a list