I want to copy over the emacs fonts settings from one computer to another - any ideas how to do this.
I did C-u C-x = to get the following :
character: r (0162, 114, 0x72)
charset: ascii (ASCII (ISO646 IRV))
code point: 114
syntax: word
category: a:ASCII l:Latin
buffer code: 0x72
file code: 0x72 (encoded by coding system undecided-unix)
font: -Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO8859-1
Now I want to replicate this on another machine
(Running GNU emacs 23.1.1) ?
Thanks.
You can set the default font using:
(set-default-font "-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO8859-1")
Put this in the target machine's .emacs file, or you can switch at will if you simply execute the line (paste in any buffer, put cursor after ) and use C-x C-e).
Related
On GitHub
why does the code look like this?
It looks fine in all the code editors out there
Ctrl+M characters present in a file in linux, when originally the file came from Windows environment.
You may need to remove Ctrl+M characters, when you import a text file from MS-DOS (or MS-Windows), and forget to transfer it in ASCII or text mode. Here are several ways to do it; pick the one you are most comfortable with.
The easiest way is probably to use the stream editor sed to remove the ^M characters. Type this command: % sed -e "s/^M//" filename > newfilename
To enter ^M, type CTRL-V, then CTRL-M. That is, hold down the CTRL key then press V and M in succession.
You can also do it in vi: % vi filename
Inside vi [in ESC mode] type: :%s/^M//g
To enter ^M, type CTRL-V, then CTRL-M. That is, hold down the CTRL key then press V and M in succession.
You can also do it inside Emacs. To do so, follow these steps:
Go to the beginning of the document
Type: M-x replace-string RET C-q C-m RET RET
where "RET" means and C-q and C-m mean .
Courtesy: https://its.ucsc.edu/unix-timeshare/tutorials/clean-ctrl-m.html
I write my SQL-queries with Emacs. Now, I encountered the following problem. I have a query which has the greek letter μ.
SELECT *
FROM tab.labor
WHERE unit = 'μg/l'
To write the μ, I used the suggestion from greek:
M-x set-input-method RET TeX
and to go back:
M-x toggle-input-method
When I close the file and reopen it, I got the following query:
SELECT *
FROM tab.labor
WHERE unit = 'μg/l'
If I open the file with notepad I got the correct version. How can I set Emacs to get greek letters?
Thanks for help.
PS:
Windows 7
GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
Try M-x revert-buffer-with-coding-system and specify utf-8. It looks like the file was saved in UTF-8, but Emacs opened it as Latin-1 for some reason.
Specify the encoding of the file you want to open:
C-xEntercutf-8EnterC-xC-ffilenameEnter
I work with emacs23 with the iso-8859-1 coding system. I have these lines in my .emacs file:
(setq default-buffer-file-coding-system 'iso-8859-1)
(set-selection-coding-system 'iso-8859-1)
However, if I try to copy a non-ASCII character from another window and paste it to my emacs window, it doesn't work correctly. For instance, if I try to copy and paste "ì" I get "ì". How can I fix it?
As suggested by Karol S, it seems that the best thing to do is switch emacs to UTF-8.
I have a .txt file named COPYING which is edited on windows.
It contains Windows-style line breaks :
$ file COPYING
COPYING: ASCII English text, with CRLF line terminators
I tried to convert it to Unix style using dos2unix. Below is the output :
$ dos2unix COPYING
dos2unix: Skipping binary file COPYING
I was surprised to find that the dos2unix program reports it as a binary file. Then using some other editor (not Emacs) I found that the file contains a control character. I am interested in finding all the invisible characters in the file using Emacs.
By googling, I have found the following solution which uses tr :
tr -cd '\11\12\40-\176' < file_name
How can I do the same in an Emacs way? I tried the Hexl mode. The Hexl mode shows text and their corresponding ASCII values in a single buffer which is great. How do I find the characters which have ASCII values other than 11-12, 40-176 (i.e tab, space, and visible characters)? I tried to create a regular expression for that search, but it is quite complicated.
To see invisible characters, you can try whitespace-mode. Spaces and tabs will be displayed with a symbol in a different face. If the coding system is automatically being detected as dos (showing (DOS) on the status bar), carriage returns at the end of a line will be hidden as well. Run revert-buffer-with-coding-system to switch it to Unix or binary (e.g. C-x RET r unix) and they'll always show up as ^M. The binary coding system will display any non-ASCII characters as control characters as well.
Emacs won't hide any character by default. Press Ctrl+Meta+%, or Esc then Ctrl+% if the former is too hard on your fingers, or M-x replace-regexp RET if you prefer. Then, for the regular expression, enter
[^#-^H^K-^_^?]
However, where I wrote ^H, type Ctrl+Q then Ctrl+H, to enter a “control-H” character literally, and similarly for the others. You can press Ctrl+Q then Ctrl+Space for ^#, and usually Ctrl+Q then Backspace for ^?. Replace all occurrences of this regular expression by the empty string.
Since you have the file open in Emacs, you can change its line endings while you're at it. Press C-x RET f (Ctrl+X Return F) and enter us-ascii-unix as the new desired encoding for the file.
Check out M-x set-buffer-file-coding-system. From the documentation:
(set-buffer-file-coding-system CODING-SYSTEM &optional FORCE NOMODIFY)
Set the file coding-system of the current buffer to CODING-SYSTEM.
This means that when you save the buffer, it will be converted
according to CODING-SYSTEM. For a list of possible values of
CODING-SYSTEM, use M-x list-coding-systems.
So, going from DOS to UNIX, M-x set-buffer-file-coding-system unix.
I'm using Emacs on windows. My default folder is c:/home, but I want to edit my file in d:/ how to do it in ido mode ? I tried // but that put me in c:/.
Currently, I use C-f (change back to normal find file mode), but that defeat the purpose of using ido mode in first place....
As stated in a comment you just type "d:/" in the minibuffer while in ido-find-file. You don't need to be at the start of the string, it's intelligent enough to know what you're trying to do.
C-x C-f d:/ MyFile.txt
will point you at the file D:/MyFile.txt