From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#6000: describe-text-sexp does not know window-width Date: Sun, 6 Jun 2021 09:42:22 +0200 Message-ID: References: <87simkaazt.fsf@mail.jurta.org> <87o8cn71us.fsf@gnus.org> <87h7ie3isy.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3887"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lennart Borgman , 6000@debbugs.gnu.org To: Juri Linkov , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 06 09:43:15 2021 Return-path: Envelope-to: geb-bug-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 1lpnRC-0000tm-M3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 09:43:14 +0200 Original-Received: from localhost ([::1]:53598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpnRB-0005ij-Mx for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 03:43:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpnR0-0005h3-AB for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 03:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpnR0-0002Wu-4A for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 03:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpnQz-00014e-UD for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 03:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 07:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 6000-submit@debbugs.gnu.org id=B6000.16229653564097 (code B ref 6000); Sun, 06 Jun 2021 07:43:01 +0000 Original-Received: (at 6000) by debbugs.gnu.org; 6 Jun 2021 07:42:36 +0000 Original-Received: from localhost ([127.0.0.1]:50534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpnQZ-000141-Vb for submit@debbugs.gnu.org; Sun, 06 Jun 2021 03:42:36 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:46619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpnQY-00013n-8u for 6000@debbugs.gnu.org; Sun, 06 Jun 2021 03:42:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622965347; bh=YKystbV4YV50b+tFxC1CrAfm16UYVnQ6vGsWpWTrW6g=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=XKnq43BFY5jpEvIQiHJd++Wy7Jk6ECHIxAgKhngfYrqyzzLvPyNPgy/o+fRzRIxv3 DGfDuT2oVOtQecHkvuj07TU+vKDUHD5MYOweDhWQbLD2mYsGqSqBolCz24fc07rLyC 7KMdQ6/2Z86nsswA9Q6hvjeWnO8Xj61bJ0RGGYps= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([46.125.249.84]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MvsJ5-1lXzSW02Rr-00stt5; Sun, 06 Jun 2021 09:42:27 +0200 In-Reply-To: <87h7ie3isy.fsf@mail.linkov.net> Content-Language: en-US X-Provags-ID: V03:K1:CeCsw/A+pjZc0L921pvmHkvLlIEMicZMDRquiA3l4Qj1YSbXJyC 3Eo2V5OMxGAFtiYVPK8NPWXxadf9ThD0ilPzcj8RELDH1N3mTN2pNw/eHuYSLw+4D90QPF+ QLUeRVRpkVu7qgvUc6V0tHxSzRULxFoeu2uIk29NRXBLDKDnSG6ZhsNdOFe/xOSBF5AAyU7 JAEybZNER0US16XcpOsCg== X-UI-Out-Filterresults: notjunk:1;V03:K0:rSWOPMdWejc=:pYLB1kqcIoCvcmydS3qavC jbfdVx++xqqJMsrExXDvGmmXOybMyDXhz3B2+67XiQ6qygGEMWiOtGC0h2PjtGOf7juG97yOQ 6bFUB6/EgFAZhYUBJ2KPUdUAnBirhK5O184ZF7RbaFDSh9jy6QmlrXqURWVVoPzMu7ycA44ZL Et0YgjNhVzBSzV1OXatpCmsTxN2myj+X4VdjjkgCDUlht9ejK6K2Fgk8OPzIvwdaOSLS5bwgm 9/nbdcat8CQ8OAnaxXQ8Bi/Rk+wQVpdMDC6zVfEorjpQys1iwajRb9cCHybJhJPl283WiXnoC LPjFuTiTF9bF/Zd1Plhi4suq9hcTlC/G6NGCqd01/qkyF2KO+6i+QQetp6HHBV0DBeRmHOjBf Gc5dwvDqmeRY/4kkU4xYOyLISVtFQ/d52H007Irop1ao7ipZdlEghnVSMwAv673LDoHpEupZQ T90wkRStQMbIyxKBzmXLEESyPVcR3xLI5dUflcYICupMpbxZR6k5O4mZM78P8S3V+esU7EPmp 0PT2S5ygF6sFvkmSHPuLQjb+/jwSggRf8ydgwSaso9hUtsIUYSLLuZlhEqDq+1oxQYnARl8UT jfqe7NWDB+ntfCh2TkOqgO+5y29mmniiuEuwnxP/gHyqTJpRyuOs+HDKu3MIV/19tbtSPrw8S VeyCX9c2Cnwc81FBNd89egB9C/mDgVwEQfd+9eS96jMdwe2TlqxpMrYlNPlNlLsRwA70jCC5n 4XRCtt0cweKzoPo+5JWMkzk8WlM5ZozAmENwgYbYD3SBbJGNd6DUBT8h9JdogV1r5DpsxcKw X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208090 Archived-At: >> Does anybody have a test case that displays the problem (in case it's >> still in place after all these years)? > > Indeed a test case would be needed, but I have none. With emacs -Q evaluate (progn (split-window nil -20 t) (put-text-property 1 2 'foo "This is a very long text property") (describe-char 1)) or (progn (setq split-height-threshold nil) (setq split-width-threshold 20) (put-text-property 1 2 'foo "This is a very long text property") (describe-char 1)) Here these show a *Help* window on the right where not the entire text property string is visible. Depending on your settings it won't matter much because the rest of that buffer is only partially visible too. To show the inverse effect, again with emacs -Q, evaluate (progn (split-window nil 20 t) (put-text-property 1 2 'foo t) (describe-char 1)) Here this shows *Help* in the window on the right with a line foo [Show] where clicking on [Show] will show "t" in the window on the left. This is embarrassingly silly. Obviously, there are many more scenarios but most of them require to customize `display-buffer-alist'. Presumably, most people don't notice the behavior - they just got used to it. We could - Do nothing: If, in the earlier scenarios, we'd insert a "Show" button instead of the text, clicking that button might again pop up a too narrow *Pp Eval Output* window and nothing has been gained. As for the last scenario, we could tell users that they are on their own when they invoke `describe-char' in a too narrow window. - Skip the `window-width' check in `describe-text-sexp' and maybe recommend using `temp-buffer-resize-mode' with a few tweaks like (progn (temp-buffer-resize-mode) (setq temp-buffer-max-width 100) (setq fit-window-to-buffer-horizontally t) (setq split-height-threshold nil) (setq split-width-threshold 20) (put-text-property 1 2 'foo "This is a very long text property") (describe-char 1)) But some people don't like `temp-buffer-resize-mode'. - Calculate the maximum width of text in the buffer preceding the line where to insert the property with a function like (defun max-column-in-frame () "Return maximum column of current buffer in selected frame. The return value is the longest column from the beginning of the buffer to the line specified by the selected frame's height." (save-excursion (goto-char (point-min)) (let ((width (frame-width)) (height (frame-height)) (line 0) (max-column 0) column) (while (and (< line height) (< (point) (point-max))) (setq column (move-to-column width)) (when (> column max-column) (setq max-column column)) (forward-line 1) (setq line (1+ line))) max-column))) and use that instead of `window-width' in `describe-text-sexp' as (<= (length pp) (- (max-column-in-frame) (current-column)))) This will delegate the problem to those who inserted text earlier into that buffer. If they were right, `describe-text-sexp' won't do anything wrong. martin