emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [bug?] org-repair-property-drawers does not repair whole file


From: Nicolas Goaziou
Subject: Re: [O] [bug?] org-repair-property-drawers does not repair whole file
Date: Sun, 08 Mar 2015 22:45:28 +0100

Gregor Zattler <address@hidden> writes:

> Sadly no: I reapplied `org-repair-property-drawers' on my org
> file with no customisation at all:
>
> emacs-snapshot -Q -nw -L /home/grfz/src/org-mode/lisp/ file.org 
> ~/src/org-mode/etc/ORG-NEWS
>
> I loaded `org-repair-property-drawers' from
> ~/src/org-mode/etc/ORG-NEWS and executed it in file.org.  Result
> is ’(nil nil nil nil nil nil nil nil nil nil nil nil ... )’ and
> the buffer file.org remains unmodified.

Doesn't the function fix the "anon" file you sent?

Is it possible to have access to the file? You might want to hide
contents first with the following function

  (defun scramble-contents ()
    (interactive)
    (let ((tree (org-element-parse-buffer)))
      (org-element-map tree '(code comment comment-block example-block 
fixed-width
                                   keyword link node-property plain-text 
verbatim)
        (lambda (obj)
          (cl-case (org-element-type obj)
            ((code comment comment-block example-block fixed-width keyword
                   node-property verbatim)
             (let ((value (org-element-property :value obj)))
               (org-element-put-property
                obj :value (replace-regexp-in-string "[[:alnum:]]" "x" value))))
            (link
             (unless (string= (org-element-property :type obj) "radio")
               (org-element-put-property obj :raw-link "http://orgmode.org";)))
            (plain-text
             (org-element-set-element
              obj (replace-regexp-in-string "[[:alnum:]]" "x" obj)))))
        nil nil nil t)
      (let ((buffer (get-buffer-create "*Scrambled text*")))
        (with-current-buffer buffer
          (insert (org-element-interpret-data tree))
          (goto-char (point-min)))
        (switch-to-buffer buffer))))

Regards,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]