all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to get the new frame?
@ 2015-07-21  0:47 Ian Zimmerman
  2015-07-21  1:03 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Ian Zimmerman @ 2015-07-21  0:47 UTC (permalink / raw)
  To: help-gnu-emacs

Is there a neat way in Lisp code to get at the frame which
find-file-other-frame just has created?  The function itself returns
(indirectly, via switch-to-buffer-other-frame) the buffer and not the
frame, just as all the *-other-frame functions.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: How to get the new frame?
  2015-07-21  0:47 How to get the new frame? Ian Zimmerman
@ 2015-07-21  1:03 ` Emanuel Berg
  2015-07-21  1:42   ` Ian Zimmerman
  2015-07-21  3:56 ` John Mastro
       [not found] ` <mailman.7206.1437440684.904.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 31+ messages in thread
From: Emanuel Berg @ 2015-07-21  1:03 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Zimmerman <itz@buug.org> writes:

> Is there a neat way in Lisp code to get at the frame
> which find-file-other-frame just has created?
> The function itself returns (indirectly, via
> switch-to-buffer-other-frame) the buffer and not the
> frame, just as all the *-other-frame functions.

"get at"...?

You want to get *to* the frame, or get the
actual frame?

`get-other-frame' perhaps?

Or go to it, do (selected-frame), then return
transparently. Is there a frame-save-excursion? No,
but perhaps you can make it work somehow.

By the way: Why do people use frames?

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to get the new frame?
  2015-07-21  1:03 ` Emanuel Berg
@ 2015-07-21  1:42   ` Ian Zimmerman
  2015-07-21  1:43     ` Emanuel Berg
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Zimmerman @ 2015-07-21  1:42 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-07-21 03:03 +0200, Emanuel Berg wrote:

> "get at"...?
> 
> You want to get *to* the frame, or get the actual frame?

Get the frame object into a Lisp variable, that is all.  It was a dumb
question, since selected-frame does exactly what I want.

> By the way: Why do people use frames?

I won't answer in general, but in this particular situation:  I want to
temporarily open a file in the context of other programs (such as a web
browser) which I always place on a different window manager desktop than
Emacs, and then close it.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: How to get the new frame?
  2015-07-21  1:42   ` Ian Zimmerman
@ 2015-07-21  1:43     ` Emanuel Berg
  2015-07-21  2:07       ` Ian Zimmerman
  0 siblings, 1 reply; 31+ messages in thread
From: Emanuel Berg @ 2015-07-21  1:43 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Zimmerman <itz@buug.org> writes:

> I won't answer in general, but in this particular
> situation: I want to temporarily open a file in the
> context of other programs (such as a web browser)
> which I always place on a different window manager
> desktop than Emacs, and then close it.

???

No, I'll stick with windows...

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to get the new frame?
  2015-07-21  1:43     ` Emanuel Berg
@ 2015-07-21  2:07       ` Ian Zimmerman
  2015-07-21 21:07         ` Emanuel Berg
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Zimmerman @ 2015-07-21  2:07 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-07-21 03:43 +0200, Emanuel Berg wrote:

> > I won't answer in general, but in this particular situation: I want
> > to temporarily open a file in the context of other programs (such as
> > a web browser) which I always place on a different window manager
> > desktop than Emacs, and then close it.

> No, I'll stick with windows...

So how would you handle this situation?  Switch to the Emacs desktop,
open the file, commit the item to memory (or paper?), switch to the
browser desktop, enter the item, switch to the Emacs desktop, kill the
buffer+window, switch to the browser desktop again?

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: How to get the new frame?
  2015-07-21  0:47 How to get the new frame? Ian Zimmerman
  2015-07-21  1:03 ` Emanuel Berg
@ 2015-07-21  3:56 ` John Mastro
  2015-07-21  4:46   ` Ian Zimmerman
       [not found] ` <mailman.7206.1437440684.904.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 31+ messages in thread
From: John Mastro @ 2015-07-21  3:56 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> Is there a neat way in Lisp code to get at the frame which
> find-file-other-frame just has created?  The function itself returns
> (indirectly, via switch-to-buffer-other-frame) the buffer and not the
> frame, just as all the *-other-frame functions.


Would something like this work?

(window-frame (get-buffer-window (find-file-other-frame ...)))

-- 
john


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

* Re: How to get the new frame?
  2015-07-21  3:56 ` John Mastro
@ 2015-07-21  4:46   ` Ian Zimmerman
  0 siblings, 0 replies; 31+ messages in thread
From: Ian Zimmerman @ 2015-07-21  4:46 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-07-20 20:56 -0700, John Mastro wrote:

> (window-frame (get-buffer-window (find-file-other-frame ...)))

The problem here is that the file may already be open (it's a real,
pratical possibility) in which case there's no promise that
get-buffer-window will return the new one.

But, as I wrote in reply to Emanuel, since I'm not worried about
concurrency or Emacs acting behind my back, selected-frame works just
fine.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: How to get the new frame?
@ 2015-07-21  7:00 martin rudalics
  0 siblings, 0 replies; 31+ messages in thread
From: martin rudalics @ 2015-07-21  7:00 UTC (permalink / raw)
  To: itz; +Cc: help-gnu-emacs

 > Is there a neat way in Lisp code to get at the frame which
 > find-file-other-frame just has created?

