I've installed emacs 24.3, and I would like to use a specific font (Meslo LG M DZ), but when I launch emacs, I have the message "Font `Meslo LG M DZ' is not defined". What is strange, is that when I downgrade emacs version from 24 to 23, using the same configuration file, I can use this font without any problem...
Here is how I declare Meslo in the configuration file :
(setq default-frame-alist
'(
(width . 80)
(tool-bar-lines . 0)
=> (font . "Meslo LG M DZ") <=
(vertical-scroll-bars . nil)
))
(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode))
...
How can I solve this?
You could try setting the font manually using the
Options->Set default font
menu, and then clicking
Options->Save Options, which will write the setting automatically to your .emacs file. You could then use that snippet henceforth.
It was just a matter of compilation option...
I didn't use "--without-xft", but I needed to explicitly put "--with-xft".
Related
So I have been using emacs a lot lately. And I have been noticing that the window resizes for a second when it starts up. Is there a way to fix that?
Here is the GIF of what I'm talking about.
To prevent Emacs from resizing its window after startup, put all geometry and font options on the command line or .Xdefaults file rather than in .emacs or other lisp init files.
The initial Emacs frame is drawn before running the lisp startup files, but the X config and command line options have already been read.
As your GIF is mainly showing a width change, with only a minor change in height and no change in the position of the frame, I suspect it is most likely font settings rather than size settings that you need to look for.
My Sample Code (Ensure to put these codes at the first line of your init.el file)
(setq frame-inhibit-implied-resize t) ;; prevent resize window on startup
(setq default-frame-alist '((width . 120) (height . 42)))
(defun x/disable-scroll-bars (frame)
(modify-frame-parameters frame '((horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil))))
(if (display-graphic-p)
(progn
(scroll-bar-mode -1)
(tool-bar-mode -1)
(fringe-mode '(8 . 0))
(add-hook 'after-make-frame-functions 'x/disable-scroll-bars))
(progn
(menu-bar-mode -1)
(setq-default
left-margin-width 1
right-margin-width 0)))
The core is (setq frame-inhibit-implied-resize t).
I've got this line in my .emacs to go fullscreen on startup:
(add-to-list 'default-frame-alist '(fullscreen . maximized))
I run Emacs from WSL with an X11 server on Windows 10. I could set some -geometry to make it not resize into a minimal initial window, but that seemed to be flaky and random. This happened with both Xming and Vcxsrv. It happened even with -Q so in my case it was not related to anything in my startup files.
I haven't tried Cygwins X11 server, but when I tried the evaluation version X410 (available in the Windows Store) it did not have the same problem.
I've been using the emacs that is bundled with the Mac OS X Terminal and it is fine, but it is an older version. I like it because I can easily control the entire Terminal font size in OS X easily.
I installed the most recent version of emacs which appears to be a different animal. It's a pseudo-gui with buttons and it is outside the Terminal environment. I've been trying to figure out how to adjust the font size of the screen with no luck. Anyone can help?
Maybe I'm dumb but I rather prefer the text-only nature of the older emacs version I was using. Trying to force a menu/mouse system in there seems to go against the primitive beauty of the system.
Your basic reference for font customization is: http://www.emacswiki.org/emacs/CustomizingFaces
If you don't want to do customization via the emacs customize feature (I don't care for it myself), then this question has a good answer: How to set the font size in Emacs?
As for the gui jibba jabba, here's what I have in my .emacs:
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
Turns all of that off. :-)
edit:
I suggest using the same emacs file and have a test for the NextStep libraries used in the GUI....
(when (featurep 'ns)
;; do GUI stuff like font fiddling
)
Type this:
M-x text-scale-adjust
Then you can use the key:
+: Increasing the default face height by one step.
-: Decreasing the default face height by one step.
0: Reset the default face height to the global default.
I am using GNU Emacs 24.3.1 (x86_64-suse-linux-gnu, GTK+ Version 3.6.4). I have custom font Inconsolata-g in my ~/.fonts folder, and I have set it as Monospace font in ~/.config/fontconfig/fonts.conf. It works well except Emacs is giving me error: Invalid font name, -unknown-Inconsolata-g-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1 at launch.
If I change monospace font, then Emacs launch without problem, but when I do M-x set-default-font, and select -unknown-Inconsolata-g-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1, I also get Invalid font name: "-unknown-Inconsolata-g-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1".
How could i fix this?
Thanks to Peter Dyballa (http://lists.gnu.org/archive/html/help-gnu-emacs/2013-06/msg00347.html), I fixed this with the following in my ~/.emacs:
(setq initial-frame-alist '(
(font . "Monospace-10")
))
(setq default-frame-alist '(
(font . "Monospace-10")
))
(I have set Monospace to Inconsolata-g in my system settings)
After over two weeks emacs 24.3 for Mountain Lion 10.8.3 setup, I am still unable to fix the indentation setup.
The issues:
- in scratch mode & R mode the indentation is not working. I am now using spaces
- in C++ mode, I have to toggle off the syntactic indentation in order to indent for a width of 2 columns. I want to do at least 3 columns but failed with the .emacs file
;; Set default tab to 4 spaces
(setq default-tab-width 4)
Emacswiki said the TAB indentation is only temporarily activated for auto-complete prompt so I set this up in .emacs file as well
(ac-set-trigger-key "TAB")
Because I cannot use TAB to indent, I just disable the settings above and still unsuccessful.
There is very lengthy materials in CC mode about indentation. However, I am happy with C++ mode and auto-complete. And I am hesitant to waste a few more days on CC mode just for sake of indentation.
Is there global settings for indentation in .emacs file? If no such settings, what should be the correct settings for indentation for C++ and ESS model (R) in .emacs file?
You seem to think that using CC mode would mean not using C++ mode. Actually cc-mode is the package that provides C++ mode. So the info you saw about how to set up indentation for CC mode should apply to C++ mode.
Here is a simplification of what I have in my .emacs:
(defun set-up-c-mode-styles ()
(c-add-style
"mystyle"
'(
(c-basic-offset . 3)
(c-hanging-braces-alist . nil )
(c-block-comments-indent-p . nil )
(c-recognize-knr-p . t)
(c-offsets-alist . (
(substatement . +)
(substatement-open . 0)
(case-label . 0)
(statement-case-intro . +)
(statement-case-open . +)
(arglist-close . 0)
(defun-close . 0)
)
)
)
't
)
(c-set-style "mystyle")
)
(add-hook 'c-mode-common-hook 'set-up-c-mode-styles)
Does anyone know if I can find an emacs color syntax configuration which resembles eclipse's syntax coloring? Thank you for any suggestion.
I'm not sure what Eclipse looks like, but you might want to check out Color Theme There are lots of color themes included with it and you can easily create you own if you don't like any you see.
I think you want font-lock. The emacs name for syntax coloring. I get it with the mode (Java mode, C# mode, cc-mode, etc).
I have in my .emacs:
;; for fontification in emacs progmodes:
(load "font-lock")
(setq font-lock-maximum-decoration t)
;; turn on font-lock globally
(global-font-lock-mode 1 'ON)
And then it just works, for all the various prog modes.
Emacs with C# http://www.freeimagehosting.net/uploads/6be39f23a3.jpg
Try this... http://jasonm23.github.com/emacs-theme-editor/
It will customize most of the standard font-lock parameters (keywords, functions, constants, vars, etc....)
You can paste in an existing theme and edit it, if you have something almost right.
There's a few samples on http://jasonm23.github.com
You might also like the code theme generator at http://inspiration.sweyla.com/code/
I use the same .xemacs/init.el file for both Emacs and Xemacs.
In order for it to work, I use the following:
; turn on faces
(font-lock-mode 1)
;; Turn on font-lock mode for Emacs
(cond ((not running-xemacs)
(global-font-lock-mode t)
))
Also you might need to add modes for various files. For example:
(setq auto-mode-alist (mapcar 'purecopy
'(("\\.c$" . c-mode)
("\\.cc$" . c-mode)
("\\.cxx$" . c++-mode)
("\\.htm$" . html-mode)
("\\.java$" . java-mode))))
Note there is also a Go mode for emacs which supports color highlighting. URL for Go-mode for Emacs