From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GM6OIdoLYGJ7KQEAbAwnHQ (envelope-from ) for ; Wed, 20 Apr 2022 15:34:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id c5qKIdoLYGLrPgEA9RJhRA (envelope-from ) for ; Wed, 20 Apr 2022 15:34:18 +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 470A62AAC3 for ; Wed, 20 Apr 2022 15:34:18 +0200 (CEST) Received: from localhost ([::1]:59728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhATJ-0006i4-92 for larch@yhetil.org; Wed, 20 Apr 2022 09:34:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhAJK-00023Y-FD for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:23:58 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:40492) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhAJG-0003JX-Ti for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:23:58 -0400 Received: by mail-pj1-x1033.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso4931857pjb.5 for ; Wed, 20 Apr 2022 06:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:message-id:date:mime-version; bh=xpYYC3yXmezkBvx9XPwIwfJIyxc/PfUrJGnwRhAqe4Q=; b=oQHxtkUY0Qm3Xb3SHftHuK5gauDFfPdRdtWYkGuETJQ/fGMqwEjVzi4YocTYX02uog ZGXOwqqdywHKpuAHnssxXGg7KIa6gIdy3E3mIp4sZhRquFpSseAeyvPD3QPOEMcsOr2i e68EuSJJpN8dv+jK7SZiDngaOdPBbo8+FLHxppe6EdvNmTylCU7dbObpcjRZ0JyrLVJr Shsck4WDBSxOY8GWyoq+WLHV2+5M0/u1pgHh9FfxCLQlYB8xxsNn5F97KyXXTrFr74v7 4oHZsWEXpK1u8pgXyxEa3k/L9rKuAHH4JLA8xs1OE48DMq8bPCFQQl739bkvHNgtCtQC EIeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references :message-id:date:mime-version; bh=xpYYC3yXmezkBvx9XPwIwfJIyxc/PfUrJGnwRhAqe4Q=; b=6bfZqB+VPbRCoUQobVIbA/AdmO3I7Cx1dLDGdgFJff0hTcBaCQ4W2DaDiZjSoOy0+W iPMVSA976/8iwMlSFbAFuoFTtGWQxbFCssPG0lRkkhFbboWEy7ml5shPk/Hv2/3SC3T7 zkF+EuZgTiJojkG0yUqkgBlQjiPcCCWJrIaL1G/0KztYtFwEt7yhxZ9jEz3NIYN/UggE hY20brBArrTtG/U4i0ahLQs6odtWyAyxz/EwFKBK+JdR7lq0DmKFfCp/Ncm7lKfgDfRQ KeByl2HjCi6dfxZ4JjL2CTJ24pv5N0fu5W1peGBOnVOi30N4kmhCk4CkKgrgBmdeOlbW mdBg== X-Gm-Message-State: AOAM532kZo/Dc2FYxYb62RGVW/SbFMHpgnTVnzIict/QMaIhb+GLFgEN lViWXih0kbsPWYYAa9Pz2WJ2TBUDoinDSw== X-Google-Smtp-Source: ABdhPJyxD5uubmKNiKTfNs2Sn/eJ0t4p2ANKmOstXNOhEjKFW6un7V6Y7/adVk5sx946oHlqoHJHkg== X-Received: by 2002:a17:90b:255:b0:1cf:39e7:a7aa with SMTP id fz21-20020a17090b025500b001cf39e7a7aamr4454716pjb.137.1650461033091; Wed, 20 Apr 2022 06:23:53 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id o23-20020a17090a5b1700b001d29a8f0e3asm9227361pji.48.2022.04.20.06.23.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 06:23:52 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH v2 06/38] org-macs: New function org-find-text-property-region--- In-Reply-To: References: Message-Id: Date: Wed, 20 Apr 2022 21:24:45 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1033.google.com 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, 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, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650461658; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=BOwaufgpKYmNALVGS63mSSXcUpN2whRKmNRUUh/FJIU=; b=aBDIXphze5T+3T5M4CUSFd3SDMeKQMoIfPzVSX+Mbq+pSp7QdE9V5sKOYBY0qC0T7BT3YY jSyVt9QlLCDi5T0UOScl1KQZZnQuQNfzCB39BQBcsl0OCXTORpr/RSLyIG7ZZctBMLyyYX 30NaGgPSuZXMltl3mtRG2nks/cn1qJm8i5U4+exII6/Io9KEmApHya9LKspLqM6f0LcjfO Xs9riPBHfQW9o3wBSbWmW8nId99lTLBzamVRa7KCkqaOX03nq0PQAD/XTFsO8+p4DpzQNq tVv/nZ0pFUpcAM39c3hTL7ctnAqCiHVvxf9vUtwlMRtFwxm6SFVlMi2LwNnTAA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650461658; a=rsa-sha256; cv=none; b=k1IHgDKoS9FQK5HH/gDn98MR3WT6W0BZOddXd3CrzUIlPrLlJIqXymvDub5Xxby7o5lUp1 1ObugE577n3E0GDpVmqCBqXZU4CqMUQQFl+V3mmlENO/Q9pQhDznhd0KSYCHh8A6lK20tJ mlg7xir9XN4I8aeM53Xa2s01r1H1MIHvZKvUkpKQte6Hv/dTmKNj2oII8JH0BGarc/a+G4 NXPQqDZ3ns6rIitAWpcuXp8QzMomAnaKJwuPCFeT1jJdkdhSEYOfV53000foNOrm/B0JVT joYfu+wRiEVQnRbtl4yZPyeEz7pAfMlN9CRN5mlDql/aOAHq573AhhjiinE4ug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=oQHxtkUY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 7.16 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=oQHxtkUY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 470A62AAC3 X-Spam-Score: 7.16 X-Migadu-Scanner: scn1.migadu.com X-TUID: yrUdIoYI/seh --- lisp/org-macs.el | 32 +++++++++++++++++--------------- lisp/org.el | 7 ++++++- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index a09115e7c..6161a7bfc 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -728,7 +728,7 @@ (defsubst org-current-line (&optional pos) -;;; Overlays +;;; Overlays and text properties (defun org-overlay-display (ovl text &optional face evap) "Make overlay OVL display TEXT with face FACE." @@ -751,20 +751,22 @@ (defun org-find-overlays (prop &optional pos delete) (delete (delete-overlay ov)) (t (push ov found)))))) -(defun org-flag-region (from to flag spec) - "Hide or show lines from FROM to TO, according to FLAG. -SPEC is the invisibility spec, as a symbol." - (remove-overlays from to 'invisible spec) - ;; Use `front-advance' since text right before to the beginning of - ;; the overlay belongs to the visible line than to the contents. - (when flag - (let ((o (make-overlay from to nil 'front-advance))) - (overlay-put o 'evaporate t) - (overlay-put o 'invisible spec) - (overlay-put o - 'isearch-open-invisible - (lambda (&rest _) (org-show-context 'isearch)))))) - +(defun org-find-text-property-region (pos prop) + "Find a region around POS containing same non-nil value of PROP text property. +Return nil when PROP is not set at POS." + (let* ((beg (and (get-text-property pos prop) pos)) + (end beg)) + (when beg + (unless (or (equal beg (point-min)) + (not (eq (get-text-property beg prop) + (get-text-property (1- beg) prop)))) + (setq beg (previous-single-property-change pos prop nil (point-min)))) + (unless (or (equal end (point-max)) + ;; (not (eq (get-text-property end prop) + ;; (get-text-property (1+ end) prop))) + ) + (setq end (next-single-property-change pos prop nil (point-max)))) + (cons beg end)))) ;;; Regexp matching diff --git a/lisp/org.el b/lisp/org.el index 855f0813d..b9d2d7834 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5597,7 +5597,10 @@ (defun org-fontify-like-in-org-mode (s &optional odd-levels) (let ((org-odd-levels-only odd-levels)) (org-mode) (org-font-lock-ensure) - (buffer-string)))) + (if org-link-descriptive + (org-link-display-format + (buffer-string)) + (buffer-string))))) (defun org-get-level-face (n) "Get the right face for match N in font-lock matching of headlines." @@ -5727,6 +5730,8 @@ (defun org-raise-scripts (limit) (if (equal (char-after (match-beginning 2)) ?^) (nth (if table-p 3 1) org-script-display) (nth (if table-p 2 0) org-script-display))) + (put-text-property (match-beginning 2) (match-end 3) + 'org-emphasis t) (add-text-properties (match-beginning 2) (match-end 2) (list 'invisible t)) (when (and (eq (char-after (match-beginning 3)) ?{) -- 2.35.1 -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg