unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: GNU Emacs Help <help-gnu-emacs@gnu.org>
Subject: Input method generator package - Re: Unicode fonts
Date: Sun, 23 May 2021 22:42:02 +0300	[thread overview]
Message-ID: <YKqwCsa9PJ4TAtKU@protected.localdomain> (raw)
In-Reply-To: <YKqpluU+S6wwwAC4@protected.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

And here is the 𝐼𝑁𝑃𝑈𝑇 𝑀𝐸𝑇𝐻𝑂𝐷 𝐺𝐸𝑁𝐸𝑅𝐴𝑇𝑂𝑅 package:

;;; Run M-x rcd-input-method-generator RET to generate 𝓯𝓪𝓷𝓬𝔂 input
;;; methods.
;;;
;;; CIRCLED LATIN: ⓐⓑⓒⓓⓔⓕⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓦⓧⓨⓩ
;;; FULLWIDTH LATIN: FULLWIDTH LATIN
;;; ʟᴀᴛɪɴ ʟᴇᴛᴛᴇʀ ꜱᴍᴀʟʟ ᴠᴇʀʏ ɴɪᴄᴇ ꜰᴏʀ ꜱᴏᴄɪᴀʟ ᴍᴇᴅɪᴀ
;;; 𝕸𝖆𝖙𝖍𝖊𝖒𝖆𝖙𝖎𝖈𝖆𝖑 𝕭𝖔𝖑𝖉 𝕱𝖗𝖆𝖐𝖙𝖚𝖗
;;; 𝑴𝒂𝒕𝒉𝒆𝒎𝒂𝒕𝒊𝒄𝒂𝒍 𝑩𝒐𝒍𝒅 𝑰𝒕𝒂𝒍𝒊𝒄
;;; 𝐌𝐚𝐭𝐡𝐞𝐦𝐚𝐭𝐢𝐜𝐚𝐥 𝐁𝐨𝐥𝐝
;;; 𝔻𝕆𝕌𝔹𝕃𝔼 𝕊𝕋R𝕌C𝕂
;;; 𝑀𝐴𝑇𝐻𝐸𝑀𝐴𝑇𝐼𝐶𝐴𝐿 𝐼𝑇𝐴𝐿𝐼𝐶
;;; 𝓂𝒶𝓉𝒽e𝓂𝒶𝓉𝒾𝒸𝒶𝓁 𝓈𝒸𝓇𝒾𝓅𝓉
;;; 𝓪𝓷𝓭 𝓼𝓮𝓿𝓮𝓻𝓪𝓵 𝓸𝓽𝓱𝓮𝓻𝓼
;;;
;;; customize place to save the in variable `rcd-input-method-directory'

https://hyperscope.link/3/7/7/4/1/Emacs-Input-Method-Generator-37741.html



Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/

[-- Attachment #2: input-method-generator.el --]
[-- Type: text/plain, Size: 5233 bytes --]

;;; input-method-generator.el --- Input Method Generator

;; Copyright (C) 2021 by Jean Louis

;; Author: Jean Louis <bugs@gnu.support>
;; Version: 0.1
;; Package-Requires: ()
;; Keywords: convenience
;; URL: https://hyperscope.link/3/7/7/4/1/Emacs-Input-Method-Generator-37741.html

;; 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 this program. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;;;
;;; Run M-x rcd-input-method-generator RET to generate 𝓯𝓪𝓷𝓬𝔂 input
;;; methods.
;;;
;;; CIRCLED LATIN: ⓐⓑⓒⓓⓔⓕⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓦⓧⓨⓩ
;;; FULLWIDTH LATIN: FULLWIDTH LATIN
;;; ʟᴀᴛɪɴ ʟᴇᴛᴛᴇʀ ꜱᴍᴀʟʟ ᴠᴇʀʏ ɴɪᴄᴇ ꜰᴏʀ ꜱᴏᴄɪᴀʟ ᴍᴇᴅɪᴀ
;;; 𝕸𝖆𝖙𝖍𝖊𝖒𝖆𝖙𝖎𝖈𝖆𝖑 𝕭𝖔𝖑𝖉 𝕱𝖗𝖆𝖐𝖙𝖚𝖗
;;; 𝑴𝒂𝒕𝒉𝒆𝒎𝒂𝒕𝒊𝒄𝒂𝒍 𝑩𝒐𝒍𝒅 𝑰𝒕𝒂𝒍𝒊𝒄
;;; 𝐌𝐚𝐭𝐡𝐞𝐦𝐚𝐭𝐢𝐜𝐚𝐥 𝐁𝐨𝐥𝐝
;;; 𝔻𝕆𝕌𝔹𝕃𝔼 𝕊𝕋R𝕌C𝕂
;;; 𝑀𝐴𝑇𝐻𝐸𝑀𝐴𝑇𝐼𝐶𝐴𝐿 𝐼𝑇𝐴𝐿𝐼𝐶
;;; 𝓂𝒶𝓉𝒽e𝓂𝒶𝓉𝒾𝒸𝒶𝓁 𝓈𝒸𝓇𝒾𝓅𝓉
;;; 𝓪𝓷𝓭 𝓼𝓮𝓿𝓮𝓻𝓪𝓵 𝓸𝓽𝓱𝓮𝓻𝓼
;;;
;;; customize place to save the in variable `rcd-input-method-directory'
;;; 
;;; Change Log:

