From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2FiAAwu/X2SnSwAASxT56A (envelope-from ) for ; Sat, 13 May 2023 18:47:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kB13Awu/X2QYYAAA9RJhRA (envelope-from ) for ; Sat, 13 May 2023 18:47:07 +0200 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 9D361A23B for ; Sat, 13 May 2023 18:47:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxsNt-0003z8-Ff; Sat, 13 May 2023 12:46:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxsNr-0003yw-7T for emacs-orgmode@gnu.org; Sat, 13 May 2023 12:46:15 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxsNp-0004qN-Hz for emacs-orgmode@gnu.org; Sat, 13 May 2023 12:46:14 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-30626f4d74aso7226846f8f.0 for ; Sat, 13 May 2023 09:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683996371; x=1686588371; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=yScSgrw/22Y+HCWRV22EdPzPzTWnhZCcfKVhLfVjpQE=; b=gWqCitJLXkwrSkzV5sYTMzBiH6Bv+3FIZgwZ6NXIOLoB6FoEnxSE+DtAxi1+lcXtUB QnXRcr/9zy3AS79V3zgHKazMbgBu8+wLOMiuOquuJrT6DdN0WGdWcGdpEKogHvzI0xBc cKAV8Xx36zND/FRW+gQqTxkcjMoBHz/4MzvImJP4MenUvmYPqBRng3ISsUFk5Pix4Yac DHX5CqVSGanAtAM8ntuvsHx+5t+l72oMZ0E3Khr8QK8QTn1rUfjMq84KMMXHHv1IOYFB lUK+cFmrv6w9EyGJLpwCAE8DvlKIuMpqrjBjqetOIw598xiRvLwAE62JjsJckUnAgtnQ y2+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683996371; x=1686588371; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=yScSgrw/22Y+HCWRV22EdPzPzTWnhZCcfKVhLfVjpQE=; b=XeEAX2kPeSEf9OhTrZYO/RzBWY5UgO6vomuBAfUk8wW8uU4VMjwGVRNxLZ4m/Dv1WM hfKTd2dsNq+Ky+PbCWFwCBf4uQ6HTOy2WXnHk+qYzI74fLGxGUyS0bgsgOsBPb7usOxD 7sFGtYdxjSj3E4uvkZdUy9lu5v1oblIiVoe5rs6A6dow59m8dNiwmD5VwK14WLSMLJM1 M80BsIWR0+FWevaYPpbUnT+UctU+knlh6Li0JvBHDuALGX3HaYp+TBVExePOnN1d/rKZ ho3NHFoNG+xKPHTXTbaBAps8uvOh0KTyd+tK3BDT25lGJeJFqsE1AfKljygCxLHNteXn 3Ohw== X-Gm-Message-State: AC+VfDyEGqCO/q6oqr5X8n4MeDEcUUuHLibpLr4J/D/t8xwuxIYnR3eq +gN9bEamOvzuhsUaDqwMyZo6LBRrjz8= X-Google-Smtp-Source: ACHHUZ6sw8cWLNIMYAP2oYlV5IPDs3Wj0s5tkdKaIuWppXCC/Z5Ezx3y+Dsso9vxtUEXkhrKULAv6Q== X-Received: by 2002:adf:f8d2:0:b0:306:321c:995b with SMTP id f18-20020adff8d2000000b00306321c995bmr21297435wrq.41.1683996371102; Sat, 13 May 2023 09:46:11 -0700 (PDT) Received: from [192.168.0.97] (static-86-232-229-77.ipcom.comunitel.net. [77.229.232.86]) by smtp.gmail.com with ESMTPSA id s18-20020a5d4252000000b00304aba2cfcbsm27074689wrr.7.2023.05.13.09.46.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 May 2023 09:46:10 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------lGSP0lhniAZau0GfX0PWt3Vy" Message-ID: <711f83e9-a490-6a4c-f044-de0d67e648e8@gmail.com> Date: Sat, 13 May 2023 18:43:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Help using org-entities or arternatives. Content-Language: en-GB To: Ruijie Yu Cc: emacs-orgmode@gnu.org References: From: Ypo In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=ypuntot@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.923, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683996426; a=rsa-sha256; cv=none; b=oF6Pr7laBLgtJuEJL8dMwTercPqJ/6npqOhsdUPIRbpCjnbKanu3pO99NMg7G3zN4zTek9 Q96dYJAFg7+/iWeiGB9veUu8TYPr2Yxv8yAFBun5JUIbuWmN/kZC/UEhNBLsGB7BFonugq wC39F8OP4QRlTE/kuSv2K0xd968oieJL8T606EitNsVTH8adyMskqJXZcVp+ulSkhohaep P5IsdXYUBsC/pKHH77CNWyik9HQ1Vwxru5iv4OsML6B7S4haFF1wYiQfsnrK1f5fozM7VF 3d0vb4nLDdVzxsiXyBzCOO8I0NkV+btPfsuH0Ur3/dQ6hPgzeEQAqA9pXj6CQA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gWqCitJL; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683996426; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yScSgrw/22Y+HCWRV22EdPzPzTWnhZCcfKVhLfVjpQE=; b=JR54PbUCsRWfHpIfSyE6ou8Vt7zShTZ4XmHlvmlnKZYzQrRsReWf2BvPf4gM9oUi5iLDFO V3i6PX4Jakl8ocEutDKfSMcbD2VMmZv1ppMVFMo2ViiKksyGOWF2JvXh3sOCIdiZMKK0XE K1Cg2ali6woAGfLmjfRjszeex4xPDw0lA/Qu76ZGoUmajtcqwFzWSufo1Sw/KmmIW3xd/v QY8Fg69FN28FbiLkR/IyIBX9LW9BgRJpB64YY+kib9FYgIDhpokflOQha0IA/VICWsg+g0 yKNpAdsUln38+mN4vSdEqlsb98opnKLUC2qYH98AaD25h3L9UzFC0OH9T1whYg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gWqCitJL; 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: -6.37 X-Spam-Score: -6.37 X-Migadu-Queue-Id: 9D361A23B X-TUID: lkjBLRTEQTtP This is a multi-part message in MIME format. --------------lGSP0lhniAZau0GfX0PWt3Vy Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Thanks, Ruijie. I think it is not what I was asking for, but it's nice to read your code. Best regards. El 09/05/2023 a las 13:48, Ruijie Yu escribió: > Ypo writes: > >> Hi >> >> Is it possible to, each time I write "...." to be subsituted by "[...]" ? >> >> I can't do it using abbrev, and I don't know how to do it using org-entities. >> >> I use it to yank quotes, for example, I write: >> >> "Like other editors, Emacs has commands to search for occurrences of a string. ....There are also commands that do the same thing, but >> search for patterns instead of fixed strings." >> >> And I would like to get, automatically: >> >> "Like other editors, Emacs has commands to search for occurrences of a string. [...] There are also commands that do the same thing, but >> search for patterns instead of fixed strings." >> >> Best regards > Not necessarily Org-specific, but here's my idea, untested: > > ```emacs-lisp > (defun my/yank-subst-ellipses () > (interactive) > (let* ((start (point-marker)) > (_ (insert (current-kill 0))) > (end (point-marker))) > (save-match-data > ;; Play around with this regexp > (while (re-search-forward (rx "...") end t) > ;; And this replacement text > (replace-match "[...]"))))) > ``` > > Then, since Org sets C-y as `org-yank', make an advice with it. I am > not confident in this portion at all, but here goes nothing ;) > > ```emacs-lisp > (require 'cl-lib) > (advice-add > #'org-yank :around > (lambda (org-yank &optional arg) > (cl-letf (((symbol-function 'yank) > (symbol-function 'my/yank-subst/ellipses))) > (funcall org-yank arg)))) > ``` > --------------lGSP0lhniAZau0GfX0PWt3Vy Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Thanks, Ruijie. I think it is not what I was asking for, but it's nice to read your code.

