I have used the GNU Emacs text editor for 20 years (Happy Anniversary Emacs!). During which time I have written over 54,000 lines of Emacs Lisp code to customise the program so that it behaves exactly like how I want it to behave. This article has been supplemented by a later article. This article presents 6 additions to Emacs (my most important customisations) that I have made in the form of 11 Emacs Lisp (*.el) files. The Lisp files presented in this document should work on all dialects of Emacs, including but not limited to GNU Emacs and XEmacs. Please email me if you encounter any problems installing these files in your local Emacs system. The files linked to from this document fall under the GNU General Public License. You can download an archive file containing almost my entire Emacs customisations. The name of the tarball dlisp.tar.gz the d in dlisp stands for Davin's customizations to elisp, i.e. Emacs Lisp. In the Emacs *.el source files that follow, the d- prefix stands for Davin's customisations.
To install an arbitrary Emacs Lisp file foo.el to your own local Emacs system, simply copy foo.el to one of the folders pointed to by the variable load-path and add the line (require 'foo) to your .emacs file. If you do not already have a .emacs file, create one in the folder that the environment variable HOME points to. If your HOME variable is not set, as might be the case if you are using Microsoft Windows then the HOME folder will be c:/. The trouble with this approach is that the root directory of your c:/ drive will be cluttered with a whole heap of miscellaneous files, e.g. .* (files beginning with a period). If you don't want this then you need to set it to a appropriate value for your system. Examples of sensible values for HOME on Windows systems include c:/home or d:/home (if your d:/ drive is a hard disk) or whatever. It is important that the folder pointed to by HOME actually exists, so you can put your .emacs file into it.
Here are the features of my automated backup system:
The file cbrow.el (cbrow stands for Class Browser) implements a C++ class browser. This file requires a file called diagnose.el. Pressing F5 inside a method of a source file (e.g. *.c++, *.cxx, *.cpp or *.cc) takes you to corresponding line for that function in the the header file for that class. Pressing enter at this point takes you back to the source file. Otherwise pressing F5 takes you to a summary list of all the classes in your program. At this point, enter takes you back to the header browser for the selected class. On the theory that a picture is worth 1,000 words the following diagram explains this system more clearly:
To use this code, you will need to customise the function cbrow--init which can be found at the end of cbrow.el. You can download a tarball containing these files. This code has been submitted to the Emacs Lisp List at Cambridge University, England.
The file trashcan.el contains a recoverable file deletion system that behaves like the trash can or recycle bin that many operating systems, present and past, show on their screens. This system creates special directories known as trashcan directories to hold files that can be deleted or undeleted (restored/recovered). On Unix systems there is one trashcan in the folder HOME and in each of the folders /media/[A-Za-z0-9]+/[A-Za-z0-9]+ for one trashcan directory in each Lubuntu drive. On Windows systems there are trashcan directories at the following default locations: a:\TRASHCAN, b:\TRASHCAN, c:\TRASHCAN etc.
This system changes the behaviour of the "x" key in dired mode from permanently deleting files to a two stage system. If you are not in a trashcan directory, then the selected files are moved into a trashcan directory. If you are already in a trashcan directory, the the selected files are permanently deleted. Files in a trashcan directory can be restored by viewing that directory in dired mode, selecting some files and executing the command M-x trashcan-restore. All of the files in a trashcan directory can also be permanently deleted in one hit by issuing the command M-x trashcan-empty. The name "trashcan" comes from my old Amiga Computer which I still have fond memories of! You can download a tarball containing this files. This code has been submitted to the Emacs Lisp List.
The file cfm.el (cfm stands for Current Function/Method) causes the current function (C/C++/Elisp) or method (C++/Java) to be printed on the modeline. This is useful when you are inside a large function/method and you can't remember which one you are in. This code uses diagnose.el. This feature has been super-seeded by a new package d-speedbar. You can download a tarball containing these files. This code has been submitted to the Emacs Lisp List.
The file archive-compare.el contains the function archive-compare--zips that checks the integrity of CD's burnt using my CD burner. This function makes use of the Five Minute Principle which is used by builders to assess the quality of their buildings: if the building stays erect for five minutes after completion, then it will remain erect forever! Translated to the operation of the integrity checker: if the data is still intact after five minutes after the CD is burnt, then it will remain intact for a long time. Internally this function executes the my own shell command compare-files.cc which takes two file arguments, compares them and prints the result of the comparison to std::cout. You can download a tarball containing these files.
The file directory-files-deep.el contains the following useful functions that generalise the built-in function directory-files:
This file uses the file diagnose.el. You can download a tarball containing these files. This code has been submitted to the Emacs Lisp List.
Back to Research Projects |
This page has the following hit count:
|