unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39901: Emacs needs to update window-width when the user updates the text size
       [not found] ` <b4msgip14kb.fsf@jpl.org>
@ 2020-03-04 14:19   ` 積丹尼 Dan Jacobson
  2020-03-04 14:38     ` Drew Adams
  2020-08-05 12:04     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-03-04 14:19 UTC (permalink / raw)
  To: 39901; +Cc: 953033, Katsumi Yamaoka

Emacs needs to update window-width when the user updates the text size.

>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> On Tue, 03 Mar 2020 23:51:58 +0800, 積丹尼さん wrote:
>> Package: w3m-el-snapshot
>> X-Debbugs-Cc: yamaoka@jpl.org
>> Version: 1.4.632+0.20191218.2243.cef0c7e-1

>> $ emacs -q -f w3m
>> C-x C-= [text-scale-adjust]
>> C-= [anonymous-command]

>> Here the lines get cut off.
>> They should fold, staying on the screen as the text zooms.

KY> In that case the window width, i.e., the return value of
KY> (window-width) is unchanged, so we have no clue for the point
KY> where to fold text lines.  We have no solution for it, I think.






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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-03-04 14:19   ` bug#39901: Emacs needs to update window-width when the user updates the text size 積丹尼 Dan Jacobson
@ 2020-03-04 14:38     ` Drew Adams
  2020-03-04 23:00       ` Katsumi Yamaoka
  2020-08-05 12:04     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2020-03-04 14:38 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson, 39901; +Cc: 953033, Katsumi Yamaoka

> Emacs needs to update window-width when
> the user updates the text size.

Apologies for not following this thread,
and if this reply is off-topic.  I stumbled
on this message by chance.

FWIW, letting users automatically resize
the window to accommodate a change in
text scale is the purpose of library
`face-remap+.el'.  This enhancement was
proposed to Emacs dev from the outset
(2009), but there was no interest.

`face-remap+.el' lets buffer font
resizing also zoom the window size
accordingly (horizontally, vertically,
or both).  That way, you can take
advantage of the space freed up by
resizing (text-scaling) to a smaller
font.

The code has just a small change to
`text-scale-increase'.

https://www.emacswiki.org/emacs/download/face-remap%2b.el

Option `text-scale-resize-window'
lets you control the behavior:

nil:            Don't resize window
`horizontally': Resize window only horizontally
`vertically':   Resize window only vertically
t:              Resize window both directions

