Emacs application details

Source: Internet
Author: User

The following content is collected from the Internet or unexpected discoveries during use. The content collected from the Internet will indicate the source. If you think it is inappropriate, please let me know how to delete it.

 

In emacs, only half of a Chinese character is displayed:

Solution:Http://tikii.javaeye.com/blog/135007

 

As shown in the following figure, the words "no" and "wonderful" are both half displayed.

The answer was found at http://tikii.javaeye.com/blog/135007. the answer was originally the question of installing lingoes. Delete the font of lingoes installation. Specifically, delete the lingoes. ttf file in the c:/windows/fonts directory. Or find the installation directory of lingoes and delete all the font files listed in the following font sub-directories from C:/windows/fonts.

 

Settings of compilation commands in emacs:

From: http://suchang.net/slack/Emacs.html

Add the following code to. emacs:

  1. ; C-f5, set the compile command, use the original compile of Emacs
  2. ; F5: Save the current window and use different compilers for compilation. You can add a match as shown in the following code.
  3. (Defun sucha-smart-compile ()
  4. "Simply compile your file according to the file type ."
  5. (Interactive)
  6. (Save-some-buffers t)
  7. (Let
  8. (Compile-command nil)
  9. (Alist
  10. (List '("//. c $". "c:/mingw/bin/gcc ")
  11. '("//. Cc $". "c:/mingw/bin/g ++ ")
  12. '("//. Cpp $". "c:/mingw/bin/g ++ "))))
  13. (While (not (null alist ))
  14. (If (string-match (caar alist) (buffer-file-name ))
  15. (Setq compile-command
  16. (Concat (cdar alist) ""/"" (buffer-file-name )"/"")))
  17. (Setq alist (cdr alist )))
  18. (If (null compile-command)
  19. (Setq compile-command
  20. (Read-from-minibuffer "Compile command :")))
  21. (Compile-command )))
  22. (Global-set-key [C-f5] 'compile)
  23. (Global-set-key [f5] 'sucha-smart-compile)

In the author's original article, lines 10, 11 and 12 are followed by: "gcc", "g ++", "g ++", c: /mingw/bin is the compiler path on your computer. In 16 lines of code, buffer-file-name is enclosed in double quotation marks to prevent spaces in the path.

 

Insert the current system time at the cursor:

From: http://if.ustc.edu.cn /~ Xbzhou/blog/archives/ipv72.html

  1. ; Insert-current-time
  2. (Defun insert-current-time ()
  3. "Insert the current time"
  4. (Interactive "*")
  5. (Insert (current-time-string )))
  6. (Global-set-key "/C-xt" 'insert-current-time)

 

Settings on the emacs startup window:

From: http://if.ustc.edu.cn /~ Xbzhou/blog/archives/ipv72.html

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;; Set the window interface ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. (Set-foreground-color "gray ")
  3. (Set-background-color "black ")
  4. (Set-cursor-color "gold1 ")
  5. (Set-mouse-color "gold1 ")
  6. (Set-scroll-bar-mode nil)
  7. ; Cancel the scroll bar
  8. ; (Customize-set-variable 'scroll-bar-mode' right ))
  9. ; Set the scroll bar to the right of the window, and the default is on the left
  10. (Tool-bar-mode nil)
  11. ; Cancel the toolbar
  12. (Setq default-frame-alist
  13. '(Vertical-scroll-bars)
  14. (Top. 25)
  15. (Left. 45)
  16. (Width. 110)
  17. (Height. 40)
  18. (Background-color. "black ")
  19. (Foreground-color. "gray ")
  20. (Cursor-color. "gold1 ")
  21. (Mouse-color. "gold1 ")
  22. (Tool-bar-lines. 0)
  23. (Menu-bar-lines. 1)
  24. (Right-fringe)
  25. (Left-fringe )))
  26. ; Set other colors: the background and topic highlighted by the syntax, the background and topic selected by the region, and the background and topic selected by the secondary selection.
  27. (Set-face-foreground 'highlight "white ")
  28. (Set-face-background 'highlight "blue ")
  29. (Set-face-foreground 'region "cyan ")
  30. (Set-face-background 'region "blue ")
  31. (Set-face-foreground 'secondary-selection "skyblue ")
  32. (Set-face-background 'secondary-selection "darkblue ")
  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Set the interface to end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

You can modify the code in line 17--30 to automatically maximize the window at startup. Very convenient.

Copy the current row (that is, when we need to copy a row or cut a row, we do not need to select this row as region first, you only need to move the cursor to the current line and execute the normal copy and cut command)

From: http://blog.csdn.net/g9yuayon/archive/2007/03/04/1520466.aspx

  1. (Defadvice kill-ring-save (before slickcopy activate compile)
  2. "When called interactively with no active region, copy a single line instead ."
  3. (Interactive
  4. (If mark-active (list (region-beginning) (region-end ))
  5. (List (line-beginning-position)
  6. (Line-beginning-position 2 )))))
  7. (Defadvice kill-region (before slickcut activate compile)
  8. "When called interactively with no active region, kill a single line instead ."
  9. (Interactive
  10. (If mark-active (list (region-beginning) (region-end ))
  11. (List (line-beginning-position)
  12. (Line-beginning-Position 2 )))))

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.