unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Suggested addition to custom.texi
@ 2005-04-16 21:40 Stefan Monnier
  2005-05-20 18:00 ` Reiner Steib
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2005-04-16 21:40 UTC (permalink / raw)


How about the patch below?


        Stefan


--- custom.texi	29 mar 2005 09:09:27 -0500	1.83
+++ custom.texi	16 avr 2005 17:39:33 -0400	
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2004
+@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2004,2005
 @c  Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Customization, Quitting, Amusements, Top
@@ -2313,8 +2313,44 @@
 @example
 (put 'narrow-to-region 'disabled nil)
 @end example
+
+@item
+Adjusting the configuration to various contexts.
+
+In most of the cases, people want their Emacs to behave the same on
+all their machines, so their configuration should be the same, no
+matter whether it's GNU/Linux or not, under X11 or on a tty, with one
+version of  Emacs or another, ...
+
+What can happen, tho, is that depending on the circumstance some
+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.
+
+@example
+(if (fboundp 'blinking-cursor-mode)
+    (blinking-cursor-mode 0))
+@end example
+
+@example
+(if (boundp 'coding-category-utf-8)
+  (set-coding-priority '(coding-category-utf-8)))
+@end example
+
+@example
+(require 'cl)                   ; To define `ignore-errors'.
+(ignore-errors (set-face-background 'region "grey75"))
+@end example
+
+Note also that a @code{setq} on a variable which does not exist is
+generally harmless, so those usually do not need to be made
+conditional on any kind of test.
+
 @end itemize
 
+
 @node Terminal Init
 @subsection Terminal-specific Initialization

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Suggested addition to custom.texi
  2005-04-16 21:40 Suggested addition to custom.texi Stefan Monnier
@ 2005-05-20 18:00 ` Reiner Steib
  0 siblings, 0 replies; 2+ messages in thread
From: Reiner Steib @ 2005-05-20 18:00 UTC (permalink / raw)
  Cc: Stefan Monnier

On Sat, Apr 16 2005, Stefan Monnier wrote:

> How about the patch below?

There has been no objection (withing several weeks), AFAICS.  I like
Stefan's suggestion.

[...]
> +@item
> +Adjusting the configuration to various contexts.
> +
> +In most of the cases, people want their Emacs to behave the same on
> +all their machines, so their configuration should be the same, no
> +matter whether it's GNU/Linux or not, under X11 or on a tty, with one
> +version of  Emacs or another, ...
> +
> +What can happen, tho, is that depending on the circumstance some
> +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.
[... examples ...]

Here are some examples from my init files which you may want to
include.

Possible example for w/ or w/o X11:

(setq ps-lpr-command
      (cond ((and (eq window-system 'x) (executable-find "xpp"))
	     "xpp")
	    ((executable-find "lpr")
	     "lpr")))

;; Enable a couple of modes when available...
(dolist (mode '(column-number-mode line-number-mode
		minibuffer-electric-default-mode
		file-name-shadow-mode))
  (if (fboundp mode)
      (funcall mode 1)
    (message "Mode `%s' is not available" mode)))

Require library without error in case the library is not installed
everywhere:

(require 'xtla nil t)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-20 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-16 21:40 Suggested addition to custom.texi Stefan Monnier
2005-05-20 18:00 ` Reiner Steib

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).