Chinaunix首页 | 论坛 | 博客
  • 博客访问: 913200
  • 博文数量: 132
  • 博客积分: 9976
  • 博客等级: 中将
  • 技术积分: 1781
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-30 20:40
文章分类

全部博文(132)

文章存档

2013年(1)

2011年(1)

2010年(15)

2009年(77)

2008年(36)

2007年(2)

我的朋友

分类: 系统运维

2009-04-20 13:02:22

emacs 用法2

====================================================================
from: http://blog.csdn.net/tangnf/archive/2007/05/21/1619162.aspx

emacs中的代码折叠收藏
      代码折叠是很多IDE里都具备的,对我们程序员都非常有有用的功能。在emacs里肯定也有啦,在.emacs中加入以下代码:
        ;;代码折叠
        (add-hook 'c-mode-hook 'hs-minor-mode)
        (add-hook 'c++-mode-hook 'hs-minor-mode)
     重新emacs后,再打开源码,emacs的菜单上会多出一个Hide/show,展开这个菜单,里面就是展开与收起的命令,可以对所有的代码收拢,展开,也可以对某个函数的代码展开收拢,如果想更方便,可以把他们绑定到快捷键上,不过我一般不常用,所以就不绑定了
 看看效果吧:
====================================================================
from: ~xbzhou/blog/archives/000068.html

zz emacs一句话问答

[保留] Emacs 的一些问题与答案
作者:iheaing 发表于:2006-03-02 09:12:14
【发表评论】【查看原文】【C/C++讨论区】【关闭】

对《有关 Emacs 使用技巧的内容请在这个帖子》的整理。如有错误,请跟贴指出。


Emacs资源导引
2004年 12月23日
百科全书类:
Manpage of Emacs:
Emacs 中文化指南:
Emacs WiKi百科:
Emacs User's Guide:http://www.cbi.pku.edu.cn/chinese/documents/csdoc/emacs/

论坛:

个人主页:


~huxw/emacs/daily-emacs/daily-emacs.html


-------------------------------
Q:如何使用gdb设置断点的时侯让emacs高亮源代码那一行?

A:设断点是 C-x space
-------------------------------
ecb可以到这里下载:
-------------------------------
Q:编辑c++文件时,现在M-;用的是//形式的注释
我想用/**/的
怎么办 ?

