0

With the package projectile, I use projectile-regenate-tags. At the name already says, it regenates the TAGS-table of the current project on the project root.

It works likke a charm. However, I noticed not all files are included, the files with .inc-extension. I would make it so.

A good command for this could be the following:

ctags -f TAGS -e -R --langmap=php:+.inc.foo.bar --list-maps=php

I would like that projectile-regenate-tags use these parameters. When looking up the source code of projectile-regenate-tags, I found the following:

(defun projectile-regenerate-tags ()
"Regenerate the project's [e|g]tags."
(interactive)
(if (boundp 'ggtags-mode)
    (progn
        (let* ((ggtags-project-root (projectile-project-root))
            (default-directory ggtags-project-root))
        (ggtags-ensure-project)
        (ggtags-update-tags t)))
    (let* ((project-root (projectile-project-root))
        (tags-exclude (projectile-tags-exclude-patterns))
        (default-directory project-root)
        (tags-file (expand-file-name projectile-tags-file-name))
        (command (format projectile-tags-command tags-file tags-exclude))
        shell-output exit-code)
    (with-temp-buffer
        (setq exit-code
            (call-process-shell-command command nil (current-buffer))
            shell-output (projectile-trim-string
                            (buffer-substring (point-min) (point-max)))))
    (unless (zerop exit-code)
        (error shell-output))
    (visit-tags-table tags-file))))

Aha, then look up what projectile-tags-command consists of.

(defcustom projectile-tags-command "ctags -Re -f \"%s\" %s"
"The command Projectile's going to use to generate a TAGS file."
:group 'projectile
:type 'string)

So in my init.el, I setted the variable projectile-tags-command to the following:

(setq projectile-tags-command "ctags -Re -f \"%s\" %s --langmap=php:+.inc.foo.bar --list-maps=php")

Evaluated it, and calling projectile-regenate-tags, I still don't get any relevant files with the extension .inc. I still don`t get any relevant files. So perhaps I'm wrong somehwere.

Any good suggestion?

1

You only want --langmap=php:+.inc and without the --list-maps=php argument. That example (which I've just updated for maximum clarity) was just to show the effect of the --langmap argument, and wouldn't actually generate a TAGS file.

| improve this answer | |
  • Sorry for bothering you again, now I get it totally, sorry for any inconvenience. – ReneFroger Aug 12 '15 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.