Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/themes/anima/includes/loop.php on line 296

Emacs org-mode

  • 寫筆記
  • 做 Todo
  • 寫文章
  • 做計畫

Youtube 影片


  • Outlines
  • bold italic verbatim, strikethrough
  • bulleted
    • list
    • items
  • links My Website
  • store link


name email address
Jerry [email protected] xxx
Tim [email protected] yyy

Export to other format (C-c C-e)

source code

def fact(n)
  if n == 0
    n * fact(n - 1)

org embed youtube

(defvar yt-iframe-format
;; You may want to change your width and height.
(concat ““))

(lambda (handle)
(concat “”
(lambda (path desc backend)
(cl-case backend
(html (format yt-iframe-format
path (or desc “”)))
(latex (format “\href{%s}{%s}”
path (or desc “video”))))))

Latex integration

  • characters: α → β
  • O(n \log n)

\begin{align*} 3 * 2 + 1 &= 6 + 1 &= 7 \end{align*}

有關 Latex 中文支援 (Mac OS)

  • Mac 最小安裝
    brew tap phinze/cask
    brew install brew-cask
    brew cask install basictex
  • 加 path
    # bash/zsh 等
    export PATH=/Library/TeX/texbin/:$PATH
  • 安裝中文 CTeX
    sudo tlmgr update --self --all
    sudo tlmgr install ctex environ trimspaces zhnumber
    sudo tlmgr install wrapfig capt-of
  • 在 org file 前加入
    #+LATEX_HEADER: \usepackage{ctex}
    #+LATEX_COMPILER: xelatex
  • 加入

    (defvar use-font (cond
    ((eq system-type ‘gnu/linux) “{Noto Sans TC Regular}”)
    ((eq system-type ‘darwin) “{PingFang TC}”)))

    (setq org-latex-classes (list (list “article” (format ”
    ” use-font use-font use-font))))

Literate Programming

(org-babel-load-file "~/.emacs.d/")

(use-package org
:ensure t
:mode ((“\\.org\\'” . org-mode)
(“\\.txt\\'” . org-mode))
(global-set-key (kbd “\C-c l”) ‘org-store-link)
(global-set-key (kbd “\C-c a”) ‘org-agenda)
(global-set-key (kbd “\C-c c”) ‘org-capture)
(setq org-hide-leading-stars t)
(setq org-src-fontify-natively t)
(setq org-log-done ‘time)
(setq org-agenda-files (list “~/org/”
(use-package org-download
:ensure t)
(use-package org-bullets
:ensure t
:hook (org-mode . org-bullets-mode))
(org-babel-do-load-languages ‘org-babel-load-languages
‘((shell . t)
(python . t)
(sqlite . t)
(perl . t)
(C . t)
(ruby . t)
(js . t)
(emacs-lisp . t)
(lisp . t)
(latex . t)
(java . t)))

org2blog 直接寫部落格

  • 因 xml-rpc 不相容於 unicode, 需置換 unicode support
  • emacs-lisp 的 syntax highlight 參考
    • 加入 shBrushLips.jswp-content/plugins/syntaxhighlighter
    • 修改 syntaxhighlighter.php 插入
      // ...
      wp_register_script('syntaxhighlighter-brush-lisp', plugins_url('shBrushLisp.js',__FILE__),array('syntaxhighlighter-core'),'1.0.0');
      // ...
      $this->brushes = (array) apply_filters( 'syntaxhighlighter_brushes', array(
      'as3' => 'as3',
      <bunch of other aliases>,
      'lisp' => 'lisp',
      'emacs-lisp' => 'lisp',
  • 設定

    (use-package org2blog
    :ensure t
    :requires org
    (setq org2blog/wp-blog-alist
    :url “”
    :username “jerryhsieh01”
    :url “”
    :username “Jerry”
    (setq org2blog/wp-use-sourcecode-shortcode t)
    (setq org2blog/wp-sourcecode-langs
    ‘(“sh” “cpp” “css” “js” “javascript” “perl” “php” “python” “ruby” “emacs-lisp” “lisp” “go” “lua”))


介紹 Todo


Org Capture

(setq org-default-notes-file (concat org-directory “/”))
(setq org-agenda-files (list “~/org/”
(setq org-capture-templates
‘((“t” “Todo” entry (file+headline “~/org/” “Tasks”)
“* TODO %?\n %i\n %a”)
(“j” “Journal” entry (file+olp+datetree “~/org/”)
“* %?\nEntered on %U\n %i\n %a”)
(“b” “Blog” entry (file+headline “~/org/”)
“* %?\n%T” :prepend t)
(“a” “Appointment” entry (file “~/org/”)
“* %?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n”)))

Sync with Google Calendar

(use-package auth-source
:ensure t
(use-package org-gcal
:ensure t
(let (credentials)
(add-to-list ‘auth-sources “~/.netrc”)
(setq credentials (auth-source-user-and-password “org-gcal”))
(setq org-gcal-client-id (car credentials)
org-gcal-client-secret (cadr credentials)
org-gcal-file-alist ‘((“[email protected]” . “~/org/”))
(add-hook ‘org-agenda-mode-hook (lambda () (org-gcal-sync) ))
(add-hook ‘org-capture-after-finalize-hook (lambda () (org-gcal-sync) ))

  • you need to add .netrc file
    machine org-gcal client-id xxxx secret yyyy

Org Reveal

  • 做簡報

    (use-package ox-reveal
    :ensure t


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *