From: Florian Beck <fb@miszellen.de>
To: Nick Dokos <ndokos@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [RFC] Syntax for macros
Date: Thu, 30 Jan 2014 20:25:33 +0100 [thread overview]
Message-ID: <52EAA72D.70405@miszellen.de> (raw)
In-Reply-To: <87y51x8kyr.fsf@alphaville.bos.redhat.com>
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
next prev parent reply other threads:[~2014-01-30 19:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-29 8:49 [RFC] Syntax for macros Sebastien Vauban
2014-01-29 9:25 ` Bastien
2014-01-30 10:29 ` Sebastien Vauban
2014-01-30 10:41 ` Bastien
2014-01-30 10:48 ` Sebastien Vauban
2014-01-30 14:08 ` Nick Dokos
2014-01-30 14:56 ` Sebastien Vauban
2014-01-30 16:59 ` Nick Dokos
2014-01-30 17:22 ` Thorsten Jolitz
2014-01-30 18:03 ` Bastien
2014-01-31 22:13 ` [PATCH] Font-lock: allow hiding of brackets surrounding macros Florian Beck
2014-02-01 0:22 ` Bastien
2014-02-05 10:14 ` Bastien
2014-02-05 13:07 ` Sebastien Vauban
2014-02-05 13:12 ` Bastien
2014-01-30 19:25 ` Florian Beck [this message]
2014-01-30 21:11 ` [RFC] Syntax for macros Thomas S. Dye
2014-01-30 18:24 ` Achim Gratz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52EAA72D.70405@miszellen.de \
--to=fb@miszellen.de \
--cc=emacs-orgmode@gnu.org \
--cc=ndokos@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.