;;; Code:

(defcustom rcd-input-method-directory "~/"
  "Define the directory to generated input method files."
  :group 'rcd
  :type 'string)

(defun string-to-file-force (string file)
  "Print STRING into file, matters not if file exists.
Return FILE as file name."
  (with-temp-file file
    (insert string))
  file)

(defvar rcd-input-methods '(
			    "CIRCLED LATIN@"
			    "FULLWIDTH LATIN@"
			    "LATIN LETTER SMALL"
			    "MATHEMATICAL BOLD FRAKTUR"
			    "MATHEMATICAL BOLD ITALIC"
			    "MATHEMATICAL BOLD SCRIPT"
			    "MATHEMATICAL BOLD"
			    "MATHEMATICAL DOUBLE-STRUCK"
			    "MATHEMATICAL ITALIC"
			    "MATHEMATICAL MONOSPACE"
			    "MATHEMATICAL SANS-SERIF BOLD ITALIC"
			    "MATHEMATICAL SANS-SERIF BOLD"
			    "MATHEMATICAL SANS-SERIF ITALIC"
			    "MATHEMATICAL SANS-SERIF"
			    "MATHEMATICAL SCRIPT"
			    )
  "The input methods that this package can generate and load.")

(defun rcd-input-method-generator ()
  "Generate 𝓯𝓪𝓷𝓬𝔂 input method.

Activate it with \\[toggle-input-method] or set it with \\[set-input-method]"
  (interactive)
  (let* ((completion-ignore-case t)
	 (input-method (completing-read"Input method: " rcd-input-methods))
	 (unicode-part (upcase (string-trim input-method)))
	 (name (string-replace "@" "" (downcase input-method)))
	 (name (string-replace " " "-" name))
	 (title (capitalize input-method))
	 (description (concat title " Input Method"))
	 (file (concat "input-method-" name ".el")))
    (string-to-file-force
     (rcd-input-method-generate input-method unicode-part name title description)
     file)
    (load-file file)))

