From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id eFsfFxI4WmRvDgAASxT56A (envelope-from ) for ; Tue, 09 May 2023 14:09:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iHj9FRI4WmR7EAAAG6o9tA (envelope-from ) for ; Tue, 09 May 2023 14:09:54 +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 0008518645 for ; Tue, 9 May 2023 14:09:53 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM9H-0001t9-94; Tue, 09 May 2023 08:08:55 -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 1pwM9F-0001jT-W3 for emacs-orgmode@gnu.org; Tue, 09 May 2023 08:08:54 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwM9E-0007jl-2C for emacs-orgmode@gnu.org; Tue, 09 May 2023 08:08:53 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id f8e607fa (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 9 May 2023 12:08:49 +0000 (UTC) References: User-agent: mu4e 1.11.3; emacs 30.0.50 To: Ypo Cc: emacs-orgmode@gnu.org Subject: Re: Help using org-entities or arternatives. Date: Tue, 09 May 2023 19:48:58 +0800 In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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: , Reply-to: Ruijie Yu From: Ruijie Yu via "General discussions about Org-mode." 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=1683634194; a=rsa-sha256; cv=none; b=Ku1oCbK/a7cUu6rG4fpXvTki+TauBaAQgKFZt7x0agr21sqwLZIO6Sgu+mAG16osbkoNib jMvlR6TcbsPyhx376qFH7S85mGK3fyhfsyDeGavCL2byllYpJOy8V0a+ZUgZQEa+L/qJ07 Ybj6Ubp6SLjTv/MVkIH7WXyXrV5+XOCAGTv7nH7L2p32DX1ec9P+9ofn9qeYxFLz6jCM2A HgvElqKk8P4B4h7tIy8cNZ8OIF2JFmDSwbJWENPZCgdZsWqN4z57b18+uO9jCwM38pDOTE xhaha7OjrWOL4XQbfDryFAA40CVofWic2uNB2FZt70SmMRKF4eBs7pvaMQU7GQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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=1683634194; h=from:from:sender:sender:reply-to: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; bh=GQPXn2c3Zci3HJu1diPbwxzuAcXziZpTxt+/vRiylCs=; b=oDJlXUGkHwNHAiFpd+Go7YpV+gqWTAU6ur3e/SLR47hAQkG2kvnRH2MnjhNKTa6FpdjydS sg2wB9rg3Jc9amXNcWgaDFfNLJRSYfAjTzlbSfaTIfiY7nhEhhGHHWIjfEs2eT1DzvcGJz xOHVGiYSl26k6tcSJQk71xpHc69QAQDnJn0uTQgmLKS7UeQT0hCydNXocp0wRlYA5zETM8 vX84bSIRVskQ9Boa194iSw5f4/FEasrpk1Yi45bb3McPhW9E/dAEA8nLjL8HDnpwoXWw1V ENJtT6xyMGtkDzAGbr6HIH1+c7nn2Itl41YJgzsx59rF+Fzdzr+Pi8n8T4ECjA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: -1.98 X-Spam-Score: -1.98 X-Migadu-Queue-Id: 0008518645 X-TUID: wbYs82TOcbBj 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)))) ``` -- Best, RY