added about 10 elisp keywords. work in progress to add more.

This commit is contained in:
Xah Lee 2010-08-05 07:44:11 +00:00
parent 53d1d705d2
commit 6c35178715
22 changed files with 74 additions and 24 deletions

View File

@ -1,4 +1,7 @@
TITLE: Emacs Idiom Template Set. Version 1. 2009-02-22 TITLE: Emacs Idiom Template Set.
Version 1.1. 2010-08-05
Version 1. 2009-02-22
DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks. DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks.

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: and
# --
(and $0)

View File

@ -0,0 +1,5 @@
#contributor: Xah Lee (XahLee.org)
#name: autoload
# --
(autoload 'FUNCNAME$0 "FILENAME" & "DOCSTRING" INTERACTIVE TYPE)

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: car
# --
(car $0)

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: define-key
# --
(define-key KEYMAPNAME$0 (kbd "M-b") 'FUNCNAME)

View File

@ -1,11 +1,10 @@
#name : function template #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: defun
# -- # --
(defun $1 () (defun $1 ()
"thisandthat." "DOCSTRING"
(interactive) (interactive)
(let (var1) (let (var1)
(setq var1 some) (setq var1 some)
$0 $0
) ))
)

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: defvar
# --
(defvar SYMBOL & INITVALUE "DOCSTRING")

View File

@ -1,4 +0,0 @@
#name : grab word under cursor
#contributor : Xah Lee
# --
(setq $0 (thing-at-point 'symbol))

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: if
# --
(if $0)

View File

@ -0,0 +1,6 @@
#contributor: Xah Lee (XahLee.org)
#name: let
# --
(let ($1 )
$0
)

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: not
# --
(not $0 )

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: or
# --
(or $0 )

View File

@ -0,0 +1,5 @@
#contributor: Xah Lee (XahLee.org)
#name: '(...)
#key: '
# --
'($0 )

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: setq
# --
(setq $0 )

View File

@ -1,5 +1,5 @@
#name : process marked files in dired #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: process marked files in dired
# -- # --
;; idiom for processing a list of files in dired's marked files ;; idiom for processing a list of files in dired's marked files

View File

@ -1,5 +1,5 @@
#name : a function that process a file #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: a function that process a file
# -- # --
(defun doThisFile (fpath) (defun doThisFile (fpath)
"Process the file at path FPATH ..." "Process the file at path FPATH ..."

View File

@ -1,5 +1,5 @@
#name : read lines of a file #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: read lines of a file
# -- # --
(defun read-lines (filePath) (defun read-lines (filePath)
"Return a list of lines in FILEPATH." "Return a list of lines in FILEPATH."

View File

@ -1,5 +1,5 @@
#name : find and replace on region #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: find and replace on region
# -- # --
(defun replace-html-chars-region (start end) (defun replace-html-chars-region (start end)
"Replace “<” to “&lt;” and other chars in HTML. "Replace “<” to “&lt;” and other chars in HTML.

View File

@ -1,4 +1,4 @@
#name : grab buffer substring #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: grab buffer substring
# -- # --
(setq $0 (buffer-substring-no-properties myStartPos myEndPos)) (setq $0 (buffer-substring-no-properties myStartPos myEndPos))

View File

@ -0,0 +1,4 @@
#contributor: Xah Lee (XahLee.org)
#name: grab word under cursor
# --
(setq $0 (thing-at-point 'symbol))

View File

@ -1,5 +1,5 @@
#name : traversing a directory #name: traversing a directory
#contributor : Xah Lee #contributor: Xah Lee (XahLee.org)
# -- # --
;; apply a function to all files in a dir ;; apply a function to all files in a dir
(require 'find-lisp) (require 'find-lisp)

View File

@ -1,5 +1,5 @@
#name : Command that works on region or word #contributor: Xah Lee (XahLee.org)
#contributor : Xah Lee #name: Command that works on region or word
# -- # --
;; example of a command that works on current word or text selection ;; example of a command that works on current word or text selection
(defun down-case-word-or-region () (defun down-case-word-or-region ()