Permalink
Browse files

Use rx for regex construction for great justice.

  • Loading branch information...
1 parent 8b83d57 commit eff2c7525d4cd9a84d2613584931f640097cbdd0 @technomancy committed Dec 10, 2008
Showing with 12 additions and 6 deletions.
  1. +2 −1 starter-kit-defuns.el
  2. +8 −3 starter-kit-eshell.el
  3. +2 −2 starter-kit-lisp.el
View
3 starter-kit-defuns.el
@@ -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))))))
View
11 starter-kit-eshell.el
@@ -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
@@ -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)
View
4 starter-kit-lisp.el
@@ -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")

0 comments on commit eff2c75

Please sign in to comment.