Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mofaph/emacs-mofaph
base: 74478bdb08
...
head fork: mofaph/emacs-mofaph
compare: 2b830a91b9
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
3  conf-el-get.el
@@ -15,6 +15,7 @@
(el-get 'sync packages)
(el-get 'wait)
(setq el-get-user-package-directory "~/.emacs.d")
- (el-get-init "goto-last-change"))
+ (el-get-init "goto-last-change")
+ (el-get-init "smex"))
(provide 'conf-el-get)
View
64 conf-font.el
@@ -0,0 +1,64 @@
+;;; Token from http://www.emacser.com
+
+;; 首先,判断某个字体在系统中是否安装
+(defun qiang-font-existsp (font)
+ (if (null (x-list-fonts font))
+ nil t))
+
+;; 其次,要按顺序找到一个字体列表中第一个已经安装可用的字体
+(defvar font-list '("Microsoft Yahei"
+ "文泉驿等宽微米黑"
+ "黑体"
+ "新宋体"
+ "宋体"))
+
+;; find-if is in common list package
+(eval-when-compile (require 'cl))
+(if window-system (find-if #'qiang-font-existsp font-list))
+
+;; 还要有个辅助函数,用来生产带上 font size 信息的 font 描述文本
+(defun qiang-make-font-string (font-name font-size)
+ (if (and (stringp font-size)
+ (equal ":" (string (elt font-size 0))))
+ (format "%s%s" font-name font-size)
+ (format "%s %s" font-name font-size)))
+
+;; 有了这些函数,下面出场的就是自动设置字体函数了
+(defun qiang-set-font (english-fonts
+ english-font-size
+ chinese-fonts
+ &optional chinese-font-size)
+ "english-font-size could be set to \":pixelsize=18\" or a integer.
+If set/leave chinese-font-size to nil, it will follow english-font-size"
+ (require 'cl) ; for find if
+ (let ((en-font (qiang-make-font-string
+ (find-if #'qiang-font-existsp english-fonts)
+ english-font-size))
+ (zh-font (font-spec :family (find-if #'qiang-font-existsp chinese-fonts)
+ :size chinese-font-size)))
+
+ ;; Set the default English font
+ ;;
+ ;; The following 2 method cannot make the font settig work in new frames.
+ ;; (set-default-font "Consolas:pixelsize=18")
+ ;; (add-to-list 'default-frame-alist '(font . "Consolas:pixelsize=18"))
+ ;; We have to use set-face-attribute
+ (message "Set English Font to %s" en-font)
+ (set-face-attribute
+ 'default nil :font en-font)
+
+ ;; Set Chinese font
+ ;; Do not use 'unicode charset, it will cause the english font setting invalid
+ (message "Set Chinese Font to %s" zh-font)
+ (dolist (charset '(kana han symbol cjk-misc bopomofo))
+ (set-fontset-font (frame-parameter nil 'font)
+ charset
+ zh-font))))
+
+;; 利用这个函数,Emacs 字体设置就是小菜一碟了
+(when (eq window-system 'x)
+ (qiang-set-font
+ '("Consolas" "Monaco" "DejaVu Sans Mono" "Monospace" "Courier New") ":pixelsize=14"
+ '("Microsoft Yahei" "文泉驿等宽微米黑" "黑体" "新宋体" "宋体")))
+
+(provide 'conf-font)
View
8 conf-key-binding.el
@@ -8,7 +8,6 @@
(global-set-key [?\H-m] 'set-mark-command)
(global-set-key [?\H-i] 'align))
-(global-set-key (kbd "C-x C-z") 'execute-extended-command)
(global-set-key (kbd "C-x t") 'untabify)
(global-set-key (kbd "C-,") 'point-to-register)
(global-set-key (kbd "C-.") 'jump-to-register)
@@ -26,10 +25,13 @@
;;; 第三方扩展或者自定义的扩展的键绑定
;; key command file
-;; =================================================
-;; C-x C-\ goto-last-change init-goto-last-change
+;; =============================================================================
;; f11 toggle-fullscreen conf-fullscreen
;; C-x C-b ibuffer conf-ibuffer
;; C-x C-f ido-find-file conf-ido
+;; C-x C-\ goto-last-change init-goto-last-change
+;; M-x smex init-smex
+;; M-X smex-major-mode-commands init-smex
+;; C-c C-c M-x execute-extended-command init-smex
(provide 'conf-key-binding)
View
7 init-smex.el
@@ -0,0 +1,7 @@
+(require 'smex)
+(smex-initialize)
+
+(global-set-key (kbd "M-x") 'smex)
+(global-set-key (kbd "M-X") 'smex-major-mode-commands)
+;; This is your old M-x.
+(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
View
1  init.el
@@ -18,6 +18,7 @@
(require 'conf-hl-line)
(require 'conf-winner)
(require 'conf-key-binding)
+(require 'conf-font)
;; using el-get to manage all other third party packages
(require 'conf-el-get)

No commit comments for this range

Something went wrong with that request. Please try again.