From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yLrWHgIp9WFkbwEAgWs5BA (envelope-from ) for ; Sat, 29 Jan 2022 12:46:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UFx+GwIp9WFRaQAAauVa8A (envelope-from ) for ; Sat, 29 Jan 2022 12:46:10 +0100 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 D2A0E1357F for ; Sat, 29 Jan 2022 12:46:09 +0100 (CET) Received: from localhost ([::1]:48836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDmBE-0003iT-U6 for larch@yhetil.org; Sat, 29 Jan 2022 06:46:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDm0Y-00027L-3P for emacs-orgmode@gnu.org; Sat, 29 Jan 2022 06:35:06 -0500 Received: from [2607:f8b0:4864:20::429] (port=34352 helo=mail-pf1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDm0W-0000DO-Cl; Sat, 29 Jan 2022 06:35:05 -0500 Received: by mail-pf1-x429.google.com with SMTP id v74so8561265pfc.1; Sat, 29 Jan 2022 03:35:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RM7OkZpvCj4on4QG71Ufab+KyMlvq7Lj2cRbwfgfKJQ=; b=bWVpTmrNglJf3sfJMwzaum1gz6Y+IfbgYHGXcMoRlnocvIXIEOV8CAWt4d9N1W9WS6 +339UG3vAZfYqBWLv23WQjNQ5Tce48JSidGLNSDLXomOz7K+HjEHXIjkp/NVRiIJgwQf YhPGYSj+If26LS1MzZClnCbDDNXy3Ax+NM/bmHiLKRNf8w+nGPiYnxmhdU3WMCuTbzjK A1boKxH/JeLS88ODOSHrMrg/CrlgMd1Mk3VVeAdhwaG2/tvyAOL4gfUdcCKiQtz0dhVR hWa90/hShxFxw0ZL/oh1F8byKDqAJdveYQte0iX8EqwFEFiYB6Hbn6wgeezCcGIKGmfY hxIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RM7OkZpvCj4on4QG71Ufab+KyMlvq7Lj2cRbwfgfKJQ=; b=Ktr4K4QC0W/E7Aa/pOm/5qh8wMJqZ90YG3HvogcQnbsCDLRs96/IazKgJepmjlbz/I lkrOsOliEAV9DXctRherRE7ASot8RAseETiPv0SidHztqtKbU1lPF4cbUGAFo5KBaHcJ yq99D5vKolGMIdTxOFhL8V2OV/uqzWB8d5ux0W2kFuCYI+s9QoA2yDt4rZclCg2Yq0Nj WbXCaOeNcW5y4YPX1DTHwgaqNeA8cdtrDRh0jK/riXvKkcOmZlQZwtN31NebHAWGC5Ek Dns5BSMIPFU1EtWkarp828AQXmZM/iLyLmFbFeUQx1Vl62BD9851c3TzjkorYMTNzaZC kH9A== X-Gm-Message-State: AOAM530SFlm4HGXhEbhmUz6WbZvnc5UY6ozM5xyd+4gaTbEd9bCUjTqy WBavQG7MVNH8X27RQwYcEd4VkOC0LqSzpJp6 X-Google-Smtp-Source: ABdhPJweqZsNW+CxXh1B4Fwaoz8zVfo4lP04gKrBoedmrYeevF+0mPdCYwt30H3th+K4Oo9uV2aC4g== X-Received: by 2002:a05:6a00:a10:: with SMTP id p16mr65439pfh.44.1643456102582; Sat, 29 Jan 2022 03:35:02 -0800 (PST) Received: from localhost ([209.95.60.92]) by smtp.gmail.com with ESMTPSA id p1sm2758402pfh.98.2022.01.29.03.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 03:35:01 -0800 (PST) From: Ihor Radchenko To: Bastien , Kyle Meyer , Nicolas Goaziou , Karl Voit , Christian Heinrich , emacs-orgmode@gnu.org Subject: [PATCH 06/35] org-macs: New function org-find-text-property-region Date: Sat, 29 Jan 2022 19:37:58 +0800 Message-Id: <40241d655ac6fb95f396a872572fda1a83947613.1643454546.git.yantar92@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: <87y2cvloay.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.34.1" Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::429 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=yantar92@gmail.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: Ihor Radchenko 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=1643456769; 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=SgZKPpawooJ/1QpBjN1KZIZ+/dercvF4rsPwRxoCV3Q=; b=IMRtu78sGDidsd0YVnC3AMtkmSzCUDslZ2ksZd76MY7Mmj2ToR1ol2m/MzNfVTUADvPXfM UEUTQgXIp3RmKLw1itKZxq0Jtt+npv9/QI+Lfu1XFfPpuFmM6w7V2QzNilbcbLS76IHNeS PGsN2YBN1kKHrtDCzSBVPabTUTEj0gZteR/O5tu1EkOMZ0YMt9yT2fIVaarjGBN1DVfqeJ za/tofYpHGr3nwWgVkuWfKMBpGTU3K2Xmi22jSUFSFFauYURogJ+nS/b4GBmir1sK2Ubz6 qA1u2YstSEeqaYTX3ZUYNxlZ5k50wXJoSF/ME1AaB+WQGOwNM7Mb8azDT/GiMg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643456769; a=rsa-sha256; cv=none; b=ay0TCjPPUmgMYIQUALxvls9hWbYK+srxdTmJNs2iAy00hlPuUZeZ2IwICmEthCSyXLrIzM BroQUxVQlu+3AIur2wwx8w3kPJXsl1b0yjcS2QiBmz5v+BemxUNMMkLfAGacx9LBoQQEZc Q3Nx4G1H1FRrLkVIV9e8s0q7cUVrr8TdJsXwwj7kAuRIESphkRmz3wB1unxxukGPUvIOnx 8LGUSNxwwqW4XPxY9UzCyoTWbSQSz9SMedBknpN7Ls/H0YjSipCnxwGUvG4XW2SNyU78aZ ykjrmVvGMblVbGWd9hs1jcupBVLF411yLNLHDR6QfM+5wH5TO1nsUQOZMWOFoQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=bWVpTmrN; 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: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=bWVpTmrN; 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: D2A0E1357F X-Spam-Score: -1.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: hc6CKPTOK/HG This is a multi-part message in MIME format. --------------2.34.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- lisp/org-macs.el | 32 +++++++++++++++++--------------- lisp/org.el | 7 ++++++- 2 files changed, 23 insertions(+), 16 deletions(-) --------------2.34.1 Content-Type: text/x-patch; name="0006-org-macs-New-function-org-find-text-property-region.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0006-org-macs-New-function-org-find-text-property-region.patch" diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 3c902b603..d5d4c205d 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -722,7 +722,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." @@ -745,20 +745,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 d279edae4..f59d2cfb0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5596,7 +5596,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." @@ -5726,6 +5729,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.34.1--