changeset 111649:342ca5475c01

Make glyphless-char-display-control a defcustom. international/characters.el (glyphless-char-display-control): Make it a defcustom, with update-glyphless-char-display as its :set attribute. (top level): Don't call update-glyphless-char-display.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 20 Nov 2010 16:35:45 +0200
parents 484f65f4313c
children 8fd0d7bcdf7d
files lisp/ChangeLog lisp/international/characters.el
diffstat 2 files changed, 71 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Nov 20 14:17:25 2010 +0100
+++ b/lisp/ChangeLog	Sat Nov 20 16:35:45 2010 +0200
@@ -1,3 +1,10 @@
+2010-11-20  Eli Zaretskii  <eliz@gnu.org>
+
+	* international/characters.el (glyphless-char-display-control):
+	Make it a defcustom, with update-glyphless-char-display as its
+	:set attribute.
+	(top level): Don't call update-glyphless-char-display.
+
 2010-11-20  Michael Albinus  <michael.albinus@gmx.de>
 
 	Sync with Tramp 2.2.0.
--- a/lisp/international/characters.el	Sat Nov 20 14:17:25 2010 +0100
+++ b/lisp/international/characters.el	Sat Nov 20 16:35:45 2010 +0200
@@ -1293,45 +1293,12 @@
   (aset char-acronym-table (+ #xE0021 i) (format " %c TAG" (+ 33 i))))
 (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG
 
-;;; Control of displaying glyphless characters.
-(defvar glyphless-char-display-control
-  '((format-control . thin-space)
-    (no-font . hex-code))
-  "List of directives to control display of glyphless characters.
-
-Each element has the form (GROUP . METHOD), where GROUP is a
-symbol specifying the character group, and METHOD is a symbol
-specifying the method of displaying characters belonging to that
-group.
-
-GROUP must be one of these symbols:
-  `c0-control':     U+0000..U+001F.
-  `c1-control':     U+0080..U+009F.
-  `format-control': Characters of Unicode General Category `Cf',
-                    such as U+200C (ZWNJ), U+200E (LRM), but
-                    excluding characters that have graphic images,
-                    such as U+00AD (SHY).
-  `no-font':        characters for which no suitable font is found.
-                    For character terminals, characters that cannot
-                    be encoded by `terminal-coding-system'.
-
-METHOD must be one of these symbols:
-  `zero-width': don't display.
-  `thin-space': display a thin (1-pixel width) space.  On character
-                terminals, display as 1-character space.
-  `empty-box':  display an empty box.
-  `acronym':    display an acronym of the character in a box.  The
-                acronym is taken from `char-acronym-table', which see.
-  `hex-code':   display the hexadecimal character code in a box.
-
-Just setting this variable does not take effect.  Call the
-function `update-glyphless-char-display' (which see) after
-setting this variable.")
-
-(defun update-glyphless-char-display ()
+(defun update-glyphless-char-display (&optional variable value)
   "Make the setting of `glyphless-char-display-control' take effect.
 This function updates the char-table `glyphless-char-display'."
-  (dolist (elt glyphless-char-display-control)
+  (when value
+    (set-default variable value))
+  (dolist (elt value)
     (let ((target (car elt))
 	  (method (cdr elt)))
       (or (memq method '(zero-width thin-space empty-box acronym hex-code))
@@ -1365,7 +1332,66 @@
 	    (t
 	     (error "Invalid glyphless character group: %s" target))))))
 
-(update-glyphless-char-display)
+;;; Control of displaying glyphless characters.
+(defcustom glyphless-char-display-control
+  '((format-control . thin-space)
+    (no-font . hex-code))
+  "List of directives to control display of glyphless characters.
+
+Each element has the form (GROUP . METHOD), where GROUP is a
+symbol specifying the character group, and METHOD is a symbol
+specifying the method of displaying characters belonging to that
+group.
+
+GROUP must be one of these symbols:
+  `c0-control':     U+0000..U+001F.
+  `c1-control':     U+0080..U+009F.
+  `format-control': Characters of Unicode General Category `Cf',
+                    such as U+200C (ZWNJ), U+200E (LRM), but
+                    excluding characters that have graphic images,
+                    such as U+00AD (SHY).
+  `no-font':        characters for which no suitable font is found.
+                    For character terminals, characters that cannot
+                    be encoded by `terminal-coding-system'.
+
+METHOD must be one of these symbols:
+  `zero-width': don't display.
+  `thin-space': display a thin (1-pixel width) space.  On character
+                terminals, display as 1-character space.
+  `empty-box':  display an empty box.
+  `acronym':    display an acronym of the character in a box.  The
+                acronym is taken from `char-acronym-table', which see.
+  `hex-code':   display the hexadecimal character code in a box."
+
+  :type '(alist :key-type (symbol :tag "Character Group")
+		:value-type (symbol :tag "Display Method"))
+  :options '((c0-control
+	      (choice (const :tag "Don't display" zero-width)
+		      (const :tag "Display as thin space" thin-space)
+		      (const :tag "Display as empty box" empty-box)
+		      (const :tag "Display acronym" acronym)
+		      (const :tag "Display hex code in a box" hex-code)))
+	     (c1-control
+	      (choice (const :tag "Don't display" zero-width)
+		      (const :tag "Display as thin space" thin-space)
+		      (const :tag "Display as empty box" empty-box)
+		      (const :tag "Display acronym" acronym)
+		      (const :tag "Display hex code in a box" hex-code)))
+	     (format-control
+	      (choice (const :tag "Don't display" zero-width)
+		      (const :tag "Display as thin space" thin-space)
+		      (const :tag "Display as empty box" empty-box)
+		      (const :tag "Display acronym" acronym)
+		      (const :tag "Display hex code in a box" hex-code)))
+	     (no-font
+	      (choice (const :tag "Don't display" zero-width)
+		      (const :tag "Display as thin space" thin-space)
+		      (const :tag "Display as empty box" empty-box)
+		      (const :tag "Display acronym" acronym)
+		      (const :tag "Display hex code in a box" hex-code))))
+  :set 'update-glyphless-char-display
+  :group 'display)
+
 
 ;;; Setting word boundary.