How to only include some directories in ctags? - emacs

there is an --exclude option but that to exclude the directories/files. I work on a big project and want to only include the directories that has source code and not build stuff.
How to do that? What should I include in my .ctags file?

I use:
find FILES | ctags -L -
where FILES is the appropriate arguments to make find return only the files I want to index.
Exuberant Ctags (5.8) is now old and unmaintained, though. It still works for me, so I've not switched; but the last time I checked "Universal Ctags" appeared to be the way forwards, so I would suggest starting there:
https://ctags.io
https://github.com/universal-ctags/ctags
n.b. I experienced a curious bug with Exuberant Ctags 5.8 whereby find . resulted in some corrupted tag entries, but find * did not; so you might want to use the latter if using this approach. I didn't need to index any dot files at the root level, so I'm not sure offhand what happens for .* -- I don't think I tried it. Absolute paths were also fine, but then the TAGS file isn't portable. Potentially not an issue in the newer fork.

Related

Github incorrectly detects Languages of my project as "Roff"

In one of my repositories nearly all of my code is Python and some HTML.
However, Github thinks otherwise:
What causes that?
You were creating files through a script, with an unintended extension. That is, your script was inserting a dot in the file name.
Simply rename your file my_file_0.5ms to my_file_05ms.txt and it will display the correct languages:
What you could do to fix similar problems in the future is use a script to detect extensions and the total lines of code for each extension.
Solution
GitHub Linguist is the culprit in this situation, but luckily, it can be easily resolved in a number of ways.
Create a .gitattributes file and list patterns that match the files you want to ignore, and then append either linguist-vendored or linguist-documentation.
specific-file.5ms
*.5ms
specific-folder/*
This will remove the files from your GitHub repositories statistics on the next run of Linguist (it may take some time).
Notes
If you'd like to attribute these files to a specific language, you can do that using linguist-language={name}. Full documentation on overriding Linguist can be found here.
You can also run Linguist on your own computer, but note that any changes to .gitattributes will not take effect until you commit to your repository. Linguist will not see changes that exist only in the index.

How to find files by words inside parentheses in filenames?

I have a bunch of files with filenames like Matroid (bifrons's conflicted copy 2019-11-19).scala due to problems of synchronization. I want to find this files to remove or manually correct the problems (merge the two versions of the file). I tried the command below:
$ find . -iname '*conflicted*'
But it returns nothing! Nada!
I am guessing this is because the word conflicted occurs inside parentheses, but this is just a conjecture. Anyway, why my command do not find the files? How can I find them?
Thanks.
Actually the problem had nothing to do with parentheses at all. It as a (silly) mistake of mine. The directory containing the files with the *conflicted* filename was actually a link and find does not follow links by default. After informing the option -L it worked perfectly.

.emacs.d: should I version control the archive-contents files under elpa/archives?

I am not sure whether I should version control the following files under my .emacs.d:
[lucas#lucas-ThinkPad-W520]/home/lucas/.emacs.d$ file elpa/archives/marmalade/archive-con
tents
elpa/archives/marmalade/archive-contents: HTML document, UTF-8 Unicode text, with very lo
ng lines, with no line terminators
[lucas#lucas-ThinkPad-W520]/home/lucas/.emacs.d$ file elpa/archives/gnu/archive-contents
elpa/archives/gnu/archive-contents: ASCII text
[lucas#lucas-ThinkPad-W520]/home/lucas/.emacs.d$
As shown above, marmalade/archive-contents is an HTML document while gnu/archive-contents is ASCII text. Are these safe to include in my version control or should I remove them from my index?
For example, I use emacs across different platforms like Ubuntu Linux and Windows 7, and I would like to keep my emacs environment consistent. It works so far, but I want to avoid future problems. I am ignoring files like *.elc, but I don't know whether archive-contents under version control will help or hinder my cross-platform emacs environment.
I looked at other .emacs.d/ repositories, like this one, and examined their .gitignore files, but I don't know if they are doing correctly either. Any suggestions or resources on how to manage the .emacs.d/ version control for cross-platform development would be great.
Here is my current .gitignore:
*~
*.elc
tramp
Update
This seems to be an iffy topic, but it seems that the significant majority do not version control their entire elpa/ folder even though it may take a hit on their initial load time (immediately after cloning). I think I will follow that advice, and I'm willing to live with it rather than spending more time managing the extra issues of a pre-compiled repository.
I do not commit .emacs.d/elpa at all. My init.el automatically reinstalls missing packages on startup. I did not have any issues yet, even though I exclusively use unstable packages from MELPA.
I don't think including archive-contents should cause any problems. I don't make much use of package.el, but I have that file in my repo, and haven't noticed any issues.
Byte-compiled .elc files are portable. I recommend that you do include them in your repository, otherwise you risk ending up with uncompiled elisp when you clone your repo, and Emacs will run your config awfully slowly.
Remember that none of the default recompilation commands will compile a .el file if it doesn't already have a .elc file, so you'd be left needing to decide whether or not it was valid to forcibly compile everything (which isn't necessarily a safe thing to do), or manually pick and choose. Neither is a good option.
The exceptions I make are for the elisp files which I edit myself (init file, etc) as there's more chance of causing problems when you're editing files in multiple places, and merging. So I do .gitignore these files (and forcibly compile them for new deployments). However I use http://tarsius.github.com/auto-compile (Highly recommended) to automatically ensure that the compiled versions of these (and indeed all) .elc files is always up to date, so that when I merge the modified .el files, Emacs won't load the outdated .elc file instead.
FWIW my .gitignore looks like this (although some of the names are custom). It's pretty much a case of adding stuff as you encounter a need for it, though, so I wouldn't suggest that you copy this.
*~
/auto-save-list/
/backup/
/bookmarks.bmk
/desktop/*
/eshell/*
/history
/server/
/tramp
/geben/
/erc/*
/image-dired/
/url
session.*
/my-lisp/*.elc
These files are created by package.el (more specific, the package-update-contents function), and contain the index of packages for each ELPA repository. Checking them into VC might be annoying because they get updated frequently and you have to deal with merge, which is meaningless since they will be updated by package.el eventually.

Emacs and cscope with multiple directories

How do I set up cscope in Emacs when my source code lives in multiple directories?
Say I have several paths for my C++ project:
/path/to/my/code (and subdirectories)
/path/to/other/code (and subdirectories)
/path/to/static/linking/include/files (and subdirectories)
/path/to/static/linking/lib/files' (and subdirectories)
I would like to use xcscope to navigate/look up symbols in my code and the library that I am linking to.
The instructions for xcscope.el say that I should first run C-c s (Cscope->Create list and index) at /path/to/my/code, but I am then confused about how I to have the other paths indexed by cscope.
The documentation says I should go to the other directories and run cscope -b, but what I am supposed to do after that?
I looked at the cscope.files file that C-c s built. I think I am supposed to add my other paths to this file, but this file includes a list of source code files (not directories).
Do I have to manually edit cscope.files to add every single file that I want to index that is outside of my project's root directory?
The documentation is confusing.
I got one sol'n from http://cscope.sourceforge.net/large_projects.html. Still confusing.
cscope.files is aptly named. It is NOT directories. It is files, only files. Which is as daunting as it sounds. What if you have hundreds of files. Then you have to write hundreds of lines, one per file, into cscope.files. No joke.
Automate it with some scripting. E.g., on linux, use bash scripts and redirection (>,>>,|) operators to select and filter files from any and all directories into that cscope.files.
What about the directory where cscope.files resides? IF you don't include those files, it'll only find them when you open your project (in emacs, but probably applicable to any IDE) in that source directory. So, include them, too, for easy opening of your project from anywhere.
The option "recursive/-R" seems obvious to send to cscope-indexer. Nope, not with many root directories. Does nothing (probably could do something with scripts or elisp or who knows). Just feed those files, absolute path, into cscope.files. And you might have to make sure you have only one cscope.files per project. Don't split them up relative to each diretory. Or maybe you can, something to look into.
Remember, include the /path/to/each/file/ before the file if you want cscope.files to point to it from anywhere. cscope isn't "smart", it's dumb, it just takes directions for where to look and it won't know where to look for "filename", without knowing where it is. You're just asking it to call locate filename, which it can't do anyway, when you give it a lonely filename without a dir path outside of the directory that a particular cscope.files resides.
I hope there's a way to use xcscope inside emacs, just adding directories which it will catalog and index, as the xcscope docs and emacs menu suggest. But I didn't succeed in making it work that way.
Wouldn't a soft link (ln -s) work? Worked for me.

Diff merge : view difference between two folders and ignore file version number

I need some help. I have to view difference between two folders, but I need to ignore the file version number (project version number) which is in the header of the file. Like that:
#version Release: $Revision: 9939 $
And do you know the best diff merge software for doing that in Mac OSX and the most beautiful. I know diff merge and Kaleidoscope. I love Kaleidoscope but, it cannot make some difference between two folders.
Many thanks before.
Try going into DiffMerge → Preferences → File Windows → Rulesets. You can modify the existing ruleset for your file type (or add a new one if no ruleset exists already).
Edit the ruleset you're interested in, and go to Lines to Omit. In there you can add a regex to match that line #version.
What I'm having trouble with is getting the folder diff to honor this. I find that files with no diffs according to my rules still end up in the folder diff as a non-match, but when I open the file diff window it says Files are identical or equivalent under the current RuleSet. Not sure if this is a bug or I still have something configured wrong. If I go into Folder Windows → Equivalence Mode and dig into the help there, I think I have all the folder diff properties set correctly to honor my rulesets, but still no luck.
It's a pity you need MacOS. For Win32 there is WinMerge readily configurable via Tools/Filters/Linefilters where you simply enter a regular expression to be ignored.
http://manual.winmerge.org/Filters.html
For example, you might use line filters to ignore comments or certain type of generated code, like version control system timestamps
WinMerge 3 will be Qt based hence MacOS positive too, but current 2.x is not yet.