From 73f7f1a4304cd2bb4c16aa26be799aefd089dd28 Mon Sep 17 00:00:00 2001 From: Ambrevar Date: Sat, 3 Nov 2012 16:44:09 +0100 Subject: [PATCH] Emacs: yasnippet support for bot new syntax and old syntax. Emacs: set to load ~/emacs.d/plugins by default. Shell: fixed 'archive' function to be compatible with both bsdtar and gnutar. --- .emacs.d/plugins.el | 22 ++++++++++++++-------- .shell.d/funs_rc | 12 ++++++------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.emacs.d/plugins.el b/.emacs.d/plugins.el index 73e83fc0..4eeb8d5b 100644 --- a/.emacs.d/plugins.el +++ b/.emacs.d/plugins.el @@ -2,6 +2,9 @@ ;; PLUGINS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; User plugin path. +(add-to-list 'load-path "~/.emacs.d/plugins") + ;;============================================================================== ;; Yasnippet ;;============================================================================== @@ -15,18 +18,21 @@ ;; Next follows a traditional, yet not-optimized configuration for Yasnippet. ;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/yas") (require 'yasnippet) ;; not yasnippet-bundle -(yas-global-mode 1) -;; (yas/initialize) (setq yas-snippet-dirs "~/.emacs.d/snippets" ) -;; Personal snippets -;; (setq yas/root-directory "~/.emacs.d/plugins/yas/snippets" ) +(if (fboundp 'yas/initialize) + ;; Old yasnippet versions. + (progn + (yas/initialize) + (yas/load-directory yas-snippet-dirs)) + + ;; New yasnippet versions. + (progn + (yas-global-mode 1) + (yas-load-directory yas-snippet-dirs)) +) -;; Load the snippets -;; (yas/load-directory "~/.emacs.d/plugins/yas/snippets") ;; Warning: slow! -;; (yas/load-directory yas/root-directory) -(yas-load-directory yas-snippet-dirs) ;;============================================================================== ;; Lua diff --git a/.shell.d/funs_rc b/.shell.d/funs_rc index 62739c52..7207bd2b 100644 --- a/.shell.d/funs_rc +++ b/.shell.d/funs_rc @@ -564,10 +564,10 @@ archive () echo -e " -m:\t\tChoose compression method." echo -e " gz\t\tgzip (default)." echo -e " xz\t\tLZMA." - echo -e " -v:\t\tInclude VCS data." + echo -e " -v:\t\tExclude VCS data. (GNU tar only)." } - local OPTION_VCS="--exclude-vcs" + local OPTION_VCS="" local OPTION_METHOD="" while getopts ":hm:v" opt; do @@ -580,7 +580,7 @@ archive () OPTION_METHOD="${OPTARG}" ;; v) - OPTION_VCS="" + OPTION_VCS="--exclude-vcs" ;; ?) printhelp "$0" @@ -624,7 +624,7 @@ archive () ARCNAME="${ARCSOURCE}-$(date +%y-%m-%d-%H%M%S).${ARCEXT}" (cd "$ARCPATH" && \ - tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS}) + tar -${ARCOPT} -cf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS}) else ARCSOURCE="$(basename $PWD)" @@ -633,7 +633,7 @@ archive () if [ $# = 0 ];then (cd "$PWD/.." && \ - tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS}) + tar -${ARCOPT} -cf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS}) else ## Note for zsh: do NOT initialize an array with "myarray=()". @@ -643,7 +643,7 @@ archive () FILELIST=(${FILELIST[*]} "$i") done - tar -${ARCOPT} -cvf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS} + tar -${ARCOPT} -cf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS} fi fi }