unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8379: The width of linum window is not adjusted after face-remapping
@ 2011-03-30  1:43 nixie
  2011-03-30  2:18 ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
  2011-03-30 10:39 ` bug#8379: The width of linum window is not adjusted after face-remapping Juanma Barranquero
  0 siblings, 2 replies; 10+ messages in thread
From: nixie @ 2011-03-30  1:43 UTC (permalink / raw)
  To: 8379

Hi,

I am green hand in emacs, and starting using GNU Emacs since 23.1.

I found that the width of linum window is not changed with
(text-scale-increase) or (text-scale-decrease) function. 
This is annoying especially when I increase the text size, because the
line number can not be fully viewed.

currently, I use some alleviating code like below to solve this problem.
But I think it does not have generality.

Does someone have any good suggestion on it? Or it can be solved in a
more elegant and general way. I wish that it would be solved in future
version of GNU Emacs.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun rescale-window-margin-by-faceremapping (win)
  (let ((width (car (window-margins)))
	(scale (cadr (assoc ':height 
			    (assoc 'default 
				   face-remapping-alist)))))
    (if (numberp scale)
	(progn
	  (set-window-margins win (ceiling (* width scale)) (cdr
(window-margins win)))
	  (force-window-update))
      nil)))

(defadvice linum-update-window (after scaling-margin-width last (win)
activate)
  (rescale-window-margin-by-faceremapping win)
  ad-return-value)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thanks for any help.


-- 
nixie <onixie@gmail.com>






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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-30  1:43 bug#8379: The width of linum window is not adjusted after face-remapping nixie
@ 2011-03-30  2:18 ` Drew Adams
  2011-03-30 10:39 ` bug#8379: The width of linum window is not adjusted after face-remapping Juanma Barranquero
  1 sibling, 0 replies; 10+ messages in thread
From: Drew Adams @ 2011-03-30  2:18 UTC (permalink / raw)
  To: 'nixie', 8379

> I found that the width of linum window is not changed with
> (text-scale-increase) or (text-scale-decrease) function. 
> This is annoying especially when I increase the text size, because the
> line number can not be fully viewed.

Yes, indeed.
http://www.emacswiki.org/emacs/face-remap%2b.el






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

* bug#8379: The width of linum window is not adjusted after face-remapping
  2011-03-30  1:43 bug#8379: The width of linum window is not adjusted after face-remapping nixie
  2011-03-30  2:18 ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
@ 2011-03-30 10:39 ` Juanma Barranquero
  2011-03-30 13:19   ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
  1 sibling, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-30 10:39 UTC (permalink / raw)
  To: nixie; +Cc: 8379

forcemerge 1255 8379
thanks

> I found that the width of linum window is not changed with
> (text-scale-increase) or (text-scale-decrease) function.

This is bug#1255: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255

    Juanma





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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-30 10:39 ` bug#8379: The width of linum window is not adjusted after face-remapping Juanma Barranquero
@ 2011-03-30 13:19   ` Drew Adams
  2011-03-30 13:53     ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2011-03-30 13:19 UTC (permalink / raw)
  To: 'Juanma Barranquero', 'nixie'; +Cc: 8379

> > I found that the width of linum window is not changed with
> > (text-scale-increase) or (text-scale-decrease) function.
> 
> This is bug#1255: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255

