Ihor Radchenko writes: > Amy Grinn writes: > >>> +1 >>> You may even use obsolete alias (add it to lisp/org-compat.el) >> >> Here's a patch to rename org-babel-noweb-wrap to >> org-babel-noweb-make-regexp. > > Thanks! > News entry is not necessary here - we are just renaming a function. > Otherwise, the patch looks good. > I am not yet merging it though - let's have all the patches you plan for > the new noweb-wrap argument first and then apply them together. Got it, not a problem! I've attached both patches here. Regarding the other conversation, >>>> + (while (< (point) (point-max)) >>>> + (unless (looking-at " *\"\\([^\"]+\\)\" *") >>>> + (looking-at " *\\([^ ]+\\)")) >>> >>> May you please explain the rationale behind this regexp? AFAIU, it >>> implies that you want to allow whitespace characters inside :noweb-wrap >>> boundaries. But I do not think that we need to complicate things so much. >> >> That is exactly what I was going for. I thought about the ways this >> could be used and the most general-purpose, non-syntax-breaking, >> easily-recognizable way I could think of was to use the language's >> line-comment construct followed by the standard << >> characters. >> >> # <> >> ;; <> >> // <> >> >> I can see how it might be harder to maintain to allow whitespace in the >> noweb-wrap header arg. I could create a separate org-parse-arg-list >> function to ease that burden somewhat. My opinion is that having the >> option to use the examples above is preferable to using non-standard >> wrappers, from a third-person point-of-view. > > Makes sense. Also, see a similar idea being discussed in > https://list.orgmode.org/orgmode/87o7jlzxgn.fsf@localhost/ > > I recommend the following: > > If the value starts from ", use Elisp's `read': > |"# <<" ">>" > (read (current-buffer)) ; => "# <<" > otherwise, consider read until the first whitespace. > |#<<; >>; > (re-search-forward (rx (1+ (not whitespace)))) > #<<;| > > However, there may be edge cases like > > "<< >>" > "<< >> > << << >> > << "asd" >> I didn't implement this recommendation yet; I still think the regex is a more clear way of putting it, even without using a temporary buffer: ;; If a pair of " is found separated by one or more ;; characters, capture those characters as a group (unless (eq i (string-match (rx (* space) ?\" (group (+ (not ?\"))) ?\" (* space)) raw i)) ;; Otherwise, capture the next non-whitespace group of ;; characters (string-match (rx (* space) (group (* (not space))) (* space)) raw i)) Let me know what you think!