* Trouble setting default font and window size
@ 2016-07-28 5:18 Ron House
2016-07-28 5:43 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Ron House @ 2016-07-28 5:18 UTC (permalink / raw)
To: help-gnu-emacs
I am trying to set a particular font and default window size, but I run
into a problem. I get the font I want, but when emacs starts, just as it
starts, before it sets the required font, it momentarily uses a larger
font. The window size I ask for uses the entire screen height, so that
larger font causes emacs to ignore my screen size request and use a much
smaller, standard screen size.
So I am having to specify a smaller size than I want so that the larger
font only just fits the screen, but then my reduced window when the
correct font takes over is smaller than I want.
I start emacs with:
emacs -i -geometry 85x64 <<< I really want 99x60 here.
My .emacs contains the following lines related to font settings:
(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 (:inherit nil :stipple nil :inverse-video nil :box nil
:strike-through nil :overline nil :underline nil :slant normal :weight
normal :height 90 :width normal :foundry "bitstream" :family "Bitstream
Vera Sans Mono"))))
'(header-line ((((class color grayscale) (background light)) (:inherit
mode-line :background "grey90" :foreground "grey20" :box nil :height 0.5
:width condensed))))
'(mouse ((t (:background "black")))))
This is the font I want, but emacs starts up with some other font. Can
that be changed?
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 5:18 Trouble setting default font and window size Ron House
@ 2016-07-28 5:43 ` Emanuel Berg
2016-07-28 12:37 ` Ron House
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2016-07-28 5:43 UTC (permalink / raw)
To: help-gnu-emacs
Ron House wrote:
> emacs -i -geometry 85x64
... what does -i do?
> (custom-set-faces
Try using `set-face-attribute' instead!
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 58 Blogomatic articles -
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 5:43 ` Emanuel Berg
@ 2016-07-28 12:37 ` Ron House
2016-07-28 12:47 ` Ron House
2016-07-28 13:57 ` Emanuel Berg
0 siblings, 2 replies; 12+ messages in thread
From: Ron House @ 2016-07-28 12:37 UTC (permalink / raw)
To: help-gnu-emacs
On 28/07/16 15:43, Emanuel Berg wrote:
> Ron House wrote:
>
>> emacs -i -geometry 85x64
>
> ... what does -i do?
>
>> (custom-set-faces
>
> Try using `set-face-attribute' instead!
>
Thanks Emanuel, but it doesn't work. With that change it says:
Warning (initialization): An error occurred while loading `/home/h/.emacs':
Wrong type argument: symbolp, (default ((t (:inherit nil :stipple nil
:inverse-video nil :box nil :strike-through nil :overline nil :underline
nil :slant normal :weight normal :height 90 :width normal :foundry
bitstream :family Bitstream Vera Sans Mono))))
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 12:37 ` Ron House
@ 2016-07-28 12:47 ` Ron House
2016-07-28 14:57 ` Eli Zaretskii
2016-07-28 13:57 ` Emanuel Berg
1 sibling, 1 reply; 12+ messages in thread
From: Ron House @ 2016-07-28 12:47 UTC (permalink / raw)
To: help-gnu-emacs
Replying to martin rudalics, thanks for those ideas.
> (defalias 'dynamic-setting-handle-config-changed-event 'ignore)
doesn't seem to do anything.
> "Note on e65c307 breaks font-height"
Could be. The problem seems to be that the window is displayed before
.emacs is processed, so some built-in default is used and then, after
that has messed things up, .emacs is applied to the messed up display.
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 12:37 ` Ron House
2016-07-28 12:47 ` Ron House
@ 2016-07-28 13:57 ` Emanuel Berg
2016-07-28 15:30 ` HASM
1 sibling, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2016-07-28 13:57 UTC (permalink / raw)
To: help-gnu-emacs
Ron House wrote:
>>> (custom-set-faces
>> Try using `set-face-attribute' instead!
>>
>
> Thanks Emanuel, but it doesn't work.
> With that change it says:
>
> Warning (initialization): An error occurred
> while loading `/home/h/.emacs':
>
> Wrong type argument: symbolp, (default ((t
> (:inherit nil :stipple nil :inverse-video nil
> :box nil :strike-through nil :overline nil
> :underline nil :slant normal :weight normal
> :height 90 :width normal :foundry bitstream
> :family Bitstream Vera Sans Mono))))
Yes, it doesn't work exactly like
`custom-set-faces'. But if you use the help
(`C-h f set-face-attribute RET') you can
achieve the equivalent, and perhaps circumvent
your problem.
Also `modify-face' may be of use - it is a good
start. Again, use the help to learn
the interface!
Last, you can use ~/.Xresources to move a lot
of that stuff from the Emacs init files and
also from the invocation command-line
arguments. If you do that, you need this line
xrdb ~/.Xresources
in the ~/.xinitrc file.
You can grep the web from "Xresources" and
"Emacs" for examples what it can look like.
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 58 Blogomatic articles -
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 12:47 ` Ron House
@ 2016-07-28 14:57 ` Eli Zaretskii
0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2016-07-28 14:57 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Thu, 28 Jul 2016 22:47:25 +1000
> From: Ron House <rhouse@smartchat.net.au>
>
> The problem seems to be that the window is displayed before .emacs
> is processed, so some built-in default is used and then, after that
> has messed things up, .emacs is applied to the messed up display.
I'd suggest to try 2 alternative approaches:
. Define the font in default-frame-alist
. Try to use one of the hooks provided by startup.el
One of these methods should overcome the problems related to the order
of things Emacs does at startup.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 13:57 ` Emanuel Berg
@ 2016-07-28 15:30 ` HASM
2016-07-28 16:01 ` Emanuel Berg
2016-07-29 6:09 ` Ron House
0 siblings, 2 replies; 12+ messages in thread
From: HASM @ 2016-07-28 15:30 UTC (permalink / raw)
To: help-gnu-emacs
> Last, you can use ~/.Xresources to move a lot of that stuff from the
> Emacs init files and also from the invocation command-line arguments.
I push this into my xrdb:
-----------------------------------------------------------------
Emacs*geometry: 100x50
Emacs.menuBar: off
Emacs.toolBar: off
Emacs.horizontalScrollBars: off
Emacs.verticalScrollBars: off
Emacs.background: #304060
Emacs.foreground: white
Emacs.Font: "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-15"
-----------------------------------------------------------------
and this in my initialization:
-----------------------------------------------------------------
(defun hasm-config-frame (&optional frame)
(progn
(cond (frame (select-frame frame)))
(if (equal window-system 'x)
(progn
(set-foreground-color "white")
(set-background-color "#304060")
(set-frame-height (selected-frame) 50)
(set-frame-width (selected-frame) 100)
(set-face-attribute 'fringe nil :background "#304060" :foreground "white")
(set-frame-font "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-15" nil t)
(transient-mark-mode 1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
))
(menu-bar-mode -1)))
(add-hook 'after-make-frame-functions 'hasm-config-frame)
(add-hook 'after-init-hook 'hasm-config-frame)
-----------------------------------------------------------------
and one time out of 10 or thereabout, my frame doesn't get the correct
size.
-- HASM
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 15:30 ` HASM
@ 2016-07-28 16:01 ` Emanuel Berg
2016-07-28 21:26 ` HASM
2016-07-29 6:09 ` Ron House
1 sibling, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2016-07-28 16:01 UTC (permalink / raw)
To: help-gnu-emacs
HASM wrote:
> I push this into my xrdb
So as to not confuse the OP, most likely you
mean ~/.Xresources.
From the command line, data (and changes to it)
can be read (updated) with
$ xrdb ~/.Xresources
A good way to have this automated every time
X is started is to put it in ~/.xinitrc, as in
http://user.it.uu.se/~embe8573/conf/.xinitrc
Note: xrdb(1) is "X server resource database
utility" but I always thought of it as
"X read database".
> -----------------------------------------------------------------
> Emacs*geometry: 100x50
> Emacs.menuBar: off
> Emacs.toolBar: off
> Emacs.horizontalScrollBars: off
> Emacs.verticalScrollBars: off
> Emacs.background: #304060
> Emacs.foreground: white
> Emacs.Font: "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-15"
> -----------------------------------------------------------------
Thank you, that is what I meant. Also, for an
X user, you have good taste in options :)
> (defun hasm-config-frame (&optional frame)
> (progn
> (cond (frame (select-frame frame)))
> (if (equal window-system 'x)
> (progn
> (set-foreground-color "white")
> (set-background-color "#304060")
> (set-frame-height (selected-frame) 50)
> (set-frame-width (selected-frame) 100)
> (set-face-attribute 'fringe nil :background "#304060" :foreground "white")
> (set-frame-font "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-15" nil t)
> (transient-mark-mode 1)
> (scroll-bar-mode -1)
> (tool-bar-mode -1)
> ))
> (menu-bar-mode -1)))
Again, thanks, this is what I meant with
`set-face-attribute'.
As for the Elisp, you don't need a `progn'
after `defun', and if you replace `if' with
`when', you get an implicit progn - and you can
do this safely, because you don't have an
"else" clause to your if!
> and one time out of 10 or thereabout, my
> frame doesn't get the correct size.
Hey, aren't computers supposed to
be deterministic?
OK, so it didn't circumvent the problem. But at
least it circumvented the custom interface and
tought us some Elisp in the process - WIN!
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 58 Blogomatic articles -
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 16:01 ` Emanuel Berg
@ 2016-07-28 21:26 ` HASM
2016-07-29 2:34 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: HASM @ 2016-07-28 21:26 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
>> I push this into my xrdb
> So as to not confuse the OP, most likely you
> mean ~/.Xresources.
I could further confuse the OP and claim that I have this in my
environment:
export XAPPLRESDIR=${HOME}/.x11resources/
export XENVIRONMENT=${HOME}/.Xdefaults
and have one file per X application under $XAPPLRESDIR, and a bunch of
includes in the $XENVIRONMENT file for the applications I still use,
just because that is the way I did way back when (and don't actually
call xrdb anymore) but that would be unnecessary :-)
>> -----------------------------------------------------------------
>> Emacs*geometry: 100x50
...
> Thank you, that is what I meant. Also, for an
> X user, you have good taste in options :)
Thanks!
> As for the Elisp, you don't need a `progn' after `defun', and if you
> replace `if' with `when', you get an implicit progn - and you can do
> this safely, because you don't have an "else" clause to your if!
Thanks again. My Elisp is rudimentary. I used to have a cond in there
instead of the if, with cases for other window systems, but I dropped it
when I recently switched from XEmacs back to Emacs.
-- HASM
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 21:26 ` HASM
@ 2016-07-29 2:34 ` Emanuel Berg
0 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2016-07-29 2:34 UTC (permalink / raw)
To: help-gnu-emacs
HASM wrote:
> I could further confuse the OP and claim that
> I have this in my environment: export
> XAPPLRESDIR=${HOME}/.x11resources/ export
> XENVIRONMENT=${HOME}/.Xdefaults and have one
> file per X application under $XAPPLRESDIR,
> and a bunch of includes in the $XENVIRONMENT
> file for the applications I still use, just
> because that is the way I did way back when
> (and don't actually call xrdb anymore) but
> that would be unnecessary :-)
OK! Well hopefully you don't confuse the OP
anymore, after the explanation! Everything for
the OP :)
Yeah... Actually one file per application in
general is a good idea. And that is common
practise. One .xpdfrc, one .xbindkeysrc, and
so on.
I think the Xresources file is thought to be
the X's "look and feel", tho I don't know if
that term was popularized until the GNOMEs and
KDEs desktops?
Because with Xresources you can get that by
setting conform options for several
applications with the wildcard notation! So you
don't need yet another Linux distribution to
get it...
Personally, I never used enough of them (X
applications) to explore this further, so
I just stacked the few options I have.
> I used to have a cond in there instead of the
> if, with cases for other window systems, but
> I dropped it when I recently switched from
> XEmacs back to Emacs.
People who are coming to Lisp from other
languages, and that should be almost everyone
these days, tend to like `if' + `progn' even
when there is no "else" clause equivalent
present.
When programming, it can be natural to use if
anyway as it isn't always clear from the get-go
what is needed or what will be. When set
however I think `when' is generally preferred to
(if something something) or (if something
(progn somethings)) and likewise `unless' is
preferred to (if (not something) ...).
Another "secret" of Lisp compared to other
languages is the `or' which returns the first
non-nil value. So it isn't only for branching!
It can also be the setting of a variable to the
first other thing that is set. E.g.
(setq gear (or hook line sinker))
If all three are nil, gear will naturally
be nil! But if hook is nil but line is "hemp",
gear will be "hemp" - wonderful :)
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 58 Blogomatic articles -
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Trouble setting default font and window size
2016-07-28 15:30 ` HASM
2016-07-28 16:01 ` Emanuel Berg
@ 2016-07-29 6:09 ` Ron House
2016-08-01 11:19 ` SOLVED " Ron House
1 sibling, 1 reply; 12+ messages in thread
From: Ron House @ 2016-07-29 6:09 UTC (permalink / raw)
To: help-gnu-emacs
On 29/07/16 01:30, HASM wrote:
>
>> Last, you can use ~/.Xresources to move a lot of that stuff from the
>> Emacs init files and also from the invocation command-line arguments.
>
> I push this into my xrdb:
> -----------------------------------------------------------------
> Emacs*geometry: 100x50
> Emacs.menuBar: off
> Emacs.toolBar: off
> Emacs.horizontalScrollBars: off
> Emacs.verticalScrollBars: off
> Emacs.background: #304060
> Emacs.foreground: white
> Emacs.Font: "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-15"
> -----------------------------------------------------------------
I tried this, but got inexplicable errors - despite xlsfonts showing my
font, it nevertheless claimed it was a nonexistent font when I started
emacs. It's not worth spending more time on this, but I did discover one
important fact that someone working on emacs might or might not be
interested in:
My earlier speculation about the timing of the bug was wrong. All the
mis-scaling occurs in processing the single setup line:
(custom-set-faces
'(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil
:strike-through nil :overline nil :underline nil :slant normal :weight
normal :height 90 :width normal :foundry "bitstream" :family "Bitstream
Vera Sans Mono"))))
...
When that default line is in, all the wrong stuff happens, without it,
none of it does. So it seems that instead of changing all the specs and
then redisplaying, emacs is changing some settings, displaying, then
changing some more and displaying again, instead of changing all
settings and displaying only once.
Pity it wasn't a simple fix, but thanks to all for your time and effort!
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: SOLVED setting default font and window size
2016-07-29 6:09 ` Ron House
@ 2016-08-01 11:19 ` Ron House
0 siblings, 0 replies; 12+ messages in thread
From: Ron House @ 2016-08-01 11:19 UTC (permalink / raw)
To: help-gnu-emacs
On 29/07/16 16:09, Ron House wrote:
> Pity it wasn't a simple fix, but thanks to all for your time and effort!
And just then, a bright idea collided with the victim...
Let emacs start up, let all the nonsense happen until the font has been
chosen, THEN resize the window! So I put this at the bottom of my .emacs:
(when window-system (set-frame-size (selected-frame) 90 70))
(add-to-list 'default-frame-alist '(height . 70))
(add-to-list 'default-frame-alist '(width . 90))
The first line resizes the opening window, the next 2 resize any windows
opened with ^X-5-2.
Thanks again to all.
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-08-01 11:19 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28 5:18 Trouble setting default font and window size Ron House
2016-07-28 5:43 ` Emanuel Berg
2016-07-28 12:37 ` Ron House
2016-07-28 12:47 ` Ron House
2016-07-28 14:57 ` Eli Zaretskii
2016-07-28 13:57 ` Emanuel Berg
2016-07-28 15:30 ` HASM
2016-07-28 16:01 ` Emanuel Berg
2016-07-28 21:26 ` HASM
2016-07-29 2:34 ` Emanuel Berg
2016-07-29 6:09 ` Ron House
2016-08-01 11:19 ` SOLVED " Ron House
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.