(defun rcd-input-method-generate (input-method unicode-part name title description)
  "Generate INPUT-METHOD.

Uses UNICODE-PART, NAME, TITLE and DESCRIPTION."
  (let* ((mode-1 (when (string-match "@" unicode-part) t))
	 (unicode-part (replace-regexp-in-string "@" "" unicode-part))
	 (unicode-part-capital (if mode-1 (concat unicode-part " CAPITAL LETTER ")
				 (concat unicode-part " CAPITAL ")))
	 (unicode-part-small (if mode-1 (concat unicode-part " SMALL LETTER ")
			       (concat unicode-part " SMALL "))))
    (with-temp-buffer
      (insert (format ";;;; Input method: %s\n\n" title))
      (insert "(quail-define-package\n")
      (insert (format " \"%s\" \"Unicode\" \"%s\" t\n" name title))
      (insert (format " \"%s\"\n" description))
      (insert (format " nil t nil nil nil nil nil nil nil nil t)\n\n"))
      (insert "(quail-define-rules")
      (let ((num 65))
	(while (< num 91)
	  (let* ((name (concat unicode-part-capital (char-to-string num)))
		 (char-from-name (condition-case nil
				    (char-from-name name)
				  (error ""))))
	    (when char-from-name
	      (insert (format "\n (\"%s\" %d)" (char-to-string num) char-from-name))))
	  (setq num (1+ num))))
      (let ((num 97))
	(while (< num (+ 97 26))
	  (let* ((name (concat unicode-part-small (upcase (char-to-string num))))
		 (char-from-name (condition-case nil
				     (char-from-name name)
				   (error ""))))
	    (when char-from-name
	      (insert (format "\n (\"%s\" %d)" (char-to-string num) char-from-name))))
	  (setq num (1+ num))))
      (insert ")\n\n")
      (buffer-string))))

;;; input-method-generator.el ends here

  reply	other threads:[~2021-05-23 19:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 14:53 Why do I find ^L in elisp code? Christopher Dimech
2021-05-22 15:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 15:12   ` Christopher Dimech
2021-05-22 15:19     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 19:14   ` [External] : " Drew Adams
2021-05-22 15:15 ` Eli Zaretskii
2021-05-22 15:17 ` Omar Polo
2021-05-22 15:22 ` 2QdxY4RzWzUUiLuE
2021-05-22 15:30   ` arthur miller
2021-05-22 15:41     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 15:47     ` Christopher Dimech
2021-05-22 15:58       ` Omar Polo
2021-05-22 16:51         ` arthur miller
2021-05-22 19:15         ` [External] : " Drew Adams
2021-05-22 16:18       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 16:18       ` 2QdxY4RzWzUUiLuE
2021-05-22 16:21         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 16:43           ` 2QdxY4RzWzUUiLuE
2021-05-22 17:06             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 16:27       ` arthur miller
2021-05-22 17:32         ` Christopher Dimech
2021-05-22 18:27           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 18:32             ` Christopher Dimech
2021-05-22 18:40               ` music with/from Emacs (was: Re: Why do I find ^L in elisp code?) Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 21:09                 ` music with/from Emacs Arthur Miller
2021-05-22 21:45                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 21:53                     ` Arthur Miller
2021-05-22 21:59                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-24  1:32                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-24 11:44                         ` Arthur Miller
2021-05-22 16:33       ` Why do I find ^L in elisp code? Jean Louis
2021-05-22 17:02       ` Eduardo Ochs
2021-05-22 20:08         ` Jean Louis
2021-05-22 20:18           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-22 20:25             ` Jean Louis
2021-05-23  6:42               ` Eli Zaretskii
2021-05-23 19:14                 ` Unicode fonts - " Jean Louis
2021-05-23 19:42                   ` Jean Louis [this message]
2021-05-24  8:00                   ` Yuri Khan
2021-05-24  8:18                     ` Christopher Dimech
2021-05-24  8:48                     ` Jean Louis
2021-05-24  9:38                       ` Christopher Dimech
2021-05-24 14:06                       ` Yuri Khan
2021-05-24 14:24                         ` Jean Louis
2021-05-24 14:36                           ` Yuri Khan
2021-05-24 17:39                             ` Jean Louis
2021-05-24 15:02                           ` Eli Zaretskii
2021-05-24 17:31                             ` Christopher Dimech
2021-05-24 18:05                             ` Jean Louis
2021-05-24 18:12                               ` Eli Zaretskii
2021-05-24 20:19                                 ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKqwCsa9PJ4TAtKU@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).