From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AHKSI4LErmELNQEAgWs5BA (envelope-from ) for ; Tue, 07 Dec 2021 03:18:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sLowHoLErmGmWAAAbx9fmQ (envelope-from ) for ; Tue, 07 Dec 2021 02:18:42 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 34DEA2AFBA for ; Tue, 7 Dec 2021 03:18:42 +0100 (CET) Received: from localhost ([::1]:40432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muQ41-0004jr-Bz for larch@yhetil.org; Mon, 06 Dec 2021 21:18:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muQ3T-0004jV-Ne for emacs-orgmode@gnu.org; Mon, 06 Dec 2021 21:18:07 -0500 Received: from [2607:f8b0:4864:20::236] (port=42810 helo=mail-oi1-x236.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muQ3S-00052Z-3N for emacs-orgmode@gnu.org; Mon, 06 Dec 2021 21:18:07 -0500 Received: by mail-oi1-x236.google.com with SMTP id n66so24988874oia.9 for ; Mon, 06 Dec 2021 18:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UX0uyLjE9pDM4ag8fXyHVYhvkJaLCoOiSooV4+MOGqI=; b=cD8j3WkdBFSoPR8iqW4DVfUIjv/NbdiyP0O1JN5Vhx6oO9J2D82eih9/RCGRoD/LwW mxJXhfjiyHUkV9fL5Y+/usvByEboRpYV1MJckx8QeWnvAZgfz45L0wfreJThyWC+4+1I p7hDwOk3lCkYylnDyyRyWmy9DWnEiIJwO2c4Qh1L4C0gBHLVcohZKUl5MHWGEWkIsDfg FB3FL48Y8p85+Pfa/dHKj8/2ZkvOFmUNeHBAkIbv4bZ5eG+Yzs2lNXEKbrjQPKdjnLtg tN4Ic0G/IO9Xqmf7yZ1Cb1cTb/elwEQc/C1Akio9VglLifFaX2QP9QLDtm7F38TrFTlU wC4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UX0uyLjE9pDM4ag8fXyHVYhvkJaLCoOiSooV4+MOGqI=; b=wHHyZZIdFDsh7/XcnFj0QmAc7CuTFmxKhckPXGMlcKsIr9kv7u2pop4Z1fNBMBFzFE kMgH+FHNvEf//l51RRfaFXZGxniJnxD28+igD9cCWh2Os1btPvdCXrnov9CBWcvlPuG7 Mum5QMS04u7DcH/2vz2p4yIO6b42riRoMbdZkVVz+GhSQmFtT3cH9hVWC19JVXM1SkaI WYR3TbWdMSo7JWjYtgniBUkbziRZy93XtJ2UrSLqI7Kr9qOTYQVLeLeWiQuz5xolawdi 2VZpsOXomploKB1Z7EQm/FGnP2hGoQW7wAUN2yCEqixiw4vsZeoBV7LKJ6K/Do1MuTmc DOHQ== X-Gm-Message-State: AOAM530Kf+n8E2tKxMzsHc5EONrEERplS6D989LT3eLj/Fq418w4i3Qi VYQx6afukszsgN9Vl0T44Bwnt3p6CV9eK7H3fHTECvYPGr8= X-Google-Smtp-Source: ABdhPJwdOusEawW876O21NskhFF+EDu0NBzNnxLfs60T22O38vbn7uJhnhniFMxUh8xd9tbt3e4iVsldROZeNRXCaCE= X-Received: by 2002:a17:90a:a504:: with SMTP id a4mr3014880pjq.17.1638843111457; Mon, 06 Dec 2021 18:11:51 -0800 (PST) MIME-Version: 1.0 References: <5b93e27d-df22-3799-7b35-3078472a5154@gmail.com> In-Reply-To: <5b93e27d-df22-3799-7b35-3078472a5154@gmail.com> From: Eduardo Ochs Date: Mon, 6 Dec 2021 23:11:40 -0300 Message-ID: Subject: Re: From macros to elisp programming? To: Ypo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::236 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=eduardoochs@gmail.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638843522; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=UX0uyLjE9pDM4ag8fXyHVYhvkJaLCoOiSooV4+MOGqI=; b=XI8FTn4IgcoKssv7k7axprTACAr5ewfBd4C8LpkWLd6ftmePmxtZf+p4/ZkI8vz3fVyHut s2lOOZ5RMnqF8uuVZOUIbfVXLL8ju+CU/Aeqxwnl8nF8WKdw/qrxchV02Zy3uGJ8sdKkSE n+GhHEhRbBoSaJqubVcnr7m0wCLu3E3KXea6iTowI9w5w/3pk3nt5JIKCUQfOaEdVO+cGq N4naT+4beDV/QJhSU1/pCtHeDw0Kr+ordtPLxf9Ics970pHOMC0nkOh4xepCMsLqOesErE 49hBHmrUywPaVRW88IGvNAbLSmsOv0R9wfnjDIHLnJRtLhzq5w9q7V884kM8bA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638843522; a=rsa-sha256; cv=none; b=thfiNP64qx4MJapbgdEWpcxgk6mdtfiHKUh0IgaqoJMTl/nQamhI16OvcRnjrFQ4QWNL/W GntMIeINIz/+1ZjVq/z7TzzJcu8QzFFZgdaua2qt8Of8M0/+lKY58n8W6o2syFYTxGFGAu vStRbs5opareH9kvFwHOfaMr30LvU6LwZ0lT04Lc+dHhIMsewnTN7Hlqtzn83HJU478V1G QksopXSktCPotsZF1u5AV4fhPZ6xSCHy0UBehWXxtkbqRPWx+6mo3ZkdFoQbEGYU0KRU2b 27NpagX8uEejUc/xj+hLRRNv2aW0ECa1dhR7F1G74lGi747Uq8srTTxovapcUA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cD8j3Wkd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cD8j3Wkd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 34DEA2AFBA X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: KRg15IJrVRuC On Mon, 6 Dec 2021 at 10:43, Ypo wrote: > > Hi > > I am able to make macros, but I think I am far away from Lisp programming= . > > Is there a path to go from macros to elisp programming? For example, the = last macro I've made is for transforming the name of some headlines, adding= in front of them a part from the previous headline. This is the elisp code= of the macro: > > #+BEGIN_SRC > (fset 'SanzTema5 > (kmacro-lambda-form [?\C-a ?\M-f ?\M-b ?\C- ?\M-f ?\M-f ?\M-f ?\M-f ?= \M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-w ?\C-c ?\C-n ?\C-a ?\M-f ?\M-b ?\C-y ? ?= - ? ?\C-e ?\M-b ?\M-f ?\"] 0 "%d")) > #+END_SRC > > > Using that code, from these headlines: > > *** Sanz Aparicio et al. (2019) "5 Los Motivos Adquiridos, Men=C3=A9ndez = Bala=C3=B1a" (pp. 95-118) > **** INTRODUCCI=C3=93N > > I get modified the second headline: > > *** Sanz Aparicio et al. (2019) "5 Los Motivos Adquiridos, Men=C3=A9ndez = Bala=C3=B1a" (pp. 95-118) > **** Sanz Aparicio et al. (2019) "5 Los Motivos Adquiridos - INTRODUCCI= =C3=93N" > > > Are macros near to elisp programming or they are two different worlds? > > Ypo Hi Ypo, here's a suggestion. If you run this (setq last-kbd-macro [?\C-a ?\M-f ?\M-b ?\C- ?\M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-f ?\M-w ?\C-c ?\C-n ?\C-a ?\M-f ?\M-b ?\C-y ? ?- ? ?\C-e ?\M-b ?\M-f ?\"]) and then type `C-x C-k C-e' (`kmacro-edit-macro-repeat') you will get a temporary buffer that contains this: C-a ;; move-beginning-of-line M-f ;; forward-word M-b ;; backward-word C-SPC ;; set-mark-command 9*M-f ;; forward-word M-w ;; kill-ring-save C-c C-n C-a ;; move-beginning-of-line M-f ;; forward-word M-b ;; backward-word C-y ;; yank SPC ;; self-insert-command - ;; self-insert-command SPC ;; self-insert-command C-e ;; move-end-of-line M-b ;; backward-word M-f ;; forward-word " ;; self-insert-command If you convert that by hand - suggestion: use keyboard macros for that! =3D) - to a defun like this one, (defun SanzTema5 () (interactive) (move-beginning-of-line) ; C-a (forward-word) ; M-f (backward-word) ; M-b (set-mark-command) ; C-SPC (dotimes 9 (forward-word)) ; 9*M-f ;; ^ or: (forward-word 9) (kill-ring-save) ; M-w ;; What here? I don' have a: ; C-c C-n (move-beginning-of-line) ; C-a (forward-word) ; M-f (backward-word) ; M-b (yank) ; C-y (insert " - ") ; SPC - SPC (move-end-of-line) ; C-e (backward-word) ; M-b (forward-word) ; M-f (insert "\"") ; " ) Then you will get a defun that does something that is clearly useful to you... you can start by creating and debugging a handful of defuns like that one and then learn what most people consider as "real Elisp"... Cheers =3D), Eduardo Ochs http://angg.twu.net/#eev