From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Emacs keybindings according to file type Date: Wed, 23 Sep 2020 14:33:07 +0700 Message-ID: References: <83v9g7xliv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14312"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 23 09:34:15 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKzI6-0003c1-DQ for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 09:34:14 +0200 Original-Received: from localhost ([::1]:39946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKzI5-0006pf-Eu for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 03:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKzHG-0006nw-Cz for help-gnu-emacs@gnu.org; Wed, 23 Sep 2020 03:33:22 -0400 Original-Received: from mail-vs1-xe36.google.com ([2607:f8b0:4864:20::e36]:41532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKzHE-0006MI-NL; Wed, 23 Sep 2020 03:33:22 -0400 Original-Received: by mail-vs1-xe36.google.com with SMTP id p24so6916268vsf.8; Wed, 23 Sep 2020 00:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VFNtriItLkepuOzW2igeGShL+vbMKa1hMDh5imSDOp0=; b=eRsRhTgK9g7PSxTKgMmjw/7NIV1Kc0gSg1l2TWZO5VeCdGUgi9C11ViodoeWH01CXr R/EDpldmSW3ltsXZhS5P33RiS/HhmOUR/dQoJm7CWTxQUUu9602fnv1bB/Qt0mOFB+mr jgT44X56dTmzlil+0ocNfKLSpBVpYPcYAKvOKTVHwgOLFse1RtxyjXQE/53gH7+1yuuD +fmw4oSJA1TDd+sKwWBPqXevY+3CnhJRLJ4hZa4H58OMHt/EolVwtRS3ME3qc8U8cNOI g8YuFG6pnevFnNDWy/85mPux06O6zGxMZA94WG0gzoLNtjwsuVZLxtcFKqqEMymiY0T7 RCWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VFNtriItLkepuOzW2igeGShL+vbMKa1hMDh5imSDOp0=; b=AfEpxHCX2effahb8zWO4oQipL0YJa3j2xc7tYCsGratKQzKT9t3RGBpfrBDekDNXi3 U3dahaLkTX3wNXJTgx3pByLgapd7D448LYVlIgkP4kMYgWLQ9aN4fTkYg2xbilS8vZ53 M9PLGi7ParsiL+rjMSV5FEc322+zY8UYPo92ytU/GdceAnnNaFAUDAQOS1ojMUWV9RFs GDSCbevB7y5O1q8NKBkeOuxDKMmegl4jk98+BukdMN/RYTq/HQeVjtgXYsJhNXJ9bTx3 ba5GA3qTVRttgaBhjQpO5q5XoNtA+z9d0BHDLoTP7Rjmj/5wZYkY3MgcB9aqRiTQLBwx BGWA== X-Gm-Message-State: AOAM533rU2lA8Zuh4OiYH0G7ZrMslossx8CdbiJuZ2VS7ZjKeFVoneTP iYUAKWCbUPiO0pllHifDBnUwAn9zst+f3jQarGQ= X-Google-Smtp-Source: ABdhPJzoY8qK7a3s49T1pAWxxLE2IGjv/x8jFouypwes3qSe2byXJfRWmf0JqbPA2jVMBivoKbulSZUfbJqTUgApK9s= X-Received: by 2002:a67:fb0f:: with SMTP id d15mr6175402vsr.38.1600846399241; Wed, 23 Sep 2020 00:33:19 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e36; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe36.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124151 Archived-At: On Wed, 23 Sep 2020 at 13:33, Christopher Dimech wrote: > I wrote the following code to swap line for org files. > Did not work after trying it. I need to have the thing work for > org files and other files on whicn I call M-x org-mode. > > ( defun Transpose-Org-Line () > "Binds up and down keys to org-drag-line* commands" > (local-set-key (kbd "C-t l f") 'org-drag-line-forwarrd) > (local-set-key (kbd "C-t l b") 'org-drag-line-backward) > ) > > ( add-hook 'org-mode-hook 'Transpose-Org-Line ) Works for me in emacs -Q, except that you misspelled =E2=80=98forward=E2=80= =99. Also, org-mode already binds M-S- and M-S- to commands that work the same way as org-drag-line-* unless you are in a table or on a clock timestamp. It=E2=80=99s likely that you will want to drag a line more than once in a row, so a repeatable binding (a key that you can hold down) is better than a long sequence such as C-t l f.