From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rodrigo Morales Newsgroups: gmane.emacs.help Subject: [Q] How to make text invisible without modifying the buffer? Date: Fri, 13 Aug 2021 18:39:57 -0500 Message-ID: <87bl606hiq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33572"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 14 01:42:52 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1mEgp9-0008dD-6E for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 14 Aug 2021 01:42:51 +0200 Original-Received: from localhost ([::1]:52498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEgp7-00074r-Qi for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 19:42:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEgnK-0006Ii-UF for help-gnu-emacs@gnu.org; Fri, 13 Aug 2021 19:41:00 -0400 Original-Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:39515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEgnI-0001cd-UE for help-gnu-emacs@gnu.org; Fri, 13 Aug 2021 19:40:58 -0400 Original-Received: by mail-pl1-x633.google.com with SMTP id l11so14028159plk.6 for ; Fri, 13 Aug 2021 16:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=GreOXLSO21IeosnZTegMKGKxbiBmr+hwFwvAzotL3SY=; b=BAoSX3PJlsP9kz0wUa0UuV9TtJTyNIWvrgP64VmKSz19I0qcjIETvA070jJnQv2M4e nxbBi/YeEpjnic5W50obki9DUJU8LwWluFeZ0qAdcUHuiXvQGscxVSNV4zvvzls0gyN5 AKZ85Pj6How9d0KiBFepiZJ2LXC92QYevdYBVpYozOeVzA/CTuOZZBIXEzA0PMr/9NS1 k3rdJ7FXgsQ7N1AdvYTgaOPldp6R68zWwWT74o09HFMg0zYHdwDm4hxHtfJqEjSwydcq /ohwwvWiq1ZIwF88uxeBSRucERmbA/SYOvp1JWFUr9SYgexHrWjK1ViPoxxK2SILpgwB 7r9Q== 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:date:message-id:mime-version; bh=GreOXLSO21IeosnZTegMKGKxbiBmr+hwFwvAzotL3SY=; b=X3TbnUEOC04bF3r6hf61slJgz/i4YfoyTCy7wnC/TlSArpsKa+HsTfdoLlIJkCDiE1 7bE1qG/7VECEQQsahzj7hUSsjpnQRPVxktFJrVTI5SYpHOwiWWMA9hgzdpbLl4Nxeeb6 0gi+yIr4UgF/Er/XSHNf8zZUcI5Eyk/bshTsU7kR/Y4nNYbDq+aakMvAg5KEAFB9jv1V bZ1DfYi8ZS+jTGW7nnQPt3f0Us2yE6SIGSQC5M51WzNNZ0sJJRWgSnCYc0tKFeoFXugQ k0mgROBEPQfcMnGjg6xpVMvW2gegH+csOnNcDsONvI0L3I7QLJT9MDHvOIqnHj74Bk5e gZ1Q== X-Gm-Message-State: AOAM533wydY3gm9pEkIDgZa/aD2CNxFdP9JB6wk6vRh5t9GpfZOTdk8c rZKehDKSu0xzpWnApm8XeMfNkCLmxjObHg== X-Google-Smtp-Source: ABdhPJyBbS30/9jmLMOFPYdUwci3tYaZZtsr/lv3Dh+1FcfEw91ZZ+2xMW/TDdmmZzf9bCmE/UQUUw== X-Received: by 2002:a63:134e:: with SMTP id 14mr4418420pgt.312.1628898055044; Fri, 13 Aug 2021 16:40:55 -0700 (PDT) Original-Received: from r1 ([190.239.232.245]) by smtp.gmail.com with ESMTPSA id v10sm3445224pfu.100.2021.08.13.16.40.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 16:40:54 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 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, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132512 Archived-At: * Epilogue I'm writing a mode for reading logs from the weechat IRC client. Here's an example of a log file from weechat. #+BEGIN_EXAMPLE 00:04:20 <-- user8 has quit (Quit: leaving) 00:05:06 user1 foo 00:05:29 --> user4 has joined #foo 00:06:11 <-- user5 has quit (Quit: Client closed) 00:06:24 <-- user6 has quit 00:06:28 --> user7 has joined #foo 00:06:31 user2 bar 00:07:05 user3 fizz #+END_EXAMPLE Note that a tab character is used as the delimiter for timestamps, user names and the actual message. I would like to hide those lines that present information of a user logging in or logging out. That is, those lines that matches the following regular expression (the regex has been enclosed in double quotes have been used to indicate that the last character is a tab character) #+BEGIN_EXAMPLE "^[0-9]{2}:[0-9]{2}:[0-9]{2} (-->|<--) " #+END_EXAMPLE * The question To begin writing this mode, I was wondering: How to make a line invisible? and came up with the following expression which accomplishes that #+BEGIN_SRC elisp (put-text-property (point-at-bol) (+ (point-at-eol) 1) 'invisible t) #+END_SRC The problem with this expression is the fact that it modifies the current buffer and I don't want this to happen, so my question is: How to make a line invisible without making the buffer to think that a modification has been performed?