Skip to content

Instantly share code, notes, and snippets.

(require 'vc-git)
(provide 'auto-update-gtags)
(defvar auto-update-gtags/interval (* 60 60) "interval seconds")
(defvar auto-update-gtags/command "gtags")
(defun auto-update-gtags/file-need-update-p (file interval)
(and (file-writable-p file)
(or (not (file-exists-p file))
(> (- (float-time) (float-time (nth 5 (file-attributes file))))
interval))))
@mechairoi
mechairoi / .ctags
Created February 18, 2014 01:57
.ctags for angualr js
--regex-javascript=/\.controller[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/C,controller/i
--regex-javascript=/\.filter[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/F,filter/i
--regex-javascript=/\.module[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/M,module/i
--regex-javascript=/\.directive[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/D,directive/i
--regex-javascript=/\.factory[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/F,factory/i
--regex-javascript=/\.value[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/V,value/i
--regex-javascript=/\.provider[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/P,provider/i
--regex-javascript=/\.constant[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/C,constant/i
--regex-javascript=/\.config[ \t]*\([ \t]*['"]([A-Za-z0-9_.]+)['"][ \t]*,/\1/C,config/i
"loadavg5",
"memory.total",
"memory.free",
"memory.buffers",
"memory.cached",
"memory.swap_cached",
"memory.active",
"memory.inactive",
"memory.swap_total",
"memory.swap_free",
(require 'vc-git)
(defun git-browse-remote-at-point (rev)
(interactive "P")
(let* ((root (vc-git-root buffer-file-name))
(default-directory root)
(line (if (use-region-p)
(format "%d,%d"
(line-number-at-pos (region-beginning))
(line-number-at-pos (region-end)))
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <queue>
@mechairoi
mechairoi / anything-git-grep.el
Created November 20, 2010 09:30
anything-git-grep.el
(require 'my-git)
(require 'anything-config)
(provide 'anything-git-grep)
(defun anything-git-grep-process ()
(anything-aif (anything-attr 'default-directory)
(let ((default-directory it))
(apply 'start-process "git-grep-process" nil
"git" "--no-pager" "grep" "--full-name" "-n" "--no-color"
(nbutlast
@mechairoi
mechairoi / anything-gtags-extras.el
Created December 6, 2010 16:08
anything-c-source-gtags-select with GTAGSROOT
(require 'anything-gtags)
(defmacro my-let-env (environments &rest body)
`(let ((process-environment process-environment))
,@(mapcar (lambda (env) `(setenv ,@env)) environments)
(progn ,@body)))
(defun anything-c-source-gtags-select-with-root (name gtagsroot)
(lexical-let ((gtagsroot (expand-file-name gtagsroot)))
`((name . ,name)
@mechairoi
mechairoi / .ctags
Created December 21, 2010 12:26
.ctags
--langdef=templatetoolkit
--langmap=templatetoolkit:.tt.html.htm
--regex-templatetoolkit=/[^a-zA-Z0-9_]BLOCK[ \t]+([a-zA-Z0-9_]+)/\1/b,Block/
--regex-templatetoolkit=/[^a-zA-Z0-9_]MACRO[ \t]+([a-zA-Z0-9_]+)/\1/m,Macro/
@mechairoi
mechairoi / nice-isearch-highlight.el
Created January 3, 2011 07:05
nice-isearch-highlight.el
;; override isearch.el
(lexical-let
((original-function (symbol-function 'isearch-lazy-highlight-update)))
(defun isearch-lazy-highlight-update ()
(mapc (lambda (window)
(save-selected-window
(select-window window)
(let ((isearch-lazy-highlight-window (selected-window))
(isearch-lazy-highlight-window-start (window-start))
(isearch-lazy-highlight-window-end (window-end))
@mechairoi
mechairoi / my-git.el
Created January 3, 2011 07:52
my-git.el
(require 'vc-git)
(provide 'my-git)
(defun my-git-toplevel ()
(vc-git-root (file-truename (if (buffer-file-name)
(file-name-directory (buffer-file-name))
default-directory))))
;; return git toplevel of root project
(defun my-git-root ()