< : .:: ''v0.2'' ::.
> : .:: ''v0.3'' ::.
> You can also include interactively a new path into ##switch-path## option via
> ##switch-path## command (which see).
This package facilitates when you need to switch from a
.cpp file, for example, to a corresponding
.hpp file. That is, you visit a
.cpp file, type
M-x switch-cc-to-h RET, and the corresponding
.hpp file is visited automagically.
It also helps when you have three (or more) file extensions to switch, for example, you could have
.inc extensions. So, you could switch from a
.cpp file to a
.hpp file, from
.inc, and from
For good performance, be sure to byte-compile Lisp:switch-file.el, e.g.
M-x byte-compile-file <give the path to switch-file.el when prompted>
This will generate
switch-file.elc, which will be loaded instead of Lisp:switch-file.el.
SwitchFile was tested with GNU Emacs 21, 22 and 23.
I don’t know if it is compatible with XEmacs.
To use SwitchFile, insert in your
(require 'switch-file) (setq switch-path (list <PATH-LIST>))
And, for example, to switch from a current
.cc file to a
.hh corresponding file (or vice-versa) type:
M-x switch-cc-to-h RET
As a suggestion for key bindings:
(global-set-key [f3] 'switch-cc-to-h)
You can also include interactively a new path into
switch-path option via
switch-path command (which see).
Below it’s shown a brief description of SwitchFile options, please, see the options declaration in the code for a long documentation.
To set the above options you may:
a. insert the code in your
(setq switch-path '("some-dir/" "other-dir/"))
This way always keep your default settings when you enter a new Emacs session.
b. or use
‘set-variable’ in your Emacs session, like:
M-x set-variable RET switch-path RET '("some-dir/" "other-dir/") RET
This way keep your settings only during the current Emacs session.
c. or use customization, for example:
Browse Customization Groups,
Through this way, you may choose if the settings are kept or not when you leave out the current Emacs session.
d. or see the option value:
C-h v switch-path RET
and click the
customize hypertext button. Through this way, you may choose if the settings are kept or not when you leave out the current Emacs session.
Thanks to SeungcheolJung? for code correction.
Thanks to Arndt Gulbrandsen (QtMode) for very first version.