[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] Syntax for macros
From: |
Florian Beck |
Subject: |
Re: [O] [RFC] Syntax for macros |
Date: |
Thu, 30 Jan 2014 20:25:33 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
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
- Re: [O] [RFC] Syntax for macros, (continued)
- Re: [O] [RFC] Syntax for macros, Sebastien Vauban, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Bastien, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Sebastien Vauban, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Nick Dokos, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Sebastien Vauban, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Nick Dokos, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Thorsten Jolitz, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Bastien, 2014/01/30
- [O] [PATCH] Font-lock: allow hiding of brackets surrounding macros, Florian Beck, 2014/01/31
- Re: [O] [PATCH] Font-lock: allow hiding of brackets surrounding macros, Bastien, 2014/01/31
- Re: [O] [RFC] Syntax for macros,
Florian Beck <=
- Re: [O] [RFC] Syntax for macros, Thomas S. Dye, 2014/01/30
- Re: [O] [RFC] Syntax for macros, Achim Gratz, 2014/01/30