I'm a beginner of emacs. when i try to config my emacs, i googled a lot of examples. most of them have a site-lisp directory.
My question is why not use my-lisp for self maded lisp files and use vendor-lisp for other people's site.
And what things should site-lisp direcotry contain.
my-lisp and vendor-lisp are perfectly fine directory names for organising your personal elisp configuration and libraries.
"site" means "this computer", and so the site-lisp directory is for elisp which should be available to all users of the computer.
Similarly to .emacs.d and site-lisp directory (follow for more details), I get the impression that you might be asking about having a site-lisp directory within your user-specific configuration, which would be contrary to this naming convention, and possibly a bit confusing.
If you take a look around, there's also python-site and ruby-site. They are used by other packages from the package management to install .el files in a directory where emacs finds them at load.
Related
I would like to include a few additional .pl files in my CPAN module. These files are not essential to use the module, but are provide useful functionality/glue when the module is used in some common frameworks and applications.
Currently, I just include the .pl files in a "extras" directory of the distribution. This has the drawback that the files are not installed on make install. Is there a way to include them in the installation and where should they go? (They aren't executables and don't belong in "bin".) Would "share" make sense? Or are these kinds of files usually just not installed and it is left to the user to get them out of the .tgz archive and use as needed?
I use Dist::Zilla to manage my distribution.
I would suggest the following:
If they're actual complete programs or are almost complete, polish then up and make them standalone items that could go into /bin with POD of their own.
If they're utility glue, make a ::Utils module for them to live in and document their usage.
If these are useful code snippets but not something you can install somewhere or are sample usages or handy idioms, create a ::Cookbook all-POD module and include them there with the appropriate illuminating explanation for each one.
I don't know exactly how Dist::Zilla works, but the resulting archive has to be compatible with what ExtUtils::MakeMaker creates.
When you create a module with module-starter, it creates a module template using ExtUtils::MakeMaker. It creates several files and directories like the lib directory where your module lives and the t directories where your tests live.
One thing it doesn't create is a bin directory. However, if you create a bin directory, and you put files under this directory (such as Perl scripts), these files will be installed under the bin directory in your Perl's distribution and linked to /usr/local/bin or /usr/bin. Would this be a good place for your scripts?
I liked #Joe's answer, except that in my case the files were WebWork macros -- individual .pl files that make my module callable from WebWork end-user's code. So they don't fit under any of the categories discussed here, and as .pl files can't be made a module.
This is what I ended up doing:
put all .pl macro files into 'extras/WebWork' in the distribution.
add to "dist.ini" file a [ShareDir] stanza with dir = extras property.
now the WebWork admin can install my distribution from CPAN and then use perl -MFile::ShareDir -e 'print File::ShareDir::dist_dir("Statistics-R-IO")' to find the macros and make them available in WebWork.
In my computer I have an Emacs plugin installed with the Debian package system, but this plugin is obsolete and I'm trying to install it inside my home directory with package-install. I have installed a newer version, but if I check which version is loaded, the older one is.
I tried with load-file and the global path to the new version, but it still loads the old version.
How can I force the load of the new one? Please, imagine that I'm not the sysadmin of the computer and I cannot uninstall any software package.
When a library contains multiple files one can assume that a single main file will load the others as necessary; but if the directory isn't in the load-path then it won't be able to load them (or at least not those versions), so load-file on its own isn't going to do the trick.
I don't make much use of package.el myself, but I'd really have thought that it would manage the load-path such that it took precedence over anything in site-lisp (which is presumably where the debian package is installing things.)
Try running emacs --no-site-lisp and check that the correct version of the library is loaded. If you don't want anything from the site libraries, then that might even be your solution.
If that works, then check the load-path variable after starting Emacs normally. Unless an absolute path is given, Emacs will look at those directories in sequence, and use the first one which matches. I am guessing that for some reason your site-lisp directory is appearing before the one created by package.el.
Or perhaps the package didn't install correctly at all.
That all said, in Emacs 24.3 at least (package-initialize) is called automatically and I don't think you should need to manually load anything. Check the package-load-list variable.
Edit:
On that last note, refer to cannot open load dired-details.
At the time I hadn't noticed that Emacs doesn't initialize packages until after the user init file has loaded, so you generally will need to initialize them manually in your init file.
Try this
(defun please-load-my-stuff ()
(interactive)
(load "PATH-TO-STUFF/STUFF))
When having access to init, put just form "(load ...)" there.
If more than one file is needed, load-path must be set also that way - before load, so the other required files are accessible.
Is it possible to remove built-in Emacs packages like "tetris"? They can't be marked to be deleted in package list as of 24.1. It would be nice to have a minimal installation of Emacs - even though barely useful - by deleting some or all built-in packages. Is it possible to do somehow, and will this ability added in future?
Emacs should start and be useable even if the whole lisp directory is empty (note that we rarely/never test it, so I don't guarantee that it'll work, but at least in principle it should and if it doesn't you should report it with M-x report-emacs-bug). So feel free to remove any and all packages in there you don't find useful, in order to create a trimmed-down version of Emacs.
You could just remove the elc files of all of the packages you want.
For example, in the version of emacs located in the ubuntu repository the tetris package is located in:
/usr/share/emacs/23.3/lisp/play/tetris.elc
If you move or remove it, emacs will continue to work, but you won't be able to play tetris anymore.
You might want to inspect the package--builtins variable. That said - there is little sense in removing any packages installed via package.el since package.el extracts and loads automatically only a package's autoloads - therefore having many installed packages doesn't result in any significant overhead. I'm quite certain that removing built-in packages will never be a feature of package.el.
Now, I'm using ede to manage my cpp project, and I try to find a file in my project quickly, but I failed. I used ede-find-file to find "db.h", it sits in "d:/projects/leveldb/include/db.h", unfortunately, it said cannot find.
My config is put below
(setq leveldb_root "d:/projects/leveldb/")
(ede-cpp-root-project
"leveldb"
:file (concat leveldb_root ".gitignore")
:system-include-path '("C:/Program Files/Microsoft SDKs/Windows/v7.1/Include"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include")
:include-path '("/"
"/include"))
And, is there any suggestion for project management and file find solution? (I also tried find-file-in-project).
I use ede because I need the ede-cpp-root-project to automatically set semanticdb.
Have a look at projectile. Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies. For instance - finding project files is done in pure elisp without the use of GNU find.
This library provides easy project management and navigation. The concept of a project is pretty basic - just a folder containing special file. Currently git, mercurial and bazaar repos are considered projects by default. If you want to mark a folder manually as a project just create an empty .projectile file in it.
One of the solutions that I use for my C/C++ projects is using GNU Global. You can use gtags module with Emacs, which is superior than the built-in tag system. Once you have GNU Global installed, and Emacs gtags configured, you can run gtags from the top level of your source tree to generate the tags. Now, if you run the M-x gtags-find-file to open a file that was indexed by Global. For usability, you can bind this command with a keystroke that is convenient for you.
For the original ede project types, such as the ones that generate or
read Automake files, EDE knows all the files and where they are if they
are being compiled into your program.
For ede-cpp-root, it has no list of files to use, so it will only really
search in the current directory or include path. The include path is
key since it is needed for smart completion.
If you would like to use ede-find-file for general file discovery, you
can integrate in an external tool such as GNU Global, or idutils as a
backend database for both files. You could also enable the use of your
system's locate command.
Customize ede-locate-setup-options to include whichever tool you would
like to use, and then it should work as desired.
Well, I don't really know how to solve your particular problem, but I can try to remedy it. If you install the ido package (http://www.emacswiki.org/emacs/InteractivelyDoThings), you can usually find files quickly that way. It's a find-file solution for everything in my opinion.
Or you can try xcscope.el, it is blazingly fast to find the files you want(+more) provided
you have setup your cscope database properly.
The one more alternative is gpicker. It's actually an external tool, but there's an integration plugin for emacs. It provides fuzzy search for project files regarding its relative paths and makes it pretty fast. I'm using it for about three years and strongly recommend trying gpicker other emacs users.
I on solaris 10 and I wanted to install the latest version of emacs.
I don't have root access. I tried compiling emacs 23.4 from source and I am struck due to an old version of compiler in my system.
I am trying to use the per-built binary from sunfreeware.com, Is there a means to install it in my home directory without root access?
It should be possible for most packages as long as their binaries support to be relocated.
You first need to convert the pkg files to their filesystem variant with pkgtrans, then, in most cases, you also need to extract the embedded archive which is just a cpio file.
Finally, you will need to adjust file permissions using the prototype file and possibly tweak some files or environment variables like LD_LIBRARY_PATH to have the program or libraries be functional.
Of course this can become quite cumbersome when you have to repeat all of this for every dependency the initial package might have.
I don't know about emacs but I suspect it to have many dependencies so the technique I suggest here might be too complex to worth the effort, especially as emacs has an alternative which is always installed and that many people prefer, I mean of course vi.