[Top][All Lists]

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

Re: [O] [RFC] Standardized code block keywords

From: Sebastien Vauban
Subject: Re: [O] [RFC] Standardized code block keywords
Date: Tue, 25 Oct 2011 10:21:04 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (windows-nt)

Hi Rainer,

Rainer M Krug wrote:
> On Fri, Oct 21, 2011 at 6:24 PM, Eric Schulte <address@hidden>wrote:
>>> Just to make it as easy as possible for everyone....
>>> Might it be possible to introduce a small flags like "obsolete" and
>>> "stable" (standard)
>>> Old functions, old syntax, etc., might move first to obsolete before
>>> completely removed...
>>> We could open an older file and if it isn't working, we could try
>>> #+PROPERTY: babel-function-set obsolete
>> I think that making use of such a feature is almost as onerous as changing
>> to the new terms (which is a simple search replace, in fact once terms are
>> selected I'll happily share a function on list which can be used to convert
>> all old terms in existing Org-mode files).
> The problem are not every-day users, but if one is not using org-mode not
> using for some time, it might be difficult to figure out what has changed -
> also, I wou't remember in three years time, that these things have changed,
> and run into problems when trying to open an old org-file (in the case of
> literae programming not unlikely).
> But I also see your point - Eric.

And the problem is, someday, you will have to remove such functionality
(allowing a smooth transition, thanks to declaring to use an "obsolete"
feature set). So, IMHO, better do it now, once for all...

... if you have:

> a function which checks if these files do include the old / deprecated
> keywords, and inform the user? 

See my modified version of Eric's function:

#+begin_src emacs-lisp
  ;; warn about deprecated feature from version 7.7
  (add-hook 'org-mode-hook
            (lambda ()
                (goto-char (point-min))
                (when (re-search-forward (org-make-options-regexp
                                          '("BABEL")) nil t)
                  (display-warning 'org-babel
                                   (format "This file contains a \"#+BABEL:\" 

My changes:

- warning in its own window, to be sure to see it (because it's soo easy for
  the message in the echo area to be overwritten by others, if you have many
  hooks doing many things);

- no error when match not found.

> This function could even, in this case here, suggest to do the replacing.
> This function could be over time extended, whenever in-compatible changes
> become necessary - it would be a kind of an org-to-org converter or
> org-version-checker?

See this draft:

#+begin_src emacs-lisp
  (defun my/org-propertyze-babel-line ()
    "Play me as many times as needed..."
    ;; (goto-char (point-min))
    ;; (search-forward "#+BABEL:")
    (search-forward-regexp ":")
    (delete-backward-char 2)
    (insert "\n#+PROPERTY:  "))

To be used, in its current state, with point placed just after the "#+BABEL:"

Best regards,

Sebastien Vauban

reply via email to

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