Well if Emacs Dev now recognizes that this is a bug or a missing feature (Stefan
called the _lack_ of window resizing for text scaling "one of its greatest
features"), there's a simple solution.  I proposed it as soon as text scaling
was introduced, but it wasn't adopted.

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

This provides an option that allows for automatic resizing of the window, to go
along with text resizing.  That puts the behavior under user control.  The
window resizing can be: none, horizontal, vertical, or both.

And any function or mode (e.g. linum-mode) that needs a particular type of
window resizing can obviously bind or set the value locally.

This is a trivial fix.  It would be good if Emacs Dev gives users the choice.
Here is the original thread, with a patch:
http://lists.gnu.org/archive/html/emacs-devel/2009-08/msg00414.html






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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-30 13:19   ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
@ 2011-03-30 13:53     ` Juanma Barranquero
  2011-03-31  9:31       ` nixie
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-30 13:53 UTC (permalink / raw)
  To: Drew Adams; +Cc: 8379

On Wed, Mar 30, 2011 at 15:19, Drew Adams <drew.adams@oracle.com> wrote:

> Well if Emacs Dev now recognizes that this is a bug or a missing feature

It is filed as a bug, that does not mean we all agree about its status.

> (Stefan
> called the _lack_ of window resizing for text scaling "one of its greatest
> features"),

Yes, but, if I'm reading correctly the old thread, he didn't say that
there wasn't a bug, only that the bug is not in text scaling, but in
applications (like linum) that can be affected for it and do not plan
accordingly.

    Juanma





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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-30 13:53     ` Juanma Barranquero
@ 2011-03-31  9:31       ` nixie
  2011-03-31 13:22         ` Drew Adams
  2011-03-31 14:40         ` Juanma Barranquero
  0 siblings, 2 replies; 10+ messages in thread
From: nixie @ 2011-03-31  9:31 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8379

> forcemerge 1255 8379
> thanks

>> I found that the width of linum window is not changed with
>> (text-scale-increase) or (text-scale-decrease) function.

> This is bug#1255: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255

Sorry for not kindly reading the threads archives.

> Yes, but, if I'm reading correctly the old thread, he didn't say that
> there wasn't a bug, only that the bug is not in text scaling, but in
> applications (like linum) that can be affected for it and do not plan
> accordingly.
> 
>     Juanma

yes, i think it is not a bug in text scaling. But i don't think fix it
in applications (maybe not only the linum) is a good idea. 

I wonder if there is a pure and smart window adjusting function.


-- 
nixie <onixie@gmail.com>






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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-31  9:31       ` nixie
@ 2011-03-31 13:22         ` Drew Adams
  2011-03-31 14:40         ` Juanma Barranquero
  1 sibling, 0 replies; 10+ messages in thread
From: Drew Adams @ 2011-03-31 13:22 UTC (permalink / raw)
  To: 'nixie', 'Juanma Barranquero'; +Cc: 8379

> I wonder if there is a pure and smart window adjusting function.

Did you look at face-remap+.el?  In what way does it not adjust the window as
needed?






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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-31  9:31       ` nixie
  2011-03-31 13:22         ` Drew Adams
@ 2011-03-31 14:40         ` Juanma Barranquero
  2011-03-31 14:48           ` Drew Adams
  1 sibling, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-31 14:40 UTC (permalink / raw)
  To: nixie; +Cc: 8379

On Thu, Mar 31, 2011 at 11:31, nixie <onixie@gmail.com> wrote:

> Sorry for not kindly reading the threads archives.

No problem. It is often hard to find the relevant bug. In this case, I
remembered the old one because I was involved.

> yes, i think it is not a bug in text scaling. But i don't think fix it
> in applications (maybe not only the linum) is a good idea.

I'm not really sure. On one hand, it seems like text scaling should
affect all the window (margins, etc.). On the other hand, I understand
Stefan's comment that that's not what text-scaling is supposed to do.

    Juanma





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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-31 14:40         ` Juanma Barranquero
@ 2011-03-31 14:48           ` Drew Adams
  2011-03-31 14:54             ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2011-03-31 14:48 UTC (permalink / raw)
  To: 'Juanma Barranquero', 'nixie'; +Cc: 8379

> > yes, i think it is not a bug in text scaling. But i don't 
> > think fix it in applications (maybe not only the linum)
> > is a good idea.
> 
> I'm not really sure. On one hand, it seems like text scaling should
> affect all the window (margins, etc.). On the other hand, I understand
> Stefan's comment that that's not what text-scaling is supposed to do.

There is no right or wrong answer wrt affecting the window that applies to all
contexts.  The behavior wrt the window should be under user and program control.
Sometimes you want the window to be resized to adapt to the apparent text size
change; sometimes you do not.






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

* bug#8379: The width of linum window is not adjusted afterface-remapping
  2011-03-31 14:48           ` Drew Adams
@ 2011-03-31 14:54             ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-31 14:54 UTC (permalink / raw)
  To: Drew Adams; +Cc: 8379

On Thu, Mar 31, 2011 at 16:48, Drew Adams <drew.adams@oracle.com> wrote:

> There is no right or wrong answer wrt affecting the window that applies to all
> contexts.  The behavior wrt the window should be under user and program control.
> Sometimes you want the window to be resized to adapt to the apparent text size
> change; sometimes you do not.

You're right that there's no right or wrong answer. What I meant is
that I don't know if what you call "program control" should be the
responsibility of the text-scaling code (with suitable hooks to allow
customization), or it's better to leave it as it is and let the
applications (like linum.el) adapt to a possible rescaling.

As it is now, an application has no way to know that the text in the
buffer is shown rescaled/remaped, unless it periodically checks
`face-remapping-alist', because remapping does not *have* to go
through face-remap-* functions, so there's no hook or callback.

    Juanma





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

end of thread, other threads:[~2011-03-31 14:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30  1:43 bug#8379: The width of linum window is not adjusted after face-remapping nixie
2011-03-30  2:18 ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
2011-03-30 10:39 ` bug#8379: The width of linum window is not adjusted after face-remapping Juanma Barranquero
2011-03-30 13:19   ` bug#8379: The width of linum window is not adjusted afterface-remapping Drew Adams
2011-03-30 13:53     ` Juanma Barranquero
2011-03-31  9:31       ` nixie
2011-03-31 13:22         ` Drew Adams
2011-03-31 14:40         ` Juanma Barranquero
2011-03-31 14:48           ` Drew Adams
2011-03-31 14:54             ` Juanma Barranquero

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