From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: search-invisible and friends Date: Fri, 11 Sep 2020 09:03:11 +0800 Message-ID: <87sgbpi0q8.fsf@localhost> References: <87zh5z9l9y.fsf@gnus.org> <838sdjko39.fsf@gnu.org> <871rj9957z.fsf@gnus.org> <83a6xxk8nj.fsf@gnu.org> <87d02tbits.fsf@mail.linkov.net> <87v9gli8qc.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10082"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org, Lars Ingebrigtsen , Juri Linkov To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 11 03:04:54 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kGXUk-0002XJ-FY for ged-emacs-devel@m.gmane-mx.org; Fri, 11 Sep 2020 03:04:54 +0200 Original-Received: from localhost ([::1]:40736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGXUj-0007mz-Hy for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Sep 2020 21:04:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGXU6-0007Mn-Lg for emacs-devel@gnu.org; Thu, 10 Sep 2020 21:04:14 -0400 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:37214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGXU4-0006TU-N7; Thu, 10 Sep 2020 21:04:14 -0400 Original-Received: by mail-pj1-x102d.google.com with SMTP id kk9so884488pjb.2; Thu, 10 Sep 2020 18:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=ciKLbxli0SED+vHX789jsQsFD745vlhSy6GSGamIjyI=; b=C/tkW1ogYTH5oOAU3gmLHauBxx4UmDkFukey0PBV3RrPl5PupucqGgGmuyPF9iRFDH OVHUYfxZvSgnEV5wYvi7xeytPlc4b52I8Jk2Kxn4ejLXchH8GMXLGWiCPHH9bqPcghL4 sAUc03GZ1qWO4UITXZO3tFSVWcQHy5sToSh/w9D9M0yCQOqxZjqOuULETBmP/Z0mpWkj voGd7Pp55qFu3pncSfy69GGXSw5gnuMdCB8bzNHOPT5HhAuhO5+9zYjrfTBL9pjhnZKZ nHPSrgzvtqT195peiILQgpB1C1hZMMTr5Bp4YfbPxwawy8AT363PN8R3oaXwTbUoJSM9 H6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=ciKLbxli0SED+vHX789jsQsFD745vlhSy6GSGamIjyI=; b=RQvHli9nn7TgJghdqVhxNK97n5HQY+gO7Z159IAmj6cVX74MLv0UywYcCXYHQOq6YY 6kZ6kpOBOwHx/gRcbKnof0VVCYCj1AZwBn+v/v3zPm6km3iCLEyEsbB9e9yn+2cXn4zQ mSe13ZKyGG/ksHfCn2kYzO3rK5b3pgD9ZI35/1lCzCekkBXXpIqZHa1+9cYVlwR+X1Kc RWI1D1BmtMPyyPs94kdcuYGLpibyLnNQacggoDd6m0L+a2KtrPw0sDhnUPCjyVLtQkAr D8JxbbocKGzjc+aJH0TIvTsJ1D4VfrBVozunZSoXOVGB5iP5fbYFSKIS6m2Y7P2JKlfq TO/g== X-Gm-Message-State: AOAM530IgdcGyov0kBVOz3j2iowyEJVCDocatrzWfgRjFkQCr8jTPDMW sFfHfJXZQnRsUPMtIW3awTo= X-Google-Smtp-Source: ABdhPJzTG/+UkbHc7+crkERhzWQRFYT4n4FWV1lyiUwpaQHo+l/KiAyZcUqgkMzaOQP8DoHC4gs5Fg== X-Received: by 2002:a17:90a:62c4:: with SMTP id k4mr2478081pjs.174.1599786250742; Thu, 10 Sep 2020 18:04:10 -0700 (PDT) Original-Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id j2sm188883pga.12.2020.09.10.18.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 18:04:09 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:255067 Archived-At: > Note that what I'm suggesting is somewhat orthogonal since it's about > making it possible for a text (or overlay) property to say not to skip > over a particular (hidden) chunk of text, regardless of whether (and > how) we'd open the text to show it or not. Isn't 'isearch-open-invisible property doing it already? If it is non-nil, the hidden text is not skipped by isearch. ----- Also, adding on the initial topic of skipping some technically not invisible text. Similar functionality is required by org-mode branch I am working on - some folded (temporarily hidden) may better not be searchable. I implemented it by defining custom `isearch-filter-predicate'. The code I used is below. For context, org-fold--isearch-specs lists 'invisible property values that should be searchable. org-fold-get-folding-specs-in-region retrieves all 'invisible property values in region. The code decides if isearch can search in region depending on the value of 'invisible property, but it can generally be any property. (defun org-fold--isearch-filter-predicate-text-properties (beg end) "Make sure that text hidden by any means other than `org-fold--isearch-specs' is not searchable. This function is intended to be used as `isearch-filter-predicate'." (and ;; Check folding specs that cannot be searched (seq-every-p (lambda (spec) (member spec org-fold--isearch-specs)) (org-fold-get-folding-specs-in-region beg end)) ;; Check 'invisible properties that are not folding specs (or (eq search-invisible t) ; User wants to search, allow it (let ((pos beg) unknown-invisible-property) (while (and (< pos end) (not unknown-invisible-property)) (when (and (get-text-property pos 'invisible) (not (member (get-text-property pos 'invisible) org-fold--isearch-specs))) (setq unknown-invisible-property t)) (setq pos (next-single-char-property-change pos 'invisible))) (not unknown-invisible-property))) (or (and (eq search-invisible t) ;; FIXME: this opens regions permanenly for now. ;; I also tried to force search-invisible 'open-all around ;; `isearch-range-invisible', but that somehow causes ;; infinite loop in `isearch-lazy-highlight'. (prog1 t ;; We still need to reveal the folded location (org-fold--isearch-show-temporary (cons beg end) nil))) (not (isearch-range-invisible beg end))))) Best, Ihor Stefan Monnier writes: >>>> Do you mean to match text in the display replacement, >>> No, I mean to ignore `search-invisible` on those specific chunks (but >>> still only do the search on the buffer text). >> FYI, I proposed similar patch earlier: >> https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00679.html > > OMG, yes, it's still in my TODO. > > Note that what I'm suggesting is somewhat orthogonal since it's about > making it possible for a text (or overlay) property to say not to skip > over a particular (hidden) chunk of text, regardless of whether (and > how) we'd open the text to show it or not. > > > Stefan