Best regards.

El 09/05/2023 a las 13:48, Ruijie Yu escribió:
Ypo <ypuntot@gmail.com> writes:

Hi

Is it possible to, each time I write "...." to be subsituted by "[...]" ?

I can't do it using abbrev, and I don't know how to do it using org-entities.

I use it to yank quotes, for example, I write:

 "Like other editors, Emacs has commands to search for occurrences of a string. ....There are also commands that do the same thing, but
 search for patterns instead of fixed strings."

And I would like to get, automatically:

 "Like other editors, Emacs has commands to search for occurrences of a string. [...] There are also commands that do the same thing, but
 search for patterns instead of fixed strings."

Best regards
Not necessarily Org-specific, but here's my idea, untested:

```emacs-lisp
(defun my/yank-subst-ellipses ()
  (interactive)
  (let* ((start (point-marker))
         (_ (insert (current-kill 0)))
         (end (point-marker)))
    (save-match-data
      ;; Play around with this regexp
      (while (re-search-forward (rx "...") end t)
        ;; And this replacement text
        (replace-match "[...]")))))
```

Then, since Org sets C-y as `org-yank', make an advice with it.  I am
not confident in this portion at all, but here goes nothing ;)

```emacs-lisp
(require 'cl-lib)
(advice-add
 #'org-yank :around
 (lambda (org-yank &optional arg)
   (cl-letf (((symbol-function 'yank)
              (symbol-function 'my/yank-subst/ellipses)))
     (funcall org-yank arg))))
```

--------------lGSP0lhniAZau0GfX0PWt3Vy--