Skip to content

Instantly share code, notes, and snippets.

View ryseto's full-sized avatar

Ryohei Seto ryseto

View GitHub Profile
@ryseto
ryseto / gist:2259918
Created March 31, 2012 06:19
Font setting for Emacs23 (Cocoa Emacs) create-fontset
;;; フォントセットを作る
(let* ((fontset-name "myfonts") ; フォントセットの名前
(size 12) ; ASCIIフォントのサイズ [9/10/12/14/15/17/19/20/...]
(asciifont "Menlo") ; ASCIIフォント
(jpfont "Hiragino Maru Gothic ProN") ; 日本語フォント
(font (format "%s-%d:weight=normal:slant=normal" asciifont size))
(fontspec (font-spec :family asciifont))
(jp-fontspec (font-spec :family jpfont))
(fsn (create-fontset-from-ascii-font font nil fontset-name)))
(set-fontset-font fsn 'japanese-jisx0213.2004-1 jp-fontspec)
@ryseto
ryseto / gist:2243572
Created March 29, 2012 20:39
Open PDF file by the cite key: \cite{foo} -> open foo.pdf
(defun MyTeX-open-article ()
"Open PDF file by the cite key: \cite{foo} -> open foo.pdf"
(interactive)
(let* ((s (save-excursion
(skip-chars-backward "^{,")
(point)))
(e (save-excursion
(skip-chars-forward "^},")
(point)))
(pdfdir "~/Documents/Dropbox/Papers/pdf/")
@ryseto
ryseto / gist:2242924
Created March 29, 2012 19:44
Run 'say' command on Emacs
;;; Convert text to audible speech by /usr/bin/say (Emacs + OSX)
(defun MyTeX-speech ()
"Convert text to audible speech by /usr/bin/say of OSX."
(interactive)
(let (b e s
(block-sep-str "^\*\\|^\\ *%\\|^\\ *\n\\|\\\\item\\|\\\\begin\\|\\\\end"))
(if (eq (process-status "speech") 'run)
(delete-process "speech")
(progn
(if mark-active
@ryseto
ryseto / latexdiff_dropbox.sh
Last active August 29, 2015 14:09
latexdiff_dropbox.sh
#!/bin/sh
my_typesetter="latexmk"
my_latexdiff="latexdiff"
orig_file=`basename $1 .tex`
if [ ! -f $orig_file.tex ]; then
echo "PDF file is not found."
exit
fi
echo "Input the version:"
#!/bin/bash
#
# You need to put the following in ~/.emacs.d/init.el.
# (if window-system
# (progn
# (require 'server)
# (unless (server-running-p) (server-start))))
#
EMACS_PID_ALL=`pgrep -d ' ' Emacs`
EMACS_ACTIVE=0
(defun MyTool-speech-word()
"Speak words."
(interactive)
(let* ((str (url-hexify-string (string-word-or-region))))
(process-kill-without-query
(start-process-shell-command "speech" nil
"/usr/bin/say -r 150" (concat "\"" str "\"" )))))
(defun string-word-or-region ()
"If a region is selected, the text string of the region is returned.