[If the window is alone in its frame, and if
you also use library `fit-frame.el', then the
frame is resized (horizontally & vertically).]





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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-03-04 14:38     ` Drew Adams
@ 2020-03-04 23:00       ` Katsumi Yamaoka
  2020-03-05  0:28         ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2020-03-04 23:00 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 953033, 39901

Thanks Drew.  Jidanni, try the following two advices if interest.
Probably this would be what you want `text-scale-adjust' to do.
The first one tweaks the `window-width' function so to return
a value based on the text scaling, and the second one makes the
`text-scale-adjust' function redisplay an emacs-w3m page.  It's
only a quick hack, so I don't want to imprement it in emacs-w3m.

(defadvice w3m-redisplay-this-page (around adjust-window-width activate)
  "Adjust window-width value according to `face-remapping-alist'."
  (current-buffer)
  (let ((height (ignore-errors
		  (cadr (assq :height
			      (assq 'default face-remapping-alist))))))
    (if height
	(let ((ofn (symbol-function 'window-width)))
	  (fset 'window-width (lambda (&rest args)
				(floor (/ (funcall ofn) height))))
	  (unwind-protect
	      ad-do-it
	    (fset 'window-width ofn)))
      ad-do-it)))

(defadvice text-scale-adjust (after redisplay-w3m-page activate)
  "Redisplay w3m page after scaling text."
  (when (eq major-mode 'w3m-mode)
    (let ((w3m-message-silent t))
      (w3m-redisplay-this-page))))





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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-03-04 23:00       ` Katsumi Yamaoka
@ 2020-03-05  0:28         ` 積丹尼 Dan Jacobson
  0 siblings, 0 replies; 7+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-03-05  0:28 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 953033, 39901

>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> It's only a quick hack, so I don't want to imprement it in emacs-w3m.

Thanks, but I just noticed it one day, and was just hoping it would get
fixed for everybody.





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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-03-04 14:19   ` bug#39901: Emacs needs to update window-width when the user updates the text size 積丹尼 Dan Jacobson
  2020-03-04 14:38     ` Drew Adams
@ 2020-08-05 12:04     ` Lars Ingebrigtsen
  2020-08-05 14:39       ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-05 12:04 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 953033, Katsumi Yamaoka, 39901

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

> Emacs needs to update window-width when the user updates the text size.

I think that makes sense.

Anybody got an opinion here?

I'm not sure how this would be implemented, though.  Where's the code
that computes the pixel width upon startup?  I guess that code would
have to be run again to compute the new width...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-08-05 12:04     ` Lars Ingebrigtsen
@ 2020-08-05 14:39       ` Eli Zaretskii
  2020-08-05 14:51         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-08-05 14:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 953033, yamaoka, jidanni, 39901

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 05 Aug 2020 14:04:59 +0200
> Cc: 953033@bugs.debian.org, Katsumi Yamaoka <yamaoka@jpl.org>,
>  39901@debbugs.gnu.org
> 
> 積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
> 
> > Emacs needs to update window-width when the user updates the text size.
> 
> I think that makes sense.
> 
> Anybody got an opinion here?

I do: there's no bug here -- window-width is documented to return a
value in terms of the frame's canonical character width (i.e. it uses
the dimensions of the frame's default font).  And that doesn't change
when you change the font only for a single buffer.

However, window-width can be asked to return the value in pixels, if
someone wants that, and then one can compute the width in units of any
other, larger or smaller, font.

IOW, if some applications produce unexpected or unpleasant effects
when the buffer text is resized, those applications need to be
sensitive to such resizing.  But changing the semantics of a veteran
API like suggested here is a non-starter, as it would definitely break
gobs of existing code.





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

* bug#39901: Emacs needs to update window-width when the user updates the text size
  2020-08-05 14:39       ` Eli Zaretskii
@ 2020-08-05 14:51         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-05 14:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 953033, yamaoka, jidanni, 39901

Eli Zaretskii <eliz@gnu.org> writes:

> I do: there's no bug here -- window-width is documented to return a
> value in terms of the frame's canonical character width (i.e. it uses
> the dimensions of the frame's default font).  And that doesn't change
> when you change the font only for a single buffer.
>
> However, window-width can be asked to return the value in pixels, if
> someone wants that, and then one can compute the width in units of any
> other, larger or smaller, font.
>
> IOW, if some applications produce unexpected or unpleasant effects
> when the buffer text is resized, those applications need to be
> sensitive to such resizing.  But changing the semantics of a veteran
> API like suggested here is a non-starter, as it would definitely break
> gobs of existing code.

Yeah, that's true.  I had completely forgotten that C-x C-+ only affects
the current buffer, so resizing the window on that command would be
nonsensical.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2020-08-05 14:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <878skhphb5.8.fsf@jidanni.org>
     [not found] ` <b4msgip14kb.fsf@jpl.org>
2020-03-04 14:19   ` bug#39901: Emacs needs to update window-width when the user updates the text size 積丹尼 Dan Jacobson
2020-03-04 14:38     ` Drew Adams
2020-03-04 23:00       ` Katsumi Yamaoka
2020-03-05  0:28         ` 積丹尼 Dan Jacobson
2020-08-05 12:04     ` Lars Ingebrigtsen
2020-08-05 14:39       ` Eli Zaretskii
2020-08-05 14:51         ` Lars Ingebrigtsen

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