When I browse Emacs help for functions via
C-h f, I often want to peek into the Elisp/C implementation. I want to enter
view-mode automatically when I access source code this way to avoid unnecessary modification. Is there a hook or function I can advise to accomplish this?
I use the alternative approach which you can specify entirely in your init file (as opposed to creating a
.dir-locals.el file), and I simply make the files read-only rather than using
view-mode. My config looks like this:
'((nil . ((buffer-read-only . t)
(show-trailing-whitespace . nil)
(tab-width . 8)
(eval . (whitespace-mode -1))))))
(dir-locals-set-directory-class "/usr/local/src/emacs" 'emacs)
(dir-locals-set-directory-class "/usr/local/share/emacs" 'emacs)
(dir-locals-set-directory-class "/usr/share/emacs" 'emacs)
Obviously you can do the same thing for your elpa directory, and any other directory which contains third-party source code.
var wysiwyg = dijit.byId("wysiwyg").get("value");
var wysiwyg_clean = wysiwyg.replace('&','\&');
var poststr = "act=save";
You can use encodeURIComponent().
It will escape all the characters that cannot occur verbatim in URLs:
var wysiwyg_clean = encodeURIComponent(wysiwyg);
In this example, the ampersand character
& will be replaced by the escape sequence
%26, which is valid in URLs.
I am viewing remote log files using tramp mode in emacs. Is there a way to get tramp to auto-refresh these buffers when they change remotely? If this is not possible, is there a way to reload a buffer every time it is opened?
I have tried to set
(global-auto-revert-mode t), but this does not work.
Edit: Just found out that this is intended behaviour:
You can also tell Emacs to revert buffers periodically. To do this for a specific buffer, enable the minor mode Auto-Revert mode by typing M-x auto-revert-mode. This automatically reverts the current buffer every five seconds; you can change the interval through the variable auto-revert-interval. To do the same for all file buffers, type M-x global-auto-revert-mode to enable Global Auto-Revert mode. These minor modes do not check or revert remote files, because that is usually too slow.
There is a customizable variable named auto-revert-remote-files, which does what you want.
I’m a Vim user. But more & more these days I find that one of my favourite versions of Vim is Emacs. Specifically, its
evil-mode package, which is a very good Vim emulator.
If you get started with
evil-mode, one of the first questions you might ask is, “How do I remap ESC to something more finger-friendly?” Some people like to map
jj. Personally I like
jk, because it rolls off the fingers a little more easily.
Anyway, there are a couple of ways to do it in Emacs. The simplest & cleanest I’ve found is to install the
…then add this to your
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
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.
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