[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] Change property drawer syntax
From: |
Sebastien Vauban |
Subject: |
Re: [O] [RFC] Change property drawer syntax |
Date: |
Thu, 27 Nov 2014 10:24:19 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) |
Hello Nicolas,
Nicolas Goaziou wrote:
> Sebastien Vauban writes:
>
>>> ** Sectionnement
>>>
>>> Exemple de section avec un titre court pour LaTeX :
>>>
>>> #+begin_src org
>>> ,* Ceci est un titre de section assez long
>>> :PROPERTIES:
>>> :ALT_TITLE: Ceci est un titre court
>>> :END:
>>> #+end_src
>>>
>>> Upon execution of the repair function, that entry will be wrongly
>>> converted.
>>
>> Do you experience the same problem as me?
>
> I do. I even sent you an updated revision of the repair function a few
> days ago, but, apparently, it never reached its destination. This is not
> the first time. Here it is again
>
> (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
> (and (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"))))))))))))
The above function is perfect for her task! No diff at all [1] when
applied on all my files from org-agenda-files (~ 45).
Best regards,
Seb
[1] Except the localization of the property drawer, of course.
--
Sebastien Vauban
Re: [O] [RFC] Change property drawer syntax, Sebastien Vauban, 2014/11/12
Re: [O] [RFC] Change property drawer syntax, Nicolas Goaziou, 2014/11/14