- 浏览: 558226 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
binglex:
谢谢,出现这个异常,看来这个贴才发现site-packages ...
cx_Oracle的"Unable to acquire Oracle environment handle"异常 -
lizhongkan:
这样过度比较方便。但如果原来的项目,有几十个依赖的jar包,是 ...
maven2的pom的依赖管理 -
landmine:
博文看不清呀楼主,怎么解决的?我也遇到了
applet在IE下运行极慢而且CPU占用很高 -
strivefuture:
这种方法对FF浏览器,有效吗?
Iframe Shim解决applet挡住ExtJS工具栏菜单问题 -
zw:
老大也有粗心的时候啊!
一个属性未设置导致发mail不成功的郁闷。
Remark:
For changes in the .emacs file to take effect, you need to restart
emacs or type "M-x eval-buffer <ret>"
Q: What does fontlocking do ?
A: Font Lock mode is a minor mode, always local to a particular
buffer,
which highlights (or "fontifies") using various faces according to
the
syntax of the text you are editing. It can recognize comments
and
strings in most languages; in several languages, it can also recognize
and properly highlight various other important constructs--for example,
names of functions being defined or reserved keywords.
Font Locking is turned on automatically in the emacs-default file.
It
recognizes fileformats based on their extension (e.g. .tex
for
a latex file,
.c
for a c-file or .C
for a c++-file).
Q: How do I change the colors of
my text ?
A: Font Lock recognizes patterns and assigns a face-value to them.
You can change the color and font-properties of this face yourself.
If you want to see the list of all used faces, type M-x list-faces-display
(with M the meta or alt key) or go to "Edit" "Text Properties" "Display
Faces" in the menu bar.
You can create your own faces or change properties of an existing face.
Some possible properties are:
- background
- boldness
- font
- foreground
- italic
- underline
If you want to change the foreground color of all comments to yellow for
instance,
add the following lines to your .emacs file:
(set-face-foreground 'font-lock-comment-face "Yellow" )
(set-variable font-lock-comment-face 'font-lock-comment-face)
You can find the name font-lock-comment-face
via the list of
the faces.
The function set-face-foreground
sets the color.
Q: How do I add keywords or patterns
to a certain mode ?
A: Font Lock highlighting patterns already exist for many modes, but
you
may want to fontify additional patterns. You can use the function
`font-lock-add-keywords', to add your own highlighting patterns for
a
particular mode. For example, if you want to put the string
with the filename
after an include
or import
statement in a c-file in the
same face as the word
include
or import
, put the following in your .emacs file
(font-lock-add-keywords
'c-mode
; put the string after include and import in the same color
'(("^#[ \t]*\\(import\\|include\\)[ \t]*\\(<[^>\"\n]*>?\\)"
2 font-lock-builtin-face t)
; put the # before the keywords in the same color
("^#[ \t]*\\(import\\|include\\|ifdef\\|endif\\|ifndef\\|elif\\|endif\\|define\\)[
\t]*" 0 font-lock-builtin-face t)))
Q: What's a keybinding ?
A: A keybinding "binds" a certain key to a command that is executed
every time
the key is pressed. For instance M-v (Meta-v or Alt-v) is bound to
PgUp.
Q: How do I set my own keybindings ?
A: You might want to set keybindings of your own. You can do this with
the command
global-set-key
A particular interesting key-binding for me for instance is the one
for "goto-line"
Put the following line in your .emacs:
(global-set-key [?\M-\l] 'goto-line)
This will bind the key M-l to the goto-line function.
Q: How do I create a key to kill all
characters up to the beginning of the line ?
A: First you have to define the function which performs this. You can
for instance put the following code in your .emacs files
(defun kill-upto-begin-line (foo)
"Function to kill everything up to beginning of line"
(interactive "P")
(setq num (current-column))
(while (> num 0)
(backward-delete-char-untabify 1)
(setq num (current-column))))
Then you can bind the function to a key, for instance the M-k key:
(global-set-key [?\M-\k] 'kill-upto-begin-line)
Q: How can I read mail with emacs ?
A: You can read, send, dispose, ... mail with the great program "vm"
You start it by typing M-x vm (enter)
You will have to put (require 'vm) in your .emacs file first though.
Q: Are there other mail readers ?
A: Emacs has also got an internal mail reader called Rmail.
Q: How can I customize my vm mail
program ?
A: You can put some customizations in a .vm file
If you want to know all possible variables to customize, read the manual
!
Q: Can I see an example customization
file for vm ?
A: Yes, there is one right here
Q: How can I speed up MIME encoding
and decoding ?
A: VM can encode and decode MIME attachments. It uses internal functions
for this which can be very slow. A way to speed up this process is
to compile
your own encoder and decoder and tell vm to use these instead.
You can find source-code for these processes right here:
base64-encode.c
and base64-decode.c
Copy these files into a directory you own (for instance ~/bin) and
compile
them with the commands
"gcc -o base64-encode base64-encode.c" and
"gcc -o base64-decode base64-decode.c"
Add the following lines into your .emacs file (or .vm file if you have one)
(setq vm-mime-base64-decoder-program "FULL_PATH_TO_FILE/base64-decode")
(setq vm-mime-base64-encoder-program "FULL_PATH_TO_FILE/base64-encode")
where FULL_PATH_TO_FILE is the correct path to your 2 executables. For
instance if you
put them in ~/bin and you are a student who should graduate in 2002
with login name "janssens",
FULL_PATH_TO_FILE is "/users/prom2002/janssens"
This will do the trick.
Q: How can I read news with emacs ?
A: You can read news with the gnus
program, standard for emacs.
If you want to start it, type M-x gnus (enter)
For more info, read the manual.
Q: How do I define which news-server to
use ?
A: You can define a variable for this in your .emacs file
For the kuleuven news server you should use the following line:
(setq gnus-nntp-server "news.kulnet.kuleuven.ac.be")
This is the default server that has been set in the emacs-default file.
Q: How can I put the scrollbar on the right
?
A: Put the following two lines in your .emacs file:
(setq scroll-bar-mode-explicit t)
(set-scroll-bar-mode `right)
Q: What's the problem ?
A: Dos and Unix use different characters to denote an end-of-line.
Unix uses a "newline" while Dos uses a "carriage-return".
This is why a file, saved in Dos but viewed in Unix shows the typical
"^M" at the end of each line.
Q: What can emacs do ?
A: emacs detects which coding system is used for representing the end-of-line.
If it's a unix file, it will show a ":" on the status line and emacs
will always use the newline
character to denote an end-of-line.
If it's a dos file, you will see "(DOS)" in the status line and emacs
will use the carriage return to
denote an end-of-line when saving the file. This means that emacs does
not alter the coding system of
a file. You don't see the "^M" in the file but emacs will write them
out when saving the file.
Q: How to convert from Dos to Unix
?
A: Since emacs doesn't show the "^M" in the file, you might believe
the carriage returns have dissapeared.
This is not the case: emacs still writes the "^M" when saving the file.
To get rid of them (and thus change the file from Dos to Unix text),
use the following sequence of commands:
- type M-x set-buffer-file-coding-system RET and choose `undecided-unix'
- save the file
Q: What do you mean ?
A: Sometimes you want to become another user or login to another machine
to be able to open and/or save a file.
You could go back to your terminal, start an ssh (or su) -session and
start a new emacs.
But why go through all this trouble if you can do this inside (the
already running) emacs ?!
Q: Can't I just use ange-ftp ?
A: There was the solution to this problem in emacs, called "ange-ftp".
This package uses the ftp
protocol to get save files on another
machine or as a different user.
The major disadvantage of this is the fact that ftp doesn't use any
form of encryption.
In other words, your passwords are flying totally unprotected over
the network !
Luckily there's a new package now, called TRAMP
which deals
with this problem.
Q: What's this Tramp package ?
A: Tramp
is a package which allows you to use ssh
and
scp
to open and save files on other machines or as another user.
These programs use encryption to protect your passwords.
You can read more about these programs here
.
Q: How do I use Tramp ?
A: The usage of Tramp is very similar to that of ange-ftp.
Suppose you want to open the ".emacs" file on the machine "cassini
"
as user "robust
".
For this you type the following command:
C-x C-f /r@scp:robust@cassini:~/.emacs
This makes Tramp use the "scp
" command to open the file.
Be careful: this only works if scp doesn't need a password to become
"robust" on "cassini",
i.e. if there is an entry in the file "~robust/ssh/authorized-keys"
with your key.
If this is not the case, you need to use the "ssh" command with "uuencode".
The command for this is
C-x C-f /r@su:robust@cassini:~/.emacs
Tramp will use "ssh
" and will ask you for the password of "robust".
If you enter the correct password, the file will be opened. Because
"ssh" is used, the password is encrypted before it is sent.
A: How do I setup Tramp ?
A: If you load the emacs-default
file or if you have no .emacs
file, Tramp is loaded automatically,
so you can use it immediately.
If you don't load emacs-default
, you need to add the following
lines to your .emacs
file:
(require 'tramp)
(setq tramp-default-method "scp")
(setq tramp-remote-path
(append '("/freeware/bin/gnu-tools"
) tramp-remote-path))
Be sure to put these lines AFTER everything that has to do with ange-ftp.
发表评论
-
Linux下常见定位问题步骤
2013-05-06 15:42 1478Linux在服务器端,确实高效好用,并且稳定。但是不同的L ... -
netcat(nc)有1024的限制
2013-04-23 15:43 1346gnu的netcat是个非常不错的网络工具,可是当用来模拟发送 ... -
libtools的--tag=cxx command not found错误
2013-03-01 23:14 2190最近因为storm的原因,需要在各Linux(Debian ... -
Linux和Jetty的一点小冲突
2011-09-05 10:29 1815用Grails开发的一个app,发布在jetty中,开始一 ... -
unix下边删除"-"开头的文件
2011-06-10 11:34 2257ftp的时候,不小心创建了一个"-o" ... -
git修改已经提交的信息
2011-02-11 11:31 6983当你不小心,写错了提交的注视/信息,该如何处理呢。理论上, ... -
Redhat EL5:setup Installed (but unpackaged) file(s) found
2011-01-28 11:17 1721在EL5的系统中,使用Python的setup打包rpm的 ... -
install ruby19 and rubygems on Gentoo
2010-08-26 14:39 1500Ruby1.9.2 have released,but i ... -
emerge 小计
2010-07-13 18:01 1380emerge和ebuild是Gentoo的包管理核心,其 ... -
udev管理下的网卡
2010-07-12 17:14 1782最近在VirtualBox中使用Gentoo,不小心发现, ... -
206-unable to create Linux raw ethernet NIO
2009-11-08 15:32 2535最近处理Netflow的应用,因此找到了Cisco的Sim ... -
How to Disable SELinux
2009-09-03 00:46 2932原文:http://www.crypt.gen.nz/seli ... -
svn: OPTIONS错误
2009-06-22 10:49 4645完整的异常如下: svn: OPTIONS of 'http: ... -
ntfs-3g不再支持locale选项了
2009-04-01 18:07 2226如题,今天apt-get upgrade以后,重新启动后,发现 ... -
gitosis再安装(linux)
2009-01-04 17:27 2968有机会在Linux下边安装git服务了,而gitosis对于小 ... -
emacs的regex替换
2008-12-17 12:53 5661好多编辑器都是正则表达式的替换的,比如emacs,其他没有 ... -
git恼人的trailing whitespace
2008-11-22 20:07 18376用git进行版本控制,很爽!完全的分布式管理,让你可攻可守。 ... -
disable alt+click on xfce4
2008-08-02 21:42 1193because of conflict with Mylyn' ... -
set IFS
2008-06-30 15:21 1469IFS=Internal Field Separator 实在 ... -
升级Linux内核错误
2008-06-29 22:04 1733因为要使用ntfs-3g(内核至少2.6.22才不会有wa ...
相关推荐
Plane answers to complex questions-The Theory of Linear Models, by Ronald Christensen. The 3 edition.
Questions and Answers takes some of the best questions and answers asked on the vi.stackexchange.com website. You can use this book to look up commonly asked questions, browse questions on a ...
Haldane's Best Answers to Tough Interview Questions 面试常见问题应对
Stephen Hawking-Brief Answers to the Big Questions-Random House Large Print Publishing (2018)
### CPU设计:常见问题解答概览 #### 一、引言 《CPU设计:常见问题解答》这本书由Chandra M. R. Thimmannagari撰写,并由Springer出版。本书是一本综合性的指南,旨在为CPU设计领域的工程师提供实用且全面的知识。...
Behavior modification: Answers to some ethical issues BEHAVIOR MODIFICATION : ANSWERS TO SOME ETHICAL ISSUES* THOMAS P. COOKE AND SHARON COOKE George Peabody College for Teachers Behavior ...
Common Lisp Recipes is a collection of solutions to problems and answers to questions you are likely to encounter when writing real-world applications in Common Lisp. Written by an author who has used...
However, Excel 2016 for Engineering Statistics: A Guide to Solving Practical Problems is the first book to capitalize on these improvements by teaching students and managers how to apply Excel to ...
这个名为"The-answers-to-some-problem-in-CSharp.zip_answers"的压缩包文件,显然包含了解决这些问题的详细解答。以下是根据压缩包内文档"The answers to some problem in C#.doc"推测的一些常见问题及其解决方案,...
This book is a collection of solutions to problems and answers to questions you are likely to encounter when writing real-world applications in Common Lisp. Written by an author who has used Common ...
App Development Recipes for iOS and watchOS: A Problem-Solution Approach ...Who this book is for:Developers who need to find specific solutions to common problems in developing apps for iOS and watchOS.
Learn the ins and outs of Responsive Web Design to make web pages look great on all devices NEW! Become familiar with the command line, Git, and other tools in the modern web developer’s toolkit NEW...
The book contains nearly 400 diagrams and illustrations, and 77 pages of answers to exercises. Advanced topics and "toolkit" sections, and a variety of complete programs, extend readers' programming ...
Turn to The Android Developer’s Cookbook for proven, expert answers–and the code you need to implement them. It’s all you need to jumpstart any Android project, and create high-value, feature-...
Plane Answers to Complex Questions The Theory of Linear Models 最新第四版,线性代数的统计应用版。这本就是机器学习里线性回归的详细版本,80%线性回归问题都在此书有解。到后面,如果写代码都需要矩阵化,会跪...
App Development Recipes for iOS and watchOS explores the technical side of app development with tips and tricks to avoid those little... to throw up their hands and say “It’s just not worth the hassle...
You’ll learn how to write apps from scratch, ensure interoperability, choose the best solutions for common problems, and avoid development pitfalls. Coverage includes: Implementing threads, ...
##### 概率分析与随机化算法(Chapter 5:Probabilistic Analysis and Randomized Algorithms) - **概率分析**:用于分析算法期望运行时间和概率分布。 - **随机化算法**:介绍随机选择、随机排序等技术。 - **...
At first, a database is written, and then there's a sequence of queries. The format of database is very simple: in the first line there's a number N, in the next N lines there are numbers of the ...
Dick A Guide to the Penis for Men and Women ... The book presents the facts in a manner easily accessible and relevant to all ages, and answers questions men and women are often too embarrassed to ask.