LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   emacs font setting (https://www.linuxquestions.org/questions/linux-software-2/emacs-font-setting-910091/)

ridgeland 10-25-2011 12:22 PM

emacs font setting
 
1 Attachment(s)
Hi,

I have following two lines in ~/.emacs file to set my own font size for Emacs in linux. However, the problem that I have is that, if I open up a new frame by choosing File -> New Frame in Emacs menu, the new frame opened does not have the same font setting. It seems to changed to some other settings. Please see my attached two emacs windows. The right one is the correct one. But the left one does not work. And the left one is a new frame opened from the right one. Why?

Thanks.

AuroraZero 10-25-2011 01:07 PM

Need a bit more info. Distro, GUI and file manager you are using. Does it do it if you open the file in the same window? Or only when you open them in new windows?

ntubski 10-25-2011 01:12 PM

Quote:

Originally Posted by ridgeland (Post 4507954)
Hi,

I have following two lines in ~/.emacs file to set my own font size for Emacs in linux.

Is that the (set-default-font ... line?

Quote:

However, the problem that I have is that, if I open up a new frame by choosing File -> New Frame in Emacs menu, the new frame opened does not have the same font setting... Why?
Code:

set-default-font is an alias for `set-frame-font' in `frame.el'.

(set-default-font FONT-NAME &optional KEEP-SIZE)

This function is obsolete since 23.1;
use `set-frame-font' instead.

Set the font of the selected frame to FONT-NAME.
When called interactively, prompt for the name of the font to use.
To get the frame's current default font, use `frame-parameters'.

The default behavior is to keep the numbers of lines and columns in
the frame, thus may change its pixel size.  If optional KEEP-SIZE is
non-nil (interactively, prefix argument) the current frame size (in
pixels) is kept by adjusting the numbers of the lines and columns.

Try (set-face-attribute 'default nil :font FONT) instead, from EmacsWiki - Globally Change the Default Font.

ridgeland 10-25-2011 01:23 PM

Quote:

Originally Posted by AuroraZero (Post 4507990)
Need a bit more info. Distro, GUI and file manager you are using. Does it do it if you open the file in the same window? Or only when you open them in new windows?

I am using KDE windown manager. The problem is that, when I open a file the first time in Emacs, it is ok. After that, in the existing Emacs window, I chose File -> New Frame from the menu. Then it will open up a second window which change the font from the first window. I don't know why?

ridgeland 10-25-2011 01:31 PM

I just tried both "set-frame-font" and (set-face-attribute 'default nil :font FONT). Neither work. I still have the same problem. The first window works. The second window opened from the first window does not.

AuroraZero 10-25-2011 01:38 PM

Try Options set default font. Let me know if that works.

ridgeland 10-25-2011 02:54 PM

Quote:

Originally Posted by AuroraZero (Post 4508017)
Try Options set default font. Let me know if that works.

How to do that?

AuroraZero 10-25-2011 03:11 PM

Open up Emacs click options and have a look man.

ridgeland 10-25-2011 03:30 PM

Quote:

Originally Posted by AuroraZero (Post 4508089)
Open up Emacs click options and have a look man.

The only related option I see is "save options". This will basically save your current setting, and save it into ~/.emacs file. I've already mentioned in my previous posts that I have a function to set the default font in ~/.emacs file. But that function does not work correctly. Do you know why that function does not work correctly? Look at the attached picture in the first note, which is ~/.emacs file I posted. The line "(set-default-font ...)" is the function that I am using. I also tried "(set-frame-font ...)" based on someone's suggestion. Does not work either. Any suggestion?

AuroraZero 10-25-2011 03:38 PM

Try adding this and removing what you have in the default font settings "-adobe-courier-medium-r-normal--18-180-75-75-m-110-iso8859-1". See of that syntax works.

ridgeland 10-25-2011 03:43 PM

Quote:

Originally Posted by AuroraZero (Post 4508104)
What version of Emacs are you using?

GNU Emacs 21.4.1

AuroraZero 10-25-2011 03:50 PM

In the new one you can change the fonts from the menu. This takes away the need for the right names and syntax. You may want to look into the newest version which I believe is 23. I am not saying you have to change but it may be a good idea if you did change.

ridgeland 10-25-2011 04:04 PM

The problem is that, I don't have root password to install any newer version. by the way, where can I download a newer version Emacs?

AuroraZero 10-25-2011 04:17 PM

http://www.gnu.org/s/emacs/ Try that line I posted and see if it works.

ridgeland 10-25-2011 04:25 PM

Tried downloading it. But cannot install it without root password. Do you have the same problem as me in the newer version?


All times are GMT -5. The time now is 05:50 AM.