From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.help Subject: Re: Is there a way to "asciify" a string? Date: Mon, 28 May 2018 14:24:13 +0900 Message-ID: <86d0xgl5du.fsf@misasa.okayama-u.ac.jp> References: <87zi0llisj.fsf@mbork.pl> <20180527073645.GB17354@tuxteam.de> <87y3g5l1h0.fsf@mbork.pl> <871sdxgt05.fsf@iki.fi> <83d0xh84kz.fsf@gnu.org> <87sh6df310.fsf@iki.fi> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1527490640 3880 195.159.176.226 (28 May 2018 06:57:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 May 2018 06:57:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (windows-nt) Cc: tkk@misasa.okayama-u.ac.jp, help-gnu-emacs To: Teemu Likonen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 28 08:57:16 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNC5j-0000vx-Sb for geh-help-gnu-emacs@m.gmane.org; Mon, 28 May 2018 08:57:16 +0200 Original-Received: from localhost ([::1]:54465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNC7q-0006uy-Uv for geh-help-gnu-emacs@m.gmane.org; Mon, 28 May 2018 02:59:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNAdr-0001mG-Q7 for help-gnu-emacs@gnu.org; Mon, 28 May 2018 01:24:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNAdm-00079J-OT for help-gnu-emacs@gnu.org; Mon, 28 May 2018 01:24:23 -0400 Original-Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]:44540) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNAdm-00079B-IH; Mon, 28 May 2018 01:24:18 -0400 Original-Received: by mail-pf0-x22e.google.com with SMTP id q22-v6so5278669pff.11; Sun, 27 May 2018 22:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2LSylvThv2iC3YiNrR/cWj7kepQhfw8ylz/UlNqitLg=; b=Mk5U+BvYO4Jv+ydfprJ9S2zLpz4GOGfuhvI+3f0fcmGzx/6l/1vdmWmyOkEQ+5DJMa 6TwHYT+v8NDuRQXCwdhn8L7KmIfScpANVw4NZAC3x5H2mh+LUzccwc5f9Wyzp2pl8JAL IDEOwqmw8cJTPy3RDD/SuWMNx+MlmbAnqulyj5Ye4vG8UsC0xVyi165AeSEspJHQn4TY ulflADSYIb+uI3Km63cUr2yL9kj514Piutvg80npH1fvOWQsWvTtfBmrL+YX5mWa5xgG 36MMU41wpz25IIUR/d8h4wpp9ObWEpHfSohqa5ZZJ0Ifh4SGn6/vAc39h1o0jzACDWIK zuQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=2LSylvThv2iC3YiNrR/cWj7kepQhfw8ylz/UlNqitLg=; b=VBp8Q8dpo5zj6i7OdYbXxx5V8vqbzfH45aQlYxfaTYqAWtnULhnDhKqFqZzcBWEJU7 XVTGV890n8/Rq1jzR232D4N4UDmQULyUCxwtPF2GDxoJ9vY34S0v5+JxzR7vZi1W8kVF R7QCNyZk3wYNDYEjV+tyPCINx16jwU46iLNl2rJCoDy3Kd5GStuzshy9cgl14bt+niYz H7YDAZYglWj/qHswopBHEpzsT6kwyPM5iDY7tlpZVqTR4b1FZH0LMPuYiIP6tFSEeL3t T4Eum+yjL0QTvqtZVP9mBYwjizzEP3n8nDQKVfwwtZHbXEiG846s4twvZWIlZQd1MXyS gTlw== X-Gm-Message-State: ALKqPwdckDVWraIjgo78mBu3hdkoAcH5LGArHvkKroCGI9i010Xu5iGV qXMUHDc+TLOG4YejJ8sHFMI= X-Google-Smtp-Source: AB8JxZpPRby8CfyRhOlV4XiLuSbuDlyKtNdXr9pA55DQsf3R9c963Ihg9HM01zfiSN3QY5bAlgINwQ== X-Received: by 2002:a62:ca98:: with SMTP id y24-v6mr11998376pfk.187.1527485057481; Sun, 27 May 2018 22:24:17 -0700 (PDT) Original-Received: from thinkless2017 (vesta.misasa.okayama-u.ac.jp. [150.46.48.154]) by smtp.gmail.com with ESMTPSA id 10-v6sm10378798pgb.40.2018.05.27.22.24.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 May 2018 22:24:16 -0700 (PDT) X-Google-Original-From: Tak Kunihiro In-Reply-To: <87sh6df310.fsf@iki.fi> (Teemu Likonen's message of "Sun, 27 May 2018 19:59:23 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22e X-Mailman-Approved-At: Mon, 28 May 2018 02:58:25 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116877 Archived-At: Teemu Likonen writes: > (defun my-ascii-normalize-filter (string) > (require 'cl-lib) > (cl-remove-if (lambda (char) > (> char 127)) > (ucs-normalize-NFKD-string string))) It is cool. I wanted to asciify the name too. I put the code into my M-l as shown below. #+BEGIN_SRC emacs-lisp (defun downcase-or-normalize-word (arg) "Convert to lower case from point to end of word, moving over. With ARG, normalize a word on point, moving over." (interactive "p") (require 'cl-lib) (if (equal arg 4) (let ((point0 (point)) string) (forward-word 1) (setq string (buffer-substring point0 (point))) (delete-region point0 (point)) (insert (cl-remove-if (lambda (char) (> char 127)) (ucs-normalize-NFKD-string string)))) (downcase-word arg))) (global-set-key [remap downcase-word] 'downcase-or-normalize-word) #+END_SRC