emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Q] Remove empty drawers ?
@ 2015-04-09  4:47 Xavier Maillard
  2015-04-09  5:04 ` [SOLVED] (was: [Q] Remove empty drawers ?) Xavier Maillard
  0 siblings, 1 reply; 2+ messages in thread
From: Xavier Maillard @ 2015-04-09  4:47 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi,

I tried to add a CATEGORY property recently in an org file and I was
offered to repair badly formatted PROPERTY drawers. I accepted since I
thought there was a unique element to fix but it fixed way much.

In fact, the fix has consisted in adding one empty PROPERTY block per
heading element (I don't know why though). Now I am looking for a way
to delete all of them :/

How would you do that ?

Thank you

-- Xavier.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [SOLVED] (was:  [Q] Remove empty drawers ?)
  2015-04-09  4:47 [Q] Remove empty drawers ? Xavier Maillard
@ 2015-04-09  5:04 ` Xavier Maillard
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Maillard @ 2015-04-09  5:04 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org


Xavier Maillard <xavier@maillard.im> writes:

> In fact, the fix has consisted in adding one empty PROPERTY block per
> heading element (I don't know why though). Now I am looking for a way
> to delete all of them :/
>
> How would you do that ?

Org-mode comes with the function `org-remove-empty-drawer-at', so
removing empty :PROPERTIES: becomes trivial

M-:

#+BEGIN_SRC
(with-current-buffer "monsysteme.org"
  (goto-char (point-min))
  (while (re-search-forward ":PROPERTIES:" nil t)
    (save-excursion (org-remove-empty-drawer-at (match-beginning 0)))))
#+END_SRC

There is probably something better to do it (replacing
`with-current-buffer' comes to mind for example), but it works.

Regards
-- Xavier.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-09  5:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09  4:47 [Q] Remove empty drawers ? Xavier Maillard
2015-04-09  5:04 ` [SOLVED] (was: [Q] Remove empty drawers ?) Xavier Maillard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).