[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116973: * lisp/progmodes/grep.el: Use lexical-bindi
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r116973: * lisp/progmodes/grep.el: Use lexical-binding. |
Date: |
Sat, 12 Apr 2014 19:38:11 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116973
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2014-04-12 15:38:06 -0400
message:
* lisp/progmodes/grep.el: Use lexical-binding.
(grep-expand-template): Pass explicit lexical env to `eval'.
(zrgrep): Let-bind grep-find-template explicitly.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/grep.el grep.el-20091113204419-o5vbwnq5f7feedwu-2948
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-04-12 19:30:14 +0000
+++ b/lisp/ChangeLog 2014-04-12 19:38:06 +0000
@@ -1,5 +1,9 @@
2014-04-12 Stefan Monnier <address@hidden>
+ * progmodes/grep.el: Use lexical-binding.
+ (grep-expand-template): Pass explicit lexical env to `eval'.
+ (zrgrep): Let-bind grep-find-template explicitly.
+
* emacs-lisp/cl-lib.el (current-case-table): Remove setter.
* leim/quail/sisheng.el (sisheng-list): Use with-case-table.
@@ -29,8 +33,8 @@
2014-04-12 Matthias Dahl <address@hidden>
- * faces.el (make-face): Remove deprecated optional argument. The
- conditional application of X resources is handled directly by
+ * faces.el (make-face): Remove deprecated optional argument.
+ The conditional application of X resources is handled directly by
make-face-x-resource-internal since Emacs 24.4.
(make-empty-face): Don't pass optional argument to make-face.
=== modified file 'lisp/progmodes/grep.el'
--- a/lisp/progmodes/grep.el 2014-02-14 06:59:24 +0000
+++ b/lisp/progmodes/grep.el 2014-04-12 19:38:06 +0000
@@ -1,4 +1,4 @@
-;;; grep.el --- run `grep' and display the results
+;;; grep.el --- run `grep' and display the results -*- lexical-binding:t -*-
;; Copyright (C) 1985-1987, 1993-1999, 2001-2014 Free Software
;; Foundation, Inc.
@@ -805,16 +805,20 @@
(defun grep-expand-template (template &optional regexp files dir excl)
"Patch grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>."
- (let ((command template)
- (cf case-fold-search)
- (case-fold-search nil))
+ (let* ((command template)
+ (env `((cf . ,case-fold-search)
+ (excl . ,excl)
+ (dir . ,dir)
+ (files . ,files)
+ (regexp . ,regexp)))
+ (case-fold-search nil))
(dolist (kw grep-expand-keywords command)
(if (string-match (car kw) command)
(setq command
(replace-match
(or (if (symbolp (cdr kw))
- (symbol-value (cdr kw))
- (save-match-data (eval (cdr kw))))
+ (eval (cdr kw) env)
+ (save-match-data (eval (cdr kw) env)))
"")
t t command))))))
@@ -1055,7 +1059,7 @@
(setq default-directory dir)))))))
;;;###autoload
-(defun zrgrep (regexp &optional files dir confirm grep-find-template)
+(defun zrgrep (regexp &optional files dir confirm template)
"Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR.
Like `rgrep' but uses `zgrep' for `grep-program', sets the default
file name to `*.gz', and sets `grep-highlight-matches' to `always'."
@@ -1090,10 +1094,8 @@
(list regexp files dir confirm grep-find-template)))))))
;; Set `grep-highlight-matches' to `always'
;; since `zgrep' puts filters in the grep output.
- (let ((grep-highlight-matches 'always))
- ;; `rgrep' uses the dynamically bound value `grep-find-template'
- ;; from the argument `grep-find-template' whose value is computed
- ;; in the `interactive' spec.
+ (let ((grep-find-template template)
+ (grep-highlight-matches 'always))
(rgrep regexp files dir confirm)))
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116973: * lisp/progmodes/grep.el: Use lexical-binding.,
Stefan Monnier <=