2313 |
@end example |
@end example |
2314 |
|
|
2315 |
@item |
@item |
2316 |
Adjusting the configuration to various contexts. |
Adjusting the configuration to various platforms and Emacs versions. |
2317 |
|
|
2318 |
In most of the cases, people want their Emacs to behave the same on |
Users typically want Emacs to behave the same on all systems, so the |
2319 |
all their machines, so their configuration should be the same, no |
same init file is right for all platforms. However, sometimes it |
2320 |
matter whether it's GNU/Linux or not, under X11 or on a tty, with one |
happens that a function you use for customizing Emacs is not available |
2321 |
version of Emacs or another, ... |
on some platforms or in older Emacs versions. To deal with that |
2322 |
|
situation, put the customization inside a conditional that tests whether |
2323 |
What can happen, tho, is that depending on the circumstance some |
the function or facility is available, like this: |
|
features may or may not be available. In that case just prepend each |
|
|
such customization with a little test that ensures that the feature |
|
|
can be used. The best tests are usually checking that the feature is |
|
|
available, rather than checking what kind of environment is |
|
|
being used. |
|
2324 |
|
|
2325 |
@example |
@example |
2326 |
(if (fboundp 'blinking-cursor-mode) |
(if (fboundp 'blink-cursor-mode) |
2327 |
(blinking-cursor-mode 0)) |
(blink-cursor-mode 0)) |
|
@end example |
|
2328 |
|
|
|
@example |
|
2329 |
(if (boundp 'coding-category-utf-8) |
(if (boundp 'coding-category-utf-8) |
2330 |
(set-coding-priority '(coding-category-utf-8))) |
(set-coding-priority '(coding-category-utf-8))) |
2331 |
@end example |
@end example |
2332 |
|
|
2333 |
|
@noindent |
2334 |
|
You can also simply disregard the errors that occur if the |
2335 |
|
function is not defined. |
2336 |
|
|
2337 |
@example |
@example |
2338 |
(require 'cl) ; To define `ignore-errors'. |
(condition case () |
2339 |
(ignore-errors (set-face-background 'region "grey75")) |
(set-face-background 'region "grey75") |
2340 |
|
(error nil)) |
2341 |
@end example |
@end example |
2342 |
|
|
2343 |
Note also that a @code{setq} on a variable which does not exist is |
A @code{setq} on a variable which does not exist is generally |
2344 |
generally harmless, so those usually do not need to be made |
harmless, so those do not need a conditional. |
|
conditional on any kind of test. |
|
|
|
|
2345 |
@end itemize |
@end itemize |
2346 |
|
|
|
|
|
2347 |
@node Terminal Init |
@node Terminal Init |
2348 |
@subsection Terminal-specific Initialization |
@subsection Terminal-specific Initialization |
2349 |
|
|