From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?B?R8O2a3R1xJ8=?= Kayaalp Newsgroups: gmane.emacs.help Subject: Re: Writing source code with Unicode characters Date: Thu, 06 Feb 2014 21:23:17 +0200 Message-ID: <87sirwgi56.fsf@gkayaalp.com> References: <87zjm4qeqi.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1391714630 28706 80.91.229.3 (6 Feb 2014 19:23:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Feb 2014 19:23:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 06 20:23:56 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WBUYF-0003uY-Ek for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Feb 2014 20:23:55 +0100 Original-Received: from localhost ([::1]:38087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBUYF-0007yB-0e for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Feb 2014 14:23:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBUXy-0007y0-Tt for help-gnu-emacs@gnu.org; Thu, 06 Feb 2014 14:23:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBUXs-0004dr-PE for help-gnu-emacs@gnu.org; Thu, 06 Feb 2014 14:23:38 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:45199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBUXs-0004df-IX for help-gnu-emacs@gnu.org; Thu, 06 Feb 2014 14:23:32 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WBUXr-0003Y1-Im for help-gnu-emacs@gnu.org; Thu, 06 Feb 2014 20:23:31 +0100 Original-Received: from 85.101.220.44 ([85.101.220.44]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Feb 2014 20:23:31 +0100 Original-Received: from self by 85.101.220.44 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Feb 2014 20:23:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 85.101.220.44 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:Oh8M0Qah6QNdi7/G24Pgm+qzfo0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95946 Archived-At: I just came up with a solution for this: Have an alist from two characters to unicode symbols, and have a function, when called, takes the two characters to the left of the point, then lookup the alist and replace them with the cdr of matching pair: (defvar unicode-pair-alist '((".\\" . "λ") ("->" . "→") ("=>" . "⇒"))) (defun unicode-replace-previous-two-chars () (interactive) (if (or (not (boundp 'unicode-pair-alist)) (null unicode-pair-alist)) (error "Please set ``unicode-pair-alist'' in order to use this function.")) (let* ((pair (string (get-byte (- (point) 2)) (get-byte (- (point) 1)))) (usym-pair (assoc pair unicode-pair-alist))) (if (null usym-pair) (error (concat "Pair not in ``unicode-pair-alist'': " pair))) (delete-backward-char 2) (insert (cdr usym-pair)))) (global-set-key (kbd "C-'") 'unicode-replace-previous-two-chars) One can map `->' to `→' directly, but then they can't insert `->' easily, can they? What do you think of this? I have just came up with this after I read your post, so I did not evaluate it's merits and perils. Óscar Fuentes writes: > I'll like to experiment with using Unicode on source code (λ instead of > lambda, etc) but it seems quite inconvenient to insert those chars with > C-x 8 RET. Org-mode has the capability of displaying λ when you type > \lambda, but that's just a display replacement, the raw text still is > \lambda. > > What can I use to make more convenient the insertion of Unicode chars? > (I'm mostly interested on Greek letters and other math-related symbols) > > > GK