my .config

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; C-x C-+会增加字体大小
;; C-+ 或 C-- 会增加/缩小字体大小
;; C-x C-0会恢复字体大小

;;================org========================
;;-------------------org-----------------
;; #+ATTR_ORG: :width 100 ~
;; #+ATTR_HTML:  :width 100 ~
;; C-c C-q 为标题添加标签
;;C-c, 设置优先级(方括号里的ABC)
;; C-c / m 生成带标签的树
;;C-c C-x C-v 直接预览图片
;;C-c /	它会提示再输入一个字符来选择稀疏树的创建命令。
;;C-c / r 将所有匹配的项显示成稀疏树。所有的匹配项都会高亮显示;按 C-c C-c 取消高亮。
;;------------------end org---------------
;;------------------beamer---------------
;;C-c C-b i  beamer 控制宏
;;===================end org===============
;; M -x  delete-duplicate-lines
;; C-u 7 M-x sort-field
;; M-/ (dabbrev-expand) 动态补全,默认搜索本文本
;; #+OPTIONS ^:nil 关闭下划线转义 输入a_{b}才转义
;; #+OPTIONS: toc:t  ^:nil author:nil num:2
;; #+OPTINS: n:t  html 中不换行
;;--------------------------job--------------------
;; C-c C-t || S-LEFT/RIGHT    定义todo任务
;; C-c [    &&    C-c ]  将文件加入或移除清单
;; C-c a t 列出所有未完成任务
;; C-c a a 日程表视图
;; C-c C-x C-v 直接预览图片
;;--------------------src -------------
;;(require 'org-tempo)
;; if want use <s TAB to begin a src block in org-mode 9.3,you must
;; add org-tempo. you can also use C-c C-, to do the same thing.
;;--------------------------------------
;; 丛journal中导出md文件
;;  C-c C-e H H
;;--------------------------------------
;;=================book mark================
;; ‘C-x r m’ – set a bookmark at the current location (e.g. in a file)
;; ‘C-x r b’ – jump to a bookmark
;; ‘C-x r l’ – list your bookmarks
;; ‘M-x bookmark-delete’ – delete a bookmark by name
;;===========================================

;; #+TITLE:  Documents and presentations with org-mode
;; #+AUTHOR: John Goerzen
;; #+BEAMER_HEADER: \institute{The Changelog}
;; #+PROPERTY: comments yes
;; #+PROPERTY: header-args :exports both :eval never-export
;; #+OPTIONS: H:2
;; #+BEAMER_THEME: CambridgeUS
;; #+BEAMER_COLOR_THEME: default
;;===================================================
;; M-s o    occur
;;==========================================================
(package-initialize)
;;(setq debug-on-error t) ;;调试模式
(add-to-list 'package-archives ' ("melpa"  . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/"))
;' ("gnu"    . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
;' ("nongnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/nongnu/")

;;                                . "http://elpa.emacs-china.org/melpa/")
;t)
;;启动设置
(setq default-frame-alist
             '((vertical-scroll-bars)
               (top . 0)
               (left . 1050)
               (width . 120)
               (height . 72)
                (background-color . "black") ;
                (foreground-color . "grey")
                (cursor-color . "gold1")
                (mouse-color . "gold1")
               (tool-bar-lines . 0)
               (menu-bar-lines . 0)
               (right-fringe)
               (left-fringe)))