A:[1]M-x c-mode
[2](defun my-c-comment ()
(interactive)
(insert "/* */"
(backward-char 3))
(global-unset-key "\M-;"
(global-set-key "\M-;" 'my-c-comment)
-------------------------------
Q:Emacs 和 XEmacs 的区别?

A:
-------------------------------
最新emacs for windows的下载地址

-------------------------------
Q:想在打开文件的时候就 auto indent ,不要老按 TAB 键,.emacs 怎样写?

A:
(global-set-key "\C-m" 'reindent-then-newline-and-indent)
或者这样:
(add-hook 'c-mode-common-hook
(lambda ()
(define-key c-mode-map
"\C-m" 'reindent-then-newline-and-indent)))
-------------------------------
Q:我的是21.3.1,ecb2.27。我的ecb不支持鼠标双击阿,不知道大家的ecb是什么版本的,能不能支持鼠标双击,或者用快捷键切换到ecb窗口?

A:快捷键有啊。好些是C-c , g m 就调到methods窗口。g d 就goto directorey 窗口,
说实话,我觉得ecb窗口跳转很不方便。不如speedbar,只要设置一下speedbar-get-focus的快捷键,这个是可以 toggle的。而且speedbar上该有的都有,成员函数列表都在上面。按 f 就跳到 file mode,基本ecb有的它都有了。
-------------------------------
Q:ecb有没有windows版本的?

这些东西没有什么平台一说,都是elisp语言,用emacs byte-compile一下就可以了。但是我认为ecb的跳转很麻烦。
-------------------------------
Q:我在emscs中打开了几个文件进行编辑,我要关闭缓存中某一个文件应当怎样操作?

A:1C-x k
A2:c-x c-b 在要关闭的buffer的那行 d, 在x就ok了
-------------------------------
Q:我想在打开文件的时候就 auto indent

A:你可以C-x h 选中所有内容,然后C-M \ 就可以了。
-------------------------------
Q:不想要emacs de工具栏,怎样让它不显示?

A1:options 里面 show/hide ,关掉 toolbar,然后 options 再选择 一下 save options ,下次就再也不出来了。
A2:也可把(tool-bar-mode nil)加到.emacs中
-------------------------------
Q:emacs的正确发音?

A:一马克思?一卖壳丝?
-------------------------------
Q:在打开文件时如果文件名中有空格,请问我怎么输入这个空格
发表:

A:在空格前加"\"
-------------------------------
Q:果我不小心按错了键,跑到文件头或者文件尾了,怎么能快速回到刚才光标所在的位置?

A:C-u C-@
-------------------------------
Q:编译某行出错时,我想快速把光标定位到此行,我应该如何做?

A:可以使用C-x ' 。注意是 `,也就是F1 下面的那个,不是单引号。
实在不行,M-x next-error 也可以。
-------------------------------
Q:怎样让emacs中复制的 东西可以在系统中使用?好象emacs不和系统使用相同的粘贴板

A1:C-y 不行吗?要不就直接在emacs中干吧。M-x shell
A2:
M-x gdb
file xxx.c
run
-------------------------------
Q:emacs中怎样才能运行.c的程序?我只会编译.c的程序,不会运行。每次只能退出emacs,在shell下运行

A:不用退出啊、直接按C-x C-z 就会进入shell,你然后shell下运行,然后fg回来就可以了。或者你M-x shell,直接在emacs中运行也可以的。
-------------------------------
Q:我的emacs缩进是2两个空格。怎样设置为8个呢?

A:(setq c-basic-offset 8)
-------------------------------
Q:终端下使用Ctrl+x 2/3可以上下左右分屏,默认的是一半对一半。请问可以调整两个窗口的大小吗?

A:M-x enlarge-window (c-x ^)
M-x shrink-window
你可以把他们绑定到你喜欢得键上。
-------------------------------
Q:请问在emacs里怎么显示日期?

A:(setq display-time-day-and-date t)
(display-time)
-------------------------------
Q:请问C-s时候如何粘贴要搜的内容?

A1:移动光标到你要查找的东西上(不用粘贴), C-s C-w
A2:M-y
-------------------------------
Q:不产生备份文件

A:(setq make-backup-files nil)
-------------------------------
Q:请问在emacs中怎么删除从光标位置到行首?

A1:Meta - C-k
A2:Ctrl-u 0 Ctrl-k
-------------------------------
Q:我在xp中用GNU Emacs 21.3.1...
当按pagedown多次后...emacs就会失去响应...请问怎么回事?

A:因为你设置了scroll-margin
-------------------------------
Q:写程序时经常会遇到一个很长的代码块(用'{}'包起来的)
有什么办法能把一个代码块缩起来,需要的时候再展开

A:
M-x hs-minor-mode
* C-c @ ESC C-s show all
* C-c @ ESC C-h hide all
* C-c @ C-s show block
* C-c @ C-h hide block
* C-c @ C-c toggle hide/show

我重新定义了show block和hide block的键
(add-hook 'c-mode-hook 'hs-minor-mode)
C-c bh show block
C-c bs hide block
-------------------------------
Q:每次都语法高亮显示:(global-font-lock-mode t) 加入你的.emacs文件。

-------------------------------
Q:装上ecb,有个color-themes可以调整配色方案,ecb-change-layout可以改变ecb窗口布局
-------------------------------
Q:emacs中,想复制一段文字,或复制一行,应该怎样做
我现在是先cut,(C-SPACE ..... C-w),然后在paste(C-y)一下,有没有更好的操作

A:M-w
-------------------------------
Q:请问谁知道在编译程序的时候,怎样让光标从当前buffer自动跳到正在编译程序的buffer,然后光标一直保持在这个buffer的底部?我现在 每一次编译程序后,都是C-x o,然后再C-Shift >;到最底看结果,挺麻烦的,不知道这样一个..........

A:
;; S-F9 调用 compile 并设置编译命令
;; F9 则保存所有文件并编译(无提示)
(defun du/onekey-compile ()
"Save buffers and start compile"
(interactive)
(save-some-buffers t)
(switch-to-buffer-other-window "*compilation*"
(compile compile-command)
; (other-window 1)
)
(global-set-key [S-f9] '(lambda ()
(interactive)
(switch-to-buffer-other-window "*compilation*"
(compile)
; (other-window 1)
))
(global-set-key [f9] 'du/onekey-compile)
-------------------------------
Q:如何显示ASCII表?

A:~vinicius/emacs/ascii.el
-------------------------------
Q:怎样使得 emacs 里面, 选取的区域为矩形,而不是一行行全选上了?

A:Ctrl+空格建,然后把光标移到下几行
ctrl+x r k
ctrl+x r y
-------------------------------
Q:我的tab键被用来做格式化功能了,那我怎样才能键入一个真正的tab呢?

A:C-q TAB
-------------------------------
Q:如何重新从磁盘里load当前编辑的文件?因为有时候文件可能被别人改了,所以才有这个需求

A:M-x revert-buffer
-------------------------------
Q:一般我的emacs启动后都是去/usr/share/emacs/site-lisp下面找扩展程序
请问这个目录是否可以指定?
因为我现在要把我的emacs搬家到另一个没有root权限的机器
所以我不能去改他们的/usr/share/emacs/site-lisp,只能在自己的目录干活

A:
在.emacs最前头加一条(setq load-path (cons "/home/bleem1998/.emacs-site-lisp/" load-path))
然后把所有的扩展包都丢在"/home/bleem1998/.emacs-site-lisp/"就可以了
-------------------------------
Q:请问在emacs中如何设置字体和背景的颜色?

A:设置背景颜色 M-x set-background-color
可以写到 .emacs里打开emacs就设置:
(set-face-background 'default "azure") ; azure或者别的颜色
如果只想在window模式下设置背景,终端下不需要,就加上判断:
(if window-system
(set-face-background 'default "azure"))
-------------------------------
Q:文本方式下,emacs的有些热键被终端的热键代替了。比如:ctrl-h在终端中是退格键,而emacs中是在线帮助,结果在emacs中按ctrl-h就变成了删除光标前面的字符。这种情况还很多。要怎样设置才能用emacs的热键替代终端的..........

A:
(global-set-key "\C-h" 'backward-delete-char-untabify)
(global-set-key [DEL] 'delete-char)
-------------------------------
Q:我用emacs,屏幕显示大约是80行,25列,开多个窗格时,每个窗格显示不了多少字符。
能不能让屏幕显示更多的行和列?

A:不是很清楚你的意思。是emacs窗口不够大?还是emacs编辑时自动换行的列太小?
如果是后者 (setq default-fill-column 85)
如果是前者,可以在开emacs时选择大点的尺寸,或者动动鼠标拉大点 -_-
(if window-system
(setq default-frame-alist
(append
'((top . 0) (left . 0) (width . 120) (height . 60))
default-frame-alist)))
-------------------------------
Q:fcitx的热建 Ctrol-Space 和 emacs 的 mark-set 重了, 我每次在 emacs里面输入中文,就不能mark-set了,怎么办啊?

A:Mark可以用 C-@
-------------------------------
Q:怎样把所有的/r/n都替换成/n,或者怎样删除所有的/r

A:除了使用一些工具软件(如 dos2unix、tr 等)对文件直接进行转换外,在 Emacs 中有如下两种方法:

[1]、替换法
使用 Emacs 的替换命令 replace-string 将 \r 替换为空以达到删除的目的:
M-x replace-string RETURN # 执行 replace-string 命令
Replace string: C-q C-m RETURN # 替换字符串。C-q C-m 为 \r 字符的输入形式
with: RETURN # 替换为空字符串

[2]、解码法
如果 Emacs 对文件的自动解码失败,可指定文件的解码方式打开文件。对于本问题来说,指定一种可行的 dos 解码方式即可(如 chinese-euc-dos),Emacs将会自动进行转换,从而能正确显示Window格式的文本文件的内容。在启动 Emacs 之后:
C-x C-m c chinese-euc-dos RETURN # 指定编码方式为chinese-euc-dos
C-x C-f your_file_name RETURN # 打开文件
-------------------------------
Q:>;>; 1.有什么可设置emacs在选定文本后输入时把选定的文本换掉?

A:M-x pending_delete_mode # 切换到 Delete_Selection 模式
-------------------------------
Q:>;>; 2.如何将一段选定的文字在大小写之间切换??

A:C-x C-l # 转换为小写文字
C-x C-u # 转换为大写文字
-------------------------------
Q:emacs中如何设置显示文件字体的大小?

A:可通过修改 Default face 的 Height 属性来实现(customize-face命令或者在菜单中找修改 face 的一项)。
如果是 XEmacs,有菜单选项可直接更改字体大小。
-------------------------------
Q:请问从其他地方copy到emacs的快接键

A:
拷贝一个文件到一个buffer里面用c-x i
拷贝一个buffer到另外一个buffer用c-x c-i
拷贝剪贴板里的用c-y
在linux力,可以直接用鼠标选定要拷贝的东西,再用鼠标中间的键拷贝到buffer里
-------------------------------
Q:如何让emacs启动后就最大化?

A:
(setq initial-frame-alist '((top . 0) (left . 0) (width . 97) (height . 49)))
数值自己修改吧。
-------------------------------

原帖子最后一页中有一个安装的配置文件,大家安装时可参考。
%3D1&page=28

由 kkzhou 发表于 2007年03月30日 15:31
回复
==============================================================================
from:

[ Combined Document ] | | |


Emacs can run in two different interface modes: the Windows interface, which allows the flexible use and mixture of fonts and colors; and the console interface, which constrains Emacs to the limitations of console windows. The following two sections describe how to specify and change the size, position, font, and color attributes of Emacs in both interface modes.

With the Windows interface, you can change the size, position, font, and color attributes of Emacs using three different mechanisms: using the mouse with the user interface, by specifying them as command line arguments, or by invoking Emacs Lisp functions. You will probably find it convenient to specify command line arguments in the Properties of the shortcut to the runemacs.exe file, and to invoke the lisp functions in your startup file. For information on how to propagate attributes to new frames, see .

  • SIZE

    To customize the size of specific frames, including the initial frame, see the section on customizing frames below.

    User Interface
    To resize an Emacs window, drag on a border with the mouse.
    Command Line
    To have Emacs start up with a particular size, invoke it with the X Windows -geometry command line argument. For example, to start Emacs with a window 40 lines by 80 columns in size, use the following:
    emacs -g 80x40

    Note that the geometry command can be combined with the position command, as described below.

    Emacs Lisp
    To change the size of an Emacs frame using elisp, you can use the two functions set-frame-width and set-frame-height. For example, to resize Emacs to display 40 lines by 80 columns, you could use:
    (set-frame-height (selected-frame) 40)

    (set-frame-width (selected-frame) 80)
  • POSITION

    To customize the position of specific frames, including the initial frame, see the section on customizing frames below.

    User Interface
    To reposition a running Emacs, click on its title bar and drag the window.
    Command Line
    To start Emacs at a particular position, invoke it with the X Windows -geometry command line argument. For example, to start Emacs at pixel offset (10, 30) from the top left corner:
    emacs -g +10+30

    To combine the size with position, first specify the size and then the position. The two examples above can be combined as follows:

    emacs -g 80x40+10+30

    Note that you can also specify position offsets from any of the corners of the screen. See the GEOMETRY SPECIFICATIONS section of the X man page for complete details on the geometry command.

    Emacs Lisp
    To reposition an Emacs frame using elisp, you can use the set-frame-position function. For example, to move the current frame to the offset (10, 30), you could use:
    (set-frame-position (selected-frame) 10 30)

  • COLORS

    As with other windowing attributes, Emacs uses the X Windows color names for specifying colors on the command line and in elisp. One set of these names is a set of abstract color names, e.g., red, green, and blue. These names are the ones you will typically use as arguments on the command line or in elisp functions. Emacs also supports the use of numeric color names; see the COLOR NAMES section of the X man page for complete details on how to specify numeric color names and their color spaces.

    To see the abstract color names that Emacs understands and the colors that they map to, use the menu command Edit->Text Properties->Display Colors, or invoke the list-colors-display function in the *scratch* buffer:

    (list-colors-display)

    If you would like to change the mapping of color names to RGB values, or to add new color names to Emacs, then you will want to modify the alist w32-color-map (win32-color-map in Emacs 19). To make changes, you can simply cons new mappings onto the head of the alist:

    (setq win32-color-map (cons '("snow" . 16448255) win32-color-map)) ; Emacs 19
    (setq w32-color-map (cons '("snow" . 16448255) w32-color-map)) ; Emacs 20

    The number in the element is the logical OR of three values for the red, green, and blue components: (B << 16 | G << 8 | R). In the example above, red is 255, green is 250, and blue is 250. At some point there will be support for reading in files with color mappings to make this process a little easier.

    To customize colors for specific frames, see the section on customizing frames below.

    To customize colors for color syntax highlighting, see the .

    User Interface
    To change the foreground or background color in Emacs through the windowing interface, you can use the menu commands Foreground Color->Other and Background Color->Other in the Edit->Text Properties menu.
    Command Line
    To change the foreground or background color in Emacs on the command line, you can use the -fg and -bg command line arguments. For example, to start Emacs with yellow text on a black background, invoke Emacs using:
    emacs -fg yellow -bg black
    Emacs Lisp
    You can use elisp functions to change the colors of any of the Emacs faces. For example, to change the foreground or background color of Emacs, you can use the set-foreground-color and set-background-color functions. To change the color of an arbitrary face, use the set-face-foreground and set-face-background functions. To change the color of the cursor, use the set-cursor-color function.

    This elisp changes the background color to black:

    (set-background-color "black")

    The following elisp changes the mode line foreground to firebrick:

    (set-face-foreground 'modeline "firebrick")

    The following elisp changes the cursor color to purple:

    (set-cursor-color "purple")
  • FRAMES

    Emacs uses two alists to determine the default appearances of frames, default-frame-alist and initial-frame-alist. The default-frame-alist variable sets the basic defaults of all frames. Since it is a common Emacs usage to have the initial frame have slightly different properties than other frames (e.g., its position), you can use the initial-frame-alist variable to override properties in default-frame-alist specially for the initial frame. You should definitely read the help text for these variables (C-h v) for more details on the differences between them and how they interact with each other.

    Below is an example of using default-frame-alist and initial-frame-alist to configure the appearances of the initial frame and all other frames (you would place this code in your ). With default-frame-alist, we set the top left corner of new frames to be at pixel offset +200+400, the width and height to be 80x40, the cursor to be white, the foreground to be yellow, the background to be black, and the font to be Courier 10. With initial-frame-alist, we override the top left corner of the initial frame to be at pixel offset +10+30, and inherit the remaining properties for the initial frame from default-frame-alist.

    (setq default-frame-alist
    '((top . 200) (left . 400)
    (width . 80) (height . 40)
    (cursor-color . "white")
    (cursor-type . box)
    (foreground-color . "yellow")
    (background-color . "black")
    (font . "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1")))

    (setq initial-frame-alist '((top . 10) (left . 30)))
  • SCREEN RESOLUTION

    You can use the functions x-display-pixel-width and x-display-pixel-height to determine the resolution of your screen. For example:

    (and window-system
    (setq screen-width (x-display-pixel-width)
    screen-height (x-display-pixel-height)))
  • Emacs can also run inside a console window. Simply invoke Emacs with the -nw command line option to do so. Although you cannot change the size, font, or color of the window from within Emacs, you can use the window's menu to do so. (If no icon has been created to invoke the Emacs batch file, then you'll have to create one to change these attributes.)

  • SIZE

    Under NT, go to the upper left hand corner and open the "-" menu of the console window. Select "Screen Size and Position...", and use the dialog to set the window to the size you want. Be sure to check the "Save Window Size and Position" checkbox so that future invocations will retain the new window size. After closing the dialog box, resize the window itself by dragging on the edges.

    Under Windows 95, click on the properties icon in the icon toolbar at the top of the window. Go to the "Screen" tab and select the desired window size in the "Usage" panel. Click on "OK".

    With Emacs 20.3 and previous version, Emacs uses the size of the console buffer as the frame size. If your console window has buffer larger than the window (e.g., it uses a verical scrollbar), then Emacs' frame will be larger than the console window. To work around this problem, make the console buffer the size of the console window. Or, if you have source, apply to src/w32console.c.

    Since version 20.4 this behaviour is now controlled via the variable "w32-use-full-screen-buffer".

    So to fix this include the following lines in your .emacs file:

    ;; Make sure that Emacs in console mode doesn't go beyond the
    ;; size of the Dos box in use.
    ;; (Not needed in emacs 20.4+)
    (setq w32-use-full-screen-buffer nil)
  • POSITION

    To reposition Emacs, click on the title bar of the console window and drag it.

  • COLOR

    Under the NT interface, open the "-" menu. Select "Screen Colors...", and use the dialog to choose the colors you want to use for the window. Be sure to check the "Save Configuration" checkbox so that the colors are used in future invocations. Click on "OK". Unfortunately, the colors are not immediately used, but the changes have been made. To use the new colors, simply close the window and use the icon to start Emacs again. Emacs will then come up using the colors you chose before.

    I'm not exactly sure how to change the colors on a per-console-window basis under Windows 95.

Font-lock mode is a mode that performs color syntax highlighting for other major modes in Emacs. To use font-lock, place the following in your startup file:

(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)
;; Maximum colors
(setq font-lock-maximum-decoration t)))

The above code uses the default faces for decoration. If you would like to customize the attributes of the faces, you can use the following startup code to get started:

(cond ((fboundp 'global-font-lock-mode)
;; Customize face attributes
(setq font-lock-face-attributes
;; Symbol-for-Face Foreground Background Bold Italic Underline
'((font-lock-comment-face "DarkGreen")
(font-lock-string-face "Sienna")
(font-lock-keyword-face "RoyalBlue")
(font-lock-function-name-face "Blue")
(font-lock-variable-name-face "Black")
(font-lock-type-face "Black")
(font-lock-reference-face "Purple")
))
;; Load the font-lock package.
(require 'font-lock)
;; Maximum colors
(setq font-lock-maximum-decoration t)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)))

Also see the help text for the function global-font-lock-mode and the variable font-lock-face-attributes.

To see a list of colors that Emacs understands by name, select the "Edit->Text Properties->Display Colors" menu command.

An alternative to useing font-lock-mode is to use lazy-lock, to do this use the following:

    (setq font-lock-support-mode 'lazy-lock-mode)

You can use the by Hrvoje Niksic to convert font-lock attributes in <> buffers to HTML markups. See the comments at the top of the file on how to use it.

If you are using a version of Emacs before 19.34.6 and an 8-bit display, then you should download this version of instead. However, this is likely to become out of date with respect to Hrvoje's version, so I would actually recommend upgrading to 19.34.6.

Font-locking embedded code (e.g., ASP) in HTML documents

Gian Uberto Lauri <> has modified to enable font-locking and mode editing of code embedded in HTML documents (ASP, PHP).

The format of the mode line is determined by the variable mode-line-format, a buffer-local variable. To understand how to interpret the mode line, see the Info node "C-h i m emacs RET m mode line RET". For a description of minor modes that provide additional information on the mode line (like line and column number, current time, and mail status), see the Info node "C-h i m emacs RET m optional mode line features".

You can also directly customize the format by assigning a new format string to the mode-line-format variable in your startup file. For a description of the format codes, see the help string for the variable ("C-h v mode-line-format").

You can use either a two- or three-button mouse with Emacs. If you have trouble with either of these working with Emacs, see below.

Emacs assumes that you have a three-button mouse by default. However, if you have a two-button mouse, you can press both buttons at once to emulate the missing middle button expected by Emacs.

Three variables control mouse button emulation under Emacs: w32-num-mouse-buttons, w32-mouse-button-tolerance, and w32-swap-mouse-buttons (win32-num-mouse-buttons, win32-mouse-button-tolerance. If you use help on w32-num-mouse-buttons (i.e., with "C-h v"), it will tell you how many buttons Emacs thinks your mouse has; if w32-num-mouse-buttons is less than 3, then Emacs will emulate the middle mouse button.

Emacs emulates the middle mouse button by treating simultaneous button presses of the left and right buttons as a middle button press. Since both button presses cannot really be simultaneous, Emacs compares button presses within a specified window of time to determine whether it should emulate the middle button. This window of time is controlled using w32-mouse-button-tolerance. Help on this variable will show you the value Emacs uses by default, and you can change this value to suit your needs.

Depending upon the type of two-button mouse, you may find it useful to swap the mapping of middle and right mouse buttons. By default, the middle button is mapped to mouse-2 and the right button is mapped to mouse-3. If you set w32-swap-mouse-buttons to a non-nil value, then you can swap these two mappings.

If you have a three-button mouse, Emacs should recognize and support the third (middle) button automatically. However, some people find that they have a three button mouse, but the middle mouse button does not work for them. First check to see if w32-num-mouse-buttons is set correctly. If so, then check to see whether your mouse has been installed with the proper driver (open Control Panel->Mouse to examine the driver being used). If you have the right driver, then, on NT, check if HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Busmouse\Paramete rs\NumberOfButtons is set to 3, and change it to 3 if it is not. If nothing seems to be amiss, then at the very least you can have Emacs emulate the middle button by setting w32-num-mouse-buttons to 2.

Some people have reported that using a two-button mouse with Emacs sometimes causes problems when they go to click in other windows or the desktop (e.g., double left-clicks are interpreted as a right-click); apparently this is a known bug in Windows 95, and is not confined to using Emacs. If this is happening to you, you might want to flip through a discussion on the topic.

One workaround is to right-click on the desktop, and then left-click on the desktop, and the mouse should be back in its normal state.

To highlight the region between the point and the mark, use the function transient-mark-mode:

(transient-mark-mode t)

To highlight matching parentheses, add the following to your startup file:

(show-paren-mode 1)

How do I cut & paste text with null characters?

Because of the way Emacs currently tries to share the clipboard with other Windows applications, you cannot cut and paste text with null characters embedded in it. David Biesack describes a way to get around this, at least for cutting and pasting text just within Emacs.

You can use the function set-message-beep to change the sound that Emacs uses for its beep. Emacs allows you to specify one of the Windows system sounds for the beep. For example, to use the ok system sound, place the following in your startup file:

(set-message-beep 'ok)

Look up help for the function for a complete description of how to use the function and which sounds it recognizes.

`selection-coding-system' is most likely still at it's default of `iso-latin-1-dos'. You can change this to a more appropriate coding system using `set-selection-coding-system' (C-x RET x), or temporarily with `set-next-selection-coding-system' (C-x RET X). If you NEVER cut and paste between Emacs and other programs, you can make Emacs behave for all languages with:

(set-selection-coding-system 'emacs-mule)

To copy between Emacs and other apps, you may need to use the appropriate Windows codepage as your coding system. To do this, you need to set up the codepage first:

(codepage-setup 1251)
(set-selection-coding-system 'cp1251)

[ Combined Document ] | | |

$Author: jasonr $ <>


Updated: $Date: 2008/04/12 01:14:40 $

==============================================================================
阅读(1262) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~