Overriding Emacs 23 font substitutions - emacs

I use emacs with org-mode and other packages that assume all characters have the same width. This was not problematic until I started using Emacs 23 (on Mac and Linux) instead of Carbon Emacs. Now many non-ASCII characters (such as the phonetic characters in 0250–02AF) are rendered with a different font with different metrics. I would like to force emacs to render these characters with the same font as ASCII characters, e.g. DejaVu Sans Mono 10. How can this be achieved? Where is the documentation relating to emacs fonts in never versions located?

Try
(set-fontset-font
nil '(#x0250 . #x02af) (font-spec :family "DejaVu Sans Mono"))

You can move the cursor (point) over the phonetic character and do a C-u C-x = to run some version of what-cursor-position. This will open another buffer containing information about what is under the cursor - including a line containing face and a descriptionof what face is used. Remeber the name of the face used.
Then, call M-x customize-face and enter the remembered used face and customize it to your needs.

Related

EMACS, text seems to be shifted

Using,
EMACS 24.5.1 (encoding: UTF-8 (dos/unix))
OS: Windows 8
Terminal: mintty with UTF-8 under Cygwin
Problem:
Any existing text file that I open in EMACS does not hold its indentation (text is shifted either left or right of its original position). The same text file if I open it in VIM in the same terminal session, seems to be have the correct alignment.
This happens to every text file that I open in EMACS.
I assumed the problem might be with encoding or EOL. So I tried changing the encoding of the terminal output in EMACS(using C-x RET r RET | C-x RET t RET) but that did not help.
I have been reading the official manual but can't seem to solve this issue.
Has anybody got any suggestion of how I should correct this indentation/alignment/EOL problem?
Thanks in advance.
P.S. I saw some similar emacs encoding problems on here but none of them seemed to have helped.
The problem was with the tab size and nothing to do with the encoding.
Emacs is actually pretty awesome in detecting the encoding.
The tab size = 8 white space character in Emacs by default. All my other editors I had set to 4 white space characters hence they all seem to be shifted or lost their indentation when opened in Emacs.
I have used the below configuration in my .emacs file to correct this to tabs = 4 white space char.
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
Thanks again Chris for the solution

Display all unicode characters in Emacs under OS X

First of all, please look at this screenshot
I have GUI Emacs installed via Homebrew on the left and another one running inside iTerm2 with -nw option on the right. Both of them are using Droid Sans Mono font.
But, as you can see, the right one can perfectly handle all unicode characters. I think iTerm2 helps here:
on the left display says that there is no font available
on the right display is equal to terminal code #xF0 #x9F #x8D #xBA
How can I achieve the same result in GUI Emacs as I can have in iTerm2?
OK, I finally managed this issue with these lines in my emacs config:
;; set proper language (fixes cyrillic letters in ansi-term)
(setenv "LANG" "ru_RU.UTF-8")
;; default font
(set-face-attribute 'default nil :family "Droid Sans Mono")
;; font for all unicode characters
(set-fontset-font t 'unicode "Symbola" nil 'prepend)
;; override font for cyrillic characters
(set-fontset-font t 'cyrillic "Droid Sans Mono")
The first line can be ignored, as it only for fixing cyrillic letters in ansi-term.
The steps are:
set your default font with set-face-attribute
then set different font for the specific character-sets via set-fontset-font
Of course, I'll need to set specific range of characters for Symbola font, but it works for me now.
P.S. but I still can't get colored emoji in Emacs as I have in iTerm2

Filename in chinese shows as unicode characters

when using C-x C-f, the filename which includes Chinese characters are shown as following:
How can I configure it to show Chinese words? Thank you.
=====updated=======
System: OS X 10.8.4
Emacs version: GNU Emacs 24.3.1 (x86_64-apple-darwin)
I think this may be caused by one of those annoying interactions between the operating system and Emacs. Emacs doesn't seem to know how to interpret the file names, so let's try to help it by inserting this in your .emacs file.
(setq default-buffer-file-coding-system 'utf-8-unix)
(setq default-file-name-coding-system 'gb2312)
(setq default-keyboard-coding-system 'utf-8-unix)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
You may need to try a different system instead of gb2312.

Tomorrow theme for Emacs shows Chinese charaters as blocks

I installed Tomorrow theme into my Emacs24 using melpa.
Chinese characters appeared as blocks in comments while showing the correct characters in other places.
The default font in my .emacs is like following:
(set-default-font "Menlo-12")
(setq default-frame-alist '(font . "Menlo-12"))
It seems like the Menlo font doesn't support italic Chinese characters. Type M-x customize-face RET font-lock-comment-face and change "slant" to "normal", and the characters should appear.

Font Families for Emacs

If I do M-x customize-face RET default I can adjust the default face (font) in Emacs.
There are several options, all of them explained in the documentation. Many of these options can be selected from a menu when you select/click on Value Menu, but not the Font Family.
How can I see a list of the fonts that I can use in Font Family in Emacs?
Type the following in the *scratch* buffer, and press C-j at the end of it:
(font-family-list)
You may need to expand the result to see all of them, by hitting enter on the ... at the end.
If you are using Emacs 23.1 or later on the X Window System, the following fc-list command can list font families available on your system for Emacs (or any application using fontconfig):
$ fc-list : family