From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: sokobania.01@gmail.com Newsgroups: gmane.emacs.help Subject: How to bind the same function to different keys with different behaviours? Date: Wed, 13 Jan 2016 04:55:40 -0800 (PST) Message-ID: <427779ff-2eaf-46e0-b23f-f385f7b4c0e6@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1452690025 30095 80.91.229.3 (13 Jan 2016 13:00:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Jan 2016 13:00:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 13 14:00:25 2016 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 1aJL2D-0001L5-W7 for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 14:00:22 +0100 Original-Received: from localhost ([::1]:36827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJL2D-0001Jl-53 for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 08:00:21 -0500 X-Received: by 10.107.34.144 with SMTP id i138mr112497909ioi.18.1452689740846; Wed, 13 Jan 2016 04:55:40 -0800 (PST) X-Received: by 10.50.41.5 with SMTP id b5mr68832igl.8.1452689740790; Wed, 13 Jan 2016 04:55:40 -0800 (PST) Original-Path: usenet.stanford.edu!h5no3860501igh.0!news-out.google.com!kr2ni3802igb.0!nntp.google.com!h5no3860496igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=46.20.162.131; posting-account=6AmU8QoAAABkSb2sbJisGlnlR_egh2hP Original-NNTP-Posting-Host: 46.20.162.131 User-Agent: G2/1.0 Injection-Date: Wed, 13 Jan 2016 12:55:40 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:216418 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:108708 Archived-At: In the basic modemap, the ascii keys are bound to `self-insert-command'. As it is not an emacs-lisp function, I cannot "copy" its code. I want to bind the keys [A-Z] to `my-self-insert-command' with something like: (for key from ?A to ?Z do (bind-key my-mode-map key 'my-self-insert-command)) This function kind of inserts the current key pressed under some conditions. So far, I don't know how to get acces to the current key pressed from within `my-self-insert-command'. Is this possible? If it is not possible, I'll do something like: (for key from ?A to ?Z do (bind-key my-mode-map key (lambda () (my-self-insert-command key))))