;;; charmap.el --- Unicode table for Emacs

;; Author: Anan Mikami <lateau@gmail.com>
;; Created: 25 Mar 2013
;; Keywords: unicode character ucs
;; Package-Version: 20200616.1418
;; Package-Commit: feac50b87d2a596c5e5b7b82b79ddd65b6dedd8c
;; Version: 0.0.2
;; URL: https://github.com/lateau/charmap

;; How to use:
;;   * M-x charmap to display a unicode block.
;;   * M-x charmap-all to display entire unicode blocks but it's slow.
;;   * C-f / C-b / C-n / C-p to navigate the characters.
;;   * RET will copy a character on current cursor to kill-ring.

;; This file is NOT part of GNU Emacs.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Code:

(defgroup charmap nil
  "charmap"
  :prefix "charmap-"
  :group 'applications)

(defcustom charmap-enable-simple nil
  "Display a result in minibuffer"
  :type 'symbol
  :group 'charmap)

(defcustom charmap-text-scale-adjust 4
  "Text scale."
  :type 'integer
  :group 'charmap)

(defface charmap-face '((t (:family "dejavu sans" :weight normal :slant normal :underline nil)))
  "Font lock face used to *charmap* buffer."
  :group 'charmap)

(defvar charmap-bufname "*charmap*")

(defface charmap-onechar-face '((t (:family "dejavu sans" :weight normal :slant normal :underline nil)))
  "Popup tooltip face."
  :group 'charmap)

(defconst charmap-describe-char-bufname "*Help*")

(defconst charmap-usage "Usage: C-f / C-b / C-n / C-p / RET: killring / q: quit")

(defconst charmap-char-map
  '(Adlam (#x1E900 #x1E95F)
    Aegean_Numbers (#x10100 #x1013F)
    Ahom (#x11700 #x1173F)
    Alchemical_Symbols (#x1F700 #x1F77F)
    Alphabetic_Presentation_Forms (#xFB00 #xFB4F)
    Anatolian_Hieroglyphs (#x14400 #x1467F)
    Ancient_Greek_Musical_Notation (#x1D200 #x1D24F)
    Ancient_Greek_Numbers (#x10140 #x1018F)
    Ancient_Symbols (#x10190 #x101CF)
    Arabic (#x0600 #x06FF)
    Arabic_Extended-A (#x08A0 #x08FF)
    Arabic_Mathematical_Alphabetic_Symbols (#x1EE00 #x1EEFF)
    Arabic_Presentation_Forms-A (#xFB50 #xFDFF)
    Arabic_Presentation_Forms-B (#xFE70 #xFEFF)
    Arabic_Supplement (#x0750 #x077F)
    Armenian (#x0530 #x058F)
    Arrows (#x2190 #x21FF)
    Avestan (#x10B00 #x10B3F)
    Balinese (#x1B00 #x1B7F)
    Bamum (#xA6A0 #xA6FF)
    Bamum_Supplement (#x16800 #x16A3F)
    Basic_Latin (#x0000 #x007F)
    Bassa_Vah (#x16AD0 #x16AFF)
    Batak (#x1BC0 #x1BFF)
    Bengali (#x0980 #x09FF)
    Bhaiksuki (#x11C00 #x11C6F)
    Block_Elements (#x2580 #x259F)
    Bopomofo (#x3100 #x312F)
    Bopomofo_Extended (#x31A0 #x31BF)
    Box_Drawing (#x2500 #x257F)
    Brahmi (#x11000 #x1107F)
    Braille_Patterns (#x2800 #x28FF)
    Buginese (#x1A00 #x1A1F)
    Buhid (#x1740 #x175F)
    Byzantine_Musical_Symbols (#x1D000 #x1D0FF)
    CJK_Compatibility (#x3300 #x33FF)
    CJK_Compatibility_Forms (#xFE30 #xFE4F)
    CJK_Compatibility_Ideographs (#xF900 #xFAFF)
    CJK_Compatibility_Ideographs_Supplement (#x2F800 #x2FA1F)
    CJK_Radicals_Supplement (#x2E80 #x2EFF)
    CJK_Strokes (#x31C0 #x31EF)
    CJK_Symbols_and_Punctuation (#x3000 #x303F)
    CJK_Unified_Ideographs (#x4E00 #x9FFF)
    CJK_Unified_Ideographs_Extension_A (#x3400 #x4DBF)
    CJK_Unified_Ideographs_Extension_B (#x20000 #x2A6DF)
    CJK_Unified_Ideographs_Extension_C (#x2A700 #x2B73F)
    CJK_Unified_Ideographs_Extension_D (#x2B740 #x2B81F)
    CJK_Unified_Ideographs_Extension_E (#x2B820 #x2CEAF)
    CJK_Unified_Ideographs_Extension_F (#x2CEB0 #x2EBEF)
    CJK_Unified_Ideographs_Extension_G (#x30000 #x3134F)
    Carian (#x102A0 #x102DF)
    Caucasian_Albanian (#x10530 #x1056F)
    Chakma (#x11100 #x1114F)
    Cham (#xAA00 #xAA5F)
    Cherokee (#x13A0 #x13FF)
    Cherokee_Supplement (#xAB70 #xABBF)
    Chess_Symbols (#x1FA00 #x1FA6F)
    Chorasmian (#x10FB0 #x10FDF)
    Combining_Diacritical_Marks (#x0300 #x036F)
    Combining_Diacritical_Marks_Extended (#x1AB0 #x1AFF)
    Combining_Diacritical_Marks_Supplement (#x1DC0 #x1DFF)
    Combining_Diacritical_Marks_for_Symbols (#x20D0 #x20FF)
    Combining_Half_Marks (#xFE20 #xFE2F)
    Common_Indic_Number_Forms (#xA830 #xA83F)
    Control_Pictures (#x2400 #x243F)
    Coptic (#x2C80 #x2CFF)
    Coptic_Epact_Numbers (#x102E0 #x102FF)
    Counting_Rod_Numerals (#x1D360 #x1D37F)
    Cuneiform (#x12000 #x123FF)
    Cuneiform_Numbers_and_Punctuation (#x12400 #x1247F)
    Currency_Symbols (#x20A0 #x20CF)
    Cypriot_Syllabary (#x10800 #x1083F)
    Cyrillic (#x0400 #x04FF)
    Cyrillic_Extended-A (#x2DE0 #x2DFF)
    Cyrillic_Extended-B (#xA640 #xA69F)
    Cyrillic_Extended-C (#x1C80 #x1C8F)
    Cyrillic_Supplement (#x0500 #x052F)
    Deseret (#x10400 #x1044F)
    Devanagari (#x0900 #x097F)
    Devanagari_Extended (#xA8E0 #xA8FF)
    Dingbats (#x2700 #x27BF)
    Dives_Akuru (#x11900 #x1195F)
    Dogra (#x11800 #x1184F)
    Domino_Tiles (#x1F030 #x1F09F)
    Duployan (#x1BC00 #x1BC9F)
    Early_Dynastic_Cuneiform (#x12480 #x1254F)
    Egyptian_Hieroglyph_Format_Controls (#x13430 #x1343F)
    Egyptian_Hieroglyphs (#x13000 #x1342F)
    Elbasan (#x10500 #x1052F)
    Elymaic (#x10FE0 #x10FFF)
    Emoticons (#x1F600 #x1F64F)
    Enclosed_Alphanumeric_Supplement (#x1F100 #x1F1FF)
    Enclosed_Alphanumerics (#x2460 #x24FF)
    Enclosed_CJK_Letters_and_Months (#x3200 #x32FF)
    Enclosed_Ideographic_Supplement (#x1F200 #x1F2FF)
    Ethiopic (#x1200 #x137F)
    Ethiopic_Extended (#x2D80 #x2DDF)
    Ethiopic_Extended-A (#xAB00 #xAB2F)
    Ethiopic_Supplement (#x1380 #x139F)
    General_Punctuation (#x2000 #x206F)
    Geometric_Shapes (#x25A0 #x25FF)
    Geometric_Shapes_Extended (#x1F780 #x1F7FF)
    Georgian (#x10A0 #x10FF)
    Georgian_Extended (#x1C90 #x1CBF)
    Georgian_Supplement (#x2D00 #x2D2F)
    Glagolitic (#x2C00 #x2C5F)
    Glagolitic_Supplement (#x1E000 #x1E02F)
    Gothic (#x10330 #x1034F)
    Grantha (#x11300 #x1137F)
    Greek_Extended (#x1F00 #x1FFF)
    Greek_and_Coptic (#x0370 #x03FF)
    Gujarati (#x0A80 #x0AFF)
    Gunjala_Gondi (#x11D60 #x11DAF)
    Gurmukhi (#x0A00 #x0A7F)
    Halfwidth_and_Fullwidth_Forms (#xFF00 #xFFEF)
    Hangul_Compatibility_Jamo (#x3130 #x318F)
    Hangul_Jamo (#x1100 #x11FF)
    Hangul_Jamo_Extended-A (#xA960 #xA97F)
    Hangul_Jamo_Extended-B (#xD7B0 #xD7FF)
    Hangul_Syllables (#xAC00 #xD7AF)
    Hanifi_Rohingya (#x10D00 #x10D3F)
    Hanunoo (#x1720 #x173F)
    Hatran (#x108E0 #x108FF)
    Hebrew (#x0590 #x05FF)
    High_Private_Use_Surrogates (#xDB80 #xDBFF)
    High_Surrogates (#xD800 #xDB7F)
    Hiragana (#x3040 #x309F)
    IPA_Extensions (#x0250 #x02AF)
    Ideographic_Description_Characters (#x2FF0 #x2FFF)
    Ideographic_Symbols_and_Punctuation (#x16FE0 #x16FFF)
    Imperial_Aramaic (#x10840 #x1085F)
    Indic_Siyaq_Numbers (#x1EC70 #x1ECBF)
    Inscriptional_Pahlavi (#x10B60 #x10B7F)
    Inscriptional_Parthian (#x10B40 #x10B5F)
    Javanese (#xA980 #xA9DF)
    Kaithi (#x11080 #x110CF)
    Kana_Extended-A (#x1B100 #x1B12F)
    Kana_Supplement (#x1B000 #x1B0FF)
    Kanbun (#x3190 #x319F)
    Kangxi_Radicals (#x2F00 #x2FDF)
    Kannada (#x0C80 #x0CFF)
    Katakana (#x30A0 #x30FF)
    Katakana_Phonetic_Extensions (#x31F0 #x31FF)
    Kayah_Li (#xA900 #xA92F)
    Kharoshthi (#x10A00 #x10A5F)
    Khitan_Small_Script (#x18B00 #x18CFF)
    Khmer (#x1780 #x17FF)
    Khmer_Symbols (#x19E0 #x19FF)
    Khojki (#x11200 #x1124F)
    Khudawadi (#x112B0 #x112FF)
    Lao (#x0E80 #x0EFF)
    Latin-1_Supplement (#x0080 #x00FF)
    Latin_Extended-A (#x0100 #x017F)
    Latin_Extended-B (#x0180 #x024F)
    Latin_Extended-C (#x2C60 #x2C7F)
    Latin_Extended-D (#xA720 #xA7FF)
    Latin_Extended-E (#xAB30 #xAB6F)
    Latin_Extended_Additional (#x1E00 #x1EFF)
    Lepcha (#x1C00 #x1C4F)
    Letterlike_Symbols (#x2100 #x214F)
    Limbu (#x1900 #x194F)
    Linear_A (#x10600 #x1077F)
    Linear_B_Ideograms (#x10080 #x100FF)
    Linear_B_Syllabary (#x10000 #x1007F)
    Lisu (#xA4D0 #xA4FF)
    Lisu_Supplement (#x11FB0 #x11FBF)
    Low_Surrogates (#xDC00 #xDFFF)
    Lycian (#x10280 #x1029F)
    Lydian (#x10920 #x1093F)
    Mahajani (#x11150 #x1117F)
    Mahjong_Tiles (#x1F000 #x1F02F)
    Makasar (#x11EE0 #x11EFF)
    Malayalam (#x0D00 #x0D7F)
    Mandaic (#x0840 #x085F)
    Manichaean (#x10AC0 #x10AFF)
    Marchen (#x11C70 #x11CBF)
    Masaram_Gondi (#x11D00 #x11D5F)
    Mathematical_Alphanumeric_Symbols (#x1D400 #x1D7FF)
    Mathematical_Operators (#x2200 #x22FF)
    Mayan_Numerals (#x1D2E0 #x1D2FF)
    Medefaidrin (#x16E40 #x16E9F)
    Meetei_Mayek (#xABC0 #xABFF)
    Meetei_Mayek_Extensions (#xAAE0 #xAAFF)
    Mende_Kikakui (#x1E800 #x1E8DF)
    Meroitic_Cursive (#x109A0 #x109FF)
    Meroitic_Hieroglyphs (#x10980 #x1099F)
    Miao (#x16F00 #x16F9F)
    Miscellaneous_Mathematical_Symbols-A (#x27C0 #x27EF)
    Miscellaneous_Mathematical_Symbols-B (#x2980 #x29FF)
    Miscellaneous_Symbols (#x2600 #x26FF)
    Miscellaneous_Symbols_and_Arrows (#x2B00 #x2BFF)
    Miscellaneous_Symbols_and_Pictographs (#x1F300 #x1F5FF)
    Miscellaneous_Technical (#x2300 #x23FF)
    Modi (#x11600 #x1165F)
    Modifier_Tone_Letters (#xA700 #xA71F)
    Mongolian (#x1800 #x18AF)
    Mongolian_Supplement (#x11660 #x1167F)
    Mro (#x16A40 #x16A6F)
    Multani (#x11280 #x112AF)
    Musical_Symbols (#x1D100 #x1D1FF)
    Myanmar (#x1000 #x109F)
    Myanmar_Extended-A (#xAA60 #xAA7F)
    Myanmar_Extended-B (#xA9E0 #xA9FF)
    NKo (#x07C0 #x07FF)
    Nabataean (#x10880 #x108AF)
    Nandinagari (#x119A0 #x119FF)
    New_Tai_Lue (#x1980 #x19DF)
    Newa (#x11400 #x1147F)
    Number_Forms (#x2150 #x218F)
    Nushu (#x1B170 #x1B2FF)
    Nyiakeng_Puachue_Hmong (#x1E100 #x1E14F)
    Ogham (#x1680 #x169F)
    Ol_Chiki (#x1C50 #x1C7F)
    Old_Hungarian (#x10C80 #x10CFF)
    Old_Italic (#x10300 #x1032F)
    Old_North_Arabian (#x10A80 #x10A9F)
    Old_Permic (#x10350 #x1037F)
    Old_Persian (#x103A0 #x103DF)
    Old_Sogdian (#x10F00 #x10F2F)
    Old_South_Arabian (#x10A60 #x10A7F)
    Old_Turkic (#x10C00 #x10C4F)
    Optical_Character_Recognition (#x2440 #x245F)
    Oriya (#x0B00 #x0B7F)
    Ornamental_Dingbats (#x1F650 #x1F67F)
    Osage (#x104B0 #x104FF)
    Osmanya (#x10480 #x104AF)
    Ottoman_Siyaq_Numbers (#x1ED00 #x1ED4F)
    Pahawh_Hmong (#x16B00 #x16B8F)
    Palmyrene (#x10860 #x1087F)
    Pau_Cin_Hau (#x11AC0 #x11AFF)
    Phags-pa (#xA840 #xA87F)
    Phaistos_Disc (#x101D0 #x101FF)
    Phoenician (#x10900 #x1091F)
    Phonetic_Extensions (#x1D00 #x1D7F)
    Phonetic_Extensions_Supplement (#x1D80 #x1DBF)
    Playing_Cards (#x1F0A0 #x1F0FF)
    Private_Use_Area (#xE000 #xF8FF)
    Psalter_Pahlavi (#x10B80 #x10BAF)
    Rejang (#xA930 #xA95F)
    Rumi_Numeral_Symbols (#x10E60 #x10E7F)
    Runic (#x16A0 #x16FF)
    Samaritan (#x0800 #x083F)
    Saurashtra (#xA880 #xA8DF)
    Sharada (#x11180 #x111DF)
    Shavian (#x10450 #x1047F)
    Shorthand_Format_Controls (#x1BCA0 #x1BCAF)
    Siddham (#x11580 #x115FF)
    Sinhala (#x0D80 #x0DFF)
    Sinhala_Archaic_Numbers (#x111E0 #x111FF)
    Small_Form_Variants (#xFE50 #xFE6F)
    Small_Kana_Extension (#x1B130 #x1B16F)
    Sogdian (#x10F30 #x10F6F)
    Sora_Sompeng (#x110D0 #x110FF)
    Soyombo (#x11A50 #x11AAF)
    Spacing_Modifier_Letters (#x02B0 #x02FF)
    Specials (#xFFF0 #xFFFF)
    Sundanese (#x1B80 #x1BBF)
    Sundanese_Supplement (#x1CC0 #x1CCF)
    Superscripts_and_Subscripts (#x2070 #x209F)
    Supplemental_Arrows-A (#x27F0 #x27FF)
    Supplemental_Arrows-B (#x2900 #x297F)
    Supplemental_Arrows-C (#x1F800 #x1F8FF)
    Supplemental_Mathematical_Operators (#x2A00 #x2AFF)
    Supplemental_Punctuation (#x2E00 #x2E7F)
    Supplemental_Symbols_and_Pictographs (#x1F900 #x1F9FF)
    Supplementary_Private_Use_Area-A (#xF0000 #xFFFFF)
    Supplementary_Private_Use_Area-B (#x100000 #x10FFFF)
    Sutton_SignWriting (#x1D800 #x1DAAF)
    Syloti_Nagri (#xA800 #xA82F)
    Symbols_and_Pictographs_Extended-A (#x1FA70 #x1FAFF)
    Symbols_for_Legacy_Computing (#x1FB00 #x1FBFF)
    Syriac (#x0700 #x074F)
    Syriac_Supplement (#x0860 #x086F)
    Tagalog (#x1700 #x171F)
    Tagbanwa (#x1760 #x177F)
    Tags (#xE0000 #xE007F)
    Tai_Le (#x1950 #x197F)
    Tai_Tham (#x1A20 #x1AAF)
    Tai_Viet (#xAA80 #xAADF)
    Tai_Xuan_Jing_Symbols (#x1D300 #x1D35F)
    Takri (#x11680 #x116CF)
    Tamil (#x0B80 #x0BFF)
    Tamil_Supplement (#x11FC0 #x11FFF)
    Tangut (#x17000 #x187FF)
    Tangut_Components (#x18800 #x18AFF)
    Tangut_Supplement (#x18D00 #x18D8F)
    Telugu (#x0C00 #x0C7F)
    Thaana (#x0780 #x07BF)
    Thai (#x0E00 #x0E7F)
    Tibetan (#x0F00 #x0FFF)
    Tifinagh (#x2D30 #x2D7F)
    Tirhuta (#x11480 #x114DF)
    Transport_and_Map_Symbols (#x1F680 #x1F6FF)
    Ugaritic (#x10380 #x1039F)
    Unified_Canadian_Aboriginal_Syllabics (#x1400 #x167F)
    Unified_Canadian_Aboriginal_Syllabics_Extended (#x18B0 #x18FF)
    Vai (#xA500 #xA63F)
    Variation_Selectors (#xFE00 #xFE0F)
    Variation_Selectors_Supplement (#xE0100 #xE01EF)
    Vedic_Extensions (#x1CD0 #x1CFF)
    Vertical_Forms (#xFE10 #xFE1F)
    Wancho (#x1E2C0 #x1E2FF)
    Warang_Citi (#x118A0 #x118FF)
    Yezidi (#x10E80 #x10EBF)
    Yi_Radicals (#xA490 #xA4CF)
    Yi_Syllables (#xA000 #xA48F)
    Yijing_Hexagram_Symbols (#x4DC0 #x4DFF)
    Zanabazar_Square (#x11A00 #x11A4F)))

(defun charmap-forward ()
  "Move to forward then display a character description."
  (interactive)
  (forward-char 1)
  (charmap-describe-char))

(defun charmap-backward ()
  "Move to backward."
  (interactive)
  (backward-char 1)
  (charmap-describe-char))

(defun charmap-next-line ()
  (interactive)
  (next-line)
  (charmap-describe-char))

(defun charmap-prev-line ()
  (interactive)
  (previous-line)
  (charmap-describe-char))

(defun charmap-describe-char ()
  "Display description of a character at current point."
  (describe-char (point))
  (if (equal (current-buffer) (get-buffer charmap-describe-char-bufname))
      (other-window -1)))

(defun charmap-copy-char ()
  "Copy a character on current point."
  (interactive)
  (kill-ring-save (point) (+ (point) 1))
  (message "Copied to kill-ring"))

(defun charmap-zoom-char-at-point (&optional height position) ; Not bound by default.
  "Show the Unicode char at point in a zoomed tooltip.
With a numerical prefix arg, show it that many times larger.
Non-nil POSITION means use the character at POSITION."
  (interactive (list (and current-prefix-arg  (prefix-numeric-value current-prefix-arg))))
  (unless height (setq height  1))
  (let ((new-face `(:foreground "red" :height ,(* 200 height) :inherit charmap-onechar-face)))
    (x-show-tip (propertize (char-to-string (char-after position)) 'face new-face))))

(defun charmap-delete-buffers ()
  (interactive)
  (and (get-buffer-window charmap-describe-char-bufname)
       (delete-window (get-buffer-window charmap-describe-char-bufname)))
  (and (get-buffer-window charmap-bufname)
       (delete-window (get-buffer-window charmap-bufname))))

(defvar charmap-keymap
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-f") 'charmap-forward)
    (define-key map (kbd "C-b") 'charmap-backward)
    (define-key map (kbd "C-n") 'charmap-next-line)
    (define-key map (kbd "C-p") 'charmap-prev-line)
    (define-key map (kbd "RET") 'charmap-copy-char)
    (define-key map (kbd "s") 'charmap-search)
    (define-key map (kbd "q") 'charmap-delete-buffers)
    (define-key map (kbd "z") 'charmap-zoom-char-at-point)
    map))

(defun charmap-get-blocks ()
  "Retrieve all usable unicode blocks."
  (delete nil (mapcar #'(lambda (x) (when (symbolp x) x)) charmap-char-map)))

(defun charmap-print-chars (start-incl end-incl)
  "Print characters from start to end."
  (dolist (ch (number-sequence start-incl end-incl))
    (insert-char ch 1)))

(defun charmap-print (unicode-block)
  "Retrieve a unicode block and prepare for printing the block to buffer."
  (let ((data (plist-get charmap-char-map unicode-block)))
    (and data
         (apply 'charmap-print-chars data))))

(defmacro with-charmap-buffer (&rest body)
  `(let ((buf (get-buffer-create charmap-bufname))
         (bufname charmap-bufname))
     (with-current-buffer bufname
       (delete-other-windows)
       (split-window)
       (other-window -1)
       (switch-to-buffer bufname)
       (setq buffer-read-only nil)
       (set (make-local-variable 'bidi-display-reordering) nil)
       (erase-buffer)
       (text-scale-set charmap-text-scale-adjust)
       (setq buffer-face-mode-face 'charmap-face)
       (buffer-face-mode)
       (setq truncate-lines nil)
       ,@body
       (beginning-of-buffer)
       (setq buffer-read-only t)
       (use-local-map charmap-keymap)
       (font-lock-mode t)
       (message charmap-usage))))


;;;###autoload
(defun charmap ()
  "Display a specified unicode block."
  (interactive)
  (let* ((blocks (mapcar #'(lambda(x) (subst-char-in-string ?_ ?\s (symbol-name x))) (charmap-get-blocks)))
         (unicode-block (intern-soft (subst-char-in-string ?\s ?_ (completing-read "Select a unicode block: " blocks)))))
    (if (plist-get charmap-char-map unicode-block)
        (with-charmap-buffer
         (charmap-print unicode-block))
      (error (format "Unicode block '%s' couldn't be found." (symbol-name unicode-block))))))


;;;###autoload
(defun charmap-all ()
  "Display entire unicode table."
  (interactive)
  (with-charmap-buffer
   (dolist (unicode-block (charmap-get-blocks))
     (charmap-print unicode-block)
     (delete-backward-char 1)
     (insert "\n\n"))))


(provide 'charmap)

;;; charmap.el ends here