Ctags not working with .inc-files - emacs

I would love to use tags inside Emacs, like Vim does. However, I have some problems to set it ## Setup:
GNU Emacs GUI version 25.0.5.1 (x86_64-w64-mingw32)
Compiled from Harroogan Emacs.
Projectile and Helm, using the latest version of Projectile/Helm from MELPA
Exuberant Ctags binary 58 for Windows
Windows 7 x64 bit.
Actions:
The binary ctags.exe is in the PATH, and respons when I call it from command line in Windows with ctags --help.
I tried various things to create a TAGS file, without any result. One thing that I seem to have results, is with the help of the package projectile. But it gives me weird results.
When I'm inside a project, currently the buffer index.php is being opened. Inside that buffer, I regenate tags file with projectile-regenate-tags, with C-c p R.
The messages buffer gives me the following:
Starting a new list of tags tables
Making tags-file-name local to Dev/digiloket3/TAGS while let-bound!
I see the file TAGS is being created in the project root.
The directory root structure is like this:
index.php
.projectile
|- INCLUDE
|- AJAX
|- SCRIPTS
|- PHP
Issue:
Then I visit the tag list with find-tag (g C-]). When I notice I don't get all variables and class/functions that are defined in the project.
When I call the helm-etags-select, I see the directory/file next to the tag. And what confuses me, is that only functions/classes and variables from files in the directory AJAX are being visible in the tag list, and not the variables/classes/functions from the files in the directory PHP.
Then I manually creating the TAGS file with in the command prompt with the right directory on ctags -R.
With no help.
All files in the folder PHP are called ****.inc.
When I renamed one of the files to ****.php, then they're popping up in my ctags table.
So the real issue here is how I could tell projectile/ctags to recognize .inc files as PHP-files, or index it
But I'm also open for another things to create a TAGS table on Windows platform with the ctags available on command line.
Any suggestion?

man ctags for starters (if you can do so in Windows? There is documentation available in any case.)
Assigning file extensions for a language is done with --langmap. Run the following command to see how that argument works:
ctags --langmap=php:+.inc.foo.bar --list-maps=php
So in your case, you would probably use something like this to generate your TAGS file:
ctags -e -R --langmap=php:+.inc
Tangentially, note also the options listed when you run ctags --list-kinds=php. You can then control which of those will be used: ctags --php-kinds=-v-j --list-kinds=php

Related

how to tell emacs to actually use the ctags file I created

Not finding what i'm looking for.
Want to enable/start using Ctags with emacs & Vim (setting this up for a team, some use vi some use emacs)
I can: Run "ctags -e -f ./.ctags LONG_LIST_OF_FILES (I do this in a Makefile)
note: I need to do it this way, because I need to control what is and is not scanned.
A recursive search will be a problem - as there are C files in sub directories that
do not apply to this situation
Result: the file exists, it seems happy but .. how do I tell emacs - yea, there is a ctags file here..
Actually - its more like this:
PROJECT_DOG=/home/foobar/dog
$(CTAG_FILE) = $(PROJECT_DOG)/.ctags
Then I have a number of subdirectories - sort of like this:
$(PROJECT_DOG)/libtail/src
$(PROJECT_DOG)/libtail/include
$(PROJECT_DOG)/liblegs/src
$(PROJECT_DOG)/liblegs/include
$(PROJECT_DOG)/libtail/src
$(PROJECT_DOG)/libtail/include
$(PROJECT_DOG)/libnose/src
$(PROJECT_DOG)/libnose/include
.. and numerous other "lib" like directories ..
The single top level .ctags file covers the entire project... (all "lib directories")
Problem statement:
I "visit" a file in emacs - I'm expecting ctags to appear.. but it is not
Same problem with VI and GVIM.
It seems that both tools do not know the tags file exist...
Tried looking here:
Google finds plenty of examples of how to install ctags, and run ctags
but - nothing about how to "activate?" (if that is the correct word) the tags.
https://www.emacswiki.org/emacs/BuildTags
Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctags
http://timothypratley.blogspot.com/2008/07/ctags.html
And a number of other places - no luck.
MY HOPE IS THIS:
When I visit a file in a directory - the tool (emacs/vi) automatically discovers the "tags" file in that directory, or one of the several parent directories up unto the root. The example being: I open the file: $(PROJECT_DOG)/libtail/src, but the ctags file is 2 levels up.
Or something like that..

Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with "."

