Mercurial > emacs
comparison lisp/international/characters.el @ 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 | 5c986eef8f0d |
children | f026c8607795 |
comparison
equal
deleted
inserted
replaced
111648:484f65f4313c | 111649:342ca5475c01 |
---|---|
1291 (aset char-acronym-table #xE0020 "SP TAG") ; TAG SPACE | 1291 (aset char-acronym-table #xE0020 "SP TAG") ; TAG SPACE |
1292 (dotimes (i 94) | 1292 (dotimes (i 94) |
1293 (aset char-acronym-table (+ #xE0021 i) (format " %c TAG" (+ 33 i)))) | 1293 (aset char-acronym-table (+ #xE0021 i) (format " %c TAG" (+ 33 i)))) |
1294 (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG | 1294 (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG |
1295 | 1295 |
1296 ;;; Control of displaying glyphless characters. | 1296 (defun update-glyphless-char-display (&optional variable value) |
1297 (defvar glyphless-char-display-control | |
1298 '((format-control . thin-space) | |
1299 (no-font . hex-code)) | |
1300 "List of directives to control display of glyphless characters. | |
1301 | |
1302 Each element has the form (GROUP . METHOD), where GROUP is a | |
1303 symbol specifying the character group, and METHOD is a symbol | |
1304 specifying the method of displaying characters belonging to that | |
1305 group. | |
1306 | |
1307 GROUP must be one of these symbols: | |
1308 `c0-control': U+0000..U+001F. | |
1309 `c1-control': U+0080..U+009F. | |
1310 `format-control': Characters of Unicode General Category `Cf', | |
1311 such as U+200C (ZWNJ), U+200E (LRM), but | |
1312 excluding characters that have graphic images, | |
1313 such as U+00AD (SHY). | |
1314 `no-font': characters for which no suitable font is found. | |
1315 For character terminals, characters that cannot | |
1316 be encoded by `terminal-coding-system'. | |
1317 | |
1318 METHOD must be one of these symbols: | |
1319 `zero-width': don't display. | |
1320 `thin-space': display a thin (1-pixel width) space. On character | |
1321 terminals, display as 1-character space. | |
1322 `empty-box': display an empty box. | |
1323 `acronym': display an acronym of the character in a box. The | |
1324 acronym is taken from `char-acronym-table', which see. | |
1325 `hex-code': display the hexadecimal character code in a box. | |
1326 | |
1327 Just setting this variable does not take effect. Call the | |
1328 function `update-glyphless-char-display' (which see) after | |
1329 setting this variable.") | |
1330 | |
1331 (defun update-glyphless-char-display () | |
1332 "Make the setting of `glyphless-char-display-control' take effect. | 1297 "Make the setting of `glyphless-char-display-control' take effect. |
1333 This function updates the char-table `glyphless-char-display'." | 1298 This function updates the char-table `glyphless-char-display'." |
1334 (dolist (elt glyphless-char-display-control) | 1299 (when value |
1300 (set-default variable value)) | |
1301 (dolist (elt value) | |
1335 (let ((target (car elt)) | 1302 (let ((target (car elt)) |
1336 (method (cdr elt))) | 1303 (method (cdr elt))) |
1337 (or (memq method '(zero-width thin-space empty-box acronym hex-code)) | 1304 (or (memq method '(zero-width thin-space empty-box acronym hex-code)) |
1338 (error "Invalid glyphless character display method: %s" method)) | 1305 (error "Invalid glyphless character display method: %s" method)) |
1339 (cond ((eq target 'c0-control) | 1306 (cond ((eq target 'c0-control) |
1363 ((eq target 'no-font) | 1330 ((eq target 'no-font) |
1364 (set-char-table-extra-slot glyphless-char-display 0 method)) | 1331 (set-char-table-extra-slot glyphless-char-display 0 method)) |
1365 (t | 1332 (t |
1366 (error "Invalid glyphless character group: %s" target)))))) | 1333 (error "Invalid glyphless character group: %s" target)))))) |
1367 | 1334 |
1368 (update-glyphless-char-display) | 1335 ;;; Control of displaying glyphless characters. |
1336 (defcustom glyphless-char-display-control | |
1337 '((format-control . thin-space) | |
1338 (no-font . hex-code)) | |
1339 "List of directives to control display of glyphless characters. | |
1340 | |
1341 Each element has the form (GROUP . METHOD), where GROUP is a | |
1342 symbol specifying the character group, and METHOD is a symbol | |
1343 specifying the method of displaying characters belonging to that | |
1344 group. | |
1345 | |
1346 GROUP must be one of these symbols: | |
1347 `c0-control': U+0000..U+001F. | |
1348 `c1-control': U+0080..U+009F. | |
1349 `format-control': Characters of Unicode General Category `Cf', | |
1350 such as U+200C (ZWNJ), U+200E (LRM), but | |
1351 excluding characters that have graphic images, | |
1352 such as U+00AD (SHY). | |
1353 `no-font': characters for which no suitable font is found. | |
1354 For character terminals, characters that cannot | |
1355 be encoded by `terminal-coding-system'. | |
1356 | |
1357 METHOD must be one of these symbols: | |
1358 `zero-width': don't display. | |
1359 `thin-space': display a thin (1-pixel width) space. On character | |
1360 terminals, display as 1-character space. | |
1361 `empty-box': display an empty box. | |
1362 `acronym': display an acronym of the character in a box. The | |
1363 acronym is taken from `char-acronym-table', which see. | |
1364 `hex-code': display the hexadecimal character code in a box." | |
1365 | |
1366 :type '(alist :key-type (symbol :tag "Character Group") | |
1367 :value-type (symbol :tag "Display Method")) | |
1368 :options '((c0-control | |
1369 (choice (const :tag "Don't display" zero-width) | |
1370 (const :tag "Display as thin space" thin-space) | |
1371 (const :tag "Display as empty box" empty-box) | |
1372 (const :tag "Display acronym" acronym) | |
1373 (const :tag "Display hex code in a box" hex-code))) | |
1374 (c1-control | |
1375 (choice (const :tag "Don't display" zero-width) | |
1376 (const :tag "Display as thin space" thin-space) | |
1377 (const :tag "Display as empty box" empty-box) | |
1378 (const :tag "Display acronym" acronym) | |
1379 (const :tag "Display hex code in a box" hex-code))) | |
1380 (format-control | |
1381 (choice (const :tag "Don't display" zero-width) | |
1382 (const :tag "Display as thin space" thin-space) | |
1383 (const :tag "Display as empty box" empty-box) | |
1384 (const :tag "Display acronym" acronym) | |
1385 (const :tag "Display hex code in a box" hex-code))) | |
1386 (no-font | |
1387 (choice (const :tag "Don't display" zero-width) | |
1388 (const :tag "Display as thin space" thin-space) | |
1389 (const :tag "Display as empty box" empty-box) | |
1390 (const :tag "Display acronym" acronym) | |
1391 (const :tag "Display hex code in a box" hex-code)))) | |
1392 :set 'update-glyphless-char-display | |
1393 :group 'display) | |
1394 | |
1369 | 1395 |
1370 ;;; Setting word boundary. | 1396 ;;; Setting word boundary. |
1371 | 1397 |
1372 (setq word-combining-categories | 1398 (setq word-combining-categories |
1373 '((nil . ?^) | 1399 '((nil . ?^) |