;;启动自动最大化(数据自己调整,注意格式,如(top . 0),圆点前后都要留有空格)
;;(setq initial-frame-alist '((top . 0) (left . 0) (width . 142) (height . 46)))

;;=================-用户信息==========================
(add-to-list 'load-path "/Users/mypath/.emacs.d/myconfig/")

(setq default-directory "/Users/mypath");;设置打开文件的缺省路径
(add-to-list 'exec-path "/usr/local/bin");;添加执行路径,可以M-x ielm 查看exec-path

(setq user-full-name "user_name")
(setq user-mail-address "user_name@comp.com")
;;================end====================================
(setq dired-dwim-target t) ;; dired

;;=================窗口设置================
(load-theme 'deeper-blue t t)     ;;加载浅色主题,但不启用。
(load-theme 'tango-dark t t)	;;加载深色主题,但不启用。
;;早上5点启用浅色主题, 每24小时重复一次。
(run-at-time "05:00" (* 60 60 24) (lambda () (enable-theme 'tango-dark)))
;;晚上7点启用深色主题, 每24小时重复一次。
(run-at-time "19:00" (* 60 60 24) (lambda () (enable-theme 'deeper-blue)))
;;------------窗口界面设置结束-----------------

;;------------显示时间设置------------------------------
(display-time-mode 1);;启用时间显示设置,在minibuffer上面的那个杠上
(setq display-time-24hr-format t);;时间使用24小时制
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
;; (setq display-time-interval 10);;时间的变化频率,单位多少来着?
;;(setq word-wrap-by-category t) ;;自动换行
;;------------显示时间设置结束--------------

;;------------定制操作习惯--------------------
(setq visible-bell t) ;;关闭烦人的出错时的提示声
(setq inhibit-startup-message t);;关闭emacs启动时的画面
(fset 'yes-or-no-p 'y-or-n-p);; yes 按y或空格键,n 表示 no。

;; (setq font-lock-maximum-decoration t)
;; (setq font-lock-global-modes '(not shell-mode text-mode))
;; (setq font-lock-verbose t)
;; (setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
;; 语法高亮。除 shell-mode 和 text-mode 之外的模式中使用语法高亮。

;;(setq column-number-mode t)
;;(setq line-number-mode t)
(global-display-line-numbers-mode t) ;;显示行列号
(setq mouse-yank-at-point t) ;;不要在鼠标点击的那个地方插入剪贴板内容。
(setq kill-ring-max 200);;设置粘贴缓冲条目数量

(setq-default auto-fill-function 'do-auto-fill) ; Autofill in all modes;;
;;(setq default-fill-column 360) ;;把 fill-column 设为 60. 这样的文字更好读

(setq-default indent-tabs-mode nil)
(setq default-tab-width 8);;tab键为8个字符宽度
(setq tab-stop-list ()) ;;不用 TAB 字符来indent, 这会引起很多奇怪的错误
(setq-default line-spacing 6) ;; 行间距设置
(setq enable-recursive-minibuffers t)  ;;可以递归的使用 minibuffer


(setq scroll-margin 3 scroll-conservatively 10000);;防止页面滚动时跳动,3行时滚动

(setq default-major-mode 'text-mode) ;;设置缺省主模式是text,
(add-hook 'text-mode-hook 'turn-on-auto-fill) ;;进入auto-fill次模式.而不是基本模式fundamental-mode

(show-paren-mode t);;打开括号匹配显示模式

(mouse-avoidance-mode 'animate);;光标靠近鼠标指针时,让鼠标指针自动让开

(setq frame-title-format "emacs@%b");;在标题栏显示buffer的名字

(setq auto-image-file-mode t) ;;让 Emacs 可以直接打开和显示图片。

(setq global-font-lock-mode t);;进行语法加亮。

;; 把C-j绑定到到达指定行上
(global-set-key (kbd "C-h") 'backward-delete-char-untabify)
(global-set-key (kbd "M-h") 'backward-kill-word)
(global-set-key (kbd "<f1>") 'help-command)
(global-set-key (kbd "<f8>") 'bash)
(global-set-key (kbd "M-[") 'multi-term-prev)
(global-set-key (kbd "M-]") 'multi-term-next)
(global-set-key "\C-cg" 'magit-status)

;;当你在shell、telnet、w3m等模式下时,必然碰到过要输入密码的情况,此时加密显出你的密码
(add-hook 'comint-output-filter-functions
      'comint-watch-for-password-prompt)

(setq make-backup-files nil);; 设定不产生备份文件

(setq-default make-backup-files nil);; 不生成临时文件

(put 'scroll-left 'disabled nil) ;允许屏幕左移
(put 'scroll-right 'disabled nil) ;允许屏幕右移
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
;;把这些缺省禁用的功能打开。

(setq x-select-enable-clipboard t);;允许emacs和外部其他程序的粘贴

(setq org-image-actual-width nil);;不显示实际图片尺寸

(setq track-eol t) ;; 当光标在行尾上下移动的时候,始终保持在行尾。

;;====================yasnippet===============
;; (setq yas-snippet-dirs
;; '("~/.emacs.d/snippets/";;personal snippets
;;   ))
;; (yas-global-mode 1)

(require 'openwith)
(openwith-mode t)
(setq openwith-associations
        '(("\.docx$" "open" (file) )("\.xlsx$" "open" (file) ) ("\.pptx$" "open" (file))
          ("\.mov\|\.RM$\|\.RMVB$\|\.avi$\|\.AVI$\|\.flv$\|\.mp4\|\.mkv$\|\.rmvb$" "open" (file) )
          ("\.pdf$" "open" (file))
          ("\.CHM$\|\.chm$" "open"  (file) )
          )
        )

;;(org-use-sub-superscripts '{}) ;; 上标^下标_是否需要特殊字符包裹,这里设置需要用大括号包裹

(require 'myorg)
(require 'mygtd)
(require 'myabbrev)
;;-------------------begin tramp-------------------------
;;(customize-set-variable 'tramp-default-method "ssh")
;; (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
;; (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
;; (add-to-list 'tramp-default-method-alist
;;              '("\\`localhost\\'" "\\`root\\'" "su"))
;;-------------------end tramp---------------------------

;;============================================================

(setq message-kill-buffer-on-exit t)
;;=====================begin eshell====================
(defun eshell-here ()
 "Opens up a new shell in the directory associated with the
 current buffer's file. The eshell is renamed to match that
 directory to make multiple eshell windows easier."
  (interactive)
  (let* ((parent (if (buffer-file-name)
                     (file-name-directory (buffer-file-name))
                   default-directory))
         (height (/ (window-total-height) 3))
         (name   (car (last (split-string parent "/" t)))))
    (split-window-vertically (- height))
    (other-window 1)
    (eshell "new")
    (rename-buffer (concat "*eshell: " name "*"))
    ;; (insert (concat "ls"))
    ;; (eshell-send-input)
    ))

(global-set-key (kbd "C-!") 'eshell-here)

(defun eshell/x ()
  (eshell-life-is-too-much)
  (delete-window))

(add-hook
 'eshell-mode-hook
 (lambda ()
   (define-key eshell-mode-map (kbd "C-d")
     (lambda (arg)
       "Delete a character or quit eshell if there's nothing to delete."
       (interactive "p")
       (if (and (eolp) (looking-back eshell-prompt-regexp nil))
           (progn
             (eshell-life-is-too-much)
             (delete-window))
         (delete-char arg))))))
;;=====================end eshell====================
;;==============begin picture=================
(org-babel-do-load-languages
      'org-babel-load-languages
      '((emacs-lisp . t)
        (ditaa . t)
        (python . t)
        (shell . t)
        (latex . t)
        (plantuml . t)
        (dot . t)
        (lisp . t)
        (org . t)
        (java . t)))

(setq org-plantuml-jar-path
      (expand-file-name "~/.emacs.d/plugins/plantuml-1.2023.8.jar"))
(setq org-ditaa-jar-path  "~/.emacs.d/plugins/ditaa0_9.jar")
(setq org-confirm-babel-evaluate nil)   ;picture 不提示
(add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)

; Make babel results blocks lowercase
(setq org-babel-results-keyword "results")

(defun bh/display-inline-images ()
  (condition-case nil
      (org-display-inline-images)
    (error nil)))

(setq org-latex-create-formula-image-program 'imagemagick) ;使用imagemagick
(eval-after-load "preview"
  '(add-to-list 'preview-default-preamble
                "\\PreviewEnvironment{tikzpicture}" t))

;;C-c C-c get pic  C-c C-x C-v see picture
;;==============end picture=================

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(org-agenda-files
   '("/Users/mypath/.todos/journal.org" "/Users/mypath/.todos/gtd.org"))
 '(org-download-screenshot-method "screencapture -i %s")
 '(package-selected-packages
   '(ox-spectacle org-download yasnippet ox-hugo openwith elpy magit magit-gerrit magithub)))
 ;; foreground color (yellow)
;; ---- END Email client ----
;;----------------------------------------------------------
;;(put 'erase-buffer 'disabled nil)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

my latex config

(provide 'myorg)
;;--------------------------begin latex---------------------------
;;export
;; (require 'ox-latex)
;;-------------------------begin org-download-------------------
(require 'org-download)
(add-hook 'dired-mode-hook 'org-download-enable)
(setq org-download-annotate-function (lambda (_link) ""))

(defun my-org-download-method (link)
  (let ((filename
         (format-time-string "screenshot_%Y%m%d_%H%M%S.png"))
        (dirname (file-name-sans-extension (buffer-name)) ))
    ;; if directory not exist, create it
    (unless (file-exists-p dirname)
      (make-directory dirname))
    ;; return the path to save the download files
    (expand-file-name filename dirname)))

(setq org-download-method 'my-org-download-method)

(add-hook 'org-mode-hook
          (lambda()
            (local-set-key (kbd "C-c p") 'org-download-screenshot)))
;;-------------------------End org-download -----------------

(require 'ox-beamer)
(with-eval-after-load 'ox-latex
    (add-to-list 'org-latex-classes
        '("ctexart"
          "\\documentclass[UTF8,a4paper,12pt]{ctexart}
          \\setcounter{secnumdepth}{4}
          \\usepackage[linkcolor=blue,citecolor=blue,backref=page]{hyperref}
          \\usepackage{xeCJK}
          \\hypersetup{hidelinks}
          \\usepackage{color}
          \\usepackage{xcolor}
          \\usepackage{fontspec}
          \\usepackage{tikz}
          \\usepackage{geometry}
          \\geometry{top=2cm,bottom=2cm,right=2cm,left=2.5cm}
          \\geometry{headsep=0.5cm}
          \\usepackage{setspace}
          \\setlength{\\baselineskip}{22pt}
          \\setlength{\\parskip}{0pt}
          \\usepackage{enumerate}
          \\usepackage{enumitem}
          \\newcommand{\\xiaosan}{\\fontsize{15.1pt}{\\baselineskip}\\selectfont}
          \\newcommand{\\sihao}{\\fontsize{14.1pt}{\\baselineskip}\\selectfont}
          \\newcommand{\\xiaosi}{\\fontsize{12.1pt}{\\baselineskip}\\selectfont}
          \\newcommand{\\wuhao}{\\fontsize{10.5pt}{\\baselineskip}\\selectfont}
          \\setenumerate[1]{itemsep=0pt,partopsep=0pt,parsep=\\parskip,topsep=5pt}
          \\setitemize[1]{itemsep=0pt,partopsep=0pt,parsep=\\parskip,topsep=5pt}
          \\setdescription{itemsep=0pt,partopsep=0pt,parsep=\\parskip,topsep=5pt}
          \\usepackage[super,square,numbers,sort&compress]{natbib}
          \\usepackage{minted}
          \\usemintedstyle{emacs}%{vs}%{pastie}%{autumn}%{emacs}%{tango}%{rrt}%{manni}
          \\usepackage{fancyhdr}
              \\pagestyle{plain}
          \\ctexset{contentsname=\\heiti{目{\\quad}录}}
          \\usepackage{titlesec}
              \\titleformat{\\section}[block]{\\normalfont\\xiaosan\\bfseries\\heiti}{\\thesection}{10pt}{\\xiaosan}
              \\titleformat{\\subsection}[block]{\\normalfont\\sihao\\bfseries\\heiti}{\\thesubsection}{10pt}{\\sihao
}
              \\titleformat{\\subsubsection}[block]{\\normalfont\\sihao\\bfseries\\heiti}{\\thesubsubsection}{10pt}{\\sihao}
              \\titlespacing{\\chapter} {0pt}{-22pt}{0pt}{}
              \\titlespacing{\\section} {0pt}{0pt}{0pt}
              \\titlespacing{\\subsection} {0pt}{0pt}{0pt}
              \\titlespacing{\\subsubsection} {0pt}{0pt}{0pt}"
           ("\\section{%s}" . "\\section*{%s}")
           ("\\subsection{%s}" . "\\subsection*{%s}")
           ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
           ("\\paragraph{%s}" . "\\paragraph*{%s}")
           ("\\subparagraph{%s}"     . "\\subparagraph*{%s}")))
    (add-to-list 'org-latex-classes
     ;; beamer class, for presentations
        '("beamer"
        "\\documentclass[11pt,professionalfonts]{beamer}
         \\mode
          \\beamertemplateballitem
          \\setbeameroption{show notes}
          \\usepackage{graphicx}
          \\usepackage{fontspec}
          \\usepackage{xeCJK}
          \\usepackage{color}
          \\usepackage{xcolor}
          \\usepackage{tikz}
          \\usepackage{titletoc}
          \\usepackage{ctex}
          \\usepackage{lmodern}
          \\usepackage{polyglossia}
          \\usepackage{verbatim}
          \\usepackage{soul}
          \\usepackage{textcomp}
          \\usepackage{marvosym}
          \\usepackage{wasysym}
          \\usepackage{latexsym}
          \\usepackage{minted}
          \\usemintedstyle{emacs}%{vs}%{pastie}%{autumn}%{emacs}%{tango}%{rrt}%{manni}
          \\usepackage{/Users/mypath/org/styles/zyuebeamer}
          \\subject{{{{beamersubject}}}}"
              ("\\section{%s}" . "\\section*{%s}")
              ("\\begin{frame}[fragile]\\frametitle{%s}"
               "\\end{frame}"
               "\\begin{frame}[fragile]\\frametitle{%s}"
               "\\end{frame}")))
    (add-to-list 'org-latex-packages-alist
                 '("UTF8,fontset=macnew" "ctex" t ))
    (setq org-latex-default-class "ctexart")
    (setq org-latex-logfiles-extensions
          (quote ("lof" "lot" "tex~" "tex" "aux"
                  "idx" "log" "out" "toc" "nav"
                  "snm" "vrb" "dvi" "fdb_latexmk"
                  "blg" "brf" "fls" "entoc" "ps"
                  "spl" "bbl" "xdv")))
    (setq org-latex-listings 'minted)
    (setq org-latex-minted-options
          '(("framesep" "2mm")
            ("baselinestretch" "1.2")
            ("linenos=true")
            ("fontsize" "\\footnotesize") ;
;;            ("bgcolor" "LightGray")
            ("breaklines" "true")
            ("breakanywhere" "true")
            ))
    (setq org-latex-pdf-process '("xelatex -shell-escape -interaction nonstopmode %f"
                                  "xelatex -shell-escape -interaction nonstopmode %f"))
)
;;\\ctexset{section={format=\\raggedright \\sihao \\heiti}} ;标题靠左
;;\\usepackage[super,square,numbers,sort&compress]{natbib}  ;引用标号
;; \\usepackage{amssymb}  ;数学公式包
;; \\usepackage{mathrsfs} ;数学公式包
;; \\usepackage[namelimits]{amsmath} ;数学公式包
;; \\usepackage{tikz}  ;绘图包,流程图,脑图
;; \\setmainfont{Times New Roman} ;全局设置字体
;; \\usepackage{ulem} ;下划线等标记
          ;; \\usepackage{fancyhdr} ;设置页眉页脚
          ;;     \\pagestyle{fancy}
          ;;     \\fancyhead{}
          ;;     \\fancyhead[CO,CE]{\\leftmark}
;;          \\institute{{{{beamerinstitute}}}} 指定学校
;;            ("framesep=2mm")
;;             ("fontsize=\\footnotesize")
;; (add-to-list 'org-latex-packages-alist '("" "minted")) ;加入一个包
;;--------------------------end latex---------------------------
;; Enable abbrev-mode

my abberev config

(provide 'myabbrev)

(add-hook 'org-mode-hook (lambda () (abbrev-mode t)))
;; abbev and skeleton
(define-skeleton skel-org-block
  "Insert an org block, querying for type."
  "Type: "
  "#+begin_" str "\n"
  _ - \n
  "#+end_" str "\n")

(define-abbrev org-mode-abbrev-table "sblk" "" 'skel-org-block)

(define-skeleton skel-org-block-ditaa
  "Insert a org ditaa block, querying for filename."
  "File (no extension): "
  "#+begin_src ditaa :file " str ".png :cache yes :cmdline -r\n"
  _ - \n
  "#+end_src\n")

(define-abbrev org-mode-abbrev-table "sditaa" "" 'skel-org-block-ditaa)


(define-skeleton skel-org-beamer
  "Insert an org block, querying for type."
  "Type: "
"# -*- mode: snippet -*-\n"
"#+TITLE:  "   str  \n
"#+AUTHOR:    user_name \n"
"#+EMAIL:     user_name@comp.com \n"
"#+DESCRIPTION: \n"
"#+KEYWORDS: \n"
"#+OPTIONS:   H:2 num:t toc:t \\n:nil @:t ::t |:t ^:{} -:t f:t *:t <:t broken-links:t\n"
"#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc\n"
"#+EXPORT_SELECT_TAGS: export\n"
"#+EXPORT_EXCLUDE_TAGS: noexport\n"
"#+startup: beamer\n"
"#+LaTeX_CLASS: beamer\n"
"#+LaTeX_CLASS_OPTIONS: [bigger]\n"
"#+columns: %45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act)%4BEAMER_col(Col) %8BEAMER_opt(Opt)\n"
@ _)

(define-abbrev org-mode-abbrev-table "beamh" "" 'skel-org-beamer)

(define-skeleton skel-defun
  "Insert a defun template."
  "Name: "
  "(defun " str " (" @ - ")" \n
  "(" @ _ ")" \n)

(define-abbrev org-mode-abbrev-table "defun" "" 'skel-defun)

(define-abbrev org-mode-abbrev-table "footz" "#+attr_latex: :font \\footnotesize" "")

(define-skeleton read-two-vars
  "Prompt the user for two variables, and use them in a skeleton."
  ""
  > "variable A is " (setq v1 (skeleton-read "Variable A? ")) \n
  > "variable B is " (setq v2 (skeleton-read "Variable B? ")) \n
  > "A: " v1 "    B: " v2 \n)

(define-abbrev org-mode-abbrev-table "twov" "" 'read-two-vars)

(define-skeleton skel-org-orgh
    "Insert a org head."
    "Name: "
    "#+TITLE:" str \n
    "#+OPTIONS: toc:t <:nil broken-links:t author:nil ^:{} todo:nil pri:nil tags:nil\n "
    @ _)

(define-abbrev org-mode-abbrev-table "orgh" "" 'skel-org-orgh)

(define-skeleton skel-org-hugoh
    "Insert a hugo head."
    "Name: "
"#+OPTIONS: author:nil ^:{} broken-links:t todo:nil pri:nil tags:nil\n"
"#+HUGO_BASE_DIR: ../\n"
"#+TITLE: " str \n
"#+HUGO_AUTO_SET_LASTMOD: t\n"
"#+HUGO_TAGS: " @ - \n
"#+HUGO_CATEGORIES: \n"
"#+HUGO_DRAFT: false\n")

(define-abbrev org-mode-abbrev-table "hugoh" "" 'skel-org-hugoh)


(define-skeleton skel-org-picv
    "Insert a hugo head."
    "Name: "
"#+CAPTION: " (setq v1 (skeleton-read "caption? ")) \n
"#+ATTR_HTML: :title " v1 " :align "(skeleton-read "centre/right/left? ")\n
"#+ATTR_HTML: :width "(setq v2 (skeleton-read "width %? "))"%" " :height "v2"%\n")

(define-abbrev org-mode-abbrev-table "pich" "" 'skel-org-picv)

;;==============plantuml=====================
(define-skeleton skel-org-block-plantuml
  "Insert a org plantuml block, querying for filename."
  "File (no extension): "
  "#+begin_src plantuml :file " str ".png :cach yes :cmdline -charset UTF-8\n"
  "title " @ - \n
  "#+end_src\n")

(define-abbrev org-mode-abbrev-table "spuml" "" 'skel-org-block-plantuml)

(define-skeleton skel-org-block-plantuml-activity
  "Insert a org plantuml block, querying for filename."
  "File (no extension): "
  "#+begin_src plantuml :file " str "-act.png :cache yes :tangle " str "-act.txt\n"
  (bh/plantuml-reset-counters)
  "@startuml\n"
  "skinparam activity {\n"
  "BackgroundColor<<New>> Cyan\n"
  "}\n\n"
  "title " str " - \n"
  "note left: " str "\n"
  "(*) --> \"" str "\"\n"
  "--> (*)\n"
  _ - \n
  "@enduml\n"
  "#+end_src\n")

(defvar bh/plantuml-if-count 0)

(defun bh/plantuml-if ()
  (incf bh/plantuml-if-count)
  (number-to-string bh/plantuml-if-count))

(defvar bh/plantuml-loop-count 0)

(defun bh/plantuml-loop ()
  (incf bh/plantuml-loop-count)
  (number-to-string bh/plantuml-loop-count))

(defun bh/plantuml-reset-counters ()
  (setq bh/plantuml-if-count 0
        bh/plantuml-loop-count 0)
  "")

(define-abbrev org-mode-abbrev-table "sact" "" 'skel-org-block-plantuml-activity)

(define-skeleton skel-org-block-plantuml-activity-if
  "Insert a org plantuml block activity if statement"
  ""
  "if \"\" then\n"
  "  -> [condition] ==IF" (setq ifn (bh/plantuml-if)) "==\n"
  "  --> ==IF" ifn "M1==\n"
  "  -left-> ==IF" ifn "M2==\n"
  "else\n"
  "end if\n"
  "--> ==IF" ifn "M2==")

(define-abbrev org-mode-abbrev-table "sif" "" 'skel-org-block-plantuml-activity-if)

(define-skeleton skel-org-block-plantuml-activity-for
  "Insert a org plantuml block activity for statement"
  "Loop for each: "
  "--> ==LOOP" (setq loopn (bh/plantuml-loop)) "==\n"
  "note left: Loop" loopn ": For each " str "\n"
  "--> ==ENDLOOP" loopn "==\n"
  "note left: Loop" loopn ": End for each " str "\n" )

(define-abbrev org-mode-abbrev-table "sfor" "" 'skel-org-block-plantuml-activity-for)

(define-skeleton skel-org-block-plantuml-sequence
  "Insert a org plantuml activity diagram block, querying for filename."
  "File appends (no extension): "
  "#+begin_src plantuml :file " str "-seq.png :cache yes :tangle " str "-seq.txt\n"
  "@startuml\n"
  "title " str " - \n"
  "actor CSR as \"Customer Service Representative\"\n"
  "participant CSMO as \"CSM Online\"\n"
  "participant CSMU as \"CSM Unix\"\n"
  "participant NRIS\n"
  "actor Customer"
  _ - \n
  "@enduml\n"
  "#+end_src\n")

(define-abbrev org-mode-abbrev-table "sseq" "" 'skel-org-block-plantuml-sequence)

;;=================end plantuml==========================

my gtd config

(provide 'mygtd)
;;-------------begin  gtd------------------------------
(global-set-key "\C-c1" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
;;(global-set-key "\C-cr" 'remember)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(with-eval-after-load 'ox
  (require 'ox-hugo))

(setq org-todo-keywords
      '(
       (sequence "TODO(t!)" "|" "DONE(d!)" "CANCELED(c@/!)" "ASSIGNED(a@/!)"))
      )
(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/.todos/gtd.org" "Tasks")
         "* TODO %?\n %i\n %a")
        ("j" "Journal" entry (file+datetree "~/.todos/journal.org")
         "* %?\nEntered on %U\n %i\n %a")))
(setq org-agenda-files (list "~/.todos/gtd.org"
                              "~/.todos/journal.org"
                              "~/Documents/todo/"
                              ))
(setq org-default-notes-file "~/.todos/journal.org")

;;----------------end gtd-------------------------------
;;---------------begin hugo------------------------
;; org-hugo capture
(with-eval-after-load 'org-capture
  (defun org-hugo-new-subtree-post-capture-template ()
    "Returns `org-capture' template string for new Hugo post.
See `org-capture-templates' for more information."
    (let* (;; http://www.holgerschurig.de/en/emacs-blog-from-org-to-hugo/
           (date (format-time-string (org-time-stamp-format :long :inactive) (org-current-time)))
           (title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title
           (fname (org-hugo-slug title)))
      (mapconcat #'identity
                 `(
                   ,(concat "** TODO " title "     :@随笔:")
                   ":PROPERTIES:"
                   ,(concat ":EXPORT_FILE_NAME: " fname)
                   ,(concat ":EXPORT_DATE: " date) ;Enter current date and time
                   ":END:"
                   "%?\n")          ;Place the cursor here finally
                 "\n")))

  (add-to-list 'org-capture-templates
               '("h"                ;`org-capture' binding + h
                 "Hugo post"
                 entry
                 ;; It is assumed that below file is present in `org-directory'
                 ;; and that it has a "Blog Ideas" heading. It can even be a
                 ;; symlink pointing to the actual location of all-posts.org!
                 (file+headline "~/blog/gitblog//orgcontent/0000head.org" "INBOX")
                 (function org-hugo-new-subtree-post-capture-template))))
;;---------------end hugo--------------------------