No.  Also so because `find-file-other-frame' might not have created a
new frame in the first place.  You would have to write a function
returning a list of all windows on all frames together with the buffers
they show and call that function twice, once before and once after
calling `find-file-other-frame'.  If the list returned by the second
call contains a window showing your file and that window is not present
in the list returned by the first call, chances are that you have found
the right window.

 > The function itself returns
 > (indirectly, via switch-to-buffer-other-frame) the buffer and not the
 > frame, just as all the *-other-frame functions.

Indeed.  I suppose something like

(let* ((buffer (find-file-noselect FILENAME))
        (window (display-buffer buffer '((display-buffer-pop-up-frame)))))
   (when (eq (window-buffer window) buffer)
     (window-frame window)))

should be sufficient for your purposes.

martin



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

* Re: How to get the new frame?
       [not found] <mailman.7205.1437439660.904.help-gnu-emacs@gnu.org>
@ 2015-07-21 17:25 ` Javier
  2015-07-21 17:44   ` Javier
  2015-07-23  9:01   ` Javier
  0 siblings, 2 replies; 31+ messages in thread
From: Javier @ 2015-07-21 17:25 UTC (permalink / raw)
  To: help-gnu-emacs


Ian Zimmerman <itz@buug.org> wrote:
> Is there a neat way in Lisp code to get at the frame which
> find-file-other-frame just has created?  

I define this in my .emacs

(defun other-frame-dec () "" (interactive) (other-frame '+1))
(defun other-frame-inc () "" (interactive) (other-frame '-1))

I think the function other-frame-inc would just do what you want
(change to the freshly created frame)

Emacs labels the frames as F1, F2, F3... and it just increases the
number each time you create a frame (if you delete an old frame F2,
its number does not get reused, emacs just keeps increasing the number
in the label: F10, F11...  ).

I might be wrong, but that's the way things happen in my setup.

I link those functions to very easy accesible keys to
navigate frames in emacs as if they were tabs in firefox.

(global-set-key [S-left] 'other-frame-dec)
(global-set-key [S-right] 'other-frame-inc)

or

(global-set-key [C-iso-lefttab] 'other-frame-inc)
(global-set-key [C-S-iso-lefttab] 'other-frame-dec)



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

* Re: How to get the new frame?
  2015-07-21 17:25 ` Javier
@ 2015-07-21 17:44   ` Javier
  2015-07-23  9:01   ` Javier
  1 sibling, 0 replies; 31+ messages in thread
From: Javier @ 2015-07-21 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

BTW, you may find this old thread interesting

RE: Frame numbering
http://lists.gnu.org/archive/html/help-gnu-emacs/2014-04/msg00343.html



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

* Re: How to get the new frame?
  2015-07-21  2:07       ` Ian Zimmerman
@ 2015-07-21 21:07         ` Emanuel Berg
  2015-07-21 21:49           ` Ian Zimmerman
  0 siblings, 1 reply; 31+ messages in thread
From: Emanuel Berg @ 2015-07-21 21:07 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Zimmerman <itz@buug.org> writes:

> So how would you handle this situation? Switch to
> the Emacs desktop, open the file, commit the item to
> memory (or paper?), switch to the browser desktop,
> enter the item, switch to the Emacs desktop, kill
> the buffer+window, switch to the browser
> desktop again?

I don't understand the situation 100%, but if you
could drop the "browser desktop" and use something in
Emacs which had the same capabilities, that would
nullify the problem.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to get the new frame?
  2015-07-21 21:07         ` Emanuel Berg
@ 2015-07-21 21:49           ` Ian Zimmerman
  2015-07-21 23:35             ` Emanuel Berg
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Zimmerman @ 2015-07-21 21:49 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-07-21 23:07 +0200, Emanuel Berg wrote:

> I don't understand the situation 100%, but if you could drop the
> "browser desktop" and use something in Emacs which had the same
> capabilities, that would nullify the problem.

I remember you wrote a while ago that you used openbox as WM.  So do I,
and if you follow that project you know I even contribute code on
occassion.  So do you utilize openbox virtual desktops at all?  If not,
you miss a lot of its power and maybe you should look at something
simpler.  If yes, you should be able to understand my situation even if
you substitute some other functionality for "browser".

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: How to get the new frame?
  2015-07-21 21:49           ` Ian Zimmerman
@ 2015-07-21 23:35             ` Emanuel Berg
  0 siblings, 0 replies; 31+ messages in thread
From: Emanuel Berg @ 2015-07-21 23:35 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Zimmerman <itz@buug.org> writes:

>> I don't understand the situation 100%, but if you
>> could drop the "browser desktop" and use something
>> in Emacs which had the same capabilities, that
>> would nullify the problem.
>
> I remember you wrote a while ago that you used
> openbox as WM. So do I, and if you follow that
> project you know I even contribute code on
> occassion. So do you utilize openbox virtual
> desktops at all? If not, you miss a lot of its power
> and maybe you should look at something simpler.
> If yes, you should be able to understand my
> situation even if you substitute some other
> functionality for "browser".

I only use X to play music videos and view graphical
material, so the one thing I do with Openbox is M-TAB
for switching between the xterm and
mplayer/feh/xpdf/etc windows:

    http://user.it.uu.se/~embe8573/dumps/switch-win.png

So without boasting, I don't think I use any
desktop stuff.

Cool that you contribute to the Openbox project!

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to get the new frame?
  2015-07-21 17:25 ` Javier
  2015-07-21 17:44   ` Javier
@ 2015-07-23  9:01   ` Javier
  1 sibling, 0 replies; 31+ messages in thread
From: Javier @ 2015-07-23  9:01 UTC (permalink / raw)
  To: help-gnu-emacs

Javier <nospam@nospam.com> wrote:
> Ian Zimmerman <itz@buug.org> wrote:
>> Is there a neat way in Lisp code to get at the frame which
>> find-file-other-frame just has created?  
> 
> (defun other-frame-dec () "" (interactive) (other-frame '+1))
> (defun other-frame-inc () "" (interactive) (other-frame '-1))
> 
> I think the function other-frame-inc would just do what you want
> (change to the freshly created frame)
> 
> Emacs labels the frames as F1, F2, F3... and it just increases the
> number each time you create a frame (if you delete an old frame F2,
> its number does not get reused, emacs just keeps increasing the number
> in the label: F10, F11...  ).

Ups, sorry.  No, I was wrong, it would change to the newly created frame
only in the case that one is in the highest number frame.  To change
to newly created frame in the general case one needs to see which is
the frame with the highest number.



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

* Re: How to get the new frame?
       [not found] ` <mailman.7206.1437440684.904.help-gnu-emacs@gnu.org>
@ 2015-07-23 15:11   ` B. T. Raven
  2015-07-23 15:52     ` Eli Zaretskii
                       ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: B. T. Raven @ 2015-07-23 15:11 UTC (permalink / raw)
  To: help-gnu-emacs

On 7/20/2015 8:03 PM, Emanuel Berg wrote:
> Ian Zimmerman <itz@buug.org> writes:
>
>> Is there a neat way in Lisp code to get at the frame
>> which find-file-other-frame just has created?
>> The function itself returns (indirectly, via
>> switch-to-buffer-other-frame) the buffer and not the
>> frame, just as all the *-other-frame functions.
>
> "get at"...?
>
> You want to get *to* the frame, or get the
> actual frame?
>
> `get-other-frame' perhaps?
>
> Or go to it, do (selected-frame), then return
> transparently. Is there a frame-save-excursion? No,
> but perhaps you can make it work somehow.
>
> By the way: Why do people use frames?
>

I use 2 frames under w32, w64, courier (monospace 8 line high) to 
display *Calendar* and arial (proportional font) for everything else. Is 
there any other way to accomplish this? Is there a way to read display 
geometry so I can use the same .emacs for laptops and desktops? Now I 
have to mouse around in order to make the monospace frame the minimum 
usable height (different on laptops and desktops).

Ed



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

* Re: How to get the new frame?
  2015-07-23 15:11   ` B. T. Raven
@ 2015-07-23 15:52     ` Eli Zaretskii
       [not found]     ` <mailman.7309.1437666858.904.help-gnu-emacs@gnu.org>
  2015-07-23 23:14     ` Emanuel Berg
  2 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-23 15:52 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "B. T. Raven" <btraven@nihilo.net>
> Date: Thu, 23 Jul 2015 10:11:44 -0500
> 
> Is there a way to read display geometry

Is display-monitor-attributes-list what you want?  Or maybe
display-mm-width and display-mm-height?  Or display-pixel-width and
display-pixel-height?  There are more, of course.



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

* Re: How to get the new frame?
       [not found]     ` <mailman.7309.1437666858.904.help-gnu-emacs@gnu.org>
@ 2015-07-23 18:21       ` B. T. Raven
  2015-07-23 19:23         ` Javier
                           ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: B. T. Raven @ 2015-07-23 18:21 UTC (permalink / raw)
  To: help-gnu-emacs

On 7/23/2015 10:52 AM, Eli Zaretskii wrote:
>> From: "B. T. Raven" <btraven@nihilo.net>
>> Date: Thu, 23 Jul 2015 10:11:44 -0500
>>
>> Is there a way to read display geometry
>
> Is display-monitor-attributes-list what you want?  Or maybe
> display-mm-width and display-mm-height?  Or display-pixel-width and
> display-pixel-height?  There are more, of course.
>

Thanks, Eli. I have the last four functions documented but not the first 
(variable?) in w32 24.3. I have put:

  '(display-mm-dimensions-alist (quote (("t400" 304 . 190))))

in (custom-set-variables using custom but that doesn't register the 
display monitor (14.1" diag.). Apparently the display part of the alist 
can be either nil, t, or a string but I can't get mm or pixel height or 
width through those functions after setting up the alist. Btw, what is 
this first string in the documentation of the variable:  (":0.0" . (287 
. 215))?
I was hoping that Emacs might be able to interrogate the hardware 
somehow through the OS.
In the context of my original question, is my goal somehow achievable. 
If so, what's the recipe? Hardware is Lenovo t400.


Thanks again,

Ed


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

* Re: How to get the new frame?
  2015-07-23 18:21       ` B. T. Raven
@ 2015-07-23 19:23         ` Javier
  2015-07-23 19:26         ` Eli Zaretskii
       [not found]         ` <mailman.7315.1437679612.904.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 31+ messages in thread
From: Javier @ 2015-07-23 19:23 UTC (permalink / raw)
  To: help-gnu-emacs

>> Is display-monitor-attributes-list what you want?  Or maybe
>> display-mm-width and display-mm-height?  Or display-pixel-width and
>> display-pixel-height?  There are more, of course.
>
> Thanks, Eli. I have the last four functions documented but not the first 
> (variable?) in w32 24.3. I have put:

display-monitor-attributes-list (I think it's a function) is a very
recent feature from the very last emacs versions
(in my emacs 24.3.1 is not present).

> Btw, what is  this first string in the documentation of the variable: 
> (":0.0" . (287 . 215))?

display is in the form HOST:SERVER.SCREEN.  I think it only makes
sense if you are using an Xserver in a unix-like OS.  In Win32 with a
single screen specifying t instead of ":0.0" should be enough
(but emacs compiled for Cygwin in Windows would be using an Xserver).

M-: (x-display-list) should give you a list of the displays available.

You can have a look at the emacs manual
M-: (info "(elisp) Multiple Terminals")


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

* Re: How to get the new frame?
  2015-07-23 18:21       ` B. T. Raven
  2015-07-23 19:23         ` Javier
@ 2015-07-23 19:26         ` Eli Zaretskii
       [not found]         ` <mailman.7315.1437679612.904.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-23 19:26 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "B. T. Raven" <btraven@nihilo.net>
> Date: Thu, 23 Jul 2015 13:21:52 -0500
> 
> > Is display-monitor-attributes-list what you want?  Or maybe
> > display-mm-width and display-mm-height?  Or display-pixel-width and
> > display-pixel-height?  There are more, of course.
> >
> 
> Thanks, Eli. I have the last four functions documented but not the first 
> (variable?) in w32 24.3.

Upgrade to 24.5, the latest, and you will have the first function as
well.

> I have put:
> 
>   '(display-mm-dimensions-alist (quote (("t400" 304 . 190))))
> 
> in (custom-set-variables using custom but that doesn't register the 
> display monitor (14.1" diag.).

I don't understand what that means, nor what you wanted to achieve,
and how exactly did you try achieving that via
display-mm-dimensions-alist.  Please show more of your code.

> Apparently the display part of the alist can be either nil, t, or a
> string but I can't get mm or pixel height or width through those
> functions after setting up the alist.

Again, I fail to follow.  Where I'm typing this, I get

  M-: (display-mm-height) RET => 180

What doesn't work for you?  Was this the function you tried?

> Btw, what is this first string in the documentation of the variable:
> (":0.0" . (287 . 215))?

The display name, only significant on X.

> I was hoping that Emacs might be able to interrogate the hardware
> somehow through the OS.

It does.

> In the context of my original question, is my goal somehow
> achievable.  If so, what's the recipe?

Not sure what is the question, exactly.  You said back then:

> I use 2 frames under w32, w64, courier (monospace 8 line high) to 
> display *Calendar* and arial (proportional font) for everything else. Is 
> there any other way to accomplish this?

Other than what? other than using a separate frame?  Then I suggest to
have a look at buffer-face-mode and its commands.  That's what is at
work when you click Shift-mouse-1 and select a font for the current
buffer.



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

* Re: How to get the new frame?
       [not found]         ` <mailman.7315.1437679612.904.help-gnu-emacs@gnu.org>
@ 2015-07-23 21:02           ` B. T. Raven
  2015-07-23 22:38             ` Javier
  2015-07-24  7:10             ` Eli Zaretskii
  0 siblings, 2 replies; 31+ messages in thread
From: B. T. Raven @ 2015-07-23 21:02 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks, Eli and Javier. See below

On 7/23/2015 2:26 PM, Eli Zaretskii wrote:
>> From: "B. T. Raven" <btraven@nihilo.net>
>> Date: Thu, 23 Jul 2015 13:21:52 -0500
>>
>>> Is display-monitor-attributes-list what you want?  Or maybe
>>> display-mm-width and display-mm-height?  Or display-pixel-width and
>>> display-pixel-height?  There are more, of course.
>>>
>>
>> Thanks, Eli. I have the last four functions documented but not the first
>> (variable?) in w32 24.3.
>
> Upgrade to 24.5, the latest, and you will have the first function as
> well.
>
>> I have put:
>>
>>    '(display-mm-dimensions-alist (quote (("t400" 304 . 190))))
>>
>> in (custom-set-variables using custom but that doesn't register the
>> display monitor (14.1" diag.).
>
> I don't understand what that means, nor what you wanted to achieve,
> and how exactly did you try achieving that via
> display-mm-dimensions-alist.  Please show more of your code.
>
>> Apparently the display part of the alist can be either nil, t, or a
>> string but I can't get mm or pixel height or width through those
>> functions after setting up the alist.
>
> Again, I fail to follow.  Where I'm typing this, I get
>
>    M-: (display-mm-height) RET => 180

after trying to customize I see:

display-mm-dimensions-alist is a variable defined in `frame.el'.
Its value is (("t400" 304 . 190))
Original value was nil

then

(display-mm-width "t400") evals to Display name does not exist
(display-mm-width) evals to 508
(display-mm-height) evals to 318

but both numbers are more than 50% too big for the size of the physical 
screen in mm (304 by 190)

>
> What doesn't work for you?  Was this the function you tried?
>
>> Btw, what is this first string in the documentation of the variable:
>> (":0.0" . (287 . 215))?
>
> The display name, only significant on X.
>
>> I was hoping that Emacs might be able to interrogate the hardware
>> somehow through the OS.
>
> It does.
>
>> In the context of my original question, is my goal somehow
>> achievable.  If so, what's the recipe?
>
> Not sure what is the question, exactly.  You said back then:
>
>> I use 2 frames under w32, w64, courier (monospace 8 line high) to
>> display *Calendar* and arial (proportional font) for everything else. Is
>> there any other way to accomplish this?
>
> Other than what? other than using a separate frame?  Then I suggest to
> have a look at buffer-face-mode and its commands.  That's what is at
> work when you click Shift-mouse-1 and select a font for the current
> buffer.

I think I always use only two fonts (same size). I knew about 
buffer-face-mode but I don't use it. Instead I tried to set up two 
frames and their associated fonts once and for all in the init file.

As far as I know the only code that affects all this are these lines:

"
(setq initial-frame-alist '((name . "arial") (top . 370) (left . 1) 
(width . 205) (height . 18)))

...

(make-frame '((name . "courier")
    (top . 1) (left . 1)
    (width . 223) (height . 18)
    (visibility . icon))) ;; nil or icon

...

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  '(default ((t (:stipple nil :background "ghostwhite" :foreground 
"black" :inverse-video nil :box nil :strike-through nil :overline nil 
:underline nil :slant normal :weight normal :height 108 :width normal 
:family "outline-arial unicode ms"))))
  '(scroll-bar ((t (:background "#ffffff" :foreground "#000000")))))

... and finally

(select-frame-by-name "courier")
(set-frame-font "-outline-Courier 
New-normal-r-normal-normal-*-*-96-96-c-*-iso10646-1")

;; the actual (present) width and height numbers are now just a vestige 
of my experimenting with the two frames long time ago, dividing the 
display in half roughly). What I want are two full width frames, an 8 
line monospace-font frame for *Calendar* and a 24 line proportional-font 
frame both on the display at once. Now I can only do that by fiddling 
with the frames manually.

Thanks,

Ed


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

* Re: How to get the new frame?
  2015-07-23 21:02           ` B. T. Raven
@ 2015-07-23 22:38             ` Javier
  2015-07-24  7:13               ` Eli Zaretskii
                                 ` (2 more replies)
  2015-07-24  7:10             ` Eli Zaretskii
  1 sibling, 3 replies; 31+ messages in thread
From: Javier @ 2015-07-23 22:38 UTC (permalink / raw)
  To: help-gnu-emacs

I don't have a windows computer at reach, so I cannot do much.
In any case, some points

> display-mm-dimensions-alist is a variable defined in `frame.el'.
> Its value is (("t400" 304 . 190))
> Original value was nil

"t400" doesn't look like a valid display name.

Try

(setq display-mm-dimensions-alist '(t . (304 . 190)))

t without quotes means all displays, should be always valid and be
enough for you unless you want to do a screen by screen individual
setup.

> (display-mm-width "t400") evals to Display name does not exist

That tells you that "t400" is not a valid display name.
What does it give?

M-: (x-display-list)

I'm curious to see how displays are named in Win32.  It might not even work
as there is no X server in Win32.

> (display-mm-width) evals to 508
> (display-mm-height) evals to 318
> 
> but both numbers are more than 50% too big for the size of the physical 
> screen in mm (304 by 190)

Are you using two screens like a laptop and an external monitor?
Anyway, don't worry much, I'm not surprised that emacs or the OS
are getting the wrong info.

For the rest I cannot tell you anything.  I have never used proportional
fonts in emacs.  Good luck with that.


B. T. Raven <btraven@nihilo.net> wrote:
> Thanks, Eli and Javier. See below
> 
> On 7/23/2015 2:26 PM, Eli Zaretskii wrote:
>>> From: "B. T. Raven" <btraven@nihilo.net>
>>> Date: Thu, 23 Jul 2015 13:21:52 -0500
>>>
>>>> Is display-monitor-attributes-list what you want?  Or maybe
>>>> display-mm-width and display-mm-height?  Or display-pixel-width and
>>>> display-pixel-height?  There are more, of course.
>>>>
>>>
>>> Thanks, Eli. I have the last four functions documented but not the first
>>> (variable?) in w32 24.3.
>>
>> Upgrade to 24.5, the latest, and you will have the first function as
>> well.
>>
>>> I have put:
>>>
>>>    '(display-mm-dimensions-alist (quote (("t400" 304 . 190))))
>>>
>>> in (custom-set-variables using custom but that doesn't register the
>>> display monitor (14.1" diag.).
>>
>> I don't understand what that means, nor what you wanted to achieve,
>> and how exactly did you try achieving that via
>> display-mm-dimensions-alist.  Please show more of your code.
>>
>>> Apparently the display part of the alist can be either nil, t, or a
>>> string but I can't get mm or pixel height or width through those
>>> functions after setting up the alist.
>>
>> Again, I fail to follow.  Where I'm typing this, I get
>>
>>    M-: (display-mm-height) RET => 180
> 
> after trying to customize I see:
> 
> display-mm-dimensions-alist is a variable defined in `frame.el'.
> Its value is (("t400" 304 . 190))
> Original value was nil
> 
> then
> 
> (display-mm-width "t400") evals to Display name does not exist
> (display-mm-width) evals to 508
> (display-mm-height) evals to 318
> 
> but both numbers are more than 50% too big for the size of the physical 
> screen in mm (304 by 190)
> 
>>
>> What doesn't work for you?  Was this the function you tried?
>>
>>> Btw, what is this first string in the documentation of the variable:
>>> (":0.0" . (287 . 215))?
>>
>> The display name, only significant on X.
>>
>>> I was hoping that Emacs might be able to interrogate the hardware
>>> somehow through the OS.
>>
>> It does.
>>
>>> In the context of my original question, is my goal somehow
>>> achievable.  If so, what's the recipe?
>>
>> Not sure what is the question, exactly.  You said back then:
>>
>>> I use 2 frames under w32, w64, courier (monospace 8 line high) to
>>> display *Calendar* and arial (proportional font) for everything else. Is
>>> there any other way to accomplish this?
>>
>> Other than what? other than using a separate frame?  Then I suggest to
>> have a look at buffer-face-mode and its commands.  That's what is at
>> work when you click Shift-mouse-1 and select a font for the current
>> buffer.
> 
> I think I always use only two fonts (same size). I knew about 
> buffer-face-mode but I don't use it. Instead I tried to set up two 
> frames and their associated fonts once and for all in the init file.
> 
> As far as I know the only code that affects all this are these lines:
> 
> "
> (setq initial-frame-alist '((name . "arial") (top . 370) (left . 1) 
> (width . 205) (height . 18)))
> 
> ...
> 
> (make-frame '((name . "courier")
>    (top . 1) (left . 1)
>    (width . 223) (height . 18)
>    (visibility . icon))) ;; nil or icon
> 
> ...
> 
> (custom-set-faces
>  ;; custom-set-faces was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  '(default ((t (:stipple nil :background "ghostwhite" :foreground 
> "black" :inverse-video nil :box nil :strike-through nil :overline nil 
> :underline nil :slant normal :weight normal :height 108 :width normal 
> :family "outline-arial unicode ms"))))
>  '(scroll-bar ((t (:background "#ffffff" :foreground "#000000")))))
> 
> ... and finally
> 
> (select-frame-by-name "courier")
> (set-frame-font "-outline-Courier 
> New-normal-r-normal-normal-*-*-96-96-c-*-iso10646-1")
> 
> ;; the actual (present) width and height numbers are now just a vestige 
> of my experimenting with the two frames long time ago, dividing the 
> display in half roughly). What I want are two full width frames, an 8 
> line monospace-font frame for *Calendar* and a 24 line proportional-font 
> frame both on the display at once. Now I can only do that by fiddling 
> with the frames manually.
> 
> Thanks,
> 
> Ed


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

* Re: How to get the new frame?
  2015-07-23 15:11   ` B. T. Raven
  2015-07-23 15:52     ` Eli Zaretskii
       [not found]     ` <mailman.7309.1437666858.904.help-gnu-emacs@gnu.org>
@ 2015-07-23 23:14     ` Emanuel Berg
  2 siblings, 0 replies; 31+ messages in thread
From: Emanuel Berg @ 2015-07-23 23:14 UTC (permalink / raw)
  To: help-gnu-emacs

"B. T. Raven" <btraven@nihilo.net> writes:

> I use 2 frames under w32, w64, courier (monospace 8
> line high) to display *Calendar* and arial
> (proportional font) for everything else.

I don't know what you say. Suggestion tho to use the
same monospace font for everything in one frame, but
with different windows.

> Is there a way to read display geometry so I can use
> the same .emacs for laptops and desktops?

There are several ways to do that but it is easier if
you just use the same .emacs with a branch on some
variable, then set it to different values for the
different computers and get the desired options.

> Now I have to mouse around in order to make the
> monospace frame the minimum usable height (different
> on laptops and desktops).

Yes, merge both solutions, then turn one chunk of
setup code for one case and the other for the other.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: How to get the new frame?
  2015-07-23 21:02           ` B. T. Raven
  2015-07-23 22:38             ` Javier
@ 2015-07-24  7:10             ` Eli Zaretskii
  1 sibling, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-24  7:10 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "B. T. Raven" <btraven@nihilo.net>
> Date: Thu, 23 Jul 2015 16:02:44 -0500
> 
> > Again, I fail to follow.  Where I'm typing this, I get
> >
> >    M-: (display-mm-height) RET => 180
> 
> after trying to customize I see:
> 
> display-mm-dimensions-alist is a variable defined in `frame.el'.
> Its value is (("t400" 304 . 190))
> Original value was nil
> 
> then
> 
> (display-mm-width "t400") evals to Display name does not exist
> (display-mm-width) evals to 508
> (display-mm-height) evals to 318
> 
> but both numbers are more than 50% too big for the size of the physical 
> screen in mm (304 by 190)

You have overridden the default value of display-mm-dimensions-alist,
but using an incorrect display name.  You should use "w32" instead.

In any case, you are not interested in absolute numerical values, just
in being able to distinguish between several different systems, right?
So the only thing that should be of interest is that each system
returns different values, no matter what those values are.

> What I want are two full width frames, an 8 line monospace-font
> frame for *Calendar* and a 24 line proportional-font frame both on
> the display at once. Now I can only do that by fiddling with the
> frames manually.

Like I said: use buffer-face-mode, it allows to set a font only for a
specific buffer, such as *Calendar* in your case.



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

* Re: How to get the new frame?
  2015-07-23 22:38             ` Javier
@ 2015-07-24  7:13               ` Eli Zaretskii
  2015-07-24 12:02               ` B. T. Raven
       [not found]               ` <mailman.7337.1437722035.904.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-24  7:13 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Javier <nospam@nospam.com>
> Date: Thu, 23 Jul 2015 22:38:35 +0000 (UTC)
> 
> What does it give?
> 
> M-: (x-display-list)
> 
> I'm curious to see how displays are named in Win32.  It might not even work
> as there is no X server in Win32.

It works and returns ("w32").

In general, all x-* functions do work on Windows in GUI sessions,
because the Lisp application code is too replete with calls to these
functions, so if they didn't work, many features would fail on Windows
for no good reason.

So you should always assume those functions work on Windows, unless
there's no way they can be made workable.

> I have never used proportional fonts in emacs.

Emacs will load and use them behind your back anyway, when the default
font doesn't support some special character.



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

* Re: How to get the new frame?
  2015-07-23 22:38             ` Javier
  2015-07-24  7:13               ` Eli Zaretskii
@ 2015-07-24 12:02               ` B. T. Raven
  2015-07-24 13:38                 ` Eli Zaretskii
       [not found]                 ` <mailman.7348.1437745104.904.help-gnu-emacs@gnu.org>
       [not found]               ` <mailman.7337.1437722035.904.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 31+ messages in thread
From: B. T. Raven @ 2015-07-24 12:02 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks Javier. x.display.list returns "w32"
When I set the alist with (setq display-mm-dimensions-alist '(t . (304 . 
190))) and then evaluate display-mm-width, I get: Wrong type argument: 
listp, 190. With alist set to nil, I get the erroneous width 508, height 
318.
I thought I could report the screen size to emacs (304mm by 190mm) which 
has a diagonal of 14.11 inches, very close to the nominal screen size of 
14.1.

Ed

On 7/23/2015 5:38 PM, Javier wrote:
> I don't have a windows computer at reach, so I cannot do much.
> In any case, some points
>
>> display-mm-dimensions-alist is a variable defined in `frame.el'.
>> Its value is (("t400" 304 . 190))
>> Original value was nil
>
> "t400" doesn't look like a valid display name.
>
> Try
>
> (setq display-mm-dimensions-alist '(t . (304 . 190)))
>
> t without quotes means all displays, should be always valid and be
> enough for you unless you want to do a screen by screen individual
> setup.
>
>> (display-mm-width "t400") evals to Display name does not exist
>
> That tells you that "t400" is not a valid display name.
> What does it give?
>
> M-: (x-display-list)
>
> I'm curious to see how displays are named in Win32.  It might not even work
> as there is no X server in Win32.
>
>> (display-mm-width) evals to 508
>> (display-mm-height) evals to 318
>>
>> but both numbers are more than 50% too big for the size of the physical
>> screen in mm (304 by 190)
>
> Are you using two screens like a laptop and an external monitor?
> Anyway, don't worry much, I'm not surprised that emacs or the OS
> are getting the wrong info.
>
> For the rest I cannot tell you anything.  I have never used proportional
> fonts in emacs.  Good luck with that.



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

* Re: How to get the new frame?
       [not found]               ` <mailman.7337.1437722035.904.help-gnu-emacs@gnu.org>
@ 2015-07-24 12:51                 ` B. T. Raven
  2015-07-24 13:47                   ` Eli Zaretskii
  2015-07-24 15:25                   ` Yuri Khan
  0 siblings, 2 replies; 31+ messages in thread
From: B. T. Raven @ 2015-07-24 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks, Eli. For a number of years I have thought that changing the font 
applied to all buffers. Was this ever true since ver. 20 or 21?
Anyway, your suggestion is certainly the right one to accomplish what I 
want, as long as I can set it up in .emacs.
Now I have:
"
buffer-face-mode-face is a variable defined in `face-remap.el'.
Its value is (:family "Courier New" :height 110)
Original value was variable-pitch
Local in buffer *Calendar*; global value is variable-pitch
"

I think the problem with mm height and width is due to Emacs assuming 72 
ppi (display-pixels-per-inch) rather than the true value of 120 ppi. 
(x-)display-pixel-height and -width return the correct values of 900 and 
1440 respectively.

Btw, are there other buffers besides calendar that need monospace to 
display correctly? I use proportional font even in .emacs merely for 
aesthetic reasons.

Thanks,

Ed

On 7/24/2015 2:13 AM, Eli Zaretskii wrote:
>> From: Javier <nospam@nospam.com>
>> Date: Thu, 23 Jul 2015 22:38:35 +0000 (UTC)
>>
>> What does it give?
>>
>> M-: (x-display-list)
>>
>> I'm curious to see how displays are named in Win32.  It might not even work
>> as there is no X server in Win32.
>
> It works and returns ("w32").
>
> In general, all x-* functions do work on Windows in GUI sessions,
> because the Lisp application code is too replete with calls to these
> functions, so if they didn't work, many features would fail on Windows
> for no good reason.
>
> So you should always assume those functions work on Windows, unless
> there's no way they can be made workable.
>
>> I have never used proportional fonts in emacs.
>
> Emacs will load and use them behind your back anyway, when the default
> font doesn't support some special character.
>



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

* Re: How to get the new frame?
  2015-07-24 12:02               ` B. T. Raven
@ 2015-07-24 13:38                 ` Eli Zaretskii
       [not found]                 ` <mailman.7348.1437745104.904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-24 13:38 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "B. T. Raven" <btraven@nihilo.net>
> Date: Fri, 24 Jul 2015 07:02:36 -0500
> 
> Thanks Javier. x.display.list returns "w32"
> When I set the alist with (setq display-mm-dimensions-alist '(t . (304 . 
> 190))) and then evaluate display-mm-width, I get: Wrong type argument: 
> listp, 190.

It expects a list, whereas you gave it a cons cell.



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

* Re: How to get the new frame?
  2015-07-24 12:51                 ` B. T. Raven
@ 2015-07-24 13:47                   ` Eli Zaretskii
  2015-07-27 21:13                     ` Robert Thorpe
  2015-07-24 15:25                   ` Yuri Khan
  1 sibling, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2015-07-24 13:47 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "B. T. Raven" <btraven@nihilo.net>
> Date: Fri, 24 Jul 2015 07:51:11 -0500
> 
> Thanks, Eli. For a number of years I have thought that changing the font 
> applied to all buffers. Was this ever true since ver. 20 or 21?

Yes, buffer-face-mode was introduced in Emacs 23.1.

> I think the problem with mm height and width is due to Emacs assuming 72 
> ppi (display-pixels-per-inch) rather than the true value of 120 ppi. 

Possibly.  It's what Windows reports to us.

> (x-)display-pixel-height and -width return the correct values of 900 and 
> 1440 respectively.

Then use those, instead of the mm dimensions.

> Btw, are there other buffers besides calendar that need monospace to 
> display correctly? I use proportional font even in .emacs merely for 
> aesthetic reasons.

Any major mode for some programming language will look weird with
variable-pitch fonts, IMO.



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

* Re: How to get the new frame?
       [not found]                 ` <mailman.7348.1437745104.904.help-gnu-emacs@gnu.org>
@ 2015-07-24 14:55                   ` Javier
  0 siblings, 0 replies; 31+ messages in thread
From: Javier @ 2015-07-24 14:55 UTC (permalink / raw)
  To: help-gnu-emacs

>> When I set the alist with (setq display-mm-dimensions-alist '(t . (304 . 
>> 190))) and then evaluate display-mm-width, I get: Wrong type argument: 
>> listp, 190.
> 
> It expects a list, whereas you gave it a cons cell.
 
That was my fault.  I should have written

(setq display-mm-dimensions-alist '((t . (304 . 190))))




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

* Re: How to get the new frame?
  2015-07-24 12:51                 ` B. T. Raven
  2015-07-24 13:47                   ` Eli Zaretskii
@ 2015-07-24 15:25                   ` Yuri Khan
  1 sibling, 0 replies; 31+ messages in thread
From: Yuri Khan @ 2015-07-24 15:25 UTC (permalink / raw)
  To: B. T. Raven; +Cc: help-gnu-emacs@gnu.org

On Fri, Jul 24, 2015 at 6:51 PM, B. T. Raven <btraven@nihilo.net> wrote:

> Btw, are there other buffers besides calendar that need monospace to display
> correctly? I use proportional font even in .emacs merely for aesthetic
> reasons.

Dired and Ibuffer are pretty ugly in a proportional font.



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

* Re: How to get the new frame?
  2015-07-24 13:47                   ` Eli Zaretskii
@ 2015-07-27 21:13                     ` Robert Thorpe
  0 siblings, 0 replies; 31+ messages in thread
From: Robert Thorpe @ 2015-07-27 21:13 UTC (permalink / raw)
  To: B. T. Raven; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:
>> I think the problem with mm height and width is due to Emacs assuming 72 
>> ppi (display-pixels-per-inch) rather than the true value of 120 ppi. 
>
> Possibly.  It's what Windows reports to us.

If I remember correctly Windows does something wierd here.  If you set
your machine to "small fonts" then it assumes one value for
pixels-per-inch.  If you set it to "large fonts" then it assumes another
value.  Neither of them may be the actually PPI of your screen.  I think
it has to be done this way for back compatibility.

BR,
Robert Thorpe




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

end of thread, other threads:[~2015-07-27 21:13 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21  0:47 How to get the new frame? Ian Zimmerman
2015-07-21  1:03 ` Emanuel Berg
2015-07-21  1:42   ` Ian Zimmerman
2015-07-21  1:43     ` Emanuel Berg
2015-07-21  2:07       ` Ian Zimmerman
2015-07-21 21:07         ` Emanuel Berg
2015-07-21 21:49           ` Ian Zimmerman
2015-07-21 23:35             ` Emanuel Berg
2015-07-21  3:56 ` John Mastro
2015-07-21  4:46   ` Ian Zimmerman
     [not found] ` <mailman.7206.1437440684.904.help-gnu-emacs@gnu.org>
2015-07-23 15:11   ` B. T. Raven
2015-07-23 15:52     ` Eli Zaretskii
     [not found]     ` <mailman.7309.1437666858.904.help-gnu-emacs@gnu.org>
2015-07-23 18:21       ` B. T. Raven
2015-07-23 19:23         ` Javier
2015-07-23 19:26         ` Eli Zaretskii
     [not found]         ` <mailman.7315.1437679612.904.help-gnu-emacs@gnu.org>
2015-07-23 21:02           ` B. T. Raven
2015-07-23 22:38             ` Javier
2015-07-24  7:13               ` Eli Zaretskii
2015-07-24 12:02               ` B. T. Raven
2015-07-24 13:38                 ` Eli Zaretskii
     [not found]                 ` <mailman.7348.1437745104.904.help-gnu-emacs@gnu.org>
2015-07-24 14:55                   ` Javier
     [not found]               ` <mailman.7337.1437722035.904.help-gnu-emacs@gnu.org>
2015-07-24 12:51                 ` B. T. Raven
2015-07-24 13:47                   ` Eli Zaretskii
2015-07-27 21:13                     ` Robert Thorpe
2015-07-24 15:25                   ` Yuri Khan
2015-07-24  7:10             ` Eli Zaretskii
2015-07-23 23:14     ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2015-07-21  7:00 martin rudalics
     [not found] <mailman.7205.1437439660.904.help-gnu-emacs@gnu.org>
2015-07-21 17:25 ` Javier
2015-07-21 17:44   ` Javier
2015-07-23  9:01   ` Javier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.