This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Enhanced minibuffer & find-file! 加強minibuffer和find-file! | |
;; 我一直無法忍受helm和ido-mode的find-file設計,但又覺得他們有部份功能 | |
;; 實在很方便,例如能夠按DEL直接刪回上個目錄的路徑,或者整個路徑重新輸 | |
;; 入等。這裡做了幾個符合自己需要的功能: | |
;; 1. 如果minibuffer中是個目錄的樣式,按M-[DEL]就可以往前刪到parent dir | |
;; 2. 按一次C-a只是一般的beginning-of-line,但按第二次C-a的話: | |
;; (a) 如果是個路徑,會把~/或/以後的東西刪掉。 | |
;; (b) 如果不是路徑,則整行刪掉。 | |
;; 3. 以上行為都不會把刪過的東西存到 kill-ring,所以可以放心用力刪, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; All Languages known to GitHub and their extensions. | |
;; Source: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml | |
'(("ABAP" . (".abap")) | |
("ANTLR" . (".g4")) | |
("ASP" . (".asp" ".asax" ".ascx" ".ashx" ".asmx" ".aspx" ".axd")) | |
("ATS" . (".dats" ".atxt" ".hats" ".sats")) | |
("ActionScript" . (".as")) | |
("Ada" . (".adb" ".ads")) | |
("Agda" . (".agda")) | |
("ApacheConf" . (".apacheconf")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun fsc-split-sentence-to-lists (vOriginal vLineCharNum) | |
"First arg is an ONE-LINE string as inputed sentence. The | |
second is 'How many characters in a line', an integer. | |
For example, when vLineCharNum = 3, Output is: | |
((\"一\" \"二\" \"三\") | |
(\"四\" \"五\" \"六\") | |
...)" | |
(let* ((vSplittedString (split-string-and-unquote vOriginal "")) | |
(vStart 0) | |
vOutput |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun fsc-split-sentence-to-lists (vOriginal vLineCharNum) | |
"First arg is an ONE-LINE string as inputed sentence. The | |
second is 'How many characters in a vertical line', an integer. | |
For example, when vLineCharNum = 3, Output is a reversed list." | |
;; (... | |
;; (\"四\" \"五\" \"六\") | |
;; (\"一\" \"二\" \"三\")) | |
(let* ((vOriginal (fsc-convert-halfwidth-to-fullwidth vOriginal)) | |
(vSplittedString (split-string-and-unquote vOriginal "")) | |
(vStart 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; loop | |
(defun frac (n) | |
(apply #'* | |
(loop for i from 1 to n | |
collect i))) | |
;; dotimes | |
;; (dotimes (x 5) ...) => 0, 1, 2, 3, 4 | |
(defun frac (n) | |
(let (fin) | |
(dotimes (x n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This .el file provide syntax highlighting for ruby tags in Emacs's markdown-mode | |
(defface markdown-ruby-mark '((((class color) (background light)) (:foreground "#fff" :background "#6c0099")) | |
(((class color) (background dark)) (:foreground "#6c0099" :background "#d187ff"))) "" :group 'faces) | |
(defface markdown-ruby-title '((((class color) (background light)) (:foreground "#6c0099")) | |
(((class color) (background dark)) (:foreground "#d187ff"))) "" :group 'faces) | |
(defface markdown-ruby-content '((((class color) (background light)) (:foreground "#d187ff")) | |
(((class color) (background dark)) (:foreground "#8700af"))) "" :group 'faces) | |
(font-lock-add-keywords 'markdown-mode | |
'(("\{\\(rb\\)\|.+?\|.+?\}" 1 'markdown-ruby-mark) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
footnote.js: A filter for Hexo to generate footnotes. Place this file in /scripts/footnote.js. | |
======================================================================== | |
Author: kuanyui(azazabc123[at]g~~~m~~~a~~~i~~~l[dot]com) | |
Date: 20140518 | |
License: WTFPL 1.0 | |
======================================================================== | |
The following string in article | |
{fn|I'm the a lot lot of content.} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 避免使用者在神智不清的情況下用message.el幹出無法挽回的蠢事、寄出不該寄的email | |
(setq message-confirm-send t) | |
(defun message-test-mind-before-send () | |
(interactive) | |
(let* ((a (random 50)) | |
(b (random 15)) | |
(ans (+ a b)) | |
(input (string-to-int (read-from-minibuffer (format "%s + %s = " a b))))) | |
(if (eq input ans) | |
(message-send-and-exit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; resize-frame.el --- A minor mode to resize frames easily. -*- lexical-binding: t; -*- | |
;; Copyright (C) 2014 kuanyui | |
;; Author: kuanyui <[email protected]> | |
;; Keywords: frames, tools, convenience | |
;; License: WTFPL 1.0 | |
;;; Commentary: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun run-length (input) | |
(let (l fin) | |
(mapcar (lambda (x) | |
(if (null x) | |
(setq x "nil")) | |
(cond ((null l) | |
(setq fin (list (list 1 x))) | |
(setq l x)) | |
((equal x l) | |
(setq fin (cons (list (1+ (car (car fin))) x) (cdr fin)))) |