- GNU Emacs Lisp Reference Manual
(info "elisp")
- Introduction to Programming in Emacs Lisp
(info "eintr")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Copy or Paste using one and the same key ("C-c c") | |
(defun copy-or-paste () | |
"Copy when there are selected text, paste otherwise." | |
(interactive) | |
(if (region-active-p) | |
(copy-region-as-kill (region-beginning) ; Copy | |
(region-end)) | |
;; TODO: deactive mark/region | |
;; Paste |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; demo-code-for-elisp-guide.el --- practice code for elisp-guide | |
;;; Code: | |
;; Basic concepts | |
;; Buffers | |
(current-buffer) | |
#<buffer demo-code-for-elisp-guide.el> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mapcar 'symbolp '(+ 1 "skin" nil t buffer-name)) | |
(t nil nil t t t) | |
;; | |
;; Symbol components | |
;; | |
;; 1. Print name | |
;; 2. Value | |
;; 3. Function | |
;; 4. Property list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; init.el --- Sample `user-init-file' for chinese-pyim dev | |
;; use space to indent by default | |
(setq-default indent-tabs-mode nil) | |
;; Remove trailing whitespace | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; Use git version of org-mode | |
(add-to-list 'load-path "~/repos/org-mode/lisp") | |
(add-to-list 'load-path "~/repos/org-mode/contrib/lisp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'text-mode-hook | |
(lambda () | |
;; (remove-hook 'after-change-functions #'first-line-if-changed nil t) | |
(add-hook 'post-command-hook 'first-line-if-changed2 nil 'local))) | |
(defun first-line-if-changed (beg end len) | |
(save-excursion | |
(goto-char (point-min)) | |
(end-of-line) | |
(buffer-substring-no-properties (point-min) (point)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; init.el -- minimum init file for debug Emacs | |
;;; Commentary: | |
;;; Code: | |
(setq message-log-max 10000 | |
debug-on-error t) | |
;; Remap keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ~ cat words.txt | |
a[ei, ә]art.一个 | |
an[әn, æn]art.一个 | |
ability[ә'biliti]n.能力,才干 | |
able['eibl]a.有才能的,能够的 | |
➜ ~ gawk 'match($0, /(.*)\[(.*)\](.*)/, m) { print m[1], "\t", m[2], "\t", m[3] }' words.txt | |
a ei, ә art.一个 | |
an әn, æn art.一个 | |
ability ә'biliti n.能力,才干 | |
able 'eibl a.有才能的,能够的 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; URL: http://wikemacs.org/wiki/How_to_write_helm_extensions | |
;; | |
;; A list of candidates and an action | |
;; | |
(setq some-helm-source | |
'((name . "HELM at the Emacs") | |
(candidates . (1 2 3 4)) | |
(action . (lambda (candidate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defclass record () ; No superclasses | |
((name :initarg :name | |
:initform "" | |
:type string | |
:custom string | |
:documentation "The name of a person.") | |
(birthday :initarg :birthday | |
:initform "Jan 1, 1970" | |
:custom string | |
:type string |