unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [Q] How to make text invisible without modifying the buffer?
@ 2021-08-13 23:39 Rodrigo Morales
  2021-08-14  0:01 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-14  6:03 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Rodrigo Morales @ 2021-08-13 23:39 UTC (permalink / raw)
  To: help-gnu-emacs


* 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?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-14  6:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-13 23:39 [Q] How to make text invisible without modifying the buffer? Rodrigo Morales
2021-08-14  0:01 ` Emanuel Berg via Users list for the GNU Emacs text editor
     [not found]   ` <87im0824b4.fsf@gmail.com>
2021-08-14  3:29     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14  6:03 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).