* lisp/international/characters.el (glyphless-set-char-table-range): New fun.
authorPer Starbäck <starback@stp.lingfil.uu.se>
Mon, 11 Mar 2013 17:45:23 +0000 (13:45 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 11 Mar 2013 17:45:23 +0000 (13:45 -0400)
(update-glyphless-char-display): Use it.

Fixes: debbugs:13744

lisp/ChangeLog
lisp/international/characters.el

index 924519e..0361e5a 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-11  Per Starbäck  <starback@stp.lingfil.uu.se>
+
+       * international/characters.el (glyphless-set-char-table-range): New fun.
+       (update-glyphless-char-display): Use it (bug#13744).
+
 2013-03-11  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * progmodes/cfengine.el: Update for CFEngine 3.4.2 and higher:
index ad0353f..d973ccf 100644 (file)
@@ -1410,16 +1410,16 @@ This function updates the char-table `glyphless-char-display'."
       (or (memq method '(zero-width thin-space empty-box acronym hex-code))
          (error "Invalid glyphless character display method: %s" method))
       (cond ((eq target 'c0-control)
-            (set-char-table-range glyphless-char-display '(#x00 . #x1F)
-                                  method)
+            (glyphless-set-char-table-range glyphless-char-display
+                                            #x00 #x1F method)
             ;; Users will not expect their newlines and TABs be
             ;; displayed as anything but themselves, so exempt those
             ;; two characters from c0-control.
             (set-char-table-range glyphless-char-display #x9 nil)
             (set-char-table-range glyphless-char-display #xa nil))
            ((eq target 'c1-control)
-            (set-char-table-range glyphless-char-display '(#x80 . #x9F)
-                                  method))
+            (glyphless-set-char-table-range glyphless-char-display
+                                            #x80 #x9F method))
            ((eq target 'format-control)
             (map-char-table
              #'(lambda (char category)
@@ -1443,6 +1443,14 @@ This function updates the char-table `glyphless-char-display'."
            (t
             (error "Invalid glyphless character group: %s" target))))))
 
+(defun glyphless-set-char-table-range (chartable from to method)
+  (if (eq method 'acronym)
+      (let ((i from))
+       (while (<= i to)
+         (set-char-table-range chartable i (aref char-acronym-table i))
+         (setq i (1+ i))))
+    (set-char-table-range chartable (cons from to) method)))
+
 ;;; Control of displaying glyphless characters.
 (defcustom glyphless-char-display-control
   '((format-control . thin-space)