I am using org-mode within Emacs.
The problem is after issuing C-c > or C-c .
org-mode insert date like below,
(firstly it appears within the minibuffer, even the editing file is encoded with utf-8)
<2012-12-09 \326\334\310\325>
How to resolve this issue? My OS is Win7 32bit Chinese version.
Basically, I think the fonts emacs is using are not able to display the way the day is spelled in your language. I'd guess you lack some installed fonts, or emacs doesn't know where to find them, but I'm not sure how to fix this.
That being said, inserting such octal escapes into my emacs gives me ÖÜÈÕ, which I don't believe to be how days spell in many languages. The file might be encoded in utf-8, but what about the buffer ? What's the buffer-file-coding-system variable in that buffer (C-h v buffer-file-coding-system) ?
The variables calendar-day-name-array and org-time-stamp-custom-formats might be of interest, and I guess you could override how the timestamps appear right now with org-display-custom-times, that would probably be a workaround. See the manual for more about it.
At last, I have
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
in my config, functions you may want to investigate about.
I met the same problem to yours.
Through a long time searching online, I found (setq system-time-locale "C") work.
I tried to fix this problem in August, 2014.
My solution is adding the following code into your Emacs config file:
(set-locale-environment "zh_CN.utf-8")
Note that the time will be displayed in Chinese. Hope it helps.
Related
I want my emacs to globally replace
:>>:
with
»
during typing. Any other typing combination is ok, too. I just chose :...: because that made it easier for emacs to descern the "name" of the replacement. I have a couple of sequences I want to be replaced in this way, i.e.
:>>: with »
:<<: with «
:e/: with e-accent-acute
:e\: with e-accent-grave
and so on.
Maybe there is a mechanism in emacs I can use. But googling did not get anything useful, I probably did not use the right search terms.
One big issue seems to be that the » in question is a unicode char and the .emacs-file has problems with that?
Emacs supports many Input Methods (doc here).
For example, with the latin-1-prefix input method, you can type `e to get the grave accented e; ~< will give you the opening guillemet.
Call set-input-method and select latin-1-prefix for this.
The function describe-input-method will show you complete help for your current input method.
Another interesting input method is TeX, which substitutes TeX symbols on the fly, such as \Delta, ^1, ~n, etc.
Answer to related question here. Nice tutorials here or here.
Use Abbrev Mode. Set :>>: to map to » etc.. The mode will automatically substitute. To do this, edit the abbrev file to include your mapping, or simply create the mapping in Emacs and save it with M-x write-abbrev-file.
p.s. I think Emacs is Unicode safe ATM. I've been using various Unicode characters for a long time.
In some files, especially .rb I have a problem where emacs forces me to have the following encoding line.
# -*- coding: utf-8 -*-
Even if I delete the line it will get written again once I save my file.
Is it possible to disable this feature?
It looks like this is part of the ruby-mode in emacs.
I found a link to an article that shows how to edit the ruby-mode.el file. Not sure if it works, but there is also a comment on that article that may work better:
(setq ruby-insert-encoding-magic-comment nil)
If instead of using ruby-mode your are using enh-ruby-mode you should set this variable:
(setq enh-ruby-add-encoding-comment-on-save nil)
Links:
Fix: Emacs/Aquamacs keeps adding encoding comments to my files
Also, semi-related question but pertinent answer by Michael Kohl: How can I avoid putting the magic encoding comment on top of every UTF-8 file in Ruby 1.9?
Enh-ruby-mode comment encoding line
If you've copied/pasted code from the Internet into an Emacs buffer, you might actually have non-ASCII characters. The # -*- coding: utf-8 -*- is Emacs way of telling you that it can't simply encode the file as ASCII. Scan the code for potentially offending characters (in my case it was "smart quotes" copied from http://matteomelani.wordpress.com/2011/10/17/authentication-for-mobile-devices/. Of course Ruby barfed on them.
It is the default behaviour in Emacs 28 not to write this line if the encoding is UTF-8.
At the time of writing, Emacs 28 has not yet been released, but, when it is, perhaps in 2022, upgrading should solve the problem.
When I run Emacs command ispell-buffer on an Emacs buffer which is in the LaTeX mode, ispell checks spelling also inside math expressions.
I'd very much like to disable this. Is there an easy way to do it?
I've read about detex but detex does not seem to be integrated into Emacs.
It shouldn't do this, if you are using latexisms (eg. \[ ... \], equation environments, &c) to invoke math mode. Check the contents of ispell-tex-skip-alists; cf. section 6 of the ispell FAQ for what kind of thing should be there.
You can use $..$, $$..$$ to mark out maths using ispell-tex-skip-alists, but beware getting them out of kilter...
Postscript
Check also the value of the ispell-parser variable: this should be 'tex, otherwise ispell will not look for $...$ and $$...$$ regions.
Yes, you can: install aspell instead of ispell, and use flyspell with it.
This doesn't answer your question directly, but I have found Flyspell, an on-the-fly spell checker, incredibly useful when editing LaTeX documents. It still spellchecks inside equations, but it is much easier to ignore a few extra red underlines than ispell's interactive commands.
You may know this, but you can press A during spell checking to add a word to the buffer-local dictionary (that's capital A, lowercase a adds it to the global dictionary). It's not ideal, but this is how I usually suppress spell-checking of technical terms and variable names, etc., in my LaTeX documents.
This AUCTeX mailing list thread : "spell checker (ispell-buffer) complains about products in math modes" has some workarounds and the answer demonstrates how to use ispell-tex-skip-alists.
Another approach is to use ispell-skip-region-alist. The following example is to exclude org-mode src blocks:
(add-to-list 'ispell-skip-region-alist '("#\\+begin_src". "#\\+end_src"))
I use emacs to edit most of my answers for SO, and although I use longlines-mode (I have not upgraded to emacs 23 because of some critical bugs that don't look like being fixed any time soon), I can't find a way to get longlines-mode to respect the indentation used for Markdown. I would really like to fix this, but I want it for an ordinary buffer, not for org-mode (as already answered).
Does anybody have suggestions on how I can get longlines-mode to indent wrapped lines? I am definitely willing to try hacking the Emacs Lisp, although my Emacs Lisp is pretty rusty...
I just looked through the source code of longlines.el. There doesn't seem to be any hook there to have the wrapped lines indented. If you want to do this, you'll need to write a bit of elisp (and, more importantly, understand all of the functions for doing text-properties.)
I'm writing a text with Latex in English but written my comments in Finnish. When I'm running the spell checking with ispell, I got to run through all the comments. Is there a handy way to skip the comments with the ispell? If that could be done with emacs, that would be double handy =)
One way would be to run the ispell within console and process the input with sed, for example, but I'd like to have my changes straight on the file...
(setq ispell-check-comments nil)
You'd have to dig in the code a bit, but when you spell-check a file, it's running the detex tool to strip out the TeX code. You should be able to modify the pipeline to have a sed or perl script strip the comment lines.
I kind of vaguely think AuC-TeX makes this configurable, but 30 seconds looking didn't reveal it.
Adding a modern answer to this old question, because I also had the problem:
Just use aspell, which does this out of the box.