From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: Standardized code block syntax and Property Accumulation merged into Master Date: Fri, 18 Nov 2011 09:56:19 +0100 Message-ID: <80ipmhajws.fsf@somewhere.org> References: <877h31nzrg.fsf@gmail.com> <80lirfuhs5.fsf@somewhere.org> <87hb22d8j2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Eric, Eric Schulte wrote: > "Sebastien Vauban" writes: >> Eric Schulte wrote: >>> The standard-code-block-syntax branch has been merged into the master >>> branch of the git repository. This brings two much discussed changes to >>> Org-mode, first a standard set of keywords for code blocks and second >>> the ability to accumulate properties by appending a "+" to the end of >>> the property name. For much more information on both of these changes >>> see the relevant commits [1] and [2] respectively. A function for >>> updating existing Org-mode files to use the new standardized code block >>> keywords is inline below [3], additionally I've updated my collection of >>> Org-mode code block scraps [4]. >> >> Nice to see it's finally in! > > Thanks, me too. > >> However, I have to report a _tiny_ feature of applying your function: >> >>> [3] Function to update Org-mode buffers to use the new code block synt= ax. >>> (defun update-org-buffer () >>> "Update an Org-mode buffer to the new data, code block and call = line syntax." >>> (interactive) >>> (save-excursion >>> (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t) >>> "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\= :[ \t]*")) >>> (update (re new) >>> (goto-char (point-min)) >>> (while (re-search-forward re nil t) >>> (replace-match new nil nil nil 1)))) >>> (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE"))) >>> (lob-re (to-re '("LOB"))) >>> (case-fold-search t)) >>> (update old-re "name") >>> (update lob-re "call"))))) >> >> When run on a buffer containing: >> >> #+property: var foo=3D1 >> >> #+begin_src emacs-lisp >> foo >> #+end_src >> >> #+results: >> : 1 >> >> it will translate `#+results' to `#+name': >> >> #+property: var foo=3D1 >> >> #+begin_src emacs-lisp >> foo >> #+end_src >> >> #+name: >> : 1 >> >> Further evaluations of that *un-named* code block will leave the `#+name' >> line. >> >> To get back the expected `#+results' line, you have to manually remove t= hat >> results line, and re-evaluate the code block. > > This, given that results and name are technically still synonyms this > isn't necessarily a bug I fully agree. That's why I used the term "tiny feature"=C2=A0;-) > however I do agree that a version of the functions which left the #+resul= ts: > lines immediately following code blocks unchanged would be preferable. I would say "left the #+results: lines immediately following *un-named* code blocks", as we would want `#+name:' to be used in all the other cases (that is, for results of named code blocks). Best regards, Seb --=20 Sebastien Vauban