diff options
Diffstat (limited to 'emacs-lisp-mode')
153 files changed, 1010 insertions, 0 deletions
diff --git a/emacs-lisp-mode/.read_me b/emacs-lisp-mode/.read_me new file mode 100644 index 0000000..49c8e00 --- /dev/null +++ b/emacs-lisp-mode/.read_me @@ -0,0 +1,7 @@ +-*- coding: utf-8 -*- +Originally started by Xah Lee (xahlee.org) on 2009-02-22 +Released under GPL 3. + +Feel free to add missing ones or modify existing ones to improve. + +Those starting with “x-” are supposed to be idiom templates. Not sure it's very useful. They might start with “i-” or "id-" in the future.
\ No newline at end of file diff --git a/emacs-lisp-mode/add-hook b/emacs-lisp-mode/add-hook new file mode 100755 index 0000000..77605af --- /dev/null +++ b/emacs-lisp-mode/add-hook @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: add-hook +#key: add-hook +#key: ah +# -- +(add-hook HOOK$0 FUNCTION)
\ No newline at end of file diff --git a/emacs-lisp-mode/and b/emacs-lisp-mode/and new file mode 100755 index 0000000..6502b6a --- /dev/null +++ b/emacs-lisp-mode/and @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: and +#key: and +#key: a +# -- +(and $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/append b/emacs-lisp-mode/append new file mode 100755 index 0000000..0b8639d --- /dev/null +++ b/emacs-lisp-mode/append @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: append +#key: append +# -- +(append $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/apply b/emacs-lisp-mode/apply new file mode 100755 index 0000000..1963f29 --- /dev/null +++ b/emacs-lisp-mode/apply @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: apply +#key: apply +# -- +(apply $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/aref b/emacs-lisp-mode/aref new file mode 100755 index 0000000..867ef0a --- /dev/null +++ b/emacs-lisp-mode/aref @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: aref +#key: aref +# -- +(aref ARRAY$0 INDEX)
\ No newline at end of file diff --git a/emacs-lisp-mode/aset b/emacs-lisp-mode/aset new file mode 100755 index 0000000..9402dc9 --- /dev/null +++ b/emacs-lisp-mode/aset @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: aset +#key: aset +# -- +(aset ARRAY$0 IDX NEWELT)
\ No newline at end of file diff --git a/emacs-lisp-mode/assq b/emacs-lisp-mode/assq new file mode 100755 index 0000000..d7c5257 --- /dev/null +++ b/emacs-lisp-mode/assq @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: assq +#key: assq +# -- +(assq KEY$0 LIST)
\ No newline at end of file diff --git a/emacs-lisp-mode/autoload b/emacs-lisp-mode/autoload new file mode 100755 index 0000000..c497482 --- /dev/null +++ b/emacs-lisp-mode/autoload @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: autoload +#key: autoload +# -- +(autoload 'FUNCNAME$0 "FILENAME" &optional "DOCSTRING" INTERACTIVE TYPE)
\ No newline at end of file diff --git a/emacs-lisp-mode/backward-char b/emacs-lisp-mode/backward-char new file mode 100755 index 0000000..296cf97 --- /dev/null +++ b/emacs-lisp-mode/backward-char @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: backward-char +#key: backward-char +#key: bc +# -- +(backward-char $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/beginning-of-line b/emacs-lisp-mode/beginning-of-line new file mode 100755 index 0000000..7dfd32c --- /dev/null +++ b/emacs-lisp-mode/beginning-of-line @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: beginning-of-line +#key: beginning-of-line +#key: bol +# -- +(beginning-of-line)
\ No newline at end of file diff --git a/emacs-lisp-mode/bounds-of-thing-at-point b/emacs-lisp-mode/bounds-of-thing-at-point new file mode 100755 index 0000000..6d645b6 --- /dev/null +++ b/emacs-lisp-mode/bounds-of-thing-at-point @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: bounds-of-thing-at-point +#key: bounds-of-thing-at-point +#key: botap +# -- +(bounds-of-thing-at-point '$0) ; symbol, list, sexp, defun, filename, url, email, word, sentence, whitespace, line, page ...
\ No newline at end of file diff --git a/emacs-lisp-mode/buffer-file-name b/emacs-lisp-mode/buffer-file-name new file mode 100755 index 0000000..d983182 --- /dev/null +++ b/emacs-lisp-mode/buffer-file-name @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: buffer-file-name +#key: buffer-file-name +#key: bfn +# -- +(buffer-file-name)
\ No newline at end of file diff --git a/emacs-lisp-mode/buffer-modified-p b/emacs-lisp-mode/buffer-modified-p new file mode 100755 index 0000000..f3ca3aa --- /dev/null +++ b/emacs-lisp-mode/buffer-modified-p @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: buffer-modified-p +#key: buffer-modified-p +#key: bmp +# -- +(buffer-modified-p $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/buffer-substring b/emacs-lisp-mode/buffer-substring new file mode 100755 index 0000000..0c08119 --- /dev/null +++ b/emacs-lisp-mode/buffer-substring @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: buffer-substring +#key: buffer-substring +#key: bs +# -- +(buffer-substring START$0 END)
\ No newline at end of file diff --git a/emacs-lisp-mode/buffer-substring-no-properties b/emacs-lisp-mode/buffer-substring-no-properties new file mode 100755 index 0000000..adb8270 --- /dev/null +++ b/emacs-lisp-mode/buffer-substring-no-properties @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: buffer-substring-no-properties +#key: buffer-substring-no-properties +#key: bsnp +# -- +(buffer-substring-no-properties START$0 END)
\ No newline at end of file diff --git a/emacs-lisp-mode/car b/emacs-lisp-mode/car new file mode 100755 index 0000000..09ff8e4 --- /dev/null +++ b/emacs-lisp-mode/car @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: car +#key: car +# -- +(car $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/cdr b/emacs-lisp-mode/cdr new file mode 100755 index 0000000..404d1d2 --- /dev/null +++ b/emacs-lisp-mode/cdr @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: cdr +#key: cdr +# -- +(cdr $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/concat b/emacs-lisp-mode/concat new file mode 100755 index 0000000..b94cfeb --- /dev/null +++ b/emacs-lisp-mode/concat @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: concat +#key: concat +# -- +(concat $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/cond b/emacs-lisp-mode/cond new file mode 100755 index 0000000..3927414 --- /dev/null +++ b/emacs-lisp-mode/cond @@ -0,0 +1,8 @@ +#contributor: Xah Lee (XahLee.org) +#name: cond +#key: cond +# -- +(cond +(CONDITION$0 BODY) +(CONDITION BODY) +)
\ No newline at end of file diff --git a/emacs-lisp-mode/condition-case b/emacs-lisp-mode/condition-case new file mode 100755 index 0000000..da794dd --- /dev/null +++ b/emacs-lisp-mode/condition-case @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: condition-case +#key: condition-case +#key: cc +# -- +(condition-case $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/cons b/emacs-lisp-mode/cons new file mode 100755 index 0000000..f186919 --- /dev/null +++ b/emacs-lisp-mode/cons @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: cons +#key: cons +# -- +(cons $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/consp b/emacs-lisp-mode/consp new file mode 100755 index 0000000..2b2ce5c --- /dev/null +++ b/emacs-lisp-mode/consp @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: consp +#key: consp +# -- +(consp $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/copy-directory b/emacs-lisp-mode/copy-directory new file mode 100755 index 0000000..b2516d5 --- /dev/null +++ b/emacs-lisp-mode/copy-directory @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: copy-directory +#key: copy-directory +#key: cd +# -- +(copy-directory $0 NEWNAME &optional KEEP-TIME PARENTS)
\ No newline at end of file diff --git a/emacs-lisp-mode/copy-file b/emacs-lisp-mode/copy-file new file mode 100755 index 0000000..b952b16 --- /dev/null +++ b/emacs-lisp-mode/copy-file @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: copy-file +#key: copy-file +#key: cf +# -- +(copy-file FILE$0 NEWNAME &optional OK-IF-ALREADY-EXISTS KEEP-TIME PRESERVE-UID-GID)
\ No newline at end of file diff --git a/emacs-lisp-mode/current-buffer b/emacs-lisp-mode/current-buffer new file mode 100755 index 0000000..b25a48a --- /dev/null +++ b/emacs-lisp-mode/current-buffer @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: current-buffer +#key: current-buffer +#key: cb +# -- +(current-buffer)
\ No newline at end of file diff --git a/emacs-lisp-mode/custom-autoload b/emacs-lisp-mode/custom-autoload new file mode 100755 index 0000000..b5dbb71 --- /dev/null +++ b/emacs-lisp-mode/custom-autoload @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: custom-autoload +#key: custom-autoload +#key: ca +# -- +(custom-autoload$0 SYMBOL LOAD &optional NOSET)
\ No newline at end of file diff --git a/emacs-lisp-mode/defalias b/emacs-lisp-mode/defalias new file mode 100755 index 0000000..7c3998a --- /dev/null +++ b/emacs-lisp-mode/defalias @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: defalias +#key: defalias +# -- +(defalias 'SYMBOL$0 'DEFINITION &optional DOCSTRING)
\ No newline at end of file diff --git a/emacs-lisp-mode/defcustom b/emacs-lisp-mode/defcustom new file mode 100755 index 0000000..25ecbaa --- /dev/null +++ b/emacs-lisp-mode/defcustom @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: defcustom +#key: defcustom +# -- +(defcustom $0 VALUE "DOC" &optional ARGS)
\ No newline at end of file diff --git a/emacs-lisp-mode/define-key b/emacs-lisp-mode/define-key new file mode 100755 index 0000000..e483a51 --- /dev/null +++ b/emacs-lisp-mode/define-key @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: define-key +#key: define-key +#key: dk +# -- +(define-key KEYMAPNAME$0 (kbd "M-b") 'FUNCNAME)
\ No newline at end of file diff --git a/emacs-lisp-mode/defsubst b/emacs-lisp-mode/defsubst new file mode 100755 index 0000000..5ce9033 --- /dev/null +++ b/emacs-lisp-mode/defsubst @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: defsubst +#key: defsubst +# -- +(defsubst $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/defun b/emacs-lisp-mode/defun new file mode 100644 index 0000000..6d7001e --- /dev/null +++ b/emacs-lisp-mode/defun @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: defun +# key: def +# -- +(defun ${1:fun} (${2:args}) + ${3:(interactive${4: "P"})} + $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/defvar b/emacs-lisp-mode/defvar new file mode 100755 index 0000000..6781858 --- /dev/null +++ b/emacs-lisp-mode/defvar @@ -0,0 +1,4 @@ +#name: defvar +#key: defvar +# -- +(defvar $0 &optional ${1:initvalue} "${2:docstring}")
\ No newline at end of file diff --git a/emacs-lisp-mode/delete-char b/emacs-lisp-mode/delete-char new file mode 100755 index 0000000..da983bd --- /dev/null +++ b/emacs-lisp-mode/delete-char @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: delete-char +#key: delete-char +#key: dc +# -- +(delete-char $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/delete-directory b/emacs-lisp-mode/delete-directory new file mode 100755 index 0000000..59f0838 --- /dev/null +++ b/emacs-lisp-mode/delete-directory @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: delete-directory +#key: delete-directory +#key: dd +# -- +(delete-directory $0 &optional RECURSIVE)
\ No newline at end of file diff --git a/emacs-lisp-mode/delete-file b/emacs-lisp-mode/delete-file new file mode 100755 index 0000000..dfbd4f1 --- /dev/null +++ b/emacs-lisp-mode/delete-file @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: delete-file +#key: delete-file +#key: df +# -- +(delete-file $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/delete-region b/emacs-lisp-mode/delete-region new file mode 100755 index 0000000..7c753d2 --- /dev/null +++ b/emacs-lisp-mode/delete-region @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: delete-region +#key: delete-region +#key: dr +# -- +(delete-region $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/directory-files b/emacs-lisp-mode/directory-files new file mode 100755 index 0000000..df301a2 --- /dev/null +++ b/emacs-lisp-mode/directory-files @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: directory-files +#key: directory-files +#key: df +# -- +(directory-files $0 &optional FULL MATCH NOSORT)
\ No newline at end of file diff --git a/emacs-lisp-mode/dired.process_marked b/emacs-lisp-mode/dired.process_marked new file mode 100644 index 0000000..1b42597 --- /dev/null +++ b/emacs-lisp-mode/dired.process_marked @@ -0,0 +1,16 @@ +#name : process marked files in dired +#contributor : Xah Lee +# -- +;; idiom for processing a list of files in dired's marked files + +;; suppose myProcessFile is your function that takes a file path +;; and do some processing on the file + +(defun dired-myProcessFile () + "apply myProcessFile function to marked files in dired." + (interactive) + (require 'dired) + (mapc 'myProcessFile (dired-get-marked-files)) +) + +;; to use it, type M-x dired-myProcessFile diff --git a/emacs-lisp-mode/dolist b/emacs-lisp-mode/dolist new file mode 100755 index 0000000..ea66015 --- /dev/null +++ b/emacs-lisp-mode/dolist @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: dolist +#key: dolist +# -- +(dolist $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/end-of-line b/emacs-lisp-mode/end-of-line new file mode 100755 index 0000000..f8a2d9f --- /dev/null +++ b/emacs-lisp-mode/end-of-line @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: end-of-line +#key: end-of-line +#key: eol +# -- +(end-of-line)
\ No newline at end of file diff --git a/emacs-lisp-mode/eq b/emacs-lisp-mode/eq new file mode 100755 index 0000000..3d29f52 --- /dev/null +++ b/emacs-lisp-mode/eq @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: eq +#key: eq +# -- +(eq $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/equal b/emacs-lisp-mode/equal new file mode 100755 index 0000000..7b0dd58 --- /dev/null +++ b/emacs-lisp-mode/equal @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: equal +#key: equal +# -- +(equal $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/error b/emacs-lisp-mode/error new file mode 100755 index 0000000..48bf689 --- /dev/null +++ b/emacs-lisp-mode/error @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: error +#key: error +# -- +(error "$0" &optional ARGS)
\ No newline at end of file diff --git a/emacs-lisp-mode/expand-file-name b/emacs-lisp-mode/expand-file-name new file mode 100755 index 0000000..8e6c596 --- /dev/null +++ b/emacs-lisp-mode/expand-file-name @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: expand-file-name +#key: expand-file-name +#key: efn +# -- +(expand-file-name $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/f b/emacs-lisp-mode/f new file mode 100755 index 0000000..011a606 --- /dev/null +++ b/emacs-lisp-mode/f @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: format +#key: format +# -- +(format "$0" &optional OBJECTS)
\ No newline at end of file diff --git a/emacs-lisp-mode/fboundp b/emacs-lisp-mode/fboundp new file mode 100755 index 0000000..0212c2d --- /dev/null +++ b/emacs-lisp-mode/fboundp @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: fboundp +#key: fboundp +# -- +(fboundp '$0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/file-name-directory b/emacs-lisp-mode/file-name-directory new file mode 100755 index 0000000..e7fb5c0 --- /dev/null +++ b/emacs-lisp-mode/file-name-directory @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: file-name-directory +#key: file-name-directory +#key: fnd +# -- +(file-name-directory $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/file-name-extension b/emacs-lisp-mode/file-name-extension new file mode 100755 index 0000000..38dc0c4 --- /dev/null +++ b/emacs-lisp-mode/file-name-extension @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: file-name-extension +#key: file-name-extension +#key: fne +# -- +(file-name-extension $0 &optional PERIOD)
\ No newline at end of file diff --git a/emacs-lisp-mode/file-name-nondirectory b/emacs-lisp-mode/file-name-nondirectory new file mode 100755 index 0000000..7310bec --- /dev/null +++ b/emacs-lisp-mode/file-name-nondirectory @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: file-name-nondirectory +#key: file-name-nondirectory +#key: fnn +# -- +(file-name-nondirectory $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/file-name-sans-extension b/emacs-lisp-mode/file-name-sans-extension new file mode 100755 index 0000000..8b18db5 --- /dev/null +++ b/emacs-lisp-mode/file-name-sans-extension @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: file-name-sans-extension +#key: file-name-sans-extension +#key: fnse +# -- +(file-name-sans-extension $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/file-relative-name b/emacs-lisp-mode/file-relative-name new file mode 100755 index 0000000..39b6807 --- /dev/null +++ b/emacs-lisp-mode/file-relative-name @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: file-relative-name +#key: file-relative-name +#key: frn +# -- +(file-relative-name $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/file.process b/emacs-lisp-mode/file.process new file mode 100644 index 0000000..abd1a33 --- /dev/null +++ b/emacs-lisp-mode/file.process @@ -0,0 +1,17 @@ +#name : a function that process a file +#contributor : Xah Lee +# -- +(defun doThisFile (fpath) + "Process the file at path FPATH ..." + (let () + ;; create temp buffer without undo record or font lock. (more efficient) + ;; first space in temp buff name is necessary + (set-buffer (get-buffer-create " myTemp")) + (insert-file-contents fpath nil nil nil t) + + ;; process it ... + ;; (goto-char 0) ; move to begining of file's content (in case it was open) + ;; ... do something here + ;; (write-file fpath) ;; write back to the file + + (kill-buffer " myTemp"))) diff --git a/emacs-lisp-mode/file.read-lines b/emacs-lisp-mode/file.read-lines new file mode 100644 index 0000000..b4a1942 --- /dev/null +++ b/emacs-lisp-mode/file.read-lines @@ -0,0 +1,17 @@ +#name : read lines of a file +#contributor : Xah Lee +# -- +(defun read-lines (filePath) + "Return a list of lines in FILEPATH." + (with-temp-buffer + (insert-file-contents filePath) + (split-string + (buffer-string) "\n" t)) ) + +;; process all lines +(mapc + (lambda (aLine) + (message aLine) ; do your stuff here + ) + (read-lines "inputFilePath") +)
\ No newline at end of file diff --git a/emacs-lisp-mode/find-file b/emacs-lisp-mode/find-file new file mode 100755 index 0000000..8038e83 --- /dev/null +++ b/emacs-lisp-mode/find-file @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: find-file +#key: find-file +#key: ff +# -- +(find-file $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/find-replace b/emacs-lisp-mode/find-replace new file mode 100644 index 0000000..cefcf51 --- /dev/null +++ b/emacs-lisp-mode/find-replace @@ -0,0 +1,17 @@ +#name : find and replace on region +#contributor : Xah Lee +# -- +(defun replace-html-chars-region (start end) + "Replace “<” to “<” and other chars in HTML. +This works on the current region." + (interactive "r") + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (search-forward "&" nil t) (replace-match "&" nil t)) + (goto-char (point-min)) + (while (search-forward "<" nil t) (replace-match "<" nil t)) + (goto-char (point-min)) + (while (search-forward ">" nil t) (replace-match ">" nil t)) + ) + ) diff --git a/emacs-lisp-mode/format b/emacs-lisp-mode/format new file mode 100755 index 0000000..011a606 --- /dev/null +++ b/emacs-lisp-mode/format @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: format +#key: format +# -- +(format "$0" &optional OBJECTS)
\ No newline at end of file diff --git a/emacs-lisp-mode/forward-char b/emacs-lisp-mode/forward-char new file mode 100755 index 0000000..1298e98 --- /dev/null +++ b/emacs-lisp-mode/forward-char @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: forward-char +#key: forward-char +#key: fc +# -- +(forward-char $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/forward-line b/emacs-lisp-mode/forward-line new file mode 100755 index 0000000..37d94d7 --- /dev/null +++ b/emacs-lisp-mode/forward-line @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: forward-line +#key: forward-line +#key: fl +# -- +(forward-line $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/funcall b/emacs-lisp-mode/funcall new file mode 100755 index 0000000..fb486bc --- /dev/null +++ b/emacs-lisp-mode/funcall @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: funcall +#key: funcall +# -- +(funcall $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/function b/emacs-lisp-mode/function new file mode 100755 index 0000000..cbebaf0 --- /dev/null +++ b/emacs-lisp-mode/function @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: function +#key: function +# -- +(function $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/get b/emacs-lisp-mode/get new file mode 100755 index 0000000..9b29658 --- /dev/null +++ b/emacs-lisp-mode/get @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: get +#key: get +# -- +(get SYMBOL$0 PROPNAME)
\ No newline at end of file diff --git a/emacs-lisp-mode/global-set-key b/emacs-lisp-mode/global-set-key new file mode 100755 index 0000000..8629f27 --- /dev/null +++ b/emacs-lisp-mode/global-set-key @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: global-set-key +#key: global-set-key +#key: gsk +# -- +(global-set-key (kbd "C-$0") 'COMMAND)
\ No newline at end of file diff --git a/emacs-lisp-mode/goto-char b/emacs-lisp-mode/goto-char new file mode 100755 index 0000000..7cb8d2b --- /dev/null +++ b/emacs-lisp-mode/goto-char @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: goto-char +#key: goto-char +#key: gc +# -- +(goto-char $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/grabstring b/emacs-lisp-mode/grabstring new file mode 100644 index 0000000..55600b1 --- /dev/null +++ b/emacs-lisp-mode/grabstring @@ -0,0 +1,4 @@ +#name : grab buffer substring +#contributor : Xah Lee +# -- +(setq $0 (buffer-substring-no-properties myStartPos myEndPos)) diff --git a/emacs-lisp-mode/grabthing b/emacs-lisp-mode/grabthing new file mode 100644 index 0000000..772b8dc --- /dev/null +++ b/emacs-lisp-mode/grabthing @@ -0,0 +1,4 @@ +#name : grab word under cursor +#contributor : Xah Lee +# -- +(setq $0 (thing-at-point 'symbol)) diff --git a/emacs-lisp-mode/hash b/emacs-lisp-mode/hash new file mode 100644 index 0000000..0022722 --- /dev/null +++ b/emacs-lisp-mode/hash @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: hash +# key: hash +# -- +make-hash-table ${1:options}
\ No newline at end of file diff --git a/emacs-lisp-mode/if b/emacs-lisp-mode/if new file mode 100755 index 0000000..c797755 --- /dev/null +++ b/emacs-lisp-mode/if @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: if +#key: if +# -- +(if $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/insert b/emacs-lisp-mode/insert new file mode 100755 index 0000000..ae5943d --- /dev/null +++ b/emacs-lisp-mode/insert @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: insert +#key: insert +#key: i +# -- +(insert $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/insert-file-contents b/emacs-lisp-mode/insert-file-contents new file mode 100755 index 0000000..ffdd154 --- /dev/null +++ b/emacs-lisp-mode/insert-file-contents @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: insert-file-contents +#key: insert-file-contents +#key: ifc +# -- +(insert-file-contents $0 &optional VISIT BEG END REPLACE)
\ No newline at end of file diff --git a/emacs-lisp-mode/interactive b/emacs-lisp-mode/interactive new file mode 100755 index 0000000..f973892 --- /dev/null +++ b/emacs-lisp-mode/interactive @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: interactive +#key: interactive +# -- +(interactive)
\ No newline at end of file diff --git a/emacs-lisp-mode/kbd b/emacs-lisp-mode/kbd new file mode 100755 index 0000000..be91b08 --- /dev/null +++ b/emacs-lisp-mode/kbd @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: kbd +#key: kbd +# -- +(kbd "$0")
\ No newline at end of file diff --git a/emacs-lisp-mode/kill-buffer b/emacs-lisp-mode/kill-buffer new file mode 100755 index 0000000..491a73b --- /dev/null +++ b/emacs-lisp-mode/kill-buffer @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: kill-buffer +#key: kill-buffer +#key: kb +# -- +(kill-buffer $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/lambda b/emacs-lisp-mode/lambda new file mode 100755 index 0000000..ae4062f --- /dev/null +++ b/emacs-lisp-mode/lambda @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: lambda +#key: lambda +# -- +(lambda ($0) "DOCSTRING" (interactive) BODY)
\ No newline at end of file diff --git a/emacs-lisp-mode/length b/emacs-lisp-mode/length new file mode 100755 index 0000000..46a379b --- /dev/null +++ b/emacs-lisp-mode/length @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: length +#key: length +# -- +(length $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/let b/emacs-lisp-mode/let new file mode 100755 index 0000000..76e991e --- /dev/null +++ b/emacs-lisp-mode/let @@ -0,0 +1,8 @@ +#contributor: Xah Lee (XahLee.org) +#name: let +#key: let +#key: l +# -- +(let ($1 ) + $0 +)
\ No newline at end of file diff --git a/emacs-lisp-mode/line-beginning-position b/emacs-lisp-mode/line-beginning-position new file mode 100755 index 0000000..647158b --- /dev/null +++ b/emacs-lisp-mode/line-beginning-position @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: line-beginning-position +#key: line-beginning-position +#key: lbp +# -- +(line-beginning-position)
\ No newline at end of file diff --git a/emacs-lisp-mode/line-end-position b/emacs-lisp-mode/line-end-position new file mode 100755 index 0000000..f3a4f4c --- /dev/null +++ b/emacs-lisp-mode/line-end-position @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: line-end-position +#key: line-end-position +#key: lep +# -- +(line-end-position)
\ No newline at end of file diff --git a/emacs-lisp-mode/list b/emacs-lisp-mode/list new file mode 100755 index 0000000..11be961 --- /dev/null +++ b/emacs-lisp-mode/list @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: list +#key: list +# -- +(list $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/looking-at b/emacs-lisp-mode/looking-at new file mode 100755 index 0000000..83741dd --- /dev/null +++ b/emacs-lisp-mode/looking-at @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: looking-at +#key: looking-at +#key: la +# -- +(looking-at $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/make-directory b/emacs-lisp-mode/make-directory new file mode 100755 index 0000000..6c6ee64 --- /dev/null +++ b/emacs-lisp-mode/make-directory @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: make-directory +#key: make-directory +#key: md +# -- +(make-directory $0 &optional PARENTS)
\ No newline at end of file diff --git a/emacs-lisp-mode/make-local-variable b/emacs-lisp-mode/make-local-variable new file mode 100755 index 0000000..06e0ff4 --- /dev/null +++ b/emacs-lisp-mode/make-local-variable @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: make-local-variable +#key: make-local-variable +#key: mlv +# -- +(make-local-variable $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/mapc b/emacs-lisp-mode/mapc new file mode 100755 index 0000000..f244f64 --- /dev/null +++ b/emacs-lisp-mode/mapc @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: mapc +#key: mapc +# -- +(mapc '$0 SEQUENCE)
\ No newline at end of file diff --git a/emacs-lisp-mode/mapcar b/emacs-lisp-mode/mapcar new file mode 100755 index 0000000..25bbd5d --- /dev/null +++ b/emacs-lisp-mode/mapcar @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: mapcar +#key: mapcar +# -- +(mapcar $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/match-beginning b/emacs-lisp-mode/match-beginning new file mode 100755 index 0000000..b3ecc75 --- /dev/null +++ b/emacs-lisp-mode/match-beginning @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: match-beginning +#key: match-beginning +#key: mb +# -- +(match-beginning N$0)
\ No newline at end of file diff --git a/emacs-lisp-mode/match-end b/emacs-lisp-mode/match-end new file mode 100755 index 0000000..d263499 --- /dev/null +++ b/emacs-lisp-mode/match-end @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: match-end +#key: match-end +#key: me +# -- +(match-end N$0)
\ No newline at end of file diff --git a/emacs-lisp-mode/match-string b/emacs-lisp-mode/match-string new file mode 100755 index 0000000..5c74e9d --- /dev/null +++ b/emacs-lisp-mode/match-string @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: match-string +#key: match-string +#key: ms +# -- +(match-string $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/memq b/emacs-lisp-mode/memq new file mode 100755 index 0000000..f0f7cba --- /dev/null +++ b/emacs-lisp-mode/memq @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: memq +#key: memq +# -- +(memq ELT$0 LIST)
\ No newline at end of file diff --git a/emacs-lisp-mode/message b/emacs-lisp-mode/message new file mode 100755 index 0000000..ea3009e --- /dev/null +++ b/emacs-lisp-mode/message @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: message +#key: message +#key: m +# -- +(message "FORMATSTRING$0" &optional ARGS)
\ No newline at end of file diff --git a/emacs-lisp-mode/minor_mode b/emacs-lisp-mode/minor_mode new file mode 100644 index 0000000..f0a09b2 --- /dev/null +++ b/emacs-lisp-mode/minor_mode @@ -0,0 +1,20 @@ +# -*- mode: snippet -*- +# name: minor_mode +# key: minor +# -- +(defvar ${1:mode}-modeline-indicator " ${2:INDICATOR}" + "call ($1-install-mode) again if this is changed") + +(defvar $1-mode nil) +(make-variable-buffer-local '$1-mode) +(put '$1-mode 'permanent-local t) + +(defun $1-mode (&optional arg) + "$0" + (interactive "P") + (setq $1-mode + (if (null arg) (not $1-mode) + (> (prefix-numeric-value arg) 0))) + (force-mode-line-update)) + +(provide '$1-mode)
\ No newline at end of file diff --git a/emacs-lisp-mode/not b/emacs-lisp-mode/not new file mode 100755 index 0000000..083bcd7 --- /dev/null +++ b/emacs-lisp-mode/not @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: not +#key: not +#key: n +# -- +(not $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/nth b/emacs-lisp-mode/nth new file mode 100755 index 0000000..b3880a2 --- /dev/null +++ b/emacs-lisp-mode/nth @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: nth +#key: nth +# -- +(nth N$0 LIST)
\ No newline at end of file diff --git a/emacs-lisp-mode/null b/emacs-lisp-mode/null new file mode 100755 index 0000000..9d451ec --- /dev/null +++ b/emacs-lisp-mode/null @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: null +#key: null +# -- +(null $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/number-to-string b/emacs-lisp-mode/number-to-string new file mode 100755 index 0000000..42eccb7 --- /dev/null +++ b/emacs-lisp-mode/number-to-string @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: number-to-string +#key: number-to-string +#key: nts +# -- +(number-to-string $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/or b/emacs-lisp-mode/or new file mode 100755 index 0000000..046218c --- /dev/null +++ b/emacs-lisp-mode/or @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: or +#key: or +#key: o +# -- +(or $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/point b/emacs-lisp-mode/point new file mode 100755 index 0000000..6aa6b74 --- /dev/null +++ b/emacs-lisp-mode/point @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: point +#key: point +#key: p +# -- +(point)
\ No newline at end of file diff --git a/emacs-lisp-mode/point-max b/emacs-lisp-mode/point-max new file mode 100755 index 0000000..6544869 --- /dev/null +++ b/emacs-lisp-mode/point-max @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: point-max +#key: point-max +# -- +(point-max)
\ No newline at end of file diff --git a/emacs-lisp-mode/point-min b/emacs-lisp-mode/point-min new file mode 100755 index 0000000..029d736 --- /dev/null +++ b/emacs-lisp-mode/point-min @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: point-min +#key: point-min +#key: pm +# -- +(point-min)
\ No newline at end of file diff --git a/emacs-lisp-mode/princ b/emacs-lisp-mode/princ new file mode 100755 index 0000000..88ad7d7 --- /dev/null +++ b/emacs-lisp-mode/princ @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: princ +#key: princ +# -- +(princ $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/print b/emacs-lisp-mode/print new file mode 100755 index 0000000..7d0f421 --- /dev/null +++ b/emacs-lisp-mode/print @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: print +#key: print +# -- +(print $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/progn b/emacs-lisp-mode/progn new file mode 100755 index 0000000..d07c5c3 --- /dev/null +++ b/emacs-lisp-mode/progn @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: progn +#key: progn +# -- +(progn $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/push b/emacs-lisp-mode/push new file mode 100755 index 0000000..f019b80 --- /dev/null +++ b/emacs-lisp-mode/push @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: push +#key: push +# -- +(push $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/put b/emacs-lisp-mode/put new file mode 100755 index 0000000..7a91f20 --- /dev/null +++ b/emacs-lisp-mode/put @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: put +#key: put +# -- +(put $0 PROPNAME VALUE)
\ No newline at end of file diff --git a/emacs-lisp-mode/re-search-backward b/emacs-lisp-mode/re-search-backward new file mode 100755 index 0000000..a04d99f --- /dev/null +++ b/emacs-lisp-mode/re-search-backward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: re-search-backward +#key: re-search-backward +#key: rsb +# -- +(re-search-backward REGEXP$0 &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/re-search-forward b/emacs-lisp-mode/re-search-forward new file mode 100755 index 0000000..31a24a3 --- /dev/null +++ b/emacs-lisp-mode/re-search-forward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: re-search-forward +#key: re-search-forward +#key: rsf +# -- +(re-search-forward REGEXP$0 &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/region-active-p b/emacs-lisp-mode/region-active-p new file mode 100755 index 0000000..e70553e --- /dev/null +++ b/emacs-lisp-mode/region-active-p @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: region-active-p +#key: region-active-p +#key: rap +# -- +(region-active-p)
\ No newline at end of file diff --git a/emacs-lisp-mode/region-beginning b/emacs-lisp-mode/region-beginning new file mode 100755 index 0000000..55496e2 --- /dev/null +++ b/emacs-lisp-mode/region-beginning @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: region-beginning +#key: region-beginning +#key: rb +# -- +(region-beginning)
\ No newline at end of file diff --git a/emacs-lisp-mode/region-end b/emacs-lisp-mode/region-end new file mode 100755 index 0000000..fddcd9f --- /dev/null +++ b/emacs-lisp-mode/region-end @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: region-end +#key: region-end +#key: re +# -- +(region-end)
\ No newline at end of file diff --git a/emacs-lisp-mode/rename-file b/emacs-lisp-mode/rename-file new file mode 100755 index 0000000..b589a89 --- /dev/null +++ b/emacs-lisp-mode/rename-file @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: rename-file +#key: rename-file +#key: rf +# -- +(rename-file FILE$0 NEWNAME &optional OK-IF-ALREADY-EXISTS)
\ No newline at end of file diff --git a/emacs-lisp-mode/repeat b/emacs-lisp-mode/repeat new file mode 100755 index 0000000..45422eb --- /dev/null +++ b/emacs-lisp-mode/repeat @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: repeat +#key: repeat +# -- +(repeat $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/replace-regexp b/emacs-lisp-mode/replace-regexp new file mode 100755 index 0000000..7535bc1 --- /dev/null +++ b/emacs-lisp-mode/replace-regexp @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: replace-regexp +#key: replace-regexp +#key: rr +# -- +(replace-regexp REGEXP$0 TO-STRING &optional DELIMITED START END)
\ No newline at end of file diff --git a/emacs-lisp-mode/replace-regexp-in-string b/emacs-lisp-mode/replace-regexp-in-string new file mode 100755 index 0000000..edf7f5b --- /dev/null +++ b/emacs-lisp-mode/replace-regexp-in-string @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: replace-regexp-in-string +#key: replace-regexp-in-string +#key: rris +# -- +(replace-regexp-in-string REGEXP$0 REP STRING &optional FIXEDCASE LITERAL SUBEXP START)
\ No newline at end of file diff --git a/emacs-lisp-mode/require b/emacs-lisp-mode/require new file mode 100755 index 0000000..9c91035 --- /dev/null +++ b/emacs-lisp-mode/require @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: require +#key: require +# -- +(require $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/save-buffer b/emacs-lisp-mode/save-buffer new file mode 100755 index 0000000..931a72c --- /dev/null +++ b/emacs-lisp-mode/save-buffer @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: save-buffer +#key: save-buffer +#key: sb +# -- +(save-buffer $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/save-excursion b/emacs-lisp-mode/save-excursion new file mode 100755 index 0000000..5f587ce --- /dev/null +++ b/emacs-lisp-mode/save-excursion @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: save-excursion +#key: save-excursion +#key: se +# -- +(save-excursion $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/search-backward b/emacs-lisp-mode/search-backward new file mode 100755 index 0000000..4b07486 --- /dev/null +++ b/emacs-lisp-mode/search-backward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: search-backward +#key: search-backward +#key: sb +# -- +(search-backward "$0" &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/search-backward-regexp b/emacs-lisp-mode/search-backward-regexp new file mode 100755 index 0000000..33795fd --- /dev/null +++ b/emacs-lisp-mode/search-backward-regexp @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: search-backward-regexp +#key: search-backward-regexp +#key: sbr +# -- +(search-backward-regexp "$0" &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/search-forward b/emacs-lisp-mode/search-forward new file mode 100755 index 0000000..03e56c8 --- /dev/null +++ b/emacs-lisp-mode/search-forward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: search-forward +#key: search-forward +#key: sf +# -- +(search-forward "$0" &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/search-forward-regexp b/emacs-lisp-mode/search-forward-regexp new file mode 100755 index 0000000..eb37b84 --- /dev/null +++ b/emacs-lisp-mode/search-forward-regexp @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: search-forward-regexp +#key: search-forward-regexp +#key: sfr +# -- +(search-forward-regexp "$0" &optional BOUND NOERROR COUNT)
\ No newline at end of file diff --git a/emacs-lisp-mode/set b/emacs-lisp-mode/set new file mode 100755 index 0000000..cf9c101 --- /dev/null +++ b/emacs-lisp-mode/set @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: set +#key: set +# -- +(set $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/set-buffer b/emacs-lisp-mode/set-buffer new file mode 100755 index 0000000..0eff93d --- /dev/null +++ b/emacs-lisp-mode/set-buffer @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: set-buffer +#key: set-buffer +#key: sb +# -- +(set-buffer $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/set-file-modes b/emacs-lisp-mode/set-file-modes new file mode 100755 index 0000000..f7d7e16 --- /dev/null +++ b/emacs-lisp-mode/set-file-modes @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: set-file-modes +#key: set-file-modes +#key: sfm +# -- +(set-file-modes $0 MODE)
\ No newline at end of file diff --git a/emacs-lisp-mode/set-mark b/emacs-lisp-mode/set-mark new file mode 100755 index 0000000..9a482a1 --- /dev/null +++ b/emacs-lisp-mode/set-mark @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: set-mark +#key: set-mark +#key: sm +# -- +(set-mark $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/setq b/emacs-lisp-mode/setq new file mode 100755 index 0000000..4bdb4fc --- /dev/null +++ b/emacs-lisp-mode/setq @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: setq +#key: setq +#key: s +# -- +(setq $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/skip-chars-backward b/emacs-lisp-mode/skip-chars-backward new file mode 100755 index 0000000..0fc4cf4 --- /dev/null +++ b/emacs-lisp-mode/skip-chars-backward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: skip-chars-backward +#key: skip-chars-backward +#key: scb +# -- +(skip-chars-backward "$0" &optional LIM)
\ No newline at end of file diff --git a/emacs-lisp-mode/skip-chars-forward b/emacs-lisp-mode/skip-chars-forward new file mode 100755 index 0000000..110cbd5 --- /dev/null +++ b/emacs-lisp-mode/skip-chars-forward @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: skip-chars-forward +#key: skip-chars-forward +#key: scf +# -- +(skip-chars-forward "$0" &optional LIM)
\ No newline at end of file diff --git a/emacs-lisp-mode/split-string b/emacs-lisp-mode/split-string new file mode 100755 index 0000000..37c372d --- /dev/null +++ b/emacs-lisp-mode/split-string @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: split-string +#key: split-string +#key: ss +# -- +(split-string $0 &optional SEPARATORS OMIT-NULLS)
\ No newline at end of file diff --git a/emacs-lisp-mode/string b/emacs-lisp-mode/string new file mode 100755 index 0000000..f3a4dda --- /dev/null +++ b/emacs-lisp-mode/string @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: string +#key: string +# -- +(string $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/string-match b/emacs-lisp-mode/string-match new file mode 100755 index 0000000..1ef9876 --- /dev/null +++ b/emacs-lisp-mode/string-match @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: string-match +#key: string-match +#key: sm +# -- +(string-match "REGEXP$0" "STRING" &optional START)
\ No newline at end of file diff --git a/emacs-lisp-mode/string-to-number b/emacs-lisp-mode/string-to-number new file mode 100755 index 0000000..449d621 --- /dev/null +++ b/emacs-lisp-mode/string-to-number @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: string-to-number +#key: string-to-number +#key: stn +# -- +(string-to-number "$0")
\ No newline at end of file diff --git a/emacs-lisp-mode/string= b/emacs-lisp-mode/string= new file mode 100755 index 0000000..d0d43aa --- /dev/null +++ b/emacs-lisp-mode/string= @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: string= +#key: string= +# -- +(string= $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/stringp b/emacs-lisp-mode/stringp new file mode 100755 index 0000000..c20be65 --- /dev/null +++ b/emacs-lisp-mode/stringp @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: stringp +#key: stringp +# -- +(stringp $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/substring b/emacs-lisp-mode/substring new file mode 100755 index 0000000..8ab6b49 --- /dev/null +++ b/emacs-lisp-mode/substring @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: substring +#key: substring +# -- +(substring STRING$0 FROM &optional TO)
\ No newline at end of file diff --git a/emacs-lisp-mode/thing-at-point b/emacs-lisp-mode/thing-at-point new file mode 100755 index 0000000..9c6e189 --- /dev/null +++ b/emacs-lisp-mode/thing-at-point @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: thing-at-point +#key: thing-at-point +#key: tap +# -- +(thing-at-point '$0) ; symbol, list, sexp, defun, filename, url, email, word, sentence, whitespace, line, page ...
\ No newline at end of file diff --git a/emacs-lisp-mode/traverse_dir b/emacs-lisp-mode/traverse_dir new file mode 100644 index 0000000..2859cbd --- /dev/null +++ b/emacs-lisp-mode/traverse_dir @@ -0,0 +1,6 @@ +#name : traversing a directory +#contributor : Xah Lee +# -- +;; apply a function to all files in a dir +(require 'find-lisp) +(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$")) diff --git a/emacs-lisp-mode/unless b/emacs-lisp-mode/unless new file mode 100755 index 0000000..15c1518 --- /dev/null +++ b/emacs-lisp-mode/unless @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: unless +#key: unless +# -- +(unless $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/vector b/emacs-lisp-mode/vector new file mode 100755 index 0000000..59ad236 --- /dev/null +++ b/emacs-lisp-mode/vector @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: vector +#key: vector +#key: v +# -- +(vector $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/when b/emacs-lisp-mode/when new file mode 100755 index 0000000..c5f4478 --- /dev/null +++ b/emacs-lisp-mode/when @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: when +#key: when +# -- +(when $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/while b/emacs-lisp-mode/while new file mode 100755 index 0000000..4584be3 --- /dev/null +++ b/emacs-lisp-mode/while @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: while +#key: while +# -- +(while $0)
\ No newline at end of file diff --git a/emacs-lisp-mode/widget-get b/emacs-lisp-mode/widget-get new file mode 100755 index 0000000..24caf7b --- /dev/null +++ b/emacs-lisp-mode/widget-get @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: widget-get +#key: widget-get +#key: wg +# -- +(widget-get $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/with-current-buffer b/emacs-lisp-mode/with-current-buffer new file mode 100755 index 0000000..9041303 --- /dev/null +++ b/emacs-lisp-mode/with-current-buffer @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: with-current-buffer +#key: with-current-buffer +#key: wcb +# -- +(with-current-buffer $0 )
\ No newline at end of file diff --git a/emacs-lisp-mode/word-or-region b/emacs-lisp-mode/word-or-region new file mode 100644 index 0000000..66a59e4 --- /dev/null +++ b/emacs-lisp-mode/word-or-region @@ -0,0 +1,27 @@ +#name : Command that works on region or word +#contributor : Xah Lee +# -- +;; example of a command that works on current word or text selection +(defun down-case-word-or-region () + "Lower case the current word or text selection." +(interactive) +(let (pos1 pos2 meat) + (if (and transient-mark-mode mark-active) + (setq pos1 (region-beginning) + pos2 (region-end)) + (setq pos1 (car (bounds-of-thing-at-point 'symbol)) + pos2 (cdr (bounds-of-thing-at-point 'symbol)))) + + ; now, pos1 and pos2 are the starting and ending positions + ; of the current word, or current text selection if exists + + ;; put your code here. + $0 + ;; Some example of things you might want to do + (downcase-region pos1 pos2) ; example of a func that takes region as args + (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text. + (delete-region pos1 pos2) ; get rid of it + (insert "newText") ; insert your new text + + ) +) diff --git a/emacs-lisp-mode/word_regexp b/emacs-lisp-mode/word_regexp new file mode 100644 index 0000000..4c3bfe6 --- /dev/null +++ b/emacs-lisp-mode/word_regexp @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: word_regexp +# key: < +# -- +"\\_<${1:word}\\_>"
\ No newline at end of file diff --git a/emacs-lisp-mode/x-dired.process_marked b/emacs-lisp-mode/x-dired.process_marked new file mode 100755 index 0000000..9af5a26 --- /dev/null +++ b/emacs-lisp-mode/x-dired.process_marked @@ -0,0 +1,17 @@ +#contributor: Xah Lee (XahLee.org) +#name: process marked files in dired +# key: x-dired +# -- +;; idiom for processing a list of files in dired's marked files + +;; suppose myProcessFile is your function that takes a file path +;; and do some processing on the file + +(defun dired-myProcessFile () + "apply myProcessFile function to marked files in dired." + (interactive) + (require 'dired) + (mapc 'myProcessFile (dired-get-marked-files)) +) + +;; to use it, type M-x dired-myProcessFile
\ No newline at end of file diff --git a/emacs-lisp-mode/x-file.process b/emacs-lisp-mode/x-file.process new file mode 100755 index 0000000..3c82822 --- /dev/null +++ b/emacs-lisp-mode/x-file.process @@ -0,0 +1,18 @@ +#contributor: Xah Lee (XahLee.org) +#name: a function that process a file +# key: x-file +# -- +(defun doThisFile (fpath) + "Process the file at path FPATH ..." + (let () + ;; create temp buffer without undo record or font lock. (more efficient) + ;; first space in temp buff name is necessary + (set-buffer (get-buffer-create " myTemp")) + (insert-file-contents fpath nil nil nil t) + + ;; process it ... + ;; (goto-char 0) ; move to begining of file's content (in case it was open) + ;; ... do something here + ;; (write-file fpath) ;; write back to the file + + (kill-buffer " myTemp")))
\ No newline at end of file diff --git a/emacs-lisp-mode/x-file.read-lines b/emacs-lisp-mode/x-file.read-lines new file mode 100755 index 0000000..2b23983 --- /dev/null +++ b/emacs-lisp-mode/x-file.read-lines @@ -0,0 +1,18 @@ +#contributor: Xah Lee (XahLee.org) +#name: read lines of a file +# key: x-file +# -- +(defun read-lines (filePath) + "Return a list of lines in FILEPATH." + (with-temp-buffer + (insert-file-contents filePath) + (split-string + (buffer-string) "\n" t)) ) + +;; process all lines +(mapc + (lambda (aLine) + (message aLine) ; do your stuff here + ) + (read-lines "inputFilePath") +)
\ No newline at end of file diff --git a/emacs-lisp-mode/x-find-replace b/emacs-lisp-mode/x-find-replace new file mode 100755 index 0000000..d4c4d11 --- /dev/null +++ b/emacs-lisp-mode/x-find-replace @@ -0,0 +1,18 @@ +#contributor: Xah Lee (XahLee.org) +#name: find and replace on region +# key: x-find-replace +# -- +(defun replace-html-chars-region (start end) + "Replace “<” to “<” and other chars in HTML. +This works on the current region." + (interactive "r") + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (search-forward "&" nil t) (replace-match "&" nil t)) + (goto-char (point-min)) + (while (search-forward "<" nil t) (replace-match "<" nil t)) + (goto-char (point-min)) + (while (search-forward ">" nil t) (replace-match ">" nil t)) + ) + )
\ No newline at end of file diff --git a/emacs-lisp-mode/x-grabstring b/emacs-lisp-mode/x-grabstring new file mode 100755 index 0000000..d348e93 --- /dev/null +++ b/emacs-lisp-mode/x-grabstring @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: grab buffer substring +# key: x-grabstring +# -- +(setq $0 (buffer-substring-no-properties myStartPos myEndPos))
\ No newline at end of file diff --git a/emacs-lisp-mode/x-grabthing b/emacs-lisp-mode/x-grabthing new file mode 100755 index 0000000..2c0079d --- /dev/null +++ b/emacs-lisp-mode/x-grabthing @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: grab word under cursor +# key: x-grabthing +# -- +(setq $0 (thing-at-point 'symbol))
\ No newline at end of file diff --git a/emacs-lisp-mode/x-traverse_dir b/emacs-lisp-mode/x-traverse_dir new file mode 100755 index 0000000..cfa461a --- /dev/null +++ b/emacs-lisp-mode/x-traverse_dir @@ -0,0 +1,7 @@ +#name: traversing a directory +#contributor: Xah Lee (XahLee.org) +# key: x-traverse_dir +# -- +;; apply a function to all files in a dir +(require 'find-lisp) +(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
\ No newline at end of file diff --git a/emacs-lisp-mode/x-word-or-region b/emacs-lisp-mode/x-word-or-region new file mode 100755 index 0000000..c7b851b --- /dev/null +++ b/emacs-lisp-mode/x-word-or-region @@ -0,0 +1,28 @@ +#contributor: Xah Lee (XahLee.org) +#name: Command that works on region or word +# key: x-word-or-region +# -- +;; example of a command that works on current word or text selection +(defun down-case-word-or-region () + "Lower case the current word or text selection." +(interactive) +(let (pos1 pos2 meat) + (if (and transient-mark-mode mark-active) + (setq pos1 (region-beginning) + pos2 (region-end)) + (setq pos1 (car (bounds-of-thing-at-point 'symbol)) + pos2 (cdr (bounds-of-thing-at-point 'symbol)))) + + ; now, pos1 and pos2 are the starting and ending positions + ; of the current word, or current text selection if exists + + ;; put your code here. + $0 + ;; Some example of things you might want to do + (downcase-region pos1 pos2) ; example of a func that takes region as args + (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text. + (delete-region pos1 pos2) ; get rid of it + (insert "newText") ; insert your new text + + ) +)
\ No newline at end of file diff --git a/emacs-lisp-mode/y-or-n-p b/emacs-lisp-mode/y-or-n-p new file mode 100755 index 0000000..8aeec63 --- /dev/null +++ b/emacs-lisp-mode/y-or-n-p @@ -0,0 +1,6 @@ +#contributor: Xah Lee (XahLee.org) +#name: y-or-n-p +#key: y-or-n-p +#key: yonp +# -- +(yes-or-no-p "PROMPT$0 ")
\ No newline at end of file diff --git a/emacs-lisp-mode/yes-or-no-p b/emacs-lisp-mode/yes-or-no-p new file mode 100755 index 0000000..e7bb064 --- /dev/null +++ b/emacs-lisp-mode/yes-or-no-p @@ -0,0 +1,5 @@ +#contributor: Xah Lee (XahLee.org) +#name: yes-or-no-p +#key: yes-or-no-p +# -- +(yes-or-no-p "PROMPT$0 ")
\ No newline at end of file |