From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: [RFC] Standardized code block keywords Date: Tue, 25 Oct 2011 10:21:04 +0200 Message-ID: <80vcrdtrbj.fsf@somewhere.org> References: <87pqhrih3s.fsf@gmail.com> <30891.1319141196@alphaville.dokosmarshall.org> <87fwinifqu.fsf@gmail.com> <32184.1319143892@alphaville.dokosmarshall.org> <808vofwf1w.fsf@somewhere.org> <87y5wfgwn7.fsf_-_@gmail.com> <87lise5muh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Rainer, Rainer M Krug wrote: > On Fri, Oct 21, 2011 at 6:24 PM, Eric Schulte 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 () (save-excursion (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:\" line.") :warning))))) #+end_src 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..." (interactive) ;; (goto-char (point-min)) ;; (search-forward "#+BABEL:") (search-forward-regexp ":") (delete-backward-char 2) (insert "\n#+PROPERTY: ")) #+end_src To be used, in its current state, with point placed just after the "#+BABEL:" keyword. Best regards, Seb -- Sebastien Vauban