]> git.eshelyaron.com Git - emacs.git/commitdiff
Replace lexical-let by lexical-binding (except Gnus, CEDET, ERT).
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 26 Apr 2012 12:43:28 +0000 (08:43 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 26 Apr 2012 12:43:28 +0000 (08:43 -0400)
* lisp/term/ns-win.el (ns-define-service):
* lisp/progmodes/pascal.el (pascal-goto-defun):
* lisp/progmodes/js.el (js--read-tab):
* lisp/progmodes/etags.el (tags-lazy-completion-table):
* lisp/emacs-lisp/syntax.el (syntax-propertize-via-font-lock):
* lisp/emacs-lisp/ewoc.el (ewoc--wrap):
* lisp/emacs-lisp/assoc.el (aput, adelete, amake):
* lisp/doc-view.el (doc-view-convert-current-doc):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/diff.el (diff-no-select): Replace lexical-let by lexical-binding.

14 files changed:
lisp/ChangeLog
lisp/dired.el
lisp/doc-view.el
lisp/emacs-lisp/assoc.el
lisp/emacs-lisp/ewoc.el
lisp/emacs-lisp/syntax.el
lisp/mpc.el
lisp/progmodes/etags.el
lisp/progmodes/js.el
lisp/progmodes/pascal.el
lisp/term/ns-win.el
lisp/url/ChangeLog
lisp/url/url.el
lisp/vc/diff.el

index ad6fd35bc5d1e019e75a5b329742c6fbbabd0145..a02521ca147f70693cf403f4433ab00f5f29cc70 100644 (file)
@@ -1,3 +1,16 @@
+2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+
+       * term/ns-win.el (ns-define-service):
+       * progmodes/pascal.el (pascal-goto-defun):
+       * progmodes/js.el (js--read-tab):
+       * progmodes/etags.el (tags-lazy-completion-table):
+       * emacs-lisp/syntax.el (syntax-propertize-via-font-lock):
+       * emacs-lisp/ewoc.el (ewoc--wrap):
+       * emacs-lisp/assoc.el (aput, adelete, amake):
+       * doc-view.el (doc-view-convert-current-doc):
+       * vc/diff.el (diff-no-select): Replace lexical-let by lexical-binding.
+
 2012-04-26  Chong Yidong  <cyd@gnu.org>
 
        * image.el (image-type-from-buffer): Only return supported image
index 77fe9cb76145e58d4106bf43c7fe268fc4acc1cb..f6f7d71c636c718b2a2c87d8ccb96b75992f04d5 100644 (file)
@@ -670,31 +670,31 @@ Don't use that together with FILTER."
 ;;         (dolist (ext completion-ignored-extensions)
 ;;           (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
 ;;         (setq cie (concat (regexp-opt cie "\\(?:") "\\'"))
-;;         (lexical-let* ((default (and buffer-file-name
-;;                                      (abbreviate-file-name buffer-file-name)))
-;;                        (cie cie)
-;;                        (completion-table
-;;                         ;; We need a mix of read-file-name and
-;;                         ;; read-directory-name so that completion to directories
-;;                         ;; is preferred, but if the user wants to enter a global
-;;                         ;; pattern, he can still use completion on filenames to
-;;                         ;; help him write the pattern.
-;;                         ;; Essentially, we want to use
-;;                         ;; (completion-table-with-predicate
-;;                         ;;  'read-file-name-internal 'file-directory-p nil)
-;;                         ;; but that doesn't work because read-file-name-internal
-;;                         ;; does not obey its `predicate' argument.
-;;                         (completion-table-in-turn
-;;                          (lambda (str pred action)
-;;                            (let ((read-file-name-predicate
-;;                                   (lambda (f)
-;;                                     (and (not (member f '("./" "../")))
-;;                                          ;; Hack! Faster than file-directory-p!
-;;                                          (eq (aref f (1- (length f))) ?/)
-;;                                          (not (string-match cie f))))))
-;;                              (complete-with-action
-;;                               action 'read-file-name-internal str nil)))
-;;                          'read-file-name-internal)))
+;;         (let* ((default (and buffer-file-name
+;;                              (abbreviate-file-name buffer-file-name)))
+;;                (cie cie)
+;;                (completion-table
+;;                 ;; We need a mix of read-file-name and
+;;                 ;; read-directory-name so that completion to directories
+;;                 ;; is preferred, but if the user wants to enter a global
+;;                 ;; pattern, he can still use completion on filenames to
+;;                 ;; help him write the pattern.
+;;                 ;; Essentially, we want to use
+;;                 ;; (completion-table-with-predicate
+;;                 ;;  'read-file-name-internal 'file-directory-p nil)
+;;                 ;; but that doesn't work because read-file-name-internal
+;;                 ;; does not obey its `predicate' argument.
+;;                 (completion-table-in-turn
+;;                  (lambda (str pred action)
+;;                    (let ((read-file-name-predicate
+;;                           (lambda (f)
+;;                             (and (not (member f '("./" "../")))
+;;                                  ;; Hack! Faster than file-directory-p!
+;;                                  (eq (aref f (1- (length f))) ?/)
+;;                                  (not (string-match cie f))))))
+;;                      (complete-with-action
+;;                       action 'read-file-name-internal str nil)))
+;;                  'read-file-name-internal)))
 ;;           (minibuffer-with-setup-hook
 ;;               (lambda ()
 ;;                 (setq minibuffer-default default)
index 53e7811bad1e3c05505188b32bb2f1678a83506f..78b6610ff3cbba08f3460e864704f188d3137864 100644 (file)
@@ -960,13 +960,12 @@ Those files are saved in the directory given by the function
       (odf
        ;; ODF files have to be converted to PDF before Ghostscript can
        ;; process it.
-       (lexical-let
-           ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
-           (opdf (expand-file-name (concat (file-name-sans-extension
-                                            (file-name-nondirectory doc-view-buffer-file-name))
-                                           ".pdf")
-                                   doc-view-current-cache-dir))
-            (png-file png-file))
+       (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
+             (opdf (expand-file-name (concat (file-name-sans-extension
+                                              (file-name-nondirectory doc-view-buffer-file-name))
+                                             ".pdf")
+                                     doc-view-current-cache-dir))
+             (png-file png-file))
         ;; The unoconv tool only supports a output directory, but no
         ;; file name.  It's named like the input file with the
         ;; extension replaced by pdf.
index 264374ed7216d9465851de0d452a4ebc71cc7281..d3185c444d720514569a56c12a3bc11fbedccb9b 100644 (file)
@@ -1,4 +1,4 @@
-;;; assoc.el --- insert/delete functions on association lists
+;;; assoc.el --- insert/delete functions on association lists  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1996, 2001-2012  Free Software Foundation, Inc.
 
@@ -36,7 +36,7 @@ the order of any other key-value pair.  Side effect sets alist to new
 sorted list."
   (set alist-symbol
        (sort (copy-alist (symbol-value alist-symbol))
-            (function (lambda (a b) (equal (car a) key))))))
+             (lambda (a _b) (equal (car a) key)))))
 
 
 (defun aelement (key value)
@@ -71,8 +71,8 @@ If VALUE is not supplied, or is nil, the key-value pair will not be
 modified, but will be moved to the head of the alist.  If the key-value
 pair cannot be found in the alist, it will be inserted into the head
 of the alist (with value nil if VALUE is nil or not supplied)."
-  (lexical-let ((elem (aelement key value))
-               alist)
+  (let ((elem (aelement key value))
+        alist)
     (asort alist-symbol key)
     (setq alist (symbol-value alist-symbol))
     (cond ((null alist) (set alist-symbol elem))
@@ -86,7 +86,7 @@ of the alist (with value nil if VALUE is nil or not supplied)."
 Alist is referenced by ALIST-SYMBOL and the key-value pair to remove
 is pair matching KEY.  Returns the altered alist."
   (asort alist-symbol key)
-  (lexical-let ((alist (symbol-value alist-symbol)))
+  (let ((alist (symbol-value alist-symbol)))
     (cond ((null alist) nil)
          ((anot-head-p alist key) alist)
          (t (set alist-symbol (cdr alist))))))
@@ -123,10 +123,10 @@ KEYLIST and VALUELIST should have the same number of elements, but
 this isn't enforced.  If VALUELIST is smaller than KEYLIST, remaining
 keys are associated with nil.  If VALUELIST is larger than KEYLIST,
 extra values are ignored.  Returns the created alist."
-  (lexical-let ((keycar (car keylist))
-               (keycdr (cdr keylist))
-               (valcar (car valuelist))
-               (valcdr (cdr valuelist)))
+  (let ((keycar (car keylist))
+        (keycdr (cdr keylist))
+        (valcar (car valuelist))
+        (valcdr (cdr valuelist)))
     (cond ((null keycdr)
           (aput alist-symbol keycar valcar))
          (t
index 4fd87209b389b2291b4b0a69f291f193c4f4d056..9e214a9703c2a4622c4753e863569a233654e82e 100644 (file)
@@ -1,4 +1,4 @@
-;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer
+;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1991-2012 Free Software Foundation, Inc.
 
@@ -216,10 +216,9 @@ NODE and leaving the new node's start there.  Return the new node."
     (ewoc--adjust m (point) R dll)))
 
 (defun ewoc--wrap (func)
-  (lexical-let ((ewoc--user-pp func))
-    (lambda (data)
-      (funcall ewoc--user-pp data)
-      (insert "\n"))))
+  (lambda (data)
+    (funcall func data)
+    (insert "\n")))
 
 \f
 ;;; ===========================================================================
index 611a766922abc07f9c16ae5449a28eeb945e85dc..583d0b151c99d4abc2814128cd85ab7ad53aa1be 100644 (file)
@@ -1,4 +1,4 @@
-;;; syntax.el --- helper functions to find syntactic context
+;;; syntax.el --- helper functions to find syntactic context  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
@@ -274,13 +274,12 @@ Note: back-references in REGEXPs do not work."
   "Propertize for syntax in START..END using font-lock syntax.
 KEYWORDS obeys the format used in `font-lock-syntactic-keywords'.
 The return value is a function suitable for `syntax-propertize-function'."
-  (lexical-let ((keywords keywords))
-    (lambda (start end)
-      (with-no-warnings
-        (let ((font-lock-syntactic-keywords keywords))
-          (font-lock-fontify-syntactic-keywords-region start end)
-          ;; In case it was eval'd/compiled.
-          (setq keywords font-lock-syntactic-keywords))))))
+  (lambda (start end)
+    (with-no-warnings
+      (let ((font-lock-syntactic-keywords keywords))
+        (font-lock-fontify-syntactic-keywords-region start end)
+        ;; In case it was eval'd/compiled.
+        (setq keywords font-lock-syntactic-keywords)))))
 
 (defun syntax-propertize (pos)
   "Ensure that syntax-table properties are set until POS."
index ea7f67933090aae70c138ac3cbba9265575285c8..a908e4bedac1f2709b526455b0c17880ccb309fc 100644 (file)
@@ -406,7 +406,7 @@ which will be concatenated with proper quoting before passing them to MPD."
                             (funcall callback (prog1 (mpc-proc-buf-to-alist
                                                       (current-buffer))
                                                 (set-buffer buf))))))
-    ;; (lexical-let ((res nil))
+    ;; (let ((res nil))
     ;;   (mpc-proc-cmd-to-alist cmd (lambda (alist) (setq res alist)))
     ;;   (mpc-proc-sync)
     ;;   res)
index d8a561340d3d79857dfbc8a312246c7ab3a508a1..638410ae627c1c236d6f9d7e836248d3e59ec485 100644 (file)
@@ -1,4 +1,4 @@
-;;; etags.el --- etags facility for Emacs
+;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2012
 ;;   Free Software Foundation, Inc.
@@ -781,7 +781,7 @@ tags table and its (recursively) included tags tables."
              (setq tags-completion-table nil)))))
 
 (defun tags-lazy-completion-table ()
-  (lexical-let ((buf (current-buffer)))
+  (let ((buf (current-buffer)))
     (lambda (string pred action)
       (with-current-buffer buf
         (save-excursion
index 69da673752090a76388748c36782a0849d4e99ec..1c8a1f45e57a8fe6b52a9f5c64cc161571f8e072 100644 (file)
@@ -1,4 +1,4 @@
-;;; js.el --- Major mode for editing JavaScript
+;;; js.el --- Major mode for editing JavaScript  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
@@ -1036,17 +1036,12 @@ LIMIT defaults to point."
 
     (c-save-buffer-state
         (open-items
-         orig-match-start
-         orig-match-end
-         orig-depth
          parse
          prev-parse-point
          name
          case-fold-search
          filtered-class-styles
-         new-item
-         goal-point
-         end-prop)
+         goal-point)
 
       ;; Figure out which class styles we need to look for
       (setq filtered-class-styles
@@ -2956,8 +2951,8 @@ browser, respectively."
     (ido-mode -1))
 
   (with-js
-   (lexical-let ((tabs (js--get-tabs)) selected-tab-cname
-                 selected-tab prev-hitab)
+   (let ((tabs (js--get-tabs)) selected-tab-cname
+         selected-tab prev-hitab)
 
      ;; Disambiguate names
      (setq tabs (loop with tab-names = (make-hash-table :test 'equal)
@@ -3053,7 +3048,6 @@ browser, respectively."
                                                   "gBrowser"
                                                   "selectedTab")
 
-                         with index = 0
                          for match in ido-matches
                          for candidate-tab = (find-tab-by-cname match)
                          if (eq (fourth candidate-tab) tab-to-match)
index 8f7f313753cbff2f83389f1bcab8e7998aef16ae..5a6f4e20fbc8a22ef315fd40693739ac8403bfad 100644 (file)
@@ -1353,21 +1353,21 @@ The default is a name found in the buffer around point."
         (default (if (pascal-comp-defun default nil 'lambda)
                      default ""))
         (label
-          ;; Do completion with default
+          ;; Do completion with default.
           (completing-read (if (not (string= default ""))
                                (concat "Label (default " default "): ")
                              "Label: ")
                            ;; Complete with the defuns found in the
                            ;; current-buffer.
-                           (lexical-let ((buf (current-buffer)))
+                           (let ((buf (current-buffer)))
                              (lambda (s p a)
                                (with-current-buffer buf
                                  (pascal-comp-defun s p a))))
                            nil t "")))
-    ;; If there was no response on prompt, use default value
+    ;; If there was no response on prompt, use default value.
     (if (string= label "")
        (setq label default))
-    ;; Goto right place in buffer if label is not an empty string
+    ;; Goto right place in buffer if label is not an empty string.
     (or (string= label "")
        (progn
          (goto-char (point-min))
index b681ec3440f80c82a06e93fe3c3302011ef9e959..feac0f1c537d8856affde0844e48d8c6009e589f 100644 (file)
@@ -1,4 +1,4 @@
-;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system
+;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1993-1994, 2005-2012  Free Software Foundation, Inc.
 
@@ -44,7 +44,7 @@
     (error "%s: Loading ns-win.el but not compiled for GNUstep/MacOS"
            (invocation-name)))
 
-(eval-when-compile (require 'cl))       ; lexical-let
+(eval-when-compile (require 'cl))
 
 ;; Documentation-purposes only: actually loaded in loadup.el.
 (require 'frame)
@@ -65,7 +65,7 @@
 ;; nsterm.m.
 (defvar ns-input-file)
 
-(defun ns-handle-nxopen (switch &optional temp)
+(defun ns-handle-nxopen (_switch &optional temp)
   (setq unread-command-events (append unread-command-events
                                       (if temp '(ns-open-temp-file)
                                         '(ns-open-file)))
@@ -74,7 +74,7 @@
 (defun ns-handle-nxopentemp (switch)
   (ns-handle-nxopen switch t))
 
-(defun ns-ignore-1-arg (switch)
+(defun ns-ignore-1-arg (_switch)
   (setq x-invocation-args (cdr x-invocation-args)))
 
 (defun ns-parse-geometry (geom)
@@ -201,21 +201,20 @@ The properties returned may include `top', `left', `height', and `width'."
                 (mapconcat 'identity (cons "ns-service" path) "-")))))
     ;; This defines the function.
     (defalias name
-      (lexical-let ((service service))
-        (lambda (arg)
-          (interactive "p")
-          (let* ((in-string
-                  (cond ((stringp arg) arg)
-                        (mark-active
-                         (buffer-substring (region-beginning) (region-end)))))
-                 (out-string (ns-perform-service service in-string)))
-            (cond
-             ((stringp arg) out-string)
-             ((and out-string (or (not in-string)
-                                  (not (string= in-string out-string))))
-              (if mark-active (delete-region (region-beginning) (region-end)))
-              (insert out-string)
-              (setq deactivate-mark nil)))))))
+      (lambda (arg)
+        (interactive "p")
+        (let* ((in-string
+                (cond ((stringp arg) arg)
+                      (mark-active
+                       (buffer-substring (region-beginning) (region-end)))))
+               (out-string (ns-perform-service service in-string)))
+          (cond
+           ((stringp arg) out-string)
+           ((and out-string (or (not in-string)
+                                (not (string= in-string out-string))))
+            (if mark-active (delete-region (region-beginning) (region-end)))
+            (insert out-string)
+            (setq deactivate-mark nil))))))
     (cond
      ((lookup-key global-map mapping)
       (while (cdr path)
index 3c9313e3e7d8f5628042faf602cca38303605f05..7ce3489cfcc48b44b082f876879812414a9a16b6 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * url.el (url-retrieve-synchronously): Replace lexical-let by
+       lexical-binding.
+
 2012-04-10  William Xu  <william.xwl@gmail.com>  (tiny change)
 
        * url.el (url-retrieve-internal): Hexify multibye URL string first
@@ -28,8 +33,8 @@
 
 2012-03-11  Chong Yidong  <cyd@gnu.org>
 
-       * url-http.el (url-http-end-of-document-sentinel): Handle
-       keepalive expiry by calling url-http again (Bug#10223).
+       * url-http.el (url-http-end-of-document-sentinel):
+       Handle keepalive expiry by calling url-http again (Bug#10223).
        (url-http): New arg, for the above.
 
 2012-03-11  Devon Sean McCullough  <emacs-hacker2012@jovi.net>
 
 2011-07-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-       * url-http.el (url-http-wait-for-headers-change-function): Remove
-       pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
+       * url-http.el (url-http-wait-for-headers-change-function):
+       Remove pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
 
 2011-06-04  Andreas Schwab  <schwab@linux-m68k.org>
 
index f3ef553bbce6e4ddc47eaa60dadd7ed53b0cfd7a..7884882c6e708f64a61a033c3980ba62cf23782d 100644 (file)
@@ -1,4 +1,4 @@
-;;; url.el --- Uniform Resource Locator retrieval tool
+;;; url.el --- Uniform Resource Locator retrieval tool  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1996-1999, 2001, 2004-2012  Free Software Foundation, Inc.
 
@@ -225,8 +225,8 @@ associated with it (the case for dired, info, or mailto URLs that need
 no further processing).  URL is either a string or a parsed URL."
   (url-do-setup)
 
-  (lexical-let ((retrieval-done nil)
-               (asynch-buffer nil))
+  (let ((retrieval-done nil)
+        (asynch-buffer nil))
     (setq asynch-buffer
          (url-retrieve url (lambda (&rest ignored)
                              (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
index dd4b4757e88801a778bb015f02a0a2ff64bc05f5..2eefdee18365c5fa1d7f14a999ab47b181229190 100644 (file)
@@ -1,4 +1,4 @@
-;;; diff.el --- run `diff'
+;;; diff.el --- run `diff'  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1992, 1994, 1996, 2001-2012 Free Software Foundation, Inc.
 
@@ -147,11 +147,8 @@ specified in `diff-switches' are passed to the diff command."
       (buffer-enable-undo (current-buffer))
       (diff-mode)
       (set (make-local-variable 'revert-buffer-function)
-           (lexical-let ((old old) (new new)
-                         (switches switches)
-                         (no-async no-async))
-             (lambda (ignore-auto noconfirm)
-               (diff-no-select old new switches no-async (current-buffer)))))
+           (lambda (_ignore-auto _noconfirm)
+             (diff-no-select old new switches no-async (current-buffer))))
       (setq default-directory thisdir)
       (let ((inhibit-read-only t))
        (insert command "\n"))
@@ -159,12 +156,11 @@ specified in `diff-switches' are passed to the diff command."
          (let ((proc (start-process "Diff" buf shell-file-name
                                      shell-command-switch command)))
            (set-process-filter proc 'diff-process-filter)
-            (lexical-let ((old-alt old-alt) (new-alt new-alt))
-              (set-process-sentinel
-               proc (lambda (proc msg)
-                      (with-current-buffer (process-buffer proc)
-                        (diff-sentinel (process-exit-status proc)
-                                       old-alt new-alt))))))
+            (set-process-sentinel
+             proc (lambda (proc _msg)
+                    (with-current-buffer (process-buffer proc)
+                      (diff-sentinel (process-exit-status proc)
+                                     old-alt new-alt)))))
        ;; Async processes aren't available.
        (let ((inhibit-read-only t))
          (diff-sentinel