Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Use rx for regex construction for great justice.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Dec 10, 2008
1 parent 8b83d57 commit eff2c75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion starter-kit-defuns.el
Expand Up @@ -80,7 +80,8 @@

(defun pretty-lambdas ()
(font-lock-add-keywords
nil `(("(?\\(lambda\\>\\)"
nil `(((rx (opt "(")
(group "lambda" word-end))
(0 (progn (compose-region (match-beginning 1) (match-end 1)
,(make-char 'greek-iso8859-7 107))
nil))))))
Expand Down
11 changes: 8 additions & 3 deletions starter-kit-eshell.el
Expand Up @@ -4,7 +4,12 @@

(setq eshell-cmpl-cycle-completions nil
eshell-save-history-on-exit t
eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
eshell-cmpl-dir-ignore (rx bos (or (and "." (opt "."))
"CVS"
".svn"
".git")
"/"
eos))

(eval-after-load 'esh-opt
'(progn
Expand All @@ -18,9 +23,9 @@
(add-to-list 'eshell-visual-commands "ssh")
(add-to-list 'eshell-visual-commands "tail")
(add-to-list 'eshell-command-completions-alist
'("gunzip" "gz\\'"))
`("gunzip" ,(rx "gz" eos)))
(add-to-list 'eshell-command-completions-alist
'("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
`("tar" ,(rx (group (or ".tar" ".tgz" ".tar.gz" eos)))))
(add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color)))

(provide 'starter-kit-eshell)
Expand Down
4 changes: 2 additions & 2 deletions starter-kit-lisp.el
Expand Up @@ -17,10 +17,10 @@
(delete-file (concat buffer-file-name "c"))))))

(font-lock-add-keywords 'emacs-lisp-mode
'(("(\\|)" . 'paren-face)))
`((,(rx (or "(" ")")) paren-face)))

(font-lock-add-keywords 'scheme-mode
'(("(\\|)" . 'paren-face)))
`((,(rx (or "(" ")")) paren-face)))

(define-key lisp-mode-shared-map (kbd "C-c l") "lambda")

Expand Down

0 comments on commit eff2c75

Please sign in to comment.