Permalink
Browse files

Add functions: major-mode, what-face.

  • Loading branch information...
1 parent aac9b97 commit 6a150099b7def9530635794fb49a511ccc837dee @winfred-lu committed Jun 14, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 winfred-misc.el
View
@@ -33,7 +33,13 @@
(defun switch-to-liu ()
(interactive)
(activate-input-method "chinese-liu5"))
-(global-set-key (kbd "<C-f9>") 'switch-to-liu)
+(global-set-key (kbd "<C-f8>") 'switch-to-liu)
+
+;; prints the major mode of current buffer
+(defun major-mode (buf)
+ (interactive "b")
+ (with-current-buffer buf
+ (message "major-mode of %s is %s" buf major-mode)))
;; http://irreal.org/blog/?p=297
;; http://nflath.com/2009/08/easier-emacs/
@@ -48,3 +54,10 @@
(insert (current-kill 0)))))
(global-set-key "\C-ce" 'eval-and-replace)
+;; http://stackoverflow.com/questions/1242352/get-font-face-under-cursor-in-emacs
+(defun what-face (pos)
+ (interactive "d")
+ (let ((face (or (get-char-property (point) 'read-face-name)
+ (get-char-property (point) 'face))))
+ (if face (message "Face: %s" face) (message "No face at %d" pos))))
+

0 comments on commit 6a15009

Please sign in to comment.