From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] Change property drawer syntax Date: Fri, 14 Nov 2014 09:36:16 +0100 Message-ID: <87ppcqnpq7.fsf@nicolasgoaziou.fr> References: <87oatek909.fsf@nicolasgoaziou.fr> <86zjbwlm31.fsf@example.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpCMF-0005qo-Oc for emacs-orgmode@gnu.org; Fri, 14 Nov 2014 03:36:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpCM6-0006Ye-Vl for emacs-orgmode@gnu.org; Fri, 14 Nov 2014 03:35:55 -0500 Received: from plane.gmane.org ([80.91.229.3]:35996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpCM6-0006XJ-PJ for emacs-orgmode@gnu.org; Fri, 14 Nov 2014 03:35:46 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XpCM2-0005Tf-Oe for emacs-orgmode@gnu.org; Fri, 14 Nov 2014 09:35:42 +0100 In-Reply-To: <86zjbwlm31.fsf@example.com> (Sebastien Vauban's message of "Wed, 12 Nov 2014 12:01:06 +0100") 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: Sebastien Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org Hello, Sebastien Vauban writes: > After heavy testing (on all my Org files, I mean) of the above function, > it works perfectly except for the following corner-case (when there are > Org properties in "quote" blocks): > > * Reference > > Example of Custom ID: > > #+begin_verse > ,* Some title > :PROPERTIES: > :CUSTOM_ID: SomeTitle > :END: > > Lorem ipsum > #+end_verse > > will be converted to: > > * Reference > :PROPERTIES: > :CUSTOM_ID: SomeTitle > :END: > > Example of Custom ID: > > #+begin_verse > ,* Some title > > Lorem ipsum > #+end_verse > > upon execution of `org-repair-property-drawers'. Thanks for your feedback. Would the following updated function solve the problem? (defun org-repair-property-drawers () "Fix properties drawers in current buffer. Ignore non Org buffers." (when (eq major-mode 'org-mode) (org-with-wide-buffer (goto-char (point-min)) (let ((case-fold-search t) (inline-re (and (featurep 'org-inlinetask) (concat (org-inlinetask-outline-regexp) "END[ \t]*$")))) (org-map-entries (lambda () (unless (and inline-re (org-looking-at-p inline-re)) (save-excursion (let ((end (save-excursion (outline-next-heading) (point)))) (forward-line) (when (org-looking-at-p org-planning-line-re) (forward-line)) (when (and (< (point) end) (not (org-looking-at-p org-property-drawer-re)) (save-excursion (re-search-forward org-property-drawer-re end t) (eq (org-element-type (save-match-data (org-element-at-point))) 'drawer))) (insert (delete-and-extract-region (match-beginning 0) (min (1+ (match-end 0)) end))) (unless (bolp) (insert "\n")))))))))))) > PS- I did not retest (yet) the same thing in #+begin/end_src > blocks... as playing with that example files makes my Emacs eat 100% > of the CPU (infloop?). Could you provide an ECM for that? Regards, -- Nicolas Goaziou