From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Beck Subject: Re: [RFC] Syntax for macros Date: Thu, 30 Jan 2014 20:25:33 +0100 Message-ID: <52EAA72D.70405@miszellen.de> References: <86ha8n6ulq.fsf@somewhere.org> <87y51zta1a.fsf@bzg.ath.cx> <867g9hiwzy.fsf@somewhere.org> <87sis592gg.fsf@bzg.ath.cx> <8638k5iw3i.fsf@somewhere.org> <8738k57ebi.fsf@gmail.com> <86zjmdfrgl.fsf@somewhere.org> <87y51x8kyr.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8xiT-0007jc-1z for emacs-orgmode@gnu.org; Thu, 30 Jan 2014 14:56:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8xiN-0001Xf-34 for emacs-orgmode@gnu.org; Thu, 30 Jan 2014 14:56:00 -0500 Received: from mo6-p04-ob.smtp.rzone.de ([2a01:238:20a:202:5304::8]:56583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8xiM-0001XL-GS for emacs-orgmode@gnu.org; Thu, 30 Jan 2014 14:55:55 -0500 In-Reply-To: <87y51x8kyr.fsf@alphaville.bos.redhat.com> 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@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos , emacs-orgmode@gnu.org On 30.01.2014 17:59, Nick Dokos wrote: > Are you advocating that the macro syntax should be changed without > worrying about backwards compatibility? That might work if almost nobody > uses macros currently[fn:1], but my impression is that they are used fairly > widely. The main problem is that this will affect org files in weeks, months or years in the future, which then mysteriously fail to work as expected. I agree, however, with Sebastien that the current syntax is a bit heavy. Two brackets would be better, but still ugly. A couple of alternative ideas: 1. How about using unicode characters? This would solve the problem of false positives and allow for light markup. E.g.: (looking-at "\\(?:「\\|{{{\\)\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\(([ \t\n]* \\([^\000]*?\\))\\)?\\(?:」\\|}}}\\)") 2. On the other hand a function to insert a macro might be all we need, e.g.: (defun org-macro-insert () (interactive) (let* ((macros (org-macro--collect-macros)) (macro (completing-read "Insert macro: " (mapcar 'car macros))) (args (string-match "$[[:digit:]]" (cdr (assoc macro macros)))) pos) (insert (format "{{{%s" macro)) (when args (insert "(") (setq pos (point)) (insert ")")) (insert "}}}") (when pos (goto-char pos)))) Maybe even hide the brackets during fontification? 3. Of course, since macros are only relevant when exporting, it should be easy to write an export filter that translates arbitrary chars to brackets. -- Florian Beck