Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] readtags: introducing macros #4075

Open
masatake opened this issue Sep 13, 2024 · 1 comment
Open

[RFC] readtags: introducing macros #4075

masatake opened this issue Sep 13, 2024 · 1 comment

Comments

@masatake
Copy link
Member

I'm enjoying using -Q.

However, writing a long S expression on CLI is painful.
Writing completion rules in zsh is a choice, but I don't have enough time.

So I'm thinking about the standard way of lisp programmer: introducing macros.

$ cat ~/extern.es
;; -*- emacs-lisp -*- supports regex literals.
(defmacro +extern? ((input :string))
  (and (subst? $input input)
       (#/func.*|var.*/ $kind)
       (or (#/extern/ (or ($ "properties") ""))
           (and (not (#/static/ (or ($ "properties") "")))
                (not (#/fileScope|reference|inputFile/ (or $extras "")))))))
$ readtags --rc ~/extern.es -Q '(+extern? "foo.c")' -l
...

This one is for extracting exported names in C source files.

The + prepended to extern? represents a request for the macro expansion.
With this prefix, we can avoid conflict between user-defined macros and the built-ins we will introduce.

@AmaiKinono, I would like to hear your comments.

@AmaiKinono
Copy link
Member

I don't use -Q directly so I can't say I have a good understanding of this proposal, but it do look useful for power users.

In universal-ctags/citre#172 I planned to create an interactive tool to filter a tags file. I think I should support using filter/sorter expressions directly so power users could combine user-defined macros with the convenience of a client tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants