unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@redhat.com>
To: 54406@debbugs.gnu.org
Subject: bug#54406: 28.0.91; rcirc text wrapping
Date: Tue, 15 Mar 2022 18:24:22 -0400	[thread overview]
Message-ID: <87h77yc0rt.fsf_-___8528.07644275657$1647383138$gmane$org@redhat.com> (raw)
In-Reply-To: <handler.54406.B.164737873611497.ack@debbugs.gnu.org> (GNU bug Tracking System's message of "Tue, 15 Mar 2022 21:13:01 +0000")


Aha, debugging printfs to the rescue. :-)

I made a little tweak to rcirc-print, and added some logging advice to
rcirc-markup-fill and rcirc-fill-paragraph, then just sat back and
waited for some #emacs traffic; this is the one that triggered:

            (save-restriction
              (narrow-to-region (point) (point))
              (insert (propertize (rcirc-format-response-string process sender response
                                                              nil text)
                                'rcirc-msgid (rcirc-get-tag "msgid"))
		      (propertize "\n" 'hard t))

              ;; squeeze spaces out of text before rcirc-text
              ;; ADDED MESSAGE CALL:
	      (message "rcirc-print(process=%S sender=%S response=%S target=%S text=%S activity=%S)\n\tfilling region: buffer=%S region=%S flag=%S"
		       process sender response target text activity
		       (current-buffer)
		       (buffer-substring (point-min) (point-max))
		       rcirc-fill-flag)
              (fill-region (point-min) (point-max))

rcirc-print(process=#<process irc.libera.chat> sender=#("userxy" 0 6 (font-lock-face (rcirc-other-nick))) response="PRIVMSG" target="#emacs" text="a bunch of text here" activity=t)
	filling region: buffer=#<buffer #emacs@irc.libera.chat> region=#("<userxy> a bunch of text here
" 0 1 (rcirc-msgid nil) 1 7 (font-lock-face (rcirc-other-nick) rcirc-msgid nil) 7 9 (rcirc-msgid nil) 9 96 (rcirc-text "a bunch of text here" rcirc-msgid nil) 96 97 (hard t)) flag=nil

(For privacy, I’ve replaced the sender name with a same-length dummy,
and replaced the message text, though mine is shorter so the text
properties probably don’t work out.)

The old version in 27.1 did:

 	    ;; squeeze spaces out of text before rcirc-text
	    (fill-region fill-start
			 (1- (or (next-single-property-change fill-start
							      'rcirc-text)
				 rcirc-prompt-end-marker)))

where fill-start is set to

  (marker-position rcirc-prompt-start-marker)

evaluated before inserting the new text.  The new version seems to be
filling the entire narrowed region containing the just-inserted text.

As an experiment, I’m trying

              (fill-region (point-min)
			   (1- (or (next-single-property-change (point-min)
								'rcirc-text)
				   (point-max))))

and it seems to do what I want so far, both for NAMES messages and user
messages.

The property change is also looked up by the goto-char immediately
following the fill-region, so perhaps they could be reversed and the new
position used as a boundary.

Though, it seems to be filling the part of the rcirc-response-formats
formatted string that comes before the message text, and it’s not clear
to me that unconditionally filling that is the right thing, if
rcirc-fill-flag is nil. *shrug* I’m not a terribly experienced IRC user,
maybe it is generally desired.

Ken

P.S. The indentation of the “when” blocks following the goto-char could
use cleaning up.






  parent reply	other threads:[~2022-03-15 22:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 21:11 bug#54406: 28.0.91; rcirc text wrapping Ken Raeburn
     [not found] ` <handler.54406.B.164737873611497.ack@debbugs.gnu.org>
2022-03-15 22:24   ` Ken Raeburn [this message]
     [not found]   ` <87h77yc0rt.fsf_-_@redhat.com>
2022-03-17 11:03     ` Lars Ingebrigtsen
2022-03-17 11:33       ` Philip Kaludercic
2022-11-04 22:52         ` Philip Kaludercic
2023-04-30 10:54           ` Philip Kaludercic
2023-09-14  0:38             ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='87h77yc0rt.fsf_-___8528.07644275657$1647383138$gmane$org@redhat.com' \
    --to=raeburn@redhat.com \
    --cc=54406@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).