LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 899|回复: 1

Emacs中C-@后C-w区域剪切的问题[已解决]

[复制链接]
发表于 2006-9-29 21:35:58 | 显示全部楼层 |阅读模式
我发现我的Emacs中,通过先C-@ Mark Set,再C-w 和M-w剪切复制的时候,最前面的一个word总是保留的,无论.c和.el文件都是如此。

比如:

-------在此处C-@
|
(show-paren-mode t)
...
...
...
若干行后C-w

前面的那个"(show"还是在的

请问这个是什么原因?有谁遇到过这样的情况。

另外问一个问题,elisp中如何区域注释,如同C语言中的/**/

我的.emacs.el内容如下:

  1. ;; set font for linux
  2. (setq facemedium-str "-simsun-simsun bitmap *-medium-r-normal--12-*-*-*-*-*-*-*")


  3. (setq fontset-facemedium
  4.     (create-fontset-from-fontset-spec
  5.     (concat
  6.      "-adobe-courier-medium-r-*-*-14-*-*-*-*-*-fontset-facemedium")))

  7. (defun setallfontsets ()
  8.      (set-default-font fontset-facemedium))

  9. (add-to-list 'after-init-hook 'setallfontsets)

  10. (add-to-list 'after-make-frame-functions
  11.      (lambda (new-frame) (select-frame new-frame) (setallfontsets)))

  12. (setq default-frame-alist (append '(
  13.                           (cursor-type      . bar)
  14.                           ;(cursor-color     . "wheat")
  15.                           ;(foreground-color . "gray90")
  16.                           (background-color . "gray10")
  17.                           )))
  18. ;Display column and row number
  19. (column-number-mode t)
  20. (line-number-mode t)

  21. ;Display matching brackets
  22. (show-paren-mode t)

  23. ;Hide toolbar
  24. (tool-bar-mode -1)

  25. ;this will make sure spaces are used instead of tabs
  26. (setq default-tab-width 4)
  27. (setq tab-width 4
  28.     indent-tabs-mode nil)
  29. (setq c-basic-offset tab-width)
  30. ;(setq c-tab-always-indent nil)

  31. (setq
  32.      backup-by-copying t      ; don't clobber symlinks
  33.      backup-directory-alist
  34.      '(("." . "~/.emacs_backup"))    ; don't litter my fs tree
  35.      delete-old-versions t
  36.      kept-new-versions 6
  37.      kept-old-versions 2
  38.      version-control t)       ; use versioned backups

  39. ;;; disable welcome screen
  40. (setq inhibit-startup-message t)


  41. (require 'cc-mode)
  42. ;(c-set-offset 'inline-open 0)
  43. ;(c-set-offset 'friend '-)
  44. ;(c-set-offset 'substatement-open 0)

  45. (setq semanticdb-project-roots
  46.           (list
  47.         (expand-file-name "/")))

  48. (defun my-indent-or-complete ()
  49.    (interactive)
  50.    (if (looking-at "\\>")
  51.           (hippie-expand nil)
  52.           (indent-for-tab-command))
  53. )

  54. (autoload 'senator-try-expand-semantic "senator")

  55. (setq hippie-expand-try-functions-list
  56.           '(
  57.                 senator-try-expand-semantic
  58.                 try-expand-dabbrev
  59.                 try-expand-dabbrev-visible
  60.                 try-expand-dabbrev-all-buffers
  61.                 try-expand-dabbrev-from-kill
  62.                 try-expand-list
  63.                 try-expand-list-all-buffers
  64.                 try-expand-line
  65.         try-expand-line-all-buffers
  66.         try-complete-file-name-partially
  67.         try-complete-file-name
  68.         try-expand-whole-kill
  69.         )
  70. )

  71. (defconst yxn-c-style
  72.   '((c-tab-always-indent        . 4)
  73.     ;(c-comment-only-line-offset . 4)
  74.     (c-hanging-braces-alist     . ((substatement-open after)
  75.                                    (brace-list-open)))
  76.     (c-hanging-colons-alist     . ((member-init-intro before)
  77.                                    (inher-intro)
  78.                                    (case-label after)
  79.                                    (label after)
  80.                                    (access-label after)))
  81.     (c-cleanup-list             . (scope-operator
  82.                                    empty-defun-braces
  83.                                    defun-close-semi))
  84.     (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
  85.                                    (substatement-open . 0)
  86.                                    (case-label        . 4)
  87.                                    (block-open        . 0)
  88.                                    (block-open        . 0)
  89.                                    (knr-argdecl-intro . -)))
  90.     (c-echo-syntactic-information-p . t)
  91.     )
  92.   "My C Programming Style")

  93. (defun my-c-mode-common-hook()
  94.     (setq tab-width 4 indent-tabs-mode nil)
  95.     ;;; hungry-delete and auto-newline
  96.     (c-toggle-auto-hungry-state 1)
  97.     ;;key map
  98.     ;(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
  99.     (define-key c-mode-base-map [(return)] 'newline-and-indent)
  100.     ;(define-key c-mode-base-map [(f7)] 'compile)
  101.     ;(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
  102.     ;;  (define-key c-mode-base-map [(tab)] 'hippie-expand)
  103.     (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
  104.     (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
  105.         ;
  106.     ;(setq c-macro-shrink-window-flag t)
  107.     ;(setq c-macro-preprocessor "cpp")
  108.     ;(setq c-macro-cppflags " ")
  109.     ;(setq c-macro-prompt-flag t)
  110.     ;(setq hs-minor-mode t)
  111.     ;(setq abbrev-mode t)
  112. )
  113. (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

  114. ;;;;C++ Mode
  115. (defun my-c++-mode-hook()
  116.     (setq tab-width 4 indent-tabs-mode nil)
  117.     (c-set-style "stroustrup")
  118.     ;;  (define-key c++-mode-map [f3] 'replace-regexp)
  119. )

  120. ;(global-set-key [(f5)] 'speedbar)

  121. ;;set title as "filename@LC's Emacs"
  122. (setq frame-title-format
  123.           '("  GNU Emacs   -   [ " (buffer-file-name "%f \]"
  124.       (dired-directory dired-directory "%b \]"))))

  125. (load-file "/usr/share/emacs/site-lisp/xcscope.el")
  126. (require 'xcscope)

  127. (add-to-list 'load-path "/usr/share/emacs/site-lisp/semantic")
  128. (add-to-list 'load-path "/usr/share/emacs/site-lisp/eieio")
  129. (add-to-list 'load-path "/usr/share/emacs/site-lisp/speedbar")
  130. (add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
  131. (require 'ecb-autoloads)

复制代码
发表于 2006-9-30 08:27:05 | 显示全部楼层
你是按了 M-@ ,而不是 C-@ ,是不是?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表