├── .gitignore ├── README.md ├── SHELX-mode.el ├── astyle-utils.el ├── bc-mode.el ├── emoji.code ├── emoji.el ├── emoji.list └── hexo-utils.el /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled. 2 | *.elc 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Some utilities written by me # 2 | 3 | May not be useful for you. For educational purposes. 4 | 5 | - `SHELX-mode.el`: A mode for edit SHELX (http://shelx.uni-goettingen.de/) files. 6 | - `astyle-utils.el`: Use astyle in Emacs. 7 | - `hexo-utils.el`: Use Hexo more efficiently. 8 | - `emoji.el`: Emoji input method. **Not working.** 9 | - `bc-mode.el`: Use GNU bc in Emacs. 10 | 11 | # License # 12 | 13 | The license is GPLv3 for code written by me. 14 | -------------------------------------------------------------------------------- /SHELX-mode.el: -------------------------------------------------------------------------------- 1 | ;;; SHELX-mode.el --- major mode to edit SHELX .ins and .res files 2 | 3 | ;; Copyright (C) 2014 Chris Zheng. 4 | 5 | ;; Author: Chris Zheng 6 | ;; Created: 2013-12-15 7 | ;; Version: 20131215 8 | ;; X-Original-Version: 0.1 9 | ;; Keywords: SHELX, faces, editing 10 | 11 | ;; This file is not part of GNU Emacs. 12 | 13 | ;; This program is free software; you can redistribute it and/or 14 | ;; modify it under the terms of the GNU General Public License as 15 | ;; published by the Free Software Foundation; either version 3, or (at 16 | ;; your option) any later version. 17 | 18 | ;; This program is distributed in the hope that it will be useful, but 19 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | ;; General Public License for more details. 22 | 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 25 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 26 | ;; Boston, MA 02110-1301, USA. 27 | 28 | ;;; Commentary: 29 | 30 | ;; Basic syntax highlighting for editing SHELX ins and res files. 31 | 32 | ;;; Installation: 33 | 34 | ;; Make sure to place `SHELX-mode.el' somewhere in the load-path and 35 | ;; add `(require 'SHELX-mode)' to init file. 36 | 37 | ;;; Code: 38 | 39 | ;; define several class of keywords 40 | (defvar SHELX-general-keywords 41 | (mapcar 'symbol-name 42 | '( 43 | ;; Crystal data and general instructions 44 | TITL CELL ZERR LATT SYMM SFAC DISP UNIT LAUE 45 | ;; REM 46 | MORE TIME END 47 | ;; Reflection data input 48 | HKLF OMIT SHEL BASF TWIN EXTI SWAT HOPE MERG 49 | ;; Least-squares organization 50 | L.S. 51 | CGLS BLOC DAMP STIR WGHT FVAR 52 | ;; Lists and tables 53 | BOND CONF MPLA RTAB HTAB LIST ACTA SIZE TEMP 54 | WPDB 55 | ;; Fouriers, peak search and lineprinter plots 56 | FMAP GRID PLAN MOLE)) 57 | "SHELX general keywords.") 58 | 59 | (defvar SHELX-refine-keywords 60 | (mapcar 'symbol-name 61 | '( 62 | ;; Atom lists and least-squares constraints 63 | SPEC RESI MOVE ANIS AFIX HFIX FRAG FEND EXYZ 64 | EADP EQIV 65 | ;; OMIT 66 | ;; The connectivity list 67 | CONN PART BIND FREE DFIX DANG BUMP SAME SADI 68 | CHIV FLAT DELU SIMU DEFS ISOR NCSY SUMP)) 69 | "SHELX refine keywords.") 70 | 71 | ;; (regexp-opt (mapcar 'symbol-name 72 | ;; '(H He 73 | ;; Li Be B C N O F Ne 74 | ;; Na Mg Al Si P S Cl Ar 75 | ;; K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr 76 | ;; Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Tc I Xe 77 | ;; Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Pu At Rn 78 | ;; Fr Ra Ac Th Pa U Np Am Cm Bk Cf Es Fm Md No Lr Rf Db Bh Hs Mt Ds Rg Cn) 79 | ;; ) 'words) 80 | 81 | (defconst SHELX-elements-regexp "\\<\\(A[cglmr-u]\\|B[aehikr]\\|C[adefl-orsu]\\|D[bsy]\\|E[rsu]\\|F[emr]\\|G[ade]\\|H[efgos]\\|I[nr]\\|Kr\\|L[airu]\\|M[dgnot]\\|N[abdeiop]\\|Os\\|P[abdmrtu]\\|R[abe-hnu]\\|S[bceimnr]\\|T[abchilm]\\|Xe\\|Yb\\|Z[nr]\\|[BCFHIKNOPSUVWY][_\$0-9A-Z]*\\)\\>") 82 | 83 | (defvar SHELX-general-keywords-regexp (regexp-opt SHELX-general-keywords 'words)) 84 | (defvar SHELX-refine-keywords-regexp (regexp-opt SHELX-refine-keywords 'words)) 85 | 86 | (setq SHELX-font-lock-keywords 87 | `( 88 | (,SHELX-general-keywords-regexp . font-lock-type-face) 89 | ;; ("\\<\\(L\.S\.\\)\\>" . font-lock-type-face) 90 | (,SHELX-refine-keywords-regexp . font-lock-keyword-face) 91 | ("\\<\\(REM\\).*" . font-lock-comment-face) 92 | (,SHELX-elements-regexp . font-lock-variable-name-face))) 93 | 94 | ;; (defvar SHELX-syntax-table nil "Syntax table for `SHELX-mode'.") 95 | ;; (setq SHELX-syntax-table 96 | ;; (let ((synTable (make-syntax-table))) 97 | 98 | ;; ;; bash style comment: “# …” 99 | ;; (modify-syntax-entry ?R "< b" synTable) 100 | ;; (modify-syntax-entry ?\n "> b" synTable) 101 | 102 | ;; synTable)) 103 | 104 | ;; Open .ins and .res files with SHELX-mode 105 | ;;;###autoload 106 | (add-to-list 'auto-mode-alist '("\\.ins\\'" . SHELX-mode)) 107 | ;;;###autoload 108 | (add-to-list 'auto-mode-alist '("\\.res\\'" . SHELX-mode)) 109 | 110 | (defvar SHELX-mode-map 111 | (let ((map (make-sparse-keymap))) 112 | (set-keymap-parent map prog-mode-map) 113 | (define-key map "\C-c\C-c" 'SH-adjust-AFIX) 114 | map) 115 | "Keymap for SHELX-mode.") 116 | 117 | ;;;###autoload 118 | (define-derived-mode SHELX-mode fundamental-mode 119 | "SHELX mode" 120 | "Major mode for editing SHELX .ins and .res files" 121 | ;; :syntax-table SHELX-syntax-table 122 | 123 | ;; (add-hook 'SHELX-mode-hook 124 | ;; '(lambda ())) 125 | (setq font-lock-keywords-case-fold-search t) 126 | 127 | (set (make-local-variable 'comment-start) "REM") 128 | 129 | ;; code for syntax highlighting 130 | (setq font-lock-defaults '((SHELX-font-lock-keywords))) 131 | (use-local-map SHELX-mode-map)) 132 | 133 | ;;;###autoload 134 | (defun SH-adjust-AFIX () 135 | "Add Missing AFIX 0." 136 | (interactive) 137 | (if (region-active-p) 138 | (save-restriction ; there is a text selection 139 | (narrow-to-region (region-beginning) (region-end)) 140 | (goto-char (point-min)) 141 | (while (re-search-forward "^\\(AFIX[ ]+[0-9]+\n\\)\\(?:^H.*\n\\)+\\(^PART[ ]+[0-9]+\n\\)" nil t) 142 | (replace-match "\\&\\1")))) 143 | (progn 144 | (goto-char (point-min)) 145 | (while (re-search-forward "^\\(AFIX[ ]+[0-9]+\n\\)\\(?:^H.*\n\\)+\\(^PART[ ]+[0-9]+\n\\)" nil t) 146 | (replace-match "\\&\\1")))) 147 | 148 | (provide 'SHELX-mode) 149 | -------------------------------------------------------------------------------- /astyle-utils.el: -------------------------------------------------------------------------------- 1 | ;; -*- lexical-binding: t; -*- 2 | 3 | ;;; astyle-utils.el --- Functions for using astyle in Emacs. 4 | 5 | ;; Copyright (C) 2015 Chris Zheng. 6 | 7 | ;; Author: Chris Zheng 8 | ;; Created: 2015-04-01 9 | ;; Version: 20150401 10 | ;; X-Original-Version: 0.1 11 | ;; Keywords: Astyle, utils 12 | 13 | ;; This file is not part of GNU Emacs. 14 | 15 | ;; This program is free software; you can redistribute it and/or 16 | ;; modify it under the terms of the GNU General Public License as 17 | ;; published by the Free Software Foundation; either version 3, or (at 18 | ;; your option) any later version. 19 | 20 | ;; This program is distributed in the hope that it will be useful, but 21 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | ;; General Public License for more details. 24 | 25 | ;; You should have received a copy of the GNU General Public License 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 27 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 28 | ;; Boston, MA 02110-1301, USA. 29 | 30 | ;;; Commentary: 31 | 32 | ;; Functions for using astyle in Emacs. 33 | 34 | ;;; Installation: 35 | 36 | ;; Make sure to place `astyle-utils.el' somewhere in the load-path and 37 | ;; add `(require 'astyle-utils)' to init file. 38 | 39 | ;;; Code: 40 | 41 | (defvar astyle-command "astyle --style=bsd -T8 -f -p -H -U -e") 42 | 43 | ;; The meaning of parameters are: 44 | 45 | ;; --indent=force-tab=# OR -T# 46 | ;; Indent using tab characters, assuming that each 47 | ;; indent is # spaces long. Force tabs to be used in areas 48 | ;; AStyle would prefer to use spaces. 49 | 50 | ;; --break-blocks OR -f 51 | ;; Insert empty lines around unrelated blocks, labels, classes, ... 52 | 53 | ;; --pad-oper OR -p 54 | ;; Insert space padding around operators. 55 | 56 | ;; --pad-header OR -H 57 | ;; Insert space padding after paren headers (e.g. 'if', 'for'...). 58 | 59 | ;; --unpad-paren OR -U 60 | ;; Remove unnecessary space padding around parenthesis. This 61 | ;; can be used in combination with the 'pad' options above. 62 | 63 | ;; --break-elseifs OR -e 64 | ;; Break 'else if()' statements into two different lines. 65 | 66 | ;;;###autoload 67 | (defun astyle (start end) 68 | "Run astyle on region or buffer" 69 | (interactive (if mark-active 70 | (list (region-beginning) (region-end)) 71 | (list (point-min) (point-max)) 72 | )) 73 | (save-restriction 74 | (shell-command-on-region start end 75 | astyle-command 76 | (current-buffer) t 77 | (get-buffer-create "*Astyle Errors*") t))) 78 | 79 | (provide 'astyle-utils) 80 | -------------------------------------------------------------------------------- /bc-mode.el: -------------------------------------------------------------------------------- 1 | ;; -*- lexical-binding: t; -*- 2 | 3 | ;;; bc-mode.el --- Inferior mode for GNU bc 4 | 5 | ;; Copyright (C) 2015 Chris Zheng. 6 | 7 | ;; Author: Chris Zheng 8 | ;; Created: 2015-11-04 9 | ;; Version: 20151104 10 | ;; X-Original-Version: 0.1 11 | ;; Keywords: GNU bc, inferior mode, convenience 12 | 13 | ;; This file is not part of GNU Emacs. 14 | 15 | ;; This program is free software; you can redistribute it and/or 16 | ;; modify it under the terms of the GNU General Public License as 17 | ;; published by the Free Software Foundation; either version 3, or (at 18 | ;; your option) any later version. 19 | 20 | ;; This program is distributed in the hope that it will be useful, but 21 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | ;; General Public License for more details. 24 | 25 | ;; You should have received a copy of the GNU General Public License 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 27 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 28 | ;; Boston, MA 02110-1301, USA. 29 | 30 | ;;; Commentary: 31 | 32 | ;; Using GNU bc in Emacs. 33 | 34 | ;;; Installation: 35 | 36 | ;; Make sure to place `bc-mode.el' somewhere in the load-path and 37 | ;; add `(require 'bc-mode)' to init file. 38 | 39 | ;;; Code: 40 | 41 | (require 'comint) 42 | 43 | (defgroup inferior-bc nil 44 | "Run bc in a buffer." 45 | :group 'inferior-bc) 46 | 47 | (defcustom inferior-bc-program "bc" 48 | "Program invoked by `run-bc'." 49 | :type 'string) 50 | 51 | (defcustom inferior-bc-startup-args '("-i" "-l") 52 | "List of command line arguments for the inferior bc process." 53 | :type '(repeat string)) 54 | 55 | (defcustom inferior-bc-buffer "*Inferior BC*" 56 | "Name of buffer for running an inferior bc process." 57 | :type 'string) 58 | 59 | (defun remove--truncate-slash (string) 60 | (with-temp-buffer 61 | (insert string) 62 | (while (search-backward "\\ 63 | " nil t) 64 | (replace-match "")) 65 | (buffer-string))) 66 | 67 | (defun run-bc (expr &optional replace) 68 | "Calculate the `expr' using GNU bc. 69 | If called interactively, the user is asked for input. If called on 70 | region the selected expression is used as input. By default display 71 | output in temp buffer `*BC Output*'. With prefix, insert the output." 72 | (interactive 73 | (list (if (use-region-p) 74 | (buffer-substring-no-properties 75 | (region-beginning) 76 | (region-end)) 77 | (read-string "Expression: ")) 78 | current-prefix-arg)) 79 | (let ((buffer (get-buffer-create inferior-bc-buffer)) 80 | (output) 81 | (try 30) 82 | (pt)) 83 | (with-current-buffer buffer 84 | (unless (comint-check-proc buffer) 85 | (apply 'make-comint 86 | (substring inferior-bc-buffer 1 -1) 87 | inferior-bc-program nil inferior-bc-startup-args) 88 | (set-process-filter (get-buffer-process buffer) 89 | 'comint-output-filter) 90 | (add-hook 'comint-preoutput-filter-functions 91 | 'remove--truncate-slash nil t)) 92 | (setq pt (point)) 93 | (comint-send-string buffer expr) 94 | (comint-send-string buffer "\n") 95 | (while (and (= (point) pt) 96 | (> try 0)) 97 | (sit-for 0.1) 98 | (setq try (1- try))) 99 | (unless (= (point) pt) 100 | (save-excursion 101 | (forward-line -1) 102 | (setq output (buffer-substring-no-properties 103 | (line-beginning-position) 104 | (line-end-position)))))) 105 | (if (and replace output) 106 | (when (use-region-p) 107 | (delete-region (region-beginning) (region-end)) 108 | (insert output)) 109 | (message "Result: %s" output)))) 110 | 111 | (provide 'bc-mode) 112 | -------------------------------------------------------------------------------- /emoji.code: -------------------------------------------------------------------------------- 1 | :smile: 2 | :laughing: 3 | :blush: 4 | :smiley: 5 | :relaxed: 6 | :smirk: 7 | :heart_eyes: 8 | :kissing_heart: -------------------------------------------------------------------------------- /emoji.el: -------------------------------------------------------------------------------- 1 | ;; -*- lexical-binding: t; -*- 2 | 3 | ;;; emoji.el --- Input method for emoji 4 | 5 | ;; Copyright (C) 2015 Chris Zheng. 6 | 7 | ;; Author: Chris Zheng 8 | ;; Created: 2015-09-01 9 | ;; Version: 20150901 10 | ;; X-Original-Version: 0.1 11 | ;; Keywords: Emoji, input method 12 | 13 | ;; This file is not part of GNU Emacs. 14 | 15 | ;; This program is free software; you can redistribute it and/or 16 | ;; modify it under the terms of the GNU General Public License as 17 | ;; published by the Free Software Foundation; either version 3, or (at 18 | ;; your option) any later version. 19 | 20 | ;; This program is distributed in the hope that it will be useful, but 21 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | ;; General Public License for more details. 24 | 25 | ;; You should have received a copy of the GNU General Public License 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 27 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 28 | ;; Boston, MA 02110-1301, USA. 29 | 30 | ;;; Commentary: 31 | 32 | ;; Define an input method for Emoji. 33 | 34 | ;;; Installation: 35 | 36 | ;; Make sure to place `emoji.el' somewhere in the load-path and 37 | ;; add `(require 'emoji)' to init file. 38 | 39 | ;;; Code: 40 | 41 | (register-input-method 42 | "emoji" "UTF-8" 'quail-use-package 43 | "😊" "Emoji input method.") 44 | 45 | (require 'quail) 46 | 47 | (quail-define-package 48 | "emoji" "UTF-8" "😊" t 49 | "An Emoji input method." 50 | '(("" . quail-delete-last-char) 51 | ("." . quail-next-translation) 52 | (">" . quail-next-translation) 53 | ("," . quail-prev-translation) 54 | ("<" . quail-prev-translation)) 55 | nil nil nil nil) 56 | 57 | (quail-define-rules 58 | (":face:" ["😄" "😃" "😀" "😊" "☺" "😉" "😍" "😘" "😚" "😙" 59 | "😜" "😝" "😛" "😳" "😁" "😔" "😌" "😒" "😞" "😣" 60 | "😂" "😭" "😪" "😥" "😰" "😅" "😓" "😩" "😫" "😨" 61 | "😱" "😠" "😡" "😤" "😖" "😆" "😋" "😷" "😎" "😴" 62 | "😵" "😲" "😟" "😦" "😧" "😈" "👿" "😮" "😬" "😐" 63 | "😕" "😯" "😶" "😇" "😏" "😑"]) 64 | (":human:" ["👲" "👳" "👮" "👷" "💂" "👶" "👦" "👧" "👨" "👩" 65 | "👴" "👵" "👱" "👼" "👸"]) 66 | (":cat:" ["😺" "😸" "😻" "😽" "😼" "🙀" "😿" "😹" "😾"]) 67 | (":animal:" ["👹" "👺" "🙈" "🙉" "🙊" "💀" "👽" "🐶" "🐺" "🐱" 68 | "🐭" "🐹" "🐰" "🐸" "🐯" "🐨" "🐻" "🐷" "🐽" "🐮" 69 | "🐗" "🐵" "🐒" "🐴" "🐑" "🐘" "🐼" "🐧" "🐦" "🐤" 70 | "🐥" "🐣" "🐔" "🐍" "🐢" "🐛" "🐝" "🐜" "🐞" "🐌" 71 | "🐙" "🐚" "🐠" "🐟" "🐬" "🐳" "🐋" "🐄" "🐏" "🐀" 72 | "🐃" "🐅" "🐇" "🐉" "🐎" "🐐" "🐓" "🐕" "🐖" "🐁" 73 | "🐂" "🐲" "🐡" "🐊" "🐫" "🐪" "🐆" "🐈" "🐩" "🐾"]) 74 | (":nature:" ["💩" "🔥" "✨" "🌟" "💫" "💥" "💢" "💦" "💧"]) 75 | (":emotion:" ["💤" "💨" "👂" "👀" "👃" "👅" "👄" "👍" "👎" "👌" 76 | "👊" "✊" "✌" "👋" "✋" "👐" "👆" "👇" "👉" "👈" 77 | "🙌" "🙏" "☝" "👏"]) 78 | (":sport:" ["💪" "🚶" "🏃" "💃" "👫" "👪" "👬" "👭" "💏" "💑" 79 | "👯" "🙆" "🙅" "💁" "🙋" "💆" "💇" "💅" "👰" "🙎" 80 | "🙍" "🙇" "🎲" "🎯" "🏈" "🏀" "⚽" "⚾" "🎾" "🎱" 81 | "🏉" "🎳" "⛳" "🚵" "🚴" "🏁" "🏇" "🏆" "🎿" "🏂" 82 | "🏊" "🏄"]) 83 | (":cloth:" ["🎩" "👑" "👒" "👟" "👞" "👡" "👠" "👢" "👕" "👔" 84 | "👚" "👗" "🎽" "👖" "👘" "👙" "💼" "👜" "👝" "👛" 85 | "👓" "🎀" "🌂" "💄"]) 86 | (":love:" ["💛" "💙" "💜" "💚" "❤" "💔" "💗" "💓" "💕" "💖" 87 | "💞" "💘" "💌" "💋" "💍" "💎"]) 88 | (":message:" ["👤" "👥" "💬" "👣" "💭"]) 89 | (":plant:" ["💐" "🌸" "🌷" "🍀" "🌹" "🌻" "🌺" "🍁" "🍃" "🍂" 90 | "🌿" "🌾" "🍄" "🌵" "🌴" "🌲" "🌳" "🌰" "🌱" "🌼"]) 91 | (":astronomy:" ["🌐" "🌞" "🌝" "🌚" "🌑" "🌒" "🌓" "🌔" "🌕" 92 | "🌖" "🌗" "🌘" "🌜" "🌛" "🌙" "🌍" "🌎" "🌏" "🌋" 93 | "🌌" "🌠" "⭐"]) 94 | (":astronomy:" ["☀" "⛅" "☁" "⚡" "☔" "❄" "⛄" "🌀" "🌁" "🌈" 95 | "🌊"]) 96 | (":holiday:" ["🎍" "💝" "🎎" "🎒" "🎓" "🎏" "🎆" "🎇" "🎐" "🎑" 97 | "🎃" "👻" "🎅" "🎄" "🎁" "🎋" "🎉" "🎊" "🎈" "🎌" 98 | "🔮"]) 99 | (":electronic:" ["🎥" "📷" "📹" "📼" "💿" "📀" "💽" "💾" "💻" "📱" 100 | "☎" "📞" "📟" "📠" "📡" "📺" "📻" "🔊" "🔉" "🔈" 101 | "🔇" "🔔" "🔕" "📢" "📣" "⏳" "⌛" "⏰" "⌚"]) 102 | (":commodity:" ["🔓" "🔒" "🔏" "🔐" "🔑" "🔎" "💡" "🔦" "🔆" "🔅" 103 | "🔌" "🔋" "🔍" "🛁" "🛀" "🚿" "🚽" "🔧" "🔩" "🔨" 104 | "🚪" "🚬" "💣" "🔫" "🔪" "💊" "💉" "💰" "💴" "💵" 105 | "💷" "💶" "💳" "💸" "📲" "📧" "📥" "📤" "✉" "📩" 106 | "📨" "📯" "📫" "📪" "📬" "📭" "📮" "📦" "📝" "📄" 107 | "📃" "📑" "📊" "📈" "📉" "📜" "📋" "📅" "📆" "📇" 108 | "📁" "📂" "✂" "📌" "📎" "✒" "✏" "📏" "📐" "📕" 109 | "📗" "📘" "📙" "📓" "📔" "📒" "📚" "📖" "🔖" "📛" 110 | "🔬" "🔭" "📰" "🎨" "🎬" "🎤" "🎧" "🎼" "🎵" "🎶" 111 | "🎹" "🎻" "🎺" "🎷" "🎸" "👾" "🎮" "🃏" "🎴" "🀄"]) 112 | (":food:" ["🎣" "☕" "🍵" "🍶" "🍼" "🍺" "🍻" "🍸" "🍹" "🍷" 113 | "🍴" "🍕" "🍔" "🍟" "🍗" "🍖" "🍝" "🍛" "🍤" "🍱" 114 | "🍣" "🍥" "🍙" "🍘" "🍚" "🍜" "🍲" "🍢" "🍡" "🍳" 115 | "🍞" "🍩" "🍮" "🍦" "🍨" "🍧" "🎂" "🍰" "🍪" "🍫" 116 | "🍬" "🍭" "🍯" "🍎" "🍏" "🍊" "🍋" "🍒" "🍇" "🍉" 117 | "🍓" "🍑" "🍈" "🍌" "🍐" "🍍" "🍠" "🍆" "🍅" "🌽"]) 118 | (":life" ["🏠" "🏡" "🏫" "🏢" "🏣" "🏥" "🏦" "🏪" "🏩" "🏨" 119 | "💒" "⛪" "🏬" "🏤" "🌇" "🌆" "🏯" "🏰" "⛺" "🏭" "🗼" 120 | "🗾" "🗻" "🌄" "🌅" "🌃" "🗽" "🌉" "🎠" "🎡" "⛲" "🎢" 121 | "🚢" "⛵" "🚤" "🚣" "⚓" "🚀" "✈" "💺" "🚁" "🚂" "🚊" "🚉" 122 | "🚞" "🚆" "🚄" "🚅" "🚈" "🚇" "🚝" "🚋" "🚃" "🚎" "🚌" "🚍" 123 | "🚙" "🚘" "🚗" "🚕" "🚖" "🚛" "🚚" "🚨" "🚓" "🚔" "🚒" "🚑" 124 | "🚐" "🚲" "🚡" "🚟" "🚠" "🚜" "💈" "🚏" "🎫" "🚦" "🚥" "⚠" 125 | "🚧" "🔰" "⛽" "🏮" "🎰" "♨" "🗿" "🎪" "🎭" "📍" "🚩"]) 126 | (":symbol:" ["🇯" "🇰" "🇩" "🇨" "🇺" "🇫" "🇪" "🇮" "🇷" "🇬" 127 | "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" 128 | "🔟" "🔢" "#" "🔣" "⬆" "⬇" "⬅" "➡" "🔠" "🔡" 129 | "🔤" "↗" "↖" "↘" "↙" "↔" "↕" "🔄" "✖" "◀" "▶" 130 | "🔼" "🔽" "↩" "↪" "ℹ" "⏪" "⏩" "⏫" "⏬" "⤵" 131 | "⤴" "🆗" "🔀" "🔁" "🔂" "🆕" "🆙" "🆒" "🆓" "🆖" 132 | "📶" "🎦" "🈁" "🈯" "🈳" "🈵" "🈴" "🈲" "🉐" "🈹" 133 | "🈺" "🈶" "🈚" "🚻" "🚹" "🚺" "🚼" "🚾" "🚰" "🚮" 134 | "🅿" "♿" "🚭" "🈷" "🈸" "🈂" "Ⓜ" "🛂" "🛄" "🛅" 135 | "🛃" "🉑" "㊙" "㊗" "🆑" "🆘" "🆔" "🚫" "🔞" "📵" 136 | "🚯" "🚱" "🚳" "🚷" "🚸" "⛔" "✳" "❇" "❎" "✅" 137 | "✴" "💟" "🆚" "📳" "📴" "🅰" "🅱" "🆎" "🅾" "💠" 138 | "➿" "♻" "♈" "♉" "♊" "♋" "♌" "♍" "♎" "♏" 139 | "♐" "♑" "♒" "♓" "⛎" "🔯" "🏧" "💹" "💲" "💱" 140 | "©" "®" "™" "❌" "‼" "⁉" "❗" "❓" "❕" "❔" 141 | "⭕" "🔝" "🔚" "🔙" "🔛" "🔜" "🔃" "➕" "➖" "➗" 142 | "♠" "♥" "♣" "♦" "💮" "💯" "✔" "☑" "🔘" "🔗" 143 | "➰" "〰" "〽" "🔱" "◼" "◻" "◾" "◽" "▪" "▫" 144 | "🔺" "🔲" "🔳" "⚫" "⚪" "🔴" "🔵" "🔻" "⬜" "⬛" 145 | "🔶" "🔷" "🔸" "🔹"]) 146 | (":time:" ["🕛" "🕧" "🕐" "🕜" "🕑" "🕝" "🕒" "🕞" "🕓" "🕟" 147 | "🕔" "🕠" "🕕" "🕖" "🕗" "🕘" "🕙" "🕚" "🕡" "🕢" 148 | "🕣" "🕤" "🕥" "🕦"]) 149 | ) 150 | 151 | (provide 'emoji) 152 | -------------------------------------------------------------------------------- /emoji.list: -------------------------------------------------------------------------------- 1 | 😄 2 | 😆 3 | 😊 4 | 😃 5 | ☺ 6 | 😏 7 | 😍 8 | 😘 -------------------------------------------------------------------------------- /hexo-utils.el: -------------------------------------------------------------------------------- 1 | ;; -*- lexical-binding: t; -*- 2 | 3 | ;;; hexo-utils.el --- Functions for using Hexo under Emacs. 4 | 5 | ;; Copyright (C) 2015 Chris Zheng. 6 | 7 | ;; Author: Chris Zheng 8 | ;; Created: 2015-01-26 9 | ;; Version: 20150126 10 | ;; X-Original-Version: 0.1 11 | ;; Keywords: Hexo, utils 12 | 13 | ;; This file is not part of GNU Emacs. 14 | 15 | ;; This program is free software; you can redistribute it and/or 16 | ;; modify it under the terms of the GNU General Public License as 17 | ;; published by the Free Software Foundation; either version 3, or (at 18 | ;; your option) any later version. 19 | 20 | ;; This program is distributed in the hope that it will be useful, but 21 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | ;; General Public License for more details. 24 | 25 | ;; You should have received a copy of the GNU General Public License 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 27 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 28 | ;; Boston, MA 02110-1301, USA. 29 | 30 | ;;; Commentary: 31 | 32 | ;; Two functions for Functions for using Hexo efficiently in Emacs. 33 | 34 | ;;; Installation: 35 | 36 | ;; Make sure to place `hexo-utils.el' somewhere in the load-path and 37 | ;; add `(require 'hexo-utils)' to init file. 38 | 39 | ;;; Code: 40 | 41 | ;;;###autoload (autoload 'hexo-deploy "hexo-utils") 42 | (defun hexo-deploy (dir) 43 | "Deploy hexo site. 44 | If called with a prefix argument, the user is asked for directory of 45 | the site. Otherwise, the directory is guessed from 46 | `default-directory'." 47 | (interactive (list (if current-prefix-arg 48 | (file-name-as-directory 49 | (read-directory-name "Hexo site directory: " 50 | default-directory)) 51 | default-directory))) 52 | (let ((old-dir default-directory)) 53 | (if (file-exists-p (concat dir "db.json")) 54 | (progn 55 | (setq default-directory dir) 56 | (start-process "hexo-deploy" "*Hexo Deploy Output*" "hexo" "d" "-g") 57 | (setq default-directory old-dir)) 58 | (progn 59 | (if (file-exists-p (expand-file-name 60 | (concat old-dir "../../db.json"))) 61 | (progn 62 | (setq default-directory (expand-file-name 63 | (concat old-dir "../../"))) 64 | (start-process "hexo-deploy" 65 | "*Hexo Deploy Output*" "hexo" "d" "-g") 66 | (setq default-directory old-dir)) 67 | (error "Hexo deploy failed. Wrong directory?")))))) 68 | 69 | (defun hexo-wait-and-visit (proc max) 70 | "Use timer to wait hexo process finish then visit the created file." 71 | (if (eq (process-status proc) 'exit) 72 | ;; Exit normally. 73 | (let ((hexo-buffer (process-buffer proc))) 74 | (set-buffer hexo-buffer) 75 | (goto-char (point-min)) 76 | ;; Compatible with Hexo v3. 77 | (if (search-forward "Created: " nil t 1) 78 | (progn 79 | (find-file (buffer-substring-no-properties (point) (line-end-position))) 80 | (kill-buffer hexo-buffer)))) 81 | (when (< max 5) 82 | (run-with-timer 6 nil `(lambda () (funcall 'hexo-wait-and-visit ,proc ,(1+ max))))))) 83 | 84 | ;;;###autoload (autoload 'hexo-new "hexo-utils") 85 | (defun hexo-new (dir type title) 86 | "Create an hexo draft/page/photo/post/. 87 | If called with a prefix argument, the user is asked for type of the 88 | created item. By default, `tpye' is post." 89 | (interactive 90 | (list 91 | (cond 92 | ((file-exists-p (concat default-directory "db.json")) default-directory) 93 | ((file-exists-p (concat default-directory "../../db.json")) 94 | (expand-file-name (concat default-directory "../../"))) 95 | (t (file-name-as-directory 96 | (read-directory-name "Hexo site directory: ")))) 97 | (if current-prefix-arg 98 | (read-string "Type to create: " "post" nil "post") 99 | "post") 100 | (read-string "Title: "))) 101 | (let ((old-dir default-directory)) 102 | (if (string= title "") 103 | (error "Empty title.") 104 | (progn 105 | (setq default-directory dir) 106 | (hexo-wait-and-visit (start-process "hexo-new" "*Hexo New Output*" "hexo" "n" type title) 0) 107 | (setq default-directory old-dir))))) 108 | 109 | (provide 'hexo-utils) 110 | --------------------------------------------------------------------------------