I am using Conan package manager on Windows to create a package. The conan command to create the package copies files to a folder within %USERPROFILE%\.conan (or C:\Users\xxxxxxx\.conan). Then from this location it builds a Visual Studio project and ultimately calls doxygen.exe to create a .chm help file in a post-build command. The doxygen command fails with:
error : failed to run html help compiler on index.hhp
Further investigation reveals the hhc.exe command executed by doxygen is failing with:
C:\Users\xxxxxxx\.conan\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation>"C:/Program Files (x86)/HTML Help Workshop/hhc.exe" html\index.hhp
HHC5010: Error: Cannot open "C:\Users\xxxxxxx\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation\html\Module.chm". Compilation stopped.
Close inspection reveals that in the error message, the ".conan" folder is missing. Sure enough, I confirmed that hhc.exe fails when the index.hpp resides in a folder that has a parent folder that starts with a ".".
Attempts to resolve this:
changing the Doxyfile setting OUTPUT_DIRECTORY to "$(TMP)/DoxygenModule" resolves the error, but creates the .chm file in another location, which I do not prefer.
navigating to the 8DOT3 name of the ".conan" folder, which is "CONAN~1", to run the hhc.exe command, succeeds, but unfortunately I have no way of getting conan to use this 8DOT3 path for creating the package. E.g. C:\Users\xxxxxxx\CONAN~1\...
I can live with the using the %TMP% folder but would prefer generating the .chm in the current folder. Anyone have any ideas?
HTML Help Workshop v1.31 is installed on my machine at C:\Program Files (x86)\HTML Help Workshop, probably from a Visual Studio installation (not sure). I attempted using a version downloaded from Microsoft website (v1.30) as well, which made no difference.
Other info: Conan version 1.18.0, Doxygen version 1.8.14, Windows 10 Version 1809
Unfortunately not a solution, but this is a known limitation in the hhc.exe, see: https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral
HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning.
Edit 2019-11-15:
I've just pushed a proposed patch to github (pull request 7402, https://github.com/doxygen/doxygen/pull/7402).
This proposed patch changes inside doxygen from the current directory to the short named current directory, but just for the HTML Help compilation.
Edit 2019-11-16:
Code has been integrated in the master version on github.
This is not an answer either. Actually, you found the answer and workaround[s] yourself.
Use OUTPUT_DIRECTORY to specify a directory containing no folder names beginning with periods.
The error you described is a known issue of the MS HTML Help compiler. More general, the HTML Help compiler does not like some folder and file names. Try and stick with these characters _, a..z, A..Z, 0..9. Do not use these signs in particular ., -, # .
Please note that the proprietary CHM file format is about 20 years old (Windows 95, ...). HTML Help is in maintenance mode, which means no new features and bug fixes are expected for either the runtime or the compiler. All mainstream development on HH has stopped.
There is no way to avoid this error if a directory name above begins with a period. Not even if only the necessary files are written by Doxygen and compiling of the index.hhp is done by a third-party tool like FAR HTML using your path that contains .conan. This is because all applications are using the faulty HHA.dll.
The above applies of course to the entire workflow you have described. Maybe you can interrupt it.
Doxygen can be configured not to call the HTMLHelp compiler. Just uncheck the GENERATE_HTMLHELP option (DoxyWizard: Experts > Topics > HTML). You have all files generated by Doxygen in your preferred output directory - but of course without the CHM file. This can be imported later e.g. by HelpNDoc and compiled as a CHM file in another location.
If you can interrupt the workflow and can also make changes to Doxygen's settings, then a preference setting of OUTPUT_DIRECTORY to e.g. C:/CacheMenu/CONAN~1/DOXYGE~1 also works as expected (here used as test case).
No matter what you do, your workaround and copy and paste from another directory outside is a quick solution at this stage. Please note the EDIT in #albert's answer.

Netbeans, phpdocumentor, and custom phpdoc.dist.xml by project

I am using Netbeans 8.0.2 and phpdocumentor 2.8.2 on a windows 7 platform.
I would like to use custom phpdoc.dist.xml config files by project so I can specify framework directories and etc. to exclude from the generated doc. I also want to keep my Netbeans PHPDOC plugin config as generic as possible, without specific output directories, ignore options, config path parameters, etc., so on, so that that the config will apply to all my projects.
The phpdoc.dist.xml file works great. The doc generated is exactly what I want.
The problem or feature, and it seems to be a phpdocumentor one as it also applies from plain command line, is that the phpdoc.bat command (without a specific config parm) has to be run from the same root directory as the phpdoc.dist.xml file, or it ignores it. No problem if I'm using command line as I can change into that directory first, but I would like to use Netbeans. I have searched on this extensively and cannot find an answer.
I considered whether to modify the phpdocumentor files to insert cd /D path/to/myproject/dir to change the directory using some Netbeans variable to represent myproject/dir, but I could not find the right place in the code or the variable to use. Plus, then I'm supporting a custom mod to phpdocumentor.
I did find these directions for a PHPStorm setup, where the author specified a PHPStorm variable for the --config command line option to point to his custom phpdoc.dist.xml.
--config="$ProjectFileDir$/phpdoc.dist.xml"
If I could do the same in Netbeans like maybe "${BASE_DIR}/phpdoc.dist.xml" it would be great, but so far I haven't hit on anything Netbeans will recognize/pay attention to in the PhpDoc script: box.
I have also tried writing a wrapper .bat file to capture my own command line variable %1 and do the directory change to that before calling phpdoc.bat, but Netbeans throws and error and says that's not a valid .bat file. I cannot find any phpdocumentor parameter to configure by specific Netbeans project but the output directory. And I would prefer not to be defining a bunch of projects on subdirectories in Netbeans, just to address phpdocumentor.
Now I am out of ideas. Can anyone point me to a solution?

Force AUCTeX to parse the whole document

I'm using AUCTeX 11.87 along with emacs 24.3 for writing my LaTeX documents. This is working nicely with one exception: The parsing.
My document structure is as follows:
./
Master.tex
Chapter_1.tex
Chapter_2.tex
...
header/
header/header.tex
header/packages.tex
header/options.tex
...
Where Master.tex \inputs header.tex which in turn inputs all files in header/. Furthermore Master.tex includes the Chapter_N.tex files within the document environment.
Here comes the problem: AUCTeX does not generate the parse files (the ones in the auto folder) until I have actually opened the file. Meaning that until I have not opened and saved the header/packages.tex and header/header.tex files AUCTeX does not know about the loaded packages and thus their commands/environments.
An now the question: Can I force AUCTeX to (re)parse the whole source-tree (and then reload the style hooks for all open documents)?
If all files are in the same directory, or in subdirectories under it, open the master file and issue M-x TeX-auto-generate RET and as TeX file or directory insert the directory of the master file and as AUTO lisp directory the auto/ subdirectory of the previous directory.
For instance, if your master file is placed in ~/my-document/, insert ~/my-document/ at the first prompt and ~/my-document/auto at the second one (you can also use relative paths if you prefer them).

How do I "source" something in my .vimrc file?

I've been working on expanding my vim-foo lately and I've run across a couple of plugins (autotag.vim for example) that require them to be "sourced" in my .vimrc file. What exactly does this mean and how do I do it?
Sourcing a file is 'executing' it. Essentially, each line of the file is considered a command. Sourcing it is the same as typing each command in order. You source with the command :source (usually shortened to :so).
So if you source myStuff.vim
:so myStuff.vim
and if myStuff.vim contained these lines
set xx iI just intersted this<C-]>
set yy bbbb4dw
It's the same as if you typed those commands into Vim
:set xx iI just intersted this<C-]>
:set yy bbbb4dw
The only file sourced by default is the .vimrc(_vimrc on windows) so that's a place you can keep all the commands you use to set up Vim every time.
Where it gets interesting is the fact that since a sourced file is just a series of commands, and sourcing is a command, you can source files from your source files. So plugins you use every time could be sourced when you start up Vim by adding a line to your .vimrc like this
so myPlugin.vim
Files in your .vim/plugin directory are sourced (loaded) automatically.
There is always the :source file command. I usually write .vimrc that contains custom commands and what not for the console application and then a .gvimrc that contains additional goodies that are appropriate for a windowed version. My .gvimrc starts with source $HOME/.vimrc to pick up everything from the console version before adding in new stuff.
There are normally two vimrc files, one is _vimrc and the other _gvimrc (in the first one are the things for vim, and in the second for gvim - graphical things) - although most people I know just put everything in _vimrc.
A good practice is to keep all your extra files (plugins, colorschemes, snippets ...) in a separate (your own) vimfiles directory (which you can take with you).
If you do
:help vimfiles
vim will tell your vimfiles directory should be located. It depends somewhat on the platform (win, unix). On windows the usual is in your user folder (documents and settings, then user ...).
In vimfiles directory there are a couple of subdirectories. Amongst them is the "plugin" subdirectory. Plugins put in that dir will be loaded automatically (also plugins put in subdirectories of "plugin").
If you do not wish to load it automatically, just put it in your "vimfiles", or some other directory, and
:so plugin_name.vim (with the appropriate path)
(you can use the $vim, $vimfiles, and $home as shortcuts when defining path to plugin)