From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IKmqMY+4nGDPLAAAgWs5BA (envelope-from ) for ; Thu, 13 May 2021 07:26:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iLRjLY+4nGBuTwAAB5/wlQ (envelope-from ) for ; Thu, 13 May 2021 05:26:39 +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 1CAC128307 for ; Thu, 13 May 2021 07:26:38 +0200 (CEST) Received: from localhost ([::1]:44068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lh3rp-0004ur-QA for larch@yhetil.org; Thu, 13 May 2021 01:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lh3rS-0004uS-E4 for emacs-orgmode@gnu.org; Thu, 13 May 2021 01:26:14 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lh3rQ-0004ZQ-Mo for emacs-orgmode@gnu.org; Thu, 13 May 2021 01:26:14 -0400 Received: by mail-wr1-x42e.google.com with SMTP id z17so6672555wrq.7 for ; Wed, 12 May 2021 22:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:cc:date:message-id :mime-version; bh=M63tK68insQNrafwQRU9nhi/dWwPvSvWRfrIFz8kl5o=; b=dM2mWbvOU1ycFYZwb8AfMqc15Voc9m3aprD8sJeuo6VhGVWwy93PoBHXMk7+Ei785P lGvGqUlKmTPAqTqpI5InEvaLIwI74VY/LDkifYoBOfZxeL/vxN9TOUGD+B5UYBNxmkuO hI80WnzH8x7FuMAZ+cenLCtHSUOjrvpKCuFsRHwb9NwicvxY7OuTnUgvwJ9Pxnj58Eb8 FWnxXSCI9t2SzDapJv/ouI7x1Y74+4GjB+lgnw0XwaIQsWfY8plxlZOZ4LIqPseu0QR3 idDih3oRj0Mn9ofaq41B6PDLNPT6RACRfLLpPd/qd8vlQ9XQG6lEfk0YiOqj116J3Knx TV5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:cc:date :message-id:mime-version; bh=M63tK68insQNrafwQRU9nhi/dWwPvSvWRfrIFz8kl5o=; b=fQwPpLfjJvFwZqfcv6+NOLQfi+gmpWyru3duqwS3ybrCzIbJ6yga+K7wIIWPEMNma3 gOZPSQipvrVvtJ1U6aNZqU075pbl24eig8bRaf3OBOXmR9ZN5rcg6B/T4MxZm0NFvQoM B/32qgmMTkYKEkXXH0a0LptqiwF+uPtEHA1Cx84FXvYHTwuBPrRpJ7pfqf8KLh6oJ3TF iInwovKKkyj+JS5A5EjTHndonrIT1WmqWAO216ordk5WrjJkEkirnc17kix6RpDYhZre cEW+lYbJ6EafghLZRXX96W2b1zTd70fmZigV/ZJmBocbceVHjIPH4pN0uANZJKHkDIo7 2CuQ== X-Gm-Message-State: AOAM531BFxWBhd/lfHvt1aseFGl/vtlyDjJGQ+aztatXRXPRoPsztmax 8vhYy/72FD7zpui9E9U1Hxs= X-Google-Smtp-Source: ABdhPJzBxonSms7WzuRRfWls1zEYELxZ7JyVPHLSgH5FzWSgXqOGcSdbcr+D5uR54o6TNY6K0XDqnQ== X-Received: by 2002:a5d:6885:: with SMTP id h5mr49736329wru.229.1620883570564; Wed, 12 May 2021 22:26:10 -0700 (PDT) Received: from localhost ([91.210.107.197]) by smtp.gmail.com with ESMTPSA id b81sm227805wmd.18.2021.05.12.22.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 22:26:09 -0700 (PDT) From: Ihor Radchenko To: Timothy Subject: Re: [PATCH] Fontification for inline src blocks In-Reply-To: <87cztv29ff.fsf@gmail.com> References: <87pmzf4bd0.fsf@gmail.com> <87pmye51a3.fsf@gmail.com> <87zgxcgaba.fsf@gmail.com> <878s4wtrzx.fsf@gmail.com> <87k0o419uh.fsf@gmail.com> <87o8dgdo7l.fsf@localhost> <87fsys102j.fsf@gmail.com> <87im3odk35.fsf@localhost> <87cztv29ff.fsf@gmail.com> Date: Thu, 13 May 2021 13:31:03 +0800 Message-ID: <87wns3p5d4.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=yantar92@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Gillespie , org-mode-email Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620883599; 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=M63tK68insQNrafwQRU9nhi/dWwPvSvWRfrIFz8kl5o=; b=syULnm6ORirt4g/hc0MYamIwj6Ea5+F3TbqmEnFTB3Sf1IG3fsAM2/fdsFjNcHN0rLyEs+ fFeSokMRobxBewp/zQ0sPqIXJKNtJqEQvq1cNVcGJdniaKsdvq4/XuF6/JoT12GCyyqYj4 dnohU+dnJUdU54fim8xetP0rOOSYZEAoJ9YAdhDb8bT67J1vPXXGCT+I8q6Idec3RcoR20 LMVjzJoaEOFHy5WdBgao2bBYZ3NKdfrY2Z7ieVeWlU6coj9BXH/dtOWOMgB8yt/4MJ+b4N j61olnIIpR+Sj+44UqxetCnq4ySUgU4DKCQeijaY3LTlWMXvdL5gAx5MnYSaRw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620883599; a=rsa-sha256; cv=none; b=SPDtDAqc3d3Fbetk0QizFdlRMW2lrCVjFTiAg+nRqOx8p4XwySn3nz/7UaHr71KAErBILa /ooASukxzCpZo/3vKHJmdQFChRqJOkxyo4TCB0L7JXZu7vmn6XyGzeMMV7V3nnnbgZpRcE 6Z66XclRlE1ksJBrikFVnyyv0BIQTlui89JKVy3hoCqCGDm9cS8QNettNm4EjUdBcuvZXR +33r/HcBXCXEHla3rKVRUDqvP3gmzYFaigvjiuSOSAR1f5NJMH7TKR3pr7i3OSYyQ6Dl/H xYtPMYnfNIJ1XWPqHepGcXrRnHJkH6UAGkNhPElwm+wvyl47HeA8EcgbYlAd6g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dM2mWbvO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dM2mWbvO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 1CAC128307 X-Spam-Score: -2.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: wkbg3brMnoJs Timothy writes: >>>> I do not like abusing prettify-symbols-mode. What if it is not enabled? > > If you know of another way of accomplishing text-replacement which > changes back when the cursor enters the region, please let me know. cursor-sensor-mode >>> Ah, it does it anyway at the moment. >> >> Hmm. You are right. You are calling compose-region directly. Note, that >> you do not add 'decompose-region function for automatic region >> destruction (see help:pretty-symbol-pattern-to-keyword). > > Isn't the same effect achieved by the remove-list-of-text-properties call? It is. Though only while font-lock is active. Now, looking at prettify-symbols-mode code, it does not seem to be necessary when font-locking is set correctly. >> If I understand correctly (I did not really install your patch), if you have >> composed region, disable font-lock, and try to edit the region, edits >> will be invisible. Or imagine setting org-inline-src-prettify-results to >> nil in already fontified buffer. > > I just tried "setting org-inline-src-prettify-results to nil in already > fontified buffer." and the region just decomposed and stayed that way. Did you also have prettify-symbols-mode disabled? >> Also, you may find help:font-lock-extra-managed-props useful. That way, >> you will not have to manually remove composition and other non-standard >> properties during fontification > > Hmmm, from a look I can't tell exactly how these are "managed". Are they > just removed when a region is processed? They are removed just before the region is processed and they are removed when font-lock-mode is disabled. On the other hand, it will not be possible to set the managed properties directly (try setting font using a direct M-: command in a buffer with font-lock enabled). >> P.S. Nitpick: You do not need to run fontification in while loops. Just >> fontifying next match before limit should be enough. Font-lock will call >> the function again if needed. > > I'm guessing for this to work I'd need to return the final char > fortified? Or is the moving of point enough? > > Maybe related - I've noticed this doesn't seem to work with multiple > src_ blocks per line, might you have any insight here? As I understand, the fontificatoin function must behave like re-search-forward. From font-lock-keywords docstring: >>> ... MATCHER can be either the regexp to search for, or the function >>> name to call to make the search (called with one argument, the limit >>> of the search; it should return non-nil, move point, and set >>> `match-data' appropriately if it succeeds; like `re-search-forward' >>> would). Best, Ihor