Skip to content

Instantly share code, notes, and snippets.

;;; popup-keybindings.el --- popup a tip of key bindings
;; http://github.com/m2ym/auto-complete
(require 'popup)
;;; User variables
(defvar popup-kbs-tip-delay 1.5
"*Delay to popup a tip.")
(require 'ghost-scratch)
;; directory を指定
(setq ghost-scratch-directory "~/.emacs.d/scratch.d")
;; 自動保存の間隔を分で指定(0 なら自動保存しない)
(setq ghost-auto-save-interval 5) ; default
;;; auto commit
;; 毎回実行 (default)
;; inparen.el --- Highlight parentheses and the inside of them.
;;; Setup:
;; (require 'inparen)
;; (global-inparen-mode t)
;;; Code:
(require 'paren)
(require 'cl)
(defun region-string ()
"Return a string of marked region or nil."
(and mark-active
transient-mark-mode
(buffer-substring-no-properties (region-beginning) (region-end))))
(defun word/region-string ()
"Return a string of word at point or region."
;; mac-dict.el --- Look up a word at point in the Dictionary.app and popup the result of it automatically.
;;; Requirements:
;; `dict.py' - <http://sakito.jp/mac/dictionary.html#python>
;; `popup.el' - <http://github.com/m2ym/auto-complete>
;;; Setup:
;; 1. Put the `dict.py' to somewhere you like. And add the execute
(require 'cl)
(require 'popup)
(defvar popup-color-string
(let ((x 9) (y 3))
(mapconcat 'identity
(loop with str = (make-string x ?\ ) repeat y collect str)
"\n"))
"*String displayed in tooltip.")
;;; init-file-maker.el --- Help making your init files
;;; Setup:
;; (require 'init-file-maker)
;; (setq ifm:dir "/path/to/your-init-files-dir")
;;; Usage:
;; To make init file, type M-x ifm:make RET.
(defun do-applescript+ (&rest scripts)
"Like `do-applescript', but execute concatenated SCRIPTS.
In case the execution fails, return an error."
(condition-case err
(do-applescript
(apply 'concat scripts))
(error err)))
(defun show-in-finder (&optional path behind)
"Display current file/directory in a Finder window"
(defface latex-hl-line
'((t (:background "DeepSkyBlue4")))
"Face for the lines start with \\documentclass[foo]{bar},
\\begin{document} or \\end{document}."
:group (if (featurep 'font-latex)
'font-latex-highlighting-faces
'font-lock-faces))
(font-lock-add-keywords
'latex-mode
(define (same-parity first . rest)
(define (collect lst test)
(if (null? lst)
'()
(let ((a (car lst)) (d (cdr lst)))
(if (test a)
(cons a (collect d test))
(collect d test)))))
(cons first
(collect rest (if (even? first